wks hace 1 año
padre
commit
c961c07ca4

+ 4 - 2
src/main/resources/mapper/modules/order/InsAreaCompanyMapper.xml

@@ -2561,14 +2561,16 @@
 
 
     <select id="getSubOrderCountDTO" resultType="com.ydtech.modules.order.entity.dto.SubOrderCountDTO">
-        select orderno, orderstatus, count(*) as count
+        select orderno, orderstatus, count(*)
+        from (select orderno, company_id, orderstatus as count
         from ins_area_company
         where orderno in
         <foreach collection="orderNo" open="(" separator="," close=")" item="item" index="index">
             #{item,jdbcType=VARCHAR}
         </foreach>
         and del_flag = '1'
-        group by orderno, orderstatus
+        group by orderno, company_id, orderstatus) as iac
+        group by orderstatus
     </select>
 
     <select id="getAllRejectOrders" resultType="com.ydtech.modules.order.entity.InsAreaCompany">

+ 73 - 67
src/main/resources/mapper/modules/order/InsOrdersMapper.xml

@@ -285,80 +285,85 @@
 
     <select id="queryPageOrderCount" resultType="Long">
         select
-            count(1)
+        count(1)
         from (
-            select
-            io.orderno
-            from
-            ins_orders io
-                <!--如果存在 公司查询则进行连表 -->
+        select
+        io.orderno
+        from
+        ins_orders io
+        <!--如果存在 公司查询则进行连表 -->
+        <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
+            left JOIN
+            ins_area_company iac on iac.orderno = io.orderno
+        </if>
+        <where>
+            and (io.del_flag IS NULL
+            or io.del_flag = 1)
+            <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
+                and io.orderno = #{orderQueryVo.orderNo}
+            </if>
+            <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
+                and io.deptid like "${orderQueryVo.deptId}%"
+            </if>
+            <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
+                and io.orderstatus = #{orderQueryVo.orderStatus}
+            </if>
+            <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
+                and io.frameno = #{orderQueryVo.frameNo}
+            </if>
+            <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
+                and io.licenseno = #{orderQueryVo.licenseNo}
+            </if>
+            <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
+                and io.insuredname = #{orderQueryVo.insuredName}
+            </if>
+            <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
+                and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
+            </if>
             <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
-                left JOIN
-                ins_area_company iac on iac.orderno = io.orderno
+                and iac.company_id = #{orderQueryVo.companyId}
             </if>
-            <where>
-                <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
-                    and io.orderno = #{orderQueryVo.orderNo}
-                </if>
-                <if test="orderQueryVo.deptId != null and orderQueryVo.deptId != ''">
-                    and io.deptid like "${orderQueryVo.deptId}%"
-                </if>
-                <if test="orderQueryVo.orderStatus != null and orderQueryVo.orderStatus != ''">
-                    and io.orderstatus = #{orderQueryVo.orderStatus}
-                </if>
-                <if test="orderQueryVo.frameNo != null and orderQueryVo.frameNo != ''">
-                    and io.frameno = #{orderQueryVo.frameNo}
-                </if>
-                <if test="orderQueryVo.licenseNo != null and orderQueryVo.licenseNo != ''">
-                    and io.licenseno = #{orderQueryVo.licenseNo}
-                </if>
-                <if test="orderQueryVo.insuredName != null and orderQueryVo.insuredName != ''">
-                    and io.insuredname = #{orderQueryVo.insuredName}
-                </if>
-                <if test="orderQueryVo.startDate != null and orderQueryVo.endDate != null">
-                    and DATE_FORMAT(io.createtime, '%Y-%m-%d') between #{orderQueryVo.startDate} AND #{orderQueryVo.endDate}
-                </if>
-                <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
-                    and iac.company_id = #{orderQueryVo.companyId}
-                </if>
-                <!--
-               <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
-                    and io.operatorid = #{orderQueryVo.userId}
-              </if>
-               -->
-                <choose>
-                    <when test="isCdy">
-                        <if test="deptId != null and deptId != '' ">
-                            and io.deptid like "${deptId}%"
-                        </if>
-                    </when>
-                    <when test="isDxFlag">
-                        <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
-                            and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id = #{orderQueryVo.userId} )
-                        </if>
-                    </when>
-                    <otherwise>
-                        <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
-                            and io.userid = #{orderQueryVo.userId}
-                        </if>
-                    </otherwise>
-                </choose>
-            </where>
-            group by io.orderno
+            <!--
+           <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
+                and io.operatorid = #{orderQueryVo.userId}
+          </if>
+           -->
+            <choose>
+                <when test="isCdy">
+                    <if test="deptId != null and deptId != '' ">
+                        and io.deptid like "${deptId}%"
+                    </if>
+                </when>
+                <when test="isDxFlag">
+                    <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
+                        and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
+                        #{orderQueryVo.userId} )
+                    </if>
+                </when>
+                <otherwise>
+                    <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and !isTeamLeader">
+                        and io.userid = #{orderQueryVo.userId}
+                    </if>
+                </otherwise>
+            </choose>
+        </where>
+        group by io.orderno
         ) as s
     </select>
 
     <select id="queryPageOrder" resultMap="BaseResultMap">
         select
-            io.*
+        io.*
         from
-            ins_orders io
+        ins_orders io
         <!--如果存在 公司查询则进行连表 -->
         <if test="orderQueryVo.companyId != null and orderQueryVo.companyId != ''">
-        left JOIN
-        ins_area_company iac on iac.orderno = io.orderno
+            left JOIN
+            ins_area_company iac on iac.orderno = io.orderno
         </if>
         <where>
+            and (io.del_flag IS NULL
+            or io.del_flag = 1)
             <if test="orderQueryVo.orderNo != null and orderQueryVo.orderNo != ''">
                 and io.orderno = #{orderQueryVo.orderNo}
             </if>
@@ -390,11 +395,11 @@
                 and io.productid = #{orderQueryVo.productid}
             </if>
 
-             <!--
-            <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
-                and io.operatorid = #{orderQueryVo.userId}
-            </if>
-             -->
+            <!--
+           <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' and isCdy">
+               and io.operatorid = #{orderQueryVo.userId}
+           </if>
+            -->
             <choose>
                 <when test="isCdy">
                     <if test="deptId != null and deptId != '' ">
@@ -403,7 +408,8 @@
                 </when>
                 <when test="isDxFlag">
                     <if test="orderQueryVo.userId != null and orderQueryVo.userId != '' ">
-                        and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id = #{orderQueryVo.userId} )
+                        and io.userid in ( select id from sys_user where manager_id = #{orderQueryVo.userId} or id =
+                        #{orderQueryVo.userId} )
                     </if>
                 </when>
                 <otherwise>