Browse Source

订单特批类型修改

anderx 1 year ago
parent
commit
049bb9b894

+ 10 - 16
src/main/java/com/goafanti/common/mapper/TOrderNewMapper.xml

@@ -607,22 +607,19 @@
         a.service_project serviceProject,o.examine_name examineName,toa.type,toa.type_explain typeExplain
         from t_order_new o left join department d on o.order_dep = d.id left join `user` u on o.buyer_id = u.id left join t_order_mid a on o.order_no=a.order_no
         left join (select * from  t_order_outsource where type=0) too on o.order_no=too.order_no
+        left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+        from t_order_approval group by order_no) toa on o.order_no=toa.order_no
         <if test="type !=null">
             inner join
-        </if>
-        <if test="type ==null">
-            left join
-        </if>
-        (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+        (select distinct order_no
         from t_order_approval
-        <if test="type !=null">
             where `type` in
             <foreach collection="type" item="item" separator="," open="(" close=")">
                 #{item}
             </foreach>
+        group by order_no) toa2 on o.order_no=toa.order_no
         </if>
-        group by order_no) toa on o.order_no=toa.order_no
-        where delete_sign in(0,2) and o.approval in(0,1,2,4,5,7,8)
+        where delete_sign in(0,2) and o.approval in(0,1,2,4,5)
         and outsource=  #{o.outsource,jdbcType=INTEGER}
         <if test="o.processStatus == 3">
             and o.process_status = #{o.processStatus,jdbcType=INTEGER}
@@ -844,21 +841,18 @@
         <if test="specially == 10">
             left join admin mg on a.salesman_id=mg.id
         </if>
+        left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+        from t_order_approval group by order_no) toa on a.order_no=toa.order_no
         <if test="type !=null">
             inner join
-        </if>
-        <if test="type ==null">
-            left join
-        </if>
-        (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
-        from t_order_approval
-        <if test="type !=null">
+            (select distinct order_no
+            from t_order_approval
             where `type` in
             <foreach collection="type" item="item" separator="," open="(" close=")">
                 #{item}
             </foreach>
+            group by order_no) toa2 on a.order_no=toa2.order_no
         </if>
-        group by order_no) toa on a.order_no=toa.order_no
         where 1=1
         <include refid="selectOrderNewSql"/>
         order by

+ 22 - 40
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1085,21 +1085,17 @@
     left join t_order_new e on a.order_no=e.order_no left join user f on e.buyer_id=f.id left join t_order_mid tm on a.order_no =tm.order_no
     left join department h on e.order_dep=h.id  left join task_hours_count k on a.id=k.tid and a.task_receiver=k.aid left join t_order_outsource l
     on a.id=l.tid  left join t_task_mid ttm  on a.id=ttm.tid left join t_task_member tmer on a.id=tmer.tid
+    left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+    from t_order_approval group by order_no) toa on e.order_no=toa.order_no
     <if test="type !=null">
-      inner join
-    </if>
-    <if test="type ==null">
-      left join
-    </if>
-    (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+      inner join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
     from t_order_approval
-    <if test="type !=null">
       where `type` in
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
+    group by order_no) toa2 on e.order_no=toa2.order_no
     </if>
-    group by order_no) toa on e.order_no=toa.order_no
     where  e.delete_sign in (0,2,3)  and e.order_status in (2,4)
     and a.outsource= #{outsource,jdbcType=INTEGER}
     <include refid="selectOrderTaskListSql"/>
@@ -1192,7 +1188,7 @@
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
-      group by order_no) toa on o.order_no=toa.order_no
+      group by order_no) toa on e.order_no=toa.order_no
     </if>
     where e.delete_sign in (0,2,3)  and e.order_status in (2,4)
     and a.outsource= #{outsource,jdbcType=INTEGER}
@@ -1531,6 +1527,8 @@
     left join district_glossory d on c.province=d.id left join task_progress tp  on a.id=tp.task_id left join t_task_member tm on a.id=tm.tid
     left join t_order_mid e on b.order_no =e.order_no left join business_project bp on a.commodity_id =bp.id left join business_category bc on bp.cid =bc.id
     left join t_task_mid ttm on a.id=ttm.tid left join admin ta on a.task_receiver =ta.id left join department td on ta.department_id =td.id
