| 
					
				 | 
			
			
				@@ -55,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, '[\"\\\\[\\\\]]', ''))) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -85,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, '[\"\\\\[\\\\]]', '')) ) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -113,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, '[\"\\\\[\\\\]]', '')) ) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -141,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, '[\"\\\\[\\\\]]', '')) ) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -161,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> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -246,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} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -395,13 +392,16 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </where> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         order by create_time desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectByTemplateId" resultType="com.fs.sop.domain.QwSop"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select * from qw_sop where temp_id = #{tempId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectWxSop" resultType="com.fs.sop.domain.QwSop"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select a.* from qw_sop a 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where a.send_type != 4 and a.status in (2,3) and a.type = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <update id="updateQwSop" parameterType="QwSop" useGeneratedKeys="false" keyProperty="id" > 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         UPDATE  qw_sop 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <trim prefix="SET" suffixOverrides=","> 
			 |