You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
200 lines
11 KiB
200 lines
11 KiB
2 years ago
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||
|
<mapper namespace="com.qs.serve.modules.vtb.mapper.VtbVerForPayReportMapper">
|
||
|
|
||
|
<select id="pageVerificationCheck" resultType="com.qs.serve.modules.vtb.entity.dto.VtbVerificationDTO">
|
||
|
SELECT
|
||
|
vtb.verification_code,
|
||
|
vtb.create_time,
|
||
|
vtb.finished_time,
|
||
|
vtb.user_code,
|
||
|
vtb.user_name,
|
||
|
vtb.supplier_code,
|
||
|
vtb.supplier_name,
|
||
|
vtb.way_title,
|
||
|
IFNULL( vtb.amount, 0 ) AS amount,
|
||
|
IFNULL(pay_item1.pay_amt,0) as pay_amount,
|
||
|
IFNULL(pay_item1.not_pay_amt,0) as not_pay_amount,
|
||
|
IFNULL( vtb.amount, 0 ) - IFNULL(pay_item1.pay_amt,0) - IFNULL(pay_item1.not_pay_amt,0) as unpay_amount,
|
||
|
cost.`code` as costApplyCode,
|
||
|
cost.charge_theme,
|
||
|
cost.submit_time,
|
||
|
act.cost_pass_time,
|
||
|
act.activity_code,
|
||
|
act.act_title
|
||
|
FROM
|
||
|
vtb_verification vtb
|
||
|
LEFT JOIN tbs_cost_apply cost ON cost.id = vtb.cost_apply_id
|
||
|
LEFT JOIN tbs_activity act ON act.id = vtb.activity_id
|
||
|
left join bms_supplier sup on vtb.supplier_id = sup.id
|
||
|
LEFT JOIN (
|
||
|
SELECT
|
||
|
pay.verification_id,
|
||
|
sum( Case pay.pay_type when 'pay' Then pay.item_pay_amount else 0 end ) AS pay_amt ,
|
||
|
sum( Case pay.pay_type when 'unPay' Then pay.item_pay_amount else 0 end ) AS not_pay_amt
|
||
|
FROM
|
||
|
pay_payment_item pay
|
||
|
WHERE pay.del_flag = 0
|
||
|
<!-- <if test="query.startPayTime != null ">-->
|
||
|
<!-- and pay.pay_date >= #{query.startPayTime} </if>-->
|
||
|
<!-- <if test="query.endPayTime != null ">-->
|
||
|
<!-- and pay.pay_date <= #{query.endPayTime} </if>-->
|
||
|
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
|
||
|
and pay.verification_id in
|
||
|
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
||
|
#{selectId}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
GROUP BY
|
||
|
pay.verification_id
|
||
|
) pay_item1 ON pay_item1.verification_id = vtb.id
|
||
|
|
||
|
WHERE
|
||
|
vtb.del_flag = 0
|
||
|
AND vtb.verification_state = 1
|
||
|
AND act.del_flag = 0
|
||
|
AND act.cancel_flag = 0
|
||
|
AND cost.del_flag = 0
|
||
|
AND cost.cancel_flag = 0
|
||
|
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
|
||
|
and vtb.id in
|
||
|
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
||
|
#{selectId}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
<if test="query.queryStartCheckTime != null ">
|
||
|
and vtb.create_time >= #{query.queryStartCheckTime} </if>
|
||
|
<if test="query.queryEndCheckTime != null ">
|
||
|
and vtb.create_time <= #{query.queryEndCheckTime} </if>
|
||
|
<if test="query.queryStartFinishCheckTime != null ">
|
||
|
and vtb.finished_time >= #{query.queryStartFinishCheckTime} </if>
|
||
|
<if test="query.queryEndFinishCheckTime != null ">
|
||
|
and vtb.finished_time <= #{query.queryEndFinishCheckTime} </if>
|
||
|
|
||
|
<if test="query.verificationCode != null and query.verificationCode != ''"> and `vtb`.`verification_code` like concat('%',#{query.verificationCode},'%')</if>
|
||
|
<if test="query.supplierCode != null and query.supplierCode != ''"> and `vtb`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if>
|
||
|
<if test="query.supplierName != null and query.supplierName != ''"> and `vtb`.`supplier_name` like concat('%',#{query.supplierName},'%')</if>
|
||
|
<if test="query.userCode != null and query.userCode != ''"> and `vtb`.`user_code` like concat('%',#{query.userCode},'%')</if>
|
||
|
<if test="query.userName != null and query.userName != ''"> and `vtb`.`user_name` like concat('%',#{query.userName},'%')</if>
|
||
|
<if test="query.wayTitle != null and query.wayTitle != ''"> and `vtb`.`way_title` = #{query.wayTitle}</if>
|
||
|
|
||
|
|
||
|
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if>
|
||
|
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if>
|
||
|
|
||
|
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if>
|
||
|
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if>
|
||
|
|
||
|
<if test="query.stopSupplierFlag != null and query.stopSupplierFlag != ''"> and `sup`.`stop_flag` = #{query.stopSupplierFlag}</if>
|
||
|
|
||
|
|
||
|
<if test="query.openPage!=null and query.openPage==1">
|
||
|
limit #{query.startRow},#{query.pageSize}
|
||
|
</if>
|
||
|
</select>
|
||
|
|
||
|
|
||
|
<select id="countVerificationCheck" resultType="java.lang.Long">
|
||
|
SELECT
|
||
|
count(1)
|
||
|
FROM
|
||
|
vtb_verification vtb
|
||
|
LEFT JOIN tbs_cost_apply cost ON cost.id = vtb.cost_apply_id
|
||
|
LEFT JOIN tbs_activity act ON act.id = vtb.activity_id
|
||
|
left join bms_supplier sup on vtb.supplier_id = sup.id
|
||
|
|
||
|
WHERE
|
||
|
vtb.del_flag = 0
|
||
|
AND vtb.verification_state = 1
|
||
|
AND act.del_flag = 0
|
||
|
AND act.cancel_flag = 0
|
||
|
AND cost.del_flag = 0
|
||
|
AND cost.cancel_flag = 0
|
||
|
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
|
||
|
and vtb.id in
|
||
|
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
||
|
#{selectId}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
<if test="query.queryStartCheckTime != null ">
|
||
|
and vtb.create_time >= #{query.queryStartCheckTime} </if>
|
||
|
<if test="query.queryEndCheckTime != null ">
|
||
|
and vtb.create_time <= #{query.queryEndCheckTime} </if>
|
||
|
<if test="query.queryStartFinishCheckTime != null ">
|
||
|
and vtb.finished_time >= #{query.queryStartFinishCheckTime} </if>
|
||
|
<if test="query.queryEndFinishCheckTime != null ">
|
||
|
and vtb.finished_time <= #{query.queryEndFinishCheckTime} </if>
|
||
|
|
||
|
<if test="query.verificationCode != null and query.verificationCode != ''"> and `vtb`.`verification_code` like concat('%',#{query.verificationCode},'%')</if>
|
||
|
<if test="query.supplierCode != null and query.supplierCode != ''"> and `vtb`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if>
|
||
|
<if test="query.supplierName != null and query.supplierName != ''"> and `vtb`.`supplier_name` like concat('%',#{query.supplierName},'%')</if>
|
||
|
<if test="query.userCode != null and query.userCode != ''"> and `vtb`.`user_code` like concat('%',#{query.userCode},'%')</if>
|
||
|
<if test="query.userName != null and query.userName != ''"> and `vtb`.`user_name` like concat('%',#{query.userName},'%')</if>
|
||
|
<if test="query.wayTitle != null and query.wayTitle != ''"> and `vtb`.`way_title` = #{query.wayTitle}</if>
|
||
|
|
||
|
|
||
|
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if>
|
||
|
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if>
|
||
|
|
||
|
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if>
|
||
|
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if>
|
||
|
|
||
|
<if test="query.stopSupplierFlag != null and query.stopSupplierFlag != ''"> and `sup`.`stop_flag` = #{query.stopSupplierFlag}</if>
|
||
|
|
||
|
</select>
|
||
|
|
||
|
<select id="getVerificationIdsForPay" resultType="java.lang.Long">
|
||
|
SELECT
|
||
|
vtb.id
|
||
|
FROM
|
||
|
vtb_verification vtb
|
||
|
LEFT JOIN tbs_cost_apply cost ON cost.id = vtb.cost_apply_id
|
||
|
LEFT JOIN tbs_activity act ON act.id = vtb.activity_id
|
||
|
left join bms_supplier sup on vtb.supplier_id = sup.id
|
||
|
|
||
|
WHERE
|
||
|
vtb.del_flag = 0
|
||
|
AND vtb.verification_state = 1
|
||
|
AND act.del_flag = 0
|
||
|
AND act.cancel_flag = 0
|
||
|
AND cost.del_flag = 0
|
||
|
AND cost.cancel_flag = 0
|
||
|
<if test="query.vtbIds !=null and query.vtbIds.size > 0">
|
||
|
and vtb.id in
|
||
|
<foreach collection="query.vtbIds" item ="selectId" index="i" open="(" close=")" separator=",">
|
||
|
#{selectId}
|
||
|
</foreach>
|
||
|
</if>
|
||
|
<if test="query.queryStartCheckTime != null ">
|
||
|
and vtb.create_time >= #{query.queryStartCheckTime} </if>
|
||
|
<if test="query.queryEndCheckTime != null ">
|
||
|
and vtb.create_time <= #{query.queryEndCheckTime} </if>
|
||
|
<if test="query.queryStartFinishCheckTime != null ">
|
||
|
and vtb.finished_time >= #{query.queryStartFinishCheckTime} </if>
|
||
|
<if test="query.queryEndFinishCheckTime != null ">
|
||
|
and vtb.finished_time <= #{query.queryEndFinishCheckTime} </if>
|
||
|
|
||
|
<if test="query.verificationCode != null and query.verificationCode != ''"> and `vtb`.`verification_code` like concat('%',#{query.verificationCode},'%')</if>
|
||
|
<if test="query.supplierCode != null and query.supplierCode != ''"> and `vtb`.`supplier_code` like concat('%',#{query.supplierCode},'%')</if>
|
||
|
<if test="query.supplierName != null and query.supplierName != ''"> and `vtb`.`supplier_name` like concat('%',#{query.supplierName},'%')</if>
|
||
|
<if test="query.userCode != null and query.userCode != ''"> and `vtb`.`user_code` like concat('%',#{query.userCode},'%')</if>
|
||
|
<if test="query.userName != null and query.userName != ''"> and `vtb`.`user_name` like concat('%',#{query.userName},'%')</if>
|
||
|
<if test="query.wayTitle != null and query.wayTitle != ''"> and `vtb`.`way_title` = #{query.wayTitle}</if>
|
||
|
|
||
|
|
||
|
<if test="query.costApplyCode != null and query.costApplyCode != ''"> and `cost`.`code` like concat('%',#{query.costApplyCode},'%')</if>
|
||
|
<if test="query.chargeTheme != null and query.chargeTheme != ''"> and `cost`.`charge_theme` like concat('%',#{query.chargeTheme},'%')</if>
|
||
|
|
||
|
<if test="query.activityCode != null and query.activityCode != ''"> and `act`.`activity_code` like concat('%',#{query.activityCode},'%')</if>
|
||
|
<if test="query.actTitle != null and query.actTitle != ''"> and `act`.`act_title` like concat('%',#{query.actTitle},'%')</if>
|
||
|
|
||
|
<if test="query.stopSupplierFlag != null and query.stopSupplierFlag != ''"> and `sup`.`stop_flag` = #{query.stopSupplierFlag}</if>
|
||
|
|
||
|
|
||
|
<if test="query.openPage!=null and query.openPage==1">
|
||
|
limit #{query.startRow},#{query.pageSize}
|
||
|
</if>
|
||
|
</select>
|
||
|
</mapper>
|
||
|
|