✨ 新增应收账单日期类型筛选

This commit is contained in:
caojia
2026-10-30 15:22:50 +08:00
parent 7ef3f40a4f
commit 762cad2c0d
7 changed files with 117 additions and 27 deletions
@@ -639,6 +639,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
</sql>
<!-- 截止日按用户选择的日期类型筛选;字段名固定在 SQL 中,避免动态列名注入。 -->
<sql id="arBillCutoffDateCondition">
<choose>
<when test="dateType != null and dateType == 'PICKUP_DATE'">
and p.pickup_date &lt; DATE_ADD(#{cutoffDate}, INTERVAL 1 DAY)
</when>
<otherwise>
and p.biz_date &lt; DATE_ADD(#{cutoffDate}, INTERVAL 1 DAY)
</otherwise>
</choose>
</sql>
<select id="selectPrcOrderBillByCustomerPeriod" resultMap="PrcOrderBillArSourceResult">
<include refid="selectArBillSourceVo"/>
where p.customer_id = #{customerId}
@@ -661,7 +673,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
and p.biz_date &lt; DATE_ADD(#{cutoffDate}, INTERVAL 1 DAY)
<include refid="arBillCutoffDateCondition"/>
and p.ar_bill_status in
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
#{status}
@@ -676,7 +688,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{excludedBillId}
</foreach>
</if>
order by p.biz_date, p.order_no, p.bill_id
<choose>
<when test="dateType != null and dateType == 'PICKUP_DATE'">
order by p.pickup_date, p.order_no, p.bill_id
</when>
<otherwise>
order by p.biz_date, p.order_no, p.bill_id
</otherwise>
</choose>
</select>
<select id="sumPrcOrderBillIncomeByCustomerPeriod" resultType="java.math.BigDecimal">
@@ -704,7 +723,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
)
</if>
and p.biz_date &lt; DATE_ADD(#{cutoffDate}, INTERVAL 1 DAY)
<include refid="arBillCutoffDateCondition"/>
and p.ar_bill_status in
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
#{status}
@@ -720,7 +739,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and p.customer_code like concat('%', #{customerCode}, '%')
</if>
<include refid="orderIdentifierCondition"/>
and p.biz_date &lt; DATE_ADD(#{cutoffDate}, INTERVAL 1 DAY)
<include refid="arBillCutoffDateCondition"/>
and p.ar_bill_status in
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
#{status}
@@ -783,7 +802,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectPrcOrderBillByCustomerCutoffAndIds" resultMap="PrcOrderBillArSourceResult">
<include refid="selectArBillSourceVo"/>
where p.customer_id = #{customerId}
and p.biz_date &lt; DATE_ADD(#{cutoffDate}, INTERVAL 1 DAY)
<include refid="arBillCutoffDateCondition"/>
and p.ar_bill_status in
<foreach collection="arBillStatuses" item="status" open="(" separator="," close=")">
#{status}
@@ -800,7 +819,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="currency != null and currency != ''">
and p.currency = #{currency}
</if>
order by p.biz_date, p.order_no, p.bill_id
<choose>
<when test="dateType != null and dateType == 'PICKUP_DATE'">
order by p.pickup_date, p.order_no, p.bill_id
</when>
<otherwise>
order by p.biz_date, p.order_no, p.bill_id
</otherwise>
</choose>
</select>
<insert id="insertPrcOrderBill" parameterType="PrcOrderBill">