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

(cherry picked from commit 762cad2c0d)
This commit is contained in:
caojia
2026-10-30 15:22:50 +08:00
parent 7399174bd6
commit 8d4e3363ae
7 changed files with 117 additions and 27 deletions
@@ -645,6 +645,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}
@@ -667,7 +679,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}
@@ -682,7 +694,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">
@@ -711,7 +730,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}
@@ -727,7 +746,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}
@@ -790,7 +809,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}
@@ -807,7 +826,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">