+    left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+    from t_order_approval group by order_no) toa on b.order_no=toa.order_no
     <if test="screen ==6">
       right join (select tid ,accept_count sls from t_task_mid where accept_count &gt; 0)tj on a.id=tj.tid
     </if>
@@ -1551,20 +1549,13 @@
       where apply_count &gt; 0)tj on a.id=tj.tid
     </if>
     <if test="type !=null">
-      inner join
-    </if>
-    <if test="type ==null">
-      left join
-    </if>
-    (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
-    from t_order_approval
-    <if test="type !=null">
-      where `type` in
+      inner join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+    from t_order_approval   where `type` in
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
+    group by order_no) toa2 on b.order_no=toa2.order_no
     </if>
-    group by order_no) toa on b.order_no=toa.order_no
     where a.split_status in (0,2) and b. delete_sign in (0,2)
     <!--  筛选项 0库存 1派单 2完成 3立项 4抽查 5未通过 6受理 7完结 8授权 9驳回 10下证 11申请 -->
     <if test="screen ==0">
@@ -1716,7 +1707,7 @@
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
-      group by order_no) toa on o.order_no=toa.order_no
+      group by order_no) toa on b.order_no=toa.order_no
     </if>
     where a.split_status in (0,2) and b. delete_sign in (0,2)
     <!--  筛选项 0库存 1派单 2完成 3立项 4抽查 5未通过 6受理 7完结 8授权 9驳回 10下证 11申请 -->
@@ -1915,21 +1906,16 @@
     left join t_order_task a  on x.task_id=a.id left join t_order_new b on a.order_no =b.order_no
     left join t_order_mid tm on b.order_no=tm.order_no left join admin ad on a.task_receiver =ad.id
     left join department dep on ad.department_id =dep.id left join business_project bp on a.commodity_id =bp.id
+    left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+    from t_order_approval group by order_no) toa on b.order_no=toa.order_no
     <if test="type !=null">
-      inner join
-    </if>
-    <if test="type ==null">
-      left join
-    </if>
-    (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
-    from t_order_approval
-    <if test="type !=null">
-      where `type` in
+      inner join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+    from t_order_approval where `type` in
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
-    </if>
     group by order_no) toa on b.order_no=toa.order_no
+    </if>
     where 1=1
     <if test="orderNo !=null">
       and a.order_no = #{orderNo}
@@ -1984,7 +1970,7 @@
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
-      group by order_no) toa on o.order_no=toa.order_no
+      group by order_no) toa on b.order_no=toa.order_no
     </if>
     where 1=1
     <if test="orderNo !=null">
@@ -2199,21 +2185,17 @@
     <if test="shiroType ==2 or  shiroType ==3">
       left join department d on b.order_dep =d.id
     </if>
+    left join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+    from t_order_approval group by order_no) toa on b.order_no=toa.order_no
     <if test="type !=null">
-      inner join
-    </if>
-    <if test="type ==null">
-      left join
-    </if>
-    (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
+      inner join (select order_no ,GROUP_CONCAT(`type`)`type` ,GROUP_CONCAT(type_explain)type_explain
     from t_order_approval
-    <if test="type !=null">
       where `type` in
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
+    group by order_no) toa2 on b.order_no=toa2.order_no
     </if>
-    group by order_no) toa on b.order_no=toa.order_no
     where  b.delete_sign in (0,2)
     and a.process_status in (1,2,3,4)
     <if test="shiroType ==1">
@@ -2295,7 +2277,7 @@
       <foreach collection="type" item="item" separator="," open="(" close=")">
         #{item}
       </foreach>
-      group by order_no) toa on o.order_no=toa.order_no
+      group by order_no) toa on b.order_no=toa.order_no
     </if>
     where  b.delete_sign in (0,2)
     and a.process_status in (1,2,3,4)