‘linchangsheng’ 4 months ago
parent
commit
bcce256275

+ 128 - 8
mall-server-api/src/main/resources/mapper/workorder/OrderBaseCMapper.xml

@@ -9,7 +9,22 @@
           order_status_text 'orderStatusText'
         from pg_order_base a
           where 1=1
-          <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -29,7 +44,22 @@
             '异常待处理' as 'orderStatusText'
         from pg_order_base a
         where is_exception=1 and a.order_status NOT IN ('YWG','YWGO','YJS')
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -46,7 +76,22 @@
         '待接单' as 'orderStatusText'
         from pg_order_base a
         where (is_meet=0 or a.order_status  IN ('DJD')) and a.order_status not in ('YQX','FWQX','FL','FWZT','YCGB')
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -65,7 +110,22 @@
         where appointment_time is null and a.order_status not in ('YWG','GCSZX','WDWG','YWGO','YQX','FWZT','YCGB',
         'FWQX','FL','YJS','LRCD','DSHPG','CJ','YPD','DXSPD','DZBPG','DWDSPGP','DXSSPGP','DTJXSSPGP','DZBSPGP'
         )
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -82,7 +142,22 @@
         '配件申请中' AS 'orderStatusText'
         from pg_order_base a  join websit_parts_apply b on a.id = b.order_base_id
         where b.status = 'ING'
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -99,7 +174,22 @@
         '配件已到货' as 'orderStatusText'
         from pg_order_base a join websit_parts_apply b on a.id = b.order_base_id
         where b.status = 'END'
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -116,7 +206,22 @@
         '配件已取消' as 'orderStatusText'
         from pg_order_base a join websit_parts_apply b on a.id = b.order_base_id
         where b.status = 'CANCEL'
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
         <if test="orderSmallType != null and orderSmallType != ''">
             and a.order_small_type = #{orderSmallType}
         </if>
@@ -141,7 +246,22 @@
             count(if(appraise_status in ('C'),1,null)) as 'cp'
         from pg_order_base a
         where 1=1
-        <include refid="orderBaseSqlWhere"></include>
+        <if test="companyWechatId != null and companyWechatId !=''">
+            and a.company_wechat_id = #{companyWechatId}
+        </if>
+        <if test="adminWebsitIds != null and adminWebsitIds.size > 0">
+            AND (
+            a.websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            or
+            a.create_websit_id IN
+            <foreach item="item" index="index" collection="adminWebsitIds" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+            )
+        </if>
     </select>
 
     <sql id="orderBaseSqlWhere">