xdd 5 dní pred
rodič
commit
451b65d8f0

+ 29 - 28
fs-service/src/main/resources/mapper/sop/QwSopMapper.xml

@@ -31,12 +31,14 @@
         <result property="stopTime"    column="stop_time"    />
         <result property="isRating"    column="is_rating"    />
         <result property="courseDay"    column="course_day"    />
+        <result property="chatId"    column="chat_id"    />
         <result property="openCommentStatus"    column="open_comment_status"    />
         <result property="isSampSend"    column="is_samp_send"    />
     </resultMap>
 
     <sql id="selectQwSopVo">
-        select *  from qw_sop
+        select *
+        from qw_sop
     </sql>
 
     <select id="selectQwSopAutoByTagsByForeach"  resultType="com.fs.qw.vo.QwSopRuleTimeVO">
@@ -53,14 +55,13 @@
         FROM
             qw_sop qs
                 LEFT JOIN
-            qw_sop_temp qst ON qs.temp_id = qst.id
+            qw_sop_temp qst ON qs.temp_id = qst.id AND qst.status = '1'
         WHERE
-            FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
-          AND qs.corp_id = #{map.corpId}
-          AND qst.status = '1'
+          qs.corp_id = #{map.corpId}
           AND qs.status IN (2, 3, 4)
+          AND qs.send_type in (2,11)
           AND qs.is_auto_sop = 1
-          AND qs.send_type = #{map.sendType}
+          AND FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
           AND (
            <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' or '>
                      find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')))
@@ -83,13 +84,12 @@
         FROM
         qw_sop qs
         LEFT JOIN
-        qw_sop_temp qst ON qs.temp_id = qst.id
+        qw_sop_temp qst ON qs.temp_id = qst.id AND qst.status = '1'
         WHERE
-            FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
-        AND qs.corp_id = #{map.corpId}
-        AND qst.status = '1'
+        qs.corp_id = #{map.corpId}
         AND qs.status IN (2, 3, 4)
-        AND qs.send_type = #{map.sendType}
+        AND qs.send_type IN (2,11)
+        AND FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
         AND (
             <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' or '>
                 find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) )
@@ -111,13 +111,12 @@
         FROM
         qw_sop qs
         LEFT JOIN
-        qw_sop_temp qst ON qs.temp_id = qst.id
+        qw_sop_temp qst ON qs.temp_id = qst.id  AND qst.status = '1'
         WHERE
-        FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
-        AND qs.corp_id = #{map.corpId}
-        AND qst.status = '1'
+         qs.corp_id = #{map.corpId}
         AND qs.status IN (2, 3, 4)
-        AND qs.send_type = #{map.sendType}
+        AND qs.send_type IN (2,11)
+        AND FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
         AND (
         <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' and '>
           NOT find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) )
@@ -139,13 +138,12 @@
         FROM
         qw_sop qs
         LEFT JOIN
-        qw_sop_temp qst ON qs.temp_id = qst.id
+        qw_sop_temp qst ON qs.temp_id = qst.id  AND qst.status = '1'
         WHERE
-             FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
-        AND qs.corp_id = #{map.corpId}
-        AND qst.status = '1'
+         qs.corp_id = #{map.corpId}
         AND qs.status IN (2, 3, 4)
         AND qs.send_type = 4
+        AND FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
         AND (
         <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' or '>
             find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) )
@@ -159,13 +157,12 @@
         FROM
             qw_sop qs
                 LEFT JOIN
-            qw_sop_temp qst ON qs.temp_id = qst.id
+            qw_sop_temp qst ON qs.temp_id = qst.id  AND qst.status = '1'
         WHERE
-            FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
-          AND qs.corp_id = #{map.corpId}
-          AND qst.status = '1'
+           qs.corp_id = #{map.corpId}
           AND qs.status IN (2, 3, 4)
-          AND qs.send_type = #{map.sendType}
+          AND qs.send_type IN (2,11)
+          AND FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
     </select>
 
 
@@ -213,13 +210,13 @@
             ]]>
     </select>
 
-    <select id="selectQwSopList" parameterType="QwSop" resultType="QwSop">
+    <select id="selectQwSopList" parameterType="QwSop" resultMap="QwSopResult">
         <include refid="selectQwSopVo"/>
         <where>
             <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
             <if test="status != null "> and status = #{status}</if>
             <if test="type != null "> and type = #{type}</if>
-            <if test="id != null and id != '' "> and id = #{id}</if>
+            <if test="id != null "> and id = #{id}</if>
             <if test="companyId != null "> and company_id = #{companyId}</if>
             <if test="qwUserIds != null  and qwUserIds != ''"> and FIND_IN_SET(#{qwUserIds}, qw_user_ids) > 0</if>
             <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
@@ -244,12 +241,14 @@
             and status != 6
          order by create_time desc
     </select>
+
     <select id="selectQwSopByIsRating" parameterType="QwSop" resultMap="QwSopResult">
         <include refid="selectQwSopVo"/>
         where is_rating = 1
-        and send_type in(2,3)
+        and send_type in(2,3,11)
         order by create_time desc
     </select>
+
     <select id="selectQwSopById" parameterType="String" resultType="com.fs.sop.domain.QwSop">
         <include refid="selectQwSopVo"/>
         where id = #{id}
@@ -519,6 +518,8 @@
         SET max_send = 1
         WHERE id = #{id}
     </update>
+
+
     <update id="updateStatusQwSopById2" useGeneratedKeys="false" keyProperty="id" >
         UPDATE qw_sop
         SET status = 3