|
@@ -116,7 +116,6 @@
|
|
|
kllu.firm_name firmName,
|
|
kllu.firm_name firmName,
|
|
|
kll.order_count orderCount
|
|
kll.order_count orderCount
|
|
|
from kwp_ledger_logistics kll
|
|
from kwp_ledger_logistics kll
|
|
|
- inner join kwp_ledger_logistics_track kllt on kll.id = kllt.l_ledger_id and kllt.del_flag = 0
|
|
|
|
|
inner join kwp_ledger_logistics_unit kllu
|
|
inner join kwp_ledger_logistics_unit kllu
|
|
|
on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
on kll.id = kllu.l_ledger_id and kllu.del_flag = 0 and
|
|
|
kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
|
|
kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
|
|
@@ -149,18 +148,30 @@
|
|
|
)
|
|
)
|
|
|
</if>
|
|
</if>
|
|
|
and (
|
|
and (
|
|
|
|
|
+ case
|
|
|
|
|
+ when kll.status = 2 then
|
|
|
|
|
+ true
|
|
|
|
|
+ when kll.status in (3, 4, 5) then
|
|
|
(
|
|
(
|
|
|
- kllt.status = 1 and
|
|
|
|
|
- kllt.create_by in
|
|
|
|
|
|
|
+ (
|
|
|
|
|
+ kllu2.contacts_id in
|
|
|
<foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
<foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
#{item,jdbcType=BIGINT}
|
|
#{item,jdbcType=BIGINT}
|
|
|
- </foreach>
|
|
|
|
|
- )
|
|
|
|
|
- or kllu2.contacts_id in
|
|
|
|
|
|
|
+ </foreach>)
|
|
|
|
|
+ or
|
|
|
|
|
+ (
|
|
|
|
|
+ select kllt.id
|
|
|
|
|
+ from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
|
|
|
|
|
+ and kllt.l_ledger_id = kll.id
|
|
|
|
|
+ and kllt.status in (3, 5)
|
|
|
|
|
+ and kllt.create_by in
|
|
|
<foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
<foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
#{item,jdbcType=BIGINT}
|
|
#{item,jdbcType=BIGINT}
|
|
|
</foreach>
|
|
</foreach>
|
|
|
)
|
|
)
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
</where>
|
|
</where>
|
|
|
order by kll.generate_time desc
|
|
order by kll.generate_time desc
|
|
|
</select>
|
|
</select>
|
|
@@ -396,7 +407,122 @@
|
|
|
</where>
|
|
</where>
|
|
|
order by kll.generate_time desc
|
|
order by kll.generate_time desc
|
|
|
</select>
|
|
</select>
|
|
|
-
|
|
|
|
|
|
|
+ <!--对账发起方-->
|
|
|
|
|
+ <select id="countSendOrder" resultType="java.util.Map">
|
|
|
|
|
+ SELECT count(1) "0",
|
|
|
|
|
+ count(IF(kll.status = 1, 1, NULL)) "1",
|
|
|
|
|
+ count(IF(kll.status = 2, 1, NULL)) "2",
|
|
|
|
|
+ count(IF(kll.status = 3, 1, NULL)) "3",
|
|
|
|
|
+ count(IF(kll.status = 4, 1, NULL)) "4",
|
|
|
|
|
+ count(IF(kll.status = 5, 1, NULL)) "5",
|
|
|
|
|
+ count(IF(kll.status = 6, 1, NULL)) "6"
|
|
|
|
|
+ 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.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>
|
|
|
|
|
+ and (
|
|
|
|
|
+ case when kll.status in (1, 6)
|
|
|
|
|
+ then
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ when kll.status in (2, 3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ kll.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ or kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <!--对账审核方-->
|
|
|
|
|
+ <select id="countAuditOrder" resultType="java.util.Map">
|
|
|
|
|
+ SELECT count(1) "0",
|
|
|
|
|
+ count(IF(kll.status = 1, 1, NULL)) "1",
|
|
|
|
|
+ count(IF(kll.status = 2, 1, NULL)) "2",
|
|
|
|
|
+ count(IF(kll.status = 3, 1, NULL)) "3",
|
|
|
|
|
+ count(IF(kll.status = 4, 1, NULL)) "4",
|
|
|
|
|
+ count(IF(kll.status = 5, 1, NULL)) "5",
|
|
|
|
|
+ count(IF(kll.status = 6, 1, NULL)) "6"
|
|
|
|
|
+ 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}
|
|
|
|
|
+ and kll.status not in (1, 6)
|
|
|
|
|
+ <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>
|
|
|
|
|
+ and (
|
|
|
|
|
+ case
|
|
|
|
|
+ when kll.status = 2 then
|
|
|
|
|
+ true
|
|
|
|
|
+ when kll.status in (3, 4, 5) then
|
|
|
|
|
+ (
|
|
|
|
|
+ (
|
|
|
|
|
+ kllu2.contacts_id in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>)
|
|
|
|
|
+ or
|
|
|
|
|
+ (
|
|
|
|
|
+ select kllt.id
|
|
|
|
|
+ from kwp_ledger_logistics_track kllt where kllt.del_flag = 0
|
|
|
|
|
+ and kllt.l_ledger_id = kll.id
|
|
|
|
|
+ and kllt.status in (3, 5)
|
|
|
|
|
+ and kllt.create_by in
|
|
|
|
|
+ <foreach collection="authList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item,jdbcType=BIGINT}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ end
|
|
|
|
|
+ )
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
<select id="countOrder" resultType="java.util.Map">
|
|
<select id="countOrder" resultType="java.util.Map">
|
|
|
SELECT count(1) "0",
|
|
SELECT count(1) "0",
|
|
|
count(IF(kll.status = 1, 1, NULL)) "1",
|
|
count(IF(kll.status = 1, 1, NULL)) "1",
|