QwSopMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.sop.mapper.QwSopMapper">
  6. <resultMap type="com.fs.sop.domain.QwSop" id="QwSopResult">
  7. <result property="id" column="id" />
  8. <result property="name" column="name" />
  9. <result property="status" column="status" />
  10. <result property="type" column="type" />
  11. <result property="qwUserIds" column="qw_user_ids" />
  12. <result property="createBy" column="create_by" />
  13. <result property="createTime" column="create_time" />
  14. <result property="companyId" column="company_id" />
  15. <result property="sendType" column="send_type" />
  16. <result property="tags" column="tags" />
  17. <result property="excludeTags" column="exclude_tags" />
  18. <result property="startTime" column="start_time" />
  19. <result property="filterMode" column="filter_mode" />
  20. <result property="filterType" column="filter_type" />
  21. <result property="tempId" column="temp_id" />
  22. <result property="corpId" column="corp_id" />
  23. <result property="expiryTime" column="expiry_time" />
  24. <result property="isAutoSop" column="is_auto_sop" />
  25. <result property="autoSopTime" column="auto_sop_time" />
  26. <result property="minConversionDay" column="min_conversion_day" />
  27. <result property="maxConversionDay" column="max_conversion_day" />
  28. <result property="minSend" column="min_send" />
  29. <result property="maxSend" column="max_send" />
  30. <result property="stopTime" column="stop_time" />
  31. <result property="isRating" column="is_rating" />
  32. <result property="courseDay" column="course_day" />
  33. <result property="openCommentStatus" column="open_comment_status" />
  34. <result property="isSampSend" column="is_samp_send" />
  35. </resultMap>
  36. <sql id="selectQwSopVo">
  37. select * from qw_sop
  38. </sql>
  39. <select id="selectQwSopAutoByTagsByForeach" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  40. SELECT
  41. qs.*,
  42. qst.name AS temp_name,
  43. qst.setting AS temp_setting,
  44. qst.status AS temp_status,
  45. qst.gap AS temp_gap,
  46. qst.sort AS temp_sort,
  47. qst.create_time AS temp_create_time,
  48. qst.create_by AS temp_create_by,
  49. qst.corp_id AS temp_company_id
  50. FROM
  51. qw_sop qs
  52. LEFT JOIN
  53. qw_sop_temp qst ON qs.temp_id = qst.id
  54. WHERE
  55. FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
  56. AND qs.corp_id = #{map.corpId}
  57. AND qst.status = '1'
  58. AND qs.status IN (2, 3, 4)
  59. AND qs.is_auto_sop = 1
  60. AND qs.send_type = #{map.sendType}
  61. AND (
  62. <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' or '>
  63. find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')))
  64. </foreach>
  65. )
  66. </select>
  67. <select id="selectQwSopAutoByTagsByForeachNotAuto" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  68. SELECT
  69. qs.*,
  70. qst.name AS temp_name,
  71. qst.setting AS temp_setting,
  72. qst.status AS temp_status,
  73. qst.gap AS temp_gap,
  74. qst.sort AS temp_sort,
  75. qst.create_time AS temp_create_time,
  76. qst.create_by AS temp_create_by,
  77. qst.corp_id AS temp_company_id
  78. FROM
  79. qw_sop qs
  80. LEFT JOIN
  81. qw_sop_temp qst ON qs.temp_id = qst.id
  82. WHERE
  83. FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
  84. AND qs.corp_id = #{map.corpId}
  85. AND qst.status = '1'
  86. AND qs.status IN (2, 3, 4)
  87. AND qs.send_type = #{map.sendType}
  88. AND (
  89. <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' or '>
  90. find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) )
  91. </foreach>
  92. )
  93. </select>
  94. <select id="selectQwSopAutoByTagsByForeachRemoveNotAuto" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  95. SELECT
  96. qs.*,
  97. qst.name AS temp_name,
  98. qst.setting AS temp_setting,
  99. qst.status AS temp_status,
  100. qst.gap AS temp_gap,
  101. qst.sort AS temp_sort,
  102. qst.create_time AS temp_create_time,
  103. qst.create_by AS temp_create_by,
  104. qst.corp_id AS temp_company_id
  105. FROM
  106. qw_sop qs
  107. LEFT JOIN
  108. qw_sop_temp qst ON qs.temp_id = qst.id
  109. WHERE
  110. FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
  111. AND qs.corp_id = #{map.corpId}
  112. AND qst.status = '1'
  113. AND qs.status IN (2, 3, 4)
  114. AND qs.send_type = #{map.sendType}
  115. AND (
  116. <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' and '>
  117. NOT find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) )
  118. </foreach>
  119. )
  120. </select>
  121. <select id="selectQwAiSopAutoByTagsByForeach" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  122. SELECT
  123. qs.*,
  124. qst.name AS temp_name,
  125. qst.setting AS temp_setting,
  126. qst.status AS temp_status,
  127. qst.gap AS temp_gap,
  128. qst.sort AS temp_sort,
  129. qst.create_time AS temp_create_time,
  130. qst.create_by AS temp_create_by,
  131. qst.corp_id AS temp_company_id
  132. FROM
  133. qw_sop qs
  134. LEFT JOIN
  135. qw_sop_temp qst ON qs.temp_id = qst.id
  136. WHERE
  137. FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
  138. AND qs.corp_id = #{map.corpId}
  139. AND qst.status = '1'
  140. AND qs.status IN (2, 3, 4)
  141. AND qs.send_type = 4
  142. AND (
  143. <foreach collection='map.tagsIdsSelectList' item='item' index='index' separator=' or '>
  144. find_in_set( #{item}, TRIM(REGEXP_REPLACE(qs.tags, '[\"\\\\[\\\\]]', '')) )
  145. </foreach>
  146. )
  147. </select>
  148. <select id="selectQwSopByQwUserId" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  149. SELECT
  150. qs.*
  151. FROM
  152. qw_sop qs
  153. LEFT JOIN
  154. qw_sop_temp qst ON qs.temp_id = qst.id
  155. WHERE
  156. FIND_IN_SET(#{map.qwUserId}, COALESCE(qs.qw_user_ids, '')) > 0
  157. AND qs.corp_id = #{map.corpId}
  158. AND qst.status = '1'
  159. AND qs.status IN (2, 3, 4)
  160. AND qs.send_type = #{map.sendType}
  161. </select>
  162. <select id="checkSopRuleTime" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  163. <![CDATA[
  164. SELECT
  165. qs.*,
  166. qst.name AS temp_name,
  167. qst.setting AS temp_setting,
  168. qst.status AS temp_status,
  169. qst.gap AS temp_gap,
  170. qst.sort AS temp_sort,
  171. qst.create_time AS temp_create_time,
  172. qst.create_by AS temp_create_by,
  173. qst.corp_id AS temp_company_id
  174. FROM
  175. qw_sop qs
  176. LEFT JOIN qw_sop_temp qst ON qs.temp_id = qst.id
  177. WHERE
  178. qs.status = 1
  179. AND qs.start_time <= NOW()
  180. ]]>
  181. </select>
  182. <select id="selectQwSopByClickHouseId" parameterType="String" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  183. <![CDATA[
  184. SELECT
  185. qs.*,
  186. qst.name AS temp_name,
  187. qst.setting AS temp_setting,
  188. qst.status AS temp_status,
  189. qst.gap AS temp_gap,
  190. qst.sort AS temp_sort,
  191. qst.create_time AS temp_create_time,
  192. qst.create_by AS temp_create_by,
  193. qst.corp_id AS temp_company_id
  194. FROM
  195. qw_sop qs
  196. LEFT JOIN
  197. qw_sop_temp qst
  198. ON
  199. qs.temp_id = qst.id
  200. WHERE
  201. qs.id = #{id}
  202. ]]>
  203. </select>
  204. <select id="selectQwSopList" parameterType="QwSop" resultType="QwSop">
  205. <include refid="selectQwSopVo"/>
  206. <where>
  207. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  208. <if test="status != null "> and status = #{status}</if>
  209. <if test="type != null "> and type = #{type}</if>
  210. <if test="id != null and id != '' "> and id = #{id}</if>
  211. <if test="companyId != null "> and company_id = #{companyId}</if>
  212. <if test="qwUserIds != null and qwUserIds != ''"> and FIND_IN_SET(#{qwUserIds}, qw_user_ids) > 0</if>
  213. <if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
  214. <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
  215. <if test="createTime != null "> and DATE(create_time) = #{createTime}</if>
  216. <if test="sendType != null "> and send_type = #{sendType}</if>
  217. <if test="expiryTime != null "> and expiry_time = #{expiryTime}</if>
  218. <if test="isAutoSop != null "> and is_auto_sop = #{isAutoSop}</if>
  219. <if test="autoSopTime != null "> and auto_sop_time = #{autoSopTime}</if>
  220. <if test="minSend != null "> and min_send = #{minSend}</if>
  221. <if test="maxSend != null "> and max_send = #{maxSend}</if>
  222. <if test="stopTime != null "> and stop_time = #{stopTime}</if>
  223. <!-- 加入固定条件 -->
  224. and status != 6
  225. </where>
  226. order by create_time desc
  227. </select>
  228. <select id="selectChatQwSopList" parameterType="QwSop" resultMap="QwSopResult">
  229. <include refid="selectQwSopVo"/>
  230. where send_type = 4
  231. and status != 6
  232. order by create_time desc
  233. </select>
  234. <select id="selectQwSopByIsRating" parameterType="QwSop" resultMap="QwSopResult">
  235. <include refid="selectQwSopVo"/>
  236. where is_rating = 1
  237. and send_type in(2,3)
  238. order by create_time desc
  239. </select>
  240. <select id="selectQwSopById" parameterType="String" resultType="com.fs.sop.domain.QwSop">
  241. <include refid="selectQwSopVo"/>
  242. where id = #{id}
  243. </select>
  244. <insert id="insertQwSop" parameterType="com.fs.sop.domain.QwSop" useGeneratedKeys="false" keyProperty="id">
  245. insert into qw_sop
  246. <trim prefix="(" suffix=")" suffixOverrides=",">
  247. <if test="data.name != null">name,</if>
  248. <if test="data.status != null">status,</if>
  249. <if test="data.type != null">type,</if>
  250. <if test="data.qwUserIds != null">qw_user_ids,</if>
  251. <if test="data.createBy != null">create_by,</if>
  252. <if test="data.createTime != null">create_time,</if>
  253. <if test="data.companyId != null">company_id,</if>
  254. <if test="data.sendType != null">send_type,</if>
  255. <if test="data.tags != null">tags,</if>
  256. <if test="data.excludeTags != null">exclude_tags,</if>
  257. <if test="data.startTime != null">start_time,</if>
  258. <if test="data.filterType != null">filter_type,</if>
  259. <if test="data.tempId != null">temp_id,</if>
  260. <if test="data.corpId != null">corp_id,</if>
  261. <if test="data.expiryTime != null">expiry_time,</if>
  262. <if test="data.isAutoSop != null">is_auto_sop,</if>
  263. <if test="data.autoSopTime != null">auto_sop_time,</if>
  264. <if test="data.minConversionDay != null">min_conversion_day,</if>
  265. <if test="data.maxConversionDay != null">max_conversion_day,</if>
  266. <if test="data.minSend != null">min_send,</if>
  267. <if test="data.maxSend != null">max_send,</if>
  268. <if test="data.isRating != null">is_rating,</if>
  269. <if test="data.courseDay != null">course_day,</if>
  270. <if test="data.openCommentStatus != null">open_comment_status,</if>
  271. </trim>
  272. <trim prefix="values (" suffix=")" suffixOverrides=",">
  273. <if test="data.name != null">#{data.name},</if>
  274. <if test="data.status != null">#{data.status},</if>
  275. <if test="data.type != null">#{data.type},</if>
  276. <if test="data.qwUserIds != null">#{data.qwUserIds},</if>
  277. <if test="data.createBy != null">#{data.createBy},</if>
  278. <if test="data.createTime != null">#{data.createTime},</if>
  279. <if test="data.companyId != null">#{data.companyId},</if>
  280. <if test="data.sendType != null">#{data.sendType},</if>
  281. <if test="data.tags != null">#{data.tags},</if>
  282. <if test="data.excludeTags != null">#{data.excludeTags},</if>
  283. <if test="data.startTime != null">#{data.startTime},</if>
  284. <if test="data.filterType != null">#{data.filterType},</if>
  285. <if test="data.tempId != null">#{data.tempId},</if>
  286. <if test="data.corpId != null">#{data.corpId},</if>
  287. <if test="data.expiryTime != null">#{data.expiryTime},</if>
  288. <if test="data.isAutoSop != null">#{data.isAutoSop},</if>
  289. <if test="data.autoSopTime != null">#{data.autoSopTime},</if>
  290. <if test="data.minConversionDay != null">#{data.minConversionDay},</if>
  291. <if test="data.maxConversionDay != null">#{data.maxConversionDay},</if>
  292. <if test="data.minSend != null">#{data.minSend},</if>
  293. <if test="data.maxSend != null">#{data.maxSend},</if>
  294. <if test="data.isRating != null">#{data.isRating},</if>
  295. <if test="data.courseDay != null">#{data.courseDay},</if>
  296. <if test="data.openCommentStatus != null">#{data.openCommentStatus},</if>
  297. </trim>
  298. </insert>
  299. <update id="updateAutoSopTime" useGeneratedKeys="false" keyProperty="id" >
  300. UPDATE qw_sop
  301. SET
  302. is_auto_sop = #{map.isAutoSop}
  303. <if test="map.autoSopTime != null and map.autoSopTime != ''">
  304. ,auto_sop_time = #{map.autoSopTime}
  305. </if>
  306. WHERE id = #{map.id}
  307. </update>
  308. <update id="updateSopStatus" useGeneratedKeys="false" keyProperty="id" >
  309. UPDATE qw_sop
  310. SET status = #{map.status},stop_time = NOW()
  311. WHERE id = #{map.id}
  312. </update>
  313. <select id="selectStatusQwSopById" resultType="QwSop">
  314. select * from qw_sop where id in
  315. <foreach item="id" collection="ids" open="(" separator="," close=")">
  316. #{id}
  317. </foreach>
  318. </select>
  319. <select id="executeSopByIds" resultType="com.fs.qw.vo.QwSopRuleTimeVO">
  320. SELECT qs.*,
  321. qst.name AS temp_name,
  322. qst.setting AS temp_setting,
  323. qst.status AS temp_status,
  324. qst.gap AS temp_gap,
  325. qst.sort AS temp_sort,
  326. qst.create_time AS temp_create_time,
  327. qst.create_by AS temp_create_by,
  328. qst.corp_id AS temp_company_id
  329. FROM qw_sop qs
  330. LEFT JOIN qw_sop_temp qst ON qs.temp_id = qst.id
  331. WHERE qs.id IN
  332. <foreach item="id" collection="ids" open="(" separator="," close=")">
  333. #{id}
  334. </foreach>
  335. </select>
  336. <select id="executeSopWxByIds" resultType="com.fs.qw.vo.WxSopRuleTimeVO">
  337. SELECT qs.*,
  338. qst.name AS temp_name,
  339. qst.setting AS temp_setting,
  340. qst.status AS temp_status,
  341. qst.gap AS temp_gap,
  342. qst.sort AS temp_sort,
  343. qst.create_time AS temp_create_time,
  344. qst.create_by AS temp_create_by,
  345. qst.corp_id AS temp_company_id
  346. FROM qw_sop qs
  347. LEFT JOIN qw_sop_temp qst ON qs.temp_id = qst.id
  348. WHERE qs.id IN
  349. <foreach item="id" collection="ids" open="(" separator="," close=")">
  350. #{id}
  351. </foreach>
  352. </select>
  353. <select id="selectAiChatQwSopList" resultType="com.fs.sop.domain.QwSop">
  354. <include refid="selectQwSopVo"/>
  355. <where>
  356. send_type = 4
  357. <if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
  358. <if test="status != null "> and status = #{status}</if>
  359. <if test="type != null "> and type = #{type}</if>
  360. <if test="companyId != null "> and company_id = #{companyId}</if>
  361. <if test="qwUserIds != null and qwUserIds != ''"> and qw_user_ids = #{qwUserIds}</if>
  362. <if test="createBy != null and createBy != ''"> and create_by = #{createBy}</if>
  363. <if test="corpId != null and corpId != ''"> and corp_id = #{corpId}</if>
  364. <if test="createTime != null "> and DATE(create_time) = #{createTime}</if>
  365. <if test="expiryTime != null "> and expiry_time = #{expiryTime}</if>
  366. <if test="isAutoSop != null "> and is_auto_sop = #{isAutoSop}</if>
  367. <if test="autoSopTime != null "> and auto_sop_time = #{autoSopTime}</if>
  368. <if test="minSend != null "> and min_send = #{minSend}</if>
  369. <if test="maxSend != null "> and max_send = #{maxSend}</if>
  370. <if test="stopTime != null "> and stop_time = #{stopTime}</if>
  371. <!-- 加入固定条件 -->
  372. and status != 6
  373. </where>
  374. order by create_time desc
  375. </select>
  376. <select id="selectByTemplateId" resultType="com.fs.sop.domain.QwSop">
  377. select * from qw_sop where temp_id = #{tempId}
  378. </select>
  379. <select id="selectWxSop" resultType="com.fs.sop.domain.QwSop">
  380. select a.* from qw_sop a
  381. where a.send_type != 4 and a.status in (2,3) and a.type = 1
  382. </select>
  383. <select id="executeSopChatByIds" resultType="com.fs.qw.vo.ChatSopRuleTimeVO">
  384. SELECT qs.*,
  385. qst.name AS temp_name,
  386. qst.setting AS temp_setting,
  387. qst.status AS temp_status,
  388. qst.gap AS temp_gap,
  389. qst.sort AS temp_sort,
  390. qst.create_time AS temp_create_time,
  391. qst.create_by AS temp_create_by,
  392. qst.corp_id AS temp_company_id
  393. FROM qw_sop qs
  394. LEFT JOIN qw_sop_temp qst ON qs.temp_id = qst.id
  395. WHERE qs.id IN
  396. <foreach item="id" collection="ids" open="(" separator="," close=")">
  397. #{id}
  398. </foreach>
  399. </select>
  400. <select id="selectQwSopAllList" resultType="com.fs.sop.domain.QwSop">
  401. SELECT DISTINCT qw_sop.id,qw_sop.name
  402. FROM sop_user_logs log
  403. RIGHT JOIN qw_sop ON log.sop_id = qw_sop.id
  404. <where>
  405. <![CDATA[
  406. log.start_time <= CURDATE()
  407. AND log.status = 1
  408. AND qw_sop.status in(2,3)
  409. AND qw_sop.is_auto_sop = 1 AND log.start_time >= #{startDate}
  410. AND log.start_time <= #{endDate}
  411. ]]>
  412. <if test="companyId != null">
  413. AND qw_sop.company_id = ${companyId}
  414. </if>
  415. </where>
  416. ORDER BY qw_sop.create_time DESC
  417. </select>
  418. <select id="selectQwSopByTempId" resultType="com.fs.sop.domain.QwSop">
  419. <include refid="selectQwSopVo"/>
  420. where temp_id = #{tempId}
  421. </select>
  422. <update id="updateQwSop" parameterType="QwSop" useGeneratedKeys="false" keyProperty="id" >
  423. UPDATE qw_sop
  424. <trim prefix="SET" suffixOverrides=",">
  425. <if test="data.name != null">name = #{data.name},</if>
  426. <if test="data.status != null">status = #{data.status},</if>
  427. <if test="data.type != null">type = #{data.type},</if>
  428. <if test="data.qwUserIds != null">qw_user_ids = #{data.qwUserIds},</if>
  429. <if test="data.createBy != null">create_by = #{data.createBy},</if>
  430. <if test="data.createTime != null">create_time = #{data.createTime},</if>
  431. <if test="data.companyId != null">company_id = #{data.companyId},</if>
  432. <if test="data.sendType != null">send_type = #{data.sendType},</if>
  433. <if test="data.tags != null">tags = #{data.tags},</if>
  434. <if test="data.excludeTags != null">exclude_tags = #{data.excludeTags},</if>
  435. <if test="data.startTime != null">start_time = #{data.startTime},</if>
  436. <if test="data.filterType != null">filter_type = #{data.filterType},</if>
  437. <if test="data.tempId != null">temp_id = #{data.tempId},</if>
  438. <if test="data.corpId != null">corp_id = #{data.corpId},</if>
  439. <if test="data.expiryTime != null">expiry_time = #{data.expiryTime},</if>
  440. <if test="data.isAutoSop != null">is_auto_sop = #{data.isAutoSop},</if>
  441. <if test="data.autoSopTime != null">auto_sop_time = #{data.autoSopTime},</if>
  442. <if test="data.minConversionDay != null">min_conversion_day = #{data.minConversionDay},</if>
  443. <if test="data.maxConversionDay != null">max_conversion_day = #{data.maxConversionDay},</if>
  444. <if test="data.minSend != null">min_send = #{data.minSend},</if>
  445. <if test="data.maxSend != null">max_send = #{data.maxSend},</if>
  446. <if test="data.voice != null">voice = #{data.voice},</if>
  447. <if test="data.isRating != null">is_rating = #{data.isRating},</if>
  448. <if test="data.courseDay != null">course_day = #{data.courseDay},</if>
  449. <if test="data.openCommentStatus != null">open_comment_status = #{data.openCommentStatus},</if>
  450. <if test="data.chatId != null">chat_id = #{data.chatId},</if>
  451. <if test="data.isSampSend != null">is_samp_send = #{data.isSampSend},</if>
  452. </trim>
  453. where id = #{data.id}
  454. </update>
  455. <delete id="deleteQwSopById" parameterType="String">
  456. DELETE FROM qw_sop
  457. where id = #{id}
  458. </delete>
  459. <delete id="deleteQwSopByIds" parameterType="String">
  460. DELETE FROM qw_sop
  461. where id in
  462. <foreach item="id" collection="array" open="(" separator="," close=")">
  463. #{id}
  464. </foreach>
  465. </delete>
  466. <update id="deleteQwSopByIdsUpdate" useGeneratedKeys="false" keyProperty="id">
  467. UPDATE qw_sop
  468. SET status = 6
  469. WHERE id IN
  470. <foreach item="id" collection="ids" open="(" separator="," close=")">
  471. #{id}
  472. </foreach>
  473. </update>
  474. <update id="updateStatusQwSopById" useGeneratedKeys="false" keyProperty="id" >
  475. UPDATE qw_sop
  476. SET status = 4
  477. WHERE id IN
  478. <foreach item="id" collection="ids" open="(" separator="," close=")">
  479. #{id}
  480. </foreach>
  481. </update>
  482. <update id="updateMinSendStatus">
  483. UPDATE qw_sop
  484. SET min_send = 1
  485. WHERE id = #{id}
  486. </update>
  487. <update id="updateMaxSendStatus">
  488. UPDATE qw_sop
  489. SET max_send = 1
  490. WHERE id = #{id}
  491. </update>
  492. <update id="updateStatusQwSopById2" useGeneratedKeys="false" keyProperty="id" >
  493. UPDATE qw_sop
  494. SET status = 3
  495. WHERE id IN
  496. <foreach item="id" collection="ids" open="(" separator="," close=")">
  497. #{id}
  498. </foreach>
  499. </update>
  500. <update id="batchUpdateSopChatIdById">
  501. <foreach collection="sopList" item="item" separator=";">
  502. UPDATE qw_sop
  503. SET chat_id = #{item.chatId}
  504. WHERE id = #{item.id}
  505. </foreach>
  506. </update>
  507. <select id="getQwSopInfoById" resultType="com.fs.sop.domain.QwSop">
  508. SELECT id,filter_mode,chat_id FROM qw_sop where id IN <foreach collection="ids" item="item" index="index" open="(" separator="," close=")">#{item}</foreach>
  509. </select>
  510. </mapper>