demand: tms-客户账单管理-发票作废审核-发票状态不同步发票表状态-回滚

This commit is contained in:
aike 2026-01-27 17:55:22 +08:00
parent 9a5a50293e
commit a2d72a2dab

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xdadan.erp.emis.mapper.EmisTmsCostProfitMapper">
<resultMap type="EmisTmsCostProfit" id="EmisTmsCostProfitResult">
<result property="id" column="id" />
<result property="billCode" column="bill_code" />
@ -158,13 +158,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<!-- 批次状态查询: batchStatus=1 在emis_waybill_batch_status中存在, batchStatus=2 在emis_tms_site_batch中不存在, 其他为3 -->
<if test="params.batchStatus != null and params.batchStatus == '1'">
<if test="params.batchStatus != null and params.batchStatus == 1">
and EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
</if>
<if test="params.batchStatus != null and params.batchStatus == '2'">
<if test="params.batchStatus != null and params.batchStatus == 2">
and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0')
</if>
<if test="params.batchStatus != null and params.batchStatus == '3'">
<if test="params.batchStatus != null and params.batchStatus == 3">
and (
NOT EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
AND EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0')
@ -172,15 +172,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
<!-- 成本状态查询: costStatus=1 在emis_waybill_batch_status中存在且所有批次bl_entering=1, costStatus=2 不存在批次bl_entering=1, 其他为3 -->
<if test="params.costStatus != null and params.costStatus == '1'">
<if test="params.costStatus != null and params.costStatus == 1">
and EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
and EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0')
and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0' AND (etsb.bl_entering IS NULL OR etsb.bl_entering != '1'))
</if>
<if test="params.costStatus != null and params.costStatus == '2'">
<if test="params.costStatus != null and params.costStatus == 2">
and NOT EXISTS (SELECT 1 FROM emis_tms_site_batch_dtl etsbd INNER JOIN emis_tms_site_batch etsb ON etsbd.batch_no = etsb.batch_no WHERE etsbd.bill_code = a.bill_code AND etsbd.del_flag = '0' AND etsb.del_flag = '0' AND etsb.bl_entering = '1')
</if>
<if test="params.costStatus != null and params.costStatus == '3'">
<if test="params.costStatus != null and params.costStatus == 3">
and (
NOT EXISTS (SELECT 1 FROM emis_waybill_batch_status ewbs WHERE ewbs.bill_code = a.bill_code AND ewbs.del_flag = '0')
OR (
@ -212,7 +212,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisTmsCostProfitById" parameterType="Long" resultMap="EmisTmsCostProfitResult">
select id, bill_code,bill_month, standard_fee, bill_fee, cost_fee, bill_profit, satisfy_money, allowance_money, deduction_money, other_money, remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_tms_cost_profit a
@ -306,4 +306,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
</mapper>
</mapper>