| 
					
				 | 
			
			
				@@ -28,6 +28,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="minSend"    column="min_send"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="maxSend"    column="max_send"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <result property="stopTime"    column="stop_time"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result property="isRating"    column="is_rating"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <result property="courseDay"    column="course_day"    /> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </resultMap> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <sql id="selectQwSopVo"> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -92,6 +94,34 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="selectQwSopAutoByTagsByForeachRemoveNotAuto"  resultType="com.fs.qw.vo.QwSopRuleTimeVO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qs.*, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.name AS temp_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.setting AS temp_setting, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.status AS temp_status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.gap AS temp_gap, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.sort AS temp_sort, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.create_time AS temp_create_time, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.create_by AS temp_create_by, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.corp_id AS temp_company_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qw_sop qs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qw_sop_temp qst ON qs.temp_id = qst.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND qs.corp_id = #{map.corpId} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND qst.status = '1' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND qs.status IN (2, 3, 4) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND qs.send_type = #{map.sendType} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        AND ( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' and '> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+          NOT find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectQwAiSopAutoByTagsByForeach"  resultType="com.fs.qw.vo.QwSopRuleTimeVO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SELECT 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         qs.*, 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -186,7 +216,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <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 = #{id}</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="id != null and id!='' "> 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> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -211,7 +241,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             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) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        order by create_time desc 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectQwSopById" parameterType="String" resultMap="QwSopResult"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="selectQwSopVo"/> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where id = #{id} 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,6 +276,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.maxConversionDay != null">max_conversion_day,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.minSend != null">min_send,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.maxSend != null">max_send,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="data.isRating != null">is_rating,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="data.courseDay != null">course_day,</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <trim prefix="values (" suffix=")" suffixOverrides=","> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.name != null">#{data.name},</if> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -264,6 +301,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.maxConversionDay != null">#{data.maxConversionDay},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.minSend != null">#{data.minSend},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.maxSend != null">#{data.maxSend},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="data.isRating != null">#{data.isRating},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="data.courseDay != null">#{data.courseDay},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </insert> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -308,6 +347,23 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    <select id="executeSopWxByIds"  resultType="com.fs.qw.vo.WxSopRuleTimeVO"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        SELECT qs.*, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.name AS temp_name, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.setting AS temp_setting, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.status AS temp_status, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.gap AS temp_gap, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.sort AS temp_sort, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.create_time AS temp_create_time, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.create_by AS temp_create_by, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        qst.corp_id AS temp_company_id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        FROM qw_sop qs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN qw_sop_temp qst ON qs.temp_id = qst.id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        WHERE qs.id IN 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <foreach item="id" collection="ids"  open="(" separator="," close=")"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            #{id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        </foreach> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    </select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <select id="selectAiChatQwSopList" resultType="com.fs.sop.domain.QwSop"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <include refid="selectQwSopVo"/> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -335,6 +391,10 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <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=","> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -360,6 +420,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.minSend != null">min_send = #{data.minSend},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.maxSend != null">max_send = #{data.maxSend},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             <if test="data.voice != null">voice = #{data.voice},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="data.isRating != null">is_rating = #{data.isRating},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            <if test="data.courseDay != null">course_day = #{data.courseDay},</if> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </trim> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         where id = #{data.id} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </update> 
			 |