QwSopMapper.xml 23 KB

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