|
|
@@ -249,9 +249,50 @@
|
|
|
</foreach>
|
|
|
</where>
|
|
|
</select>
|
|
|
+ <!--金额统计规则:未筛选状态,统计已完成的对账单,结算金额。筛选状态统计具体的状态-->
|
|
|
+ <select id="countSumMoney" resultType="com.sckw.payment.model.vo.res.LedgerCountSumVo">
|
|
|
+ select sum(kll.settle_price) "totalPrice"
|
|
|
+ from kwp_ledger_logistics kll
|
|
|
+ inner join kwp_ledger_logistics_unit kllu
|
|
|
+ on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
|
+ kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
|
|
|
+ inner join kwp_ledger_logistics_unit kllu2
|
|
|
+ on kll.id = kllu2.l_ledger_id and kllu2.del_flag = 0 and
|
|
|
+ kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
|
|
|
+ <where>
|
|
|
+ kll.del_flag = 0
|
|
|
+ and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
|
|
|
+ <if test="logisticsReq.status != null">
|
|
|
+ and kll.status = #{logisticsReq.status}
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.status == null">
|
|
|
+ and kll.status = 4
|
|
|
+ </if>
|
|
|
+ <if test="status != null and status.size() > 0">
|
|
|
+ and kll.status not in
|
|
|
+ <foreach collection="status" item="id" close=")" open="(" separator=",">
|
|
|
+ #{id,jdbcType=BIGINT}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.trading != null">
|
|
|
+ and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
|
|
|
+ and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
|
|
|
+ and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
|
|
|
+ and (
|
|
|
+ kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+ <!--数量统计规则:未筛选,统计所有。需要根据企业方,排除已保存,已撤回两个状态-->
|
|
|
<select id="countSum" resultType="com.sckw.payment.model.vo.res.LedgerCountSumVo">
|
|
|
- select IFNULL(count(1), 0) "ledgerCount",
|
|
|
- sum(kll.total_price) "totalPrice"
|
|
|
+ select IFNULL(count(1), 0) "ledgerCount"
|
|
|
from kwp_ledger_logistics kll
|
|
|
inner join kwp_ledger_logistics_unit kllu
|
|
|
on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
|
@@ -265,6 +306,12 @@
|
|
|
<if test="logisticsReq.status != null">
|
|
|
and kll.status = #{logisticsReq.status}
|
|
|
</if>
|
|
|
+ <if test="status != null and status.size() > 0">
|
|
|
+ and kll.status not in
|
|
|
+ <foreach collection="status" item="id" close=")" open="(" separator=",">
|
|
|
+ #{id,jdbcType=BIGINT}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
<if test="logisticsReq.trading != null">
|
|
|
and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
|
|
|
</if>
|