Ver código fonte

Merge remote-tracking branch 'origin/master'

lifang 3 meses atrás
pai
commit
d0a86f4b5f

+ 13 - 14
tr-modules/tr-module-smartFollowUp/src/main/resources/mapper/smart/BizMissionDocMapper.xml

@@ -155,19 +155,18 @@
     </select>
     <select id="queryAllUnlink" resultType="cn.tr.module.smart.web.vo.BizDeptUnlinkDocVO">
         SELECT
-            distinct(bmd.id) as docId,
-            bmd.type,
-            bmd.title,
-            bmd.source,
-            bmd.content,
-            bmd.phase,
-            bmd.create_time,
-            bmd.update_time,
-            bmd.create_by,
-            bmd.update_by
+        bmd.ID AS docId,
+        bmd.TYPE,
+        bmd.title,
+        bmd.SOURCE,
+        bmd.CONTENT,
+        bmd.phase,
+        bmd.create_time,
+        bmd.update_time,
+        bmd.create_by,
+        bmd.update_by
         FROM
-            biz_mission_doc bmd
-                LEFT JOIN biz_doc_dept bdd ON bmd.ID = bdd.doc_id
+        biz_mission_doc bmd
         <where>
             and bmd.deleted = 0
             and bmd.title is not null
@@ -176,12 +175,12 @@
             </if>
             <if test="!query.isLink">
                 <if test="query.deptId != null and query.deptId != ''">
-                    and (bdd.dept_id != #{query.deptId } or bdd.dept_id is null)
+                    AND NOT EXISTS ( SELECT 1 FROM biz_doc_dept bdd WHERE bdd.doc_id = bmd.ID AND bdd.dept_id = #{query.deptId})
                 </if>
             </if>
             <if test="query.isLink">
                 <if test="query.deptId != null and query.deptId != ''">
-                    and bdd.dept_id = #{query.deptId }
+                     AND EXISTS ( SELECT 1 FROM biz_doc_dept bdd WHERE bdd.doc_id = bmd.ID AND bdd.dept_id = #{query.deptId} )
                 </if>
             </if>
         </where>

+ 3 - 5
tr-modules/tr-module-smartFollowUp/src/main/resources/mapper/smart/BizQuestionGroupMapper.xml

@@ -34,7 +34,7 @@
     </select>
     <select id="queryAllUnlink" resultType="cn.tr.module.smart.web.vo.BizDeptUnlinkQuestionVO">
         SELECT
-        distinct(bqg.id)as questionGroupId,
+        bqg.id as questionGroupId,
         bqg.name,
         bqg.type,
         bqg.interval,
@@ -45,17 +45,15 @@
         bqg.update_by
         FROM
         biz_question_group bqg
-        LEFT JOIN biz_question_dept bqd ON bqg.ID = bqd.question_group_id
         <where>
-            and bqg.name is not null
             <if test="!query.isLink">
                 <if test="query.deptId != null and query.deptId != '' ">
-                    AND (bqd.dept_id != #{query.deptId} or bqd.dept_id is null)
+                   AND NOT EXISTS ( SELECT 1 FROM biz_question_dept bqd WHERE bqd.question_group_id = bqg.ID AND bqd.dept_id= #{query.deptId} )
                 </if>
             </if>
             <if test="query.isLink">
                 <if test="query.deptId != null and query.deptId != '' ">
-                    AND bqd.dept_id = #{query.deptId}
+                    AND EXISTS ( SELECT 1 FROM biz_question_dept bqd WHERE bqd.question_group_id = bqg.ID AND bqd.dept_id= #{query.deptId} )
                 </if>
             </if>
             <if test="query.condition != null and query.condition != '' ">