CustomerServiceMapper.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.izouma.awesomeadmin.dao.CustomerServiceMapper">
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.CustomerService">
  5. <!--generatedStart-->
  6. <id column="id" property="id" jdbcType="INTEGER"/>
  7. <result column="del_flag" property="delFlag" jdbcType="CHAR"/>
  8. <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
  9. <result column="update_user" property="updateUser" jdbcType="VARCHAR"/>
  10. <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
  11. <result column="create_user" property="createUser" jdbcType="VARCHAR"/>
  12. <result column="service_name" property="serviceName" jdbcType="VARCHAR"/>
  13. <result column="qq" property="qq" jdbcType="VARCHAR"/>
  14. <result column="telephone" property="telephone" jdbcType="VARCHAR"/>
  15. <result column="wchat" property="wchat" jdbcType="VARCHAR"/>
  16. <result column="remark" property="remark" jdbcType="VARCHAR"/>
  17. <result column="icon" property="icon" jdbcType="VARCHAR"/>
  18. <result column="channel" property="channel" jdbcType="INTEGER"/>
  19. <!--generatedEnd-->
  20. </resultMap>
  21. <sql id="Base_Column_List">
  22. <!--generatedStart-->
  23. id, del_flag, update_time, update_user, create_time, create_user, service_name, qq, telephone, wchat, remark, icon, channel <!--generatedEnd-->
  24. </sql>
  25. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
  26. SELECT
  27. <include refid="Base_Column_List"/>
  28. FROM customer_service
  29. WHERE id = #{id,jdbcType=INTEGER}
  30. </select>
  31. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  32. DELETE
  33. FROM customer_service
  34. WHERE id = #{id,jdbcType=INTEGER}
  35. </delete>
  36. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.CustomerService" useGeneratedKeys="true" keyProperty="id">
  37. INSERT INTO customer_service
  38. <trim prefix="(" suffix=")" suffixOverrides=",">
  39. <!--generatedStart-->
  40. <if test="id!= null">
  41. id,
  42. </if>
  43. <if test="delFlag!= null">
  44. del_flag,
  45. </if>
  46. <if test="updateTime!= null">
  47. update_time,
  48. </if>
  49. <if test="updateUser!= null">
  50. update_user,
  51. </if>
  52. <if test="createTime!= null">
  53. create_time,
  54. </if>
  55. <if test="createUser!= null">
  56. create_user,
  57. </if>
  58. <if test="serviceName!= null">
  59. service_name,
  60. </if>
  61. <if test="qq!= null">
  62. qq,
  63. </if>
  64. <if test="telephone!= null">
  65. telephone,
  66. </if>
  67. <if test="wchat!= null">
  68. wchat,
  69. </if>
  70. <if test="remark!= null">
  71. remark,
  72. </if>
  73. <if test="icon!= null">
  74. icon,
  75. </if>
  76. <if test="channel!= null">
  77. channel,
  78. </if>
  79. <!--generatedEnd-->
  80. </trim>
  81. <trim prefix="values (" suffix=")" suffixOverrides=",">
  82. <!--generatedStart-->
  83. <if test="id != null">
  84. #{id,jdbcType=INTEGER},
  85. </if>
  86. <if test="delFlag != null">
  87. #{delFlag,jdbcType=CHAR},
  88. </if>
  89. <if test="updateTime != null">
  90. #{updateTime,jdbcType=TIMESTAMP},
  91. </if>
  92. <if test="updateUser != null">
  93. #{updateUser,jdbcType=VARCHAR},
  94. </if>
  95. <if test="createTime != null">
  96. #{createTime,jdbcType=TIMESTAMP},
  97. </if>
  98. <if test="createUser != null">
  99. #{createUser,jdbcType=VARCHAR},
  100. </if>
  101. <if test="serviceName != null">
  102. #{serviceName,jdbcType=VARCHAR},
  103. </if>
  104. <if test="qq != null">
  105. #{qq,jdbcType=VARCHAR},
  106. </if>
  107. <if test="telephone != null">
  108. #{telephone,jdbcType=VARCHAR},
  109. </if>
  110. <if test="wchat != null">
  111. #{wchat,jdbcType=VARCHAR},
  112. </if>
  113. <if test="remark != null">
  114. #{remark,jdbcType=VARCHAR},
  115. </if>
  116. <if test="icon != null">
  117. #{icon,jdbcType=VARCHAR},
  118. </if>
  119. <if test="channel != null">
  120. #{channel,jdbcType=INTEGER},
  121. </if>
  122. <!--generatedEnd-->
  123. </trim>
  124. </insert>
  125. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.CustomerService">
  126. UPDATE customer_service
  127. <set>
  128. <!--generatedStart-->
  129. <if test="id != null">
  130. id= #{id,jdbcType=INTEGER},
  131. </if>
  132. <if test="delFlag != null">
  133. del_flag= #{delFlag,jdbcType=CHAR},
  134. </if>
  135. <if test="updateTime != null">
  136. update_time= #{updateTime,jdbcType=TIMESTAMP},
  137. </if>
  138. <if test="updateUser != null">
  139. update_user= #{updateUser,jdbcType=VARCHAR},
  140. </if>
  141. <if test="createTime != null">
  142. create_time= #{createTime,jdbcType=TIMESTAMP},
  143. </if>
  144. <if test="createUser != null">
  145. create_user= #{createUser,jdbcType=VARCHAR},
  146. </if>
  147. <if test="serviceName != null">
  148. service_name= #{serviceName,jdbcType=VARCHAR},
  149. </if>
  150. <if test="qq != null">
  151. qq= #{qq,jdbcType=VARCHAR},
  152. </if>
  153. <if test="telephone != null">
  154. telephone= #{telephone,jdbcType=VARCHAR},
  155. </if>
  156. <if test="wchat != null">
  157. wchat= #{wchat,jdbcType=VARCHAR},
  158. </if>
  159. <if test="remark != null">
  160. remark= #{remark,jdbcType=VARCHAR},
  161. </if>
  162. <if test="icon != null">
  163. icon= #{icon,jdbcType=VARCHAR},
  164. </if>
  165. <if test="channel != null">
  166. channel= #{channel,jdbcType=INTEGER},
  167. </if>
  168. <!--generatedEnd-->
  169. </set>
  170. WHERE
  171. <if test="id != null and !&quot;&quot;.equals(id)">
  172. id = #{id,jdbcType=INTEGER}
  173. </if>
  174. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  175. id IN (${idStr})
  176. </if>
  177. </update>
  178. <select id="queryCustomerServiceByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CustomerService">
  179. SELECT <include refid="Base_Column_List"/> FROM customer_service
  180. <where>
  181. AND del_flag = 'N'
  182. <if test="record.idStr != null and !&quot;&quot;.equals(record.idStr)">
  183. AND id IN (${record.idStr})
  184. </if>
  185. <!--generatedStart-->
  186. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  187. AND id = #{record.id}
  188. </if>
  189. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  190. AND del_flag = #{record.delFlag}
  191. </if>
  192. <if test="record.updateTime != null and !&quot;&quot;.equals(record.updateTime)">
  193. AND update_time = #{record.updateTime}
  194. </if>
  195. <if test="record.updateUser != null and !&quot;&quot;.equals(record.updateUser)">
  196. AND update_user = #{record.updateUser}
  197. </if>
  198. <if test="record.createTime != null and !&quot;&quot;.equals(record.createTime)">
  199. AND create_time = #{record.createTime}
  200. </if>
  201. <if test="record.createUser != null and !&quot;&quot;.equals(record.createUser)">
  202. AND create_user = #{record.createUser}
  203. </if>
  204. <if test="record.serviceName != null and !&quot;&quot;.equals(record.serviceName)">
  205. AND service_name = #{record.serviceName}
  206. </if>
  207. <if test="record.qq != null and !&quot;&quot;.equals(record.qq)">
  208. AND qq = #{record.qq}
  209. </if>
  210. <if test="record.telephone != null and !&quot;&quot;.equals(record.telephone)">
  211. AND telephone = #{record.telephone}
  212. </if>
  213. <if test="record.wchat != null and !&quot;&quot;.equals(record.wchat)">
  214. AND wchat = #{record.wchat}
  215. </if>
  216. <if test="record.remark != null and !&quot;&quot;.equals(record.remark)">
  217. AND remark = #{record.remark}
  218. </if>
  219. <if test="record.icon != null and !&quot;&quot;.equals(record.icon)">
  220. AND icon = #{record.icon}
  221. </if>
  222. <if test="record.channel != null and !&quot;&quot;.equals(record.channel)">
  223. AND channel = #{record.channel}
  224. </if>
  225. <!--generatedEnd-->
  226. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  227. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  228. <!--generatedStart-->
  229. OR service_name LIKE concat('%',#{record.searchKey},'%')
  230. OR qq LIKE concat('%',#{record.searchKey},'%')
  231. OR telephone LIKE concat('%',#{record.searchKey},'%')
  232. OR wchat LIKE concat('%',#{record.searchKey},'%')
  233. OR remark LIKE concat('%',#{record.searchKey},'%')
  234. OR channel LIKE concat('%',#{record.searchKey},'%')
  235. <!--generatedEnd-->
  236. </trim>
  237. </if>
  238. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  239. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  240. <choose>
  241. <when test="item.indexOf('like') != -1">
  242. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  243. <if test="detailIndex == 3">
  244. concat('%',#{itemDetail},'%')
  245. </if>
  246. <if test="detailIndex &lt; 3">
  247. ${itemDetail}
  248. </if>
  249. </foreach>
  250. </when>
  251. <otherwise>
  252. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  253. <if test="detailIndex == 3">
  254. #{itemDetail}
  255. </if>
  256. <if test="detailIndex &lt; 3">
  257. ${itemDetail}
  258. </if>
  259. </foreach>
  260. </otherwise>
  261. </choose>
  262. </foreach>
  263. </if>
  264. </where>
  265. ORDER BY
  266. <if test="record.orderByStr != null and !&quot;&quot;.equals(record.orderByStr)">
  267. <trim suffixOverrides=",">
  268. <foreach item="item" index="index" separator="," collection="record.orderByStr.split('_;')">
  269. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  270. ${itemDetail}
  271. </foreach>
  272. </foreach>
  273. </trim>
  274. ,
  275. </if>
  276. id DESC
  277. </select>
  278. <select id="queryAllCustomerService" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CustomerService">
  279. SELECT <include refid="Base_Column_List"/> FROM customer_service
  280. <where>
  281. AND del_flag = 'N'
  282. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  283. AND id IN (${idStr})
  284. </if>
  285. <!--generatedStart-->
  286. <if test="id != null and !&quot;&quot;.equals(id)">
  287. AND id = #{id}
  288. </if>
  289. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  290. AND del_flag = #{delFlag}
  291. </if>
  292. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  293. AND update_time = #{updateTime}
  294. </if>
  295. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  296. AND update_user = #{updateUser}
  297. </if>
  298. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  299. AND create_time = #{createTime}
  300. </if>
  301. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  302. AND create_user = #{createUser}
  303. </if>
  304. <if test="serviceName != null and !&quot;&quot;.equals(serviceName)">
  305. AND service_name = #{serviceName}
  306. </if>
  307. <if test="qq != null and !&quot;&quot;.equals(qq)">
  308. AND qq = #{qq}
  309. </if>
  310. <if test="telephone != null and !&quot;&quot;.equals(telephone)">
  311. AND telephone = #{telephone}
  312. </if>
  313. <if test="wchat != null and !&quot;&quot;.equals(wchat)">
  314. AND wchat = #{wchat}
  315. </if>
  316. <if test="remark != null and !&quot;&quot;.equals(remark)">
  317. AND remark = #{remark}
  318. </if>
  319. <if test="icon != null and !&quot;&quot;.equals(icon)">
  320. AND icon = #{icon}
  321. </if>
  322. <if test="channel != null and !&quot;&quot;.equals(channel)">
  323. AND channel = #{channel}
  324. </if>
  325. <!--generatedEnd-->
  326. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  327. <trim prefix="and (" suffix=")" prefixOverrides="OR">
  328. <!--generatedStart-->
  329. OR service_name LIKE concat('%',#{searchKey},'%')
  330. OR qq LIKE concat('%',#{searchKey},'%')
  331. OR telephone LIKE concat('%',#{searchKey},'%')
  332. OR wchat LIKE concat('%',#{searchKey},'%')
  333. OR remark LIKE concat('%',#{searchKey},'%')
  334. OR channel LIKE concat('%',#{searchKey},'%')
  335. <!--generatedEnd-->
  336. </trim>
  337. </if>
  338. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  339. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  340. <choose>
  341. <when test="item.indexOf('like') != -1">
  342. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  343. <if test="detailIndex == 3">
  344. concat('%',#{itemDetail},'%')
  345. </if>
  346. <if test="detailIndex &lt; 3">
  347. ${itemDetail}
  348. </if>
  349. </foreach>
  350. </when>
  351. <otherwise>
  352. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  353. <if test="detailIndex == 3">
  354. #{itemDetail}
  355. </if>
  356. <if test="detailIndex &lt; 3">
  357. ${itemDetail}
  358. </if>
  359. </foreach>
  360. </otherwise>
  361. </choose>
  362. </foreach>
  363. </if>
  364. </where>
  365. ORDER BY
  366. <if test="orderByStr != null and !&quot;&quot;.equals(orderByStr)">
  367. <trim suffixOverrides=",">
  368. <foreach item="item" index="index" separator="," collection="orderByStr.split('_;')">
  369. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  370. ${itemDetail}
  371. </foreach>
  372. </foreach>
  373. </trim>
  374. ,
  375. </if>
  376. id DESC
  377. </select>
  378. <select id="queryCustomerService" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CustomerService">
  379. SELECT <include refid="Base_Column_List"/> FROM customer_service
  380. <where>
  381. AND del_flag = 'N'
  382. <!--generatedStart-->
  383. <if test="id != null and !&quot;&quot;.equals(id)">
  384. AND id = #{id}
  385. </if>
  386. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  387. AND del_flag = #{delFlag}
  388. </if>
  389. <if test="updateTime != null and !&quot;&quot;.equals(updateTime)">
  390. AND update_time = #{updateTime}
  391. </if>
  392. <if test="updateUser != null and !&quot;&quot;.equals(updateUser)">
  393. AND update_user = #{updateUser}
  394. </if>
  395. <if test="createTime != null and !&quot;&quot;.equals(createTime)">
  396. AND create_time = #{createTime}
  397. </if>
  398. <if test="createUser != null and !&quot;&quot;.equals(createUser)">
  399. AND create_user = #{createUser}
  400. </if>
  401. <if test="serviceName != null and !&quot;&quot;.equals(serviceName)">
  402. AND service_name = #{serviceName}
  403. </if>
  404. <if test="qq != null and !&quot;&quot;.equals(qq)">
  405. AND qq = #{qq}
  406. </if>
  407. <if test="telephone != null and !&quot;&quot;.equals(telephone)">
  408. AND telephone = #{telephone}
  409. </if>
  410. <if test="wchat != null and !&quot;&quot;.equals(wchat)">
  411. AND wchat = #{wchat}
  412. </if>
  413. <if test="remark != null and !&quot;&quot;.equals(remark)">
  414. AND remark = #{remark}
  415. </if>
  416. <if test="icon != null and !&quot;&quot;.equals(icon)">
  417. AND icon = #{icon}
  418. </if>
  419. <if test="channel != null and !&quot;&quot;.equals(channel)">
  420. AND channel = #{channel}
  421. </if>
  422. <!--generatedEnd-->
  423. </where>
  424. LIMIT 1
  425. </select>
  426. <update id="delete">
  427. UPDATE customer_service SET del_flag = 'Y'
  428. WHERE
  429. <if test="id != null and !&quot;&quot;.equals(id)">
  430. id = #{id,jdbcType=INTEGER}
  431. </if>
  432. <if test="idStr != null and !&quot;&quot;.equals(idStr)">
  433. id IN (${idStr})
  434. </if>
  435. </update>
  436. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.CustomerService">
  437. SELECT
  438. <include refid="Base_Column_List"/>
  439. FROM customer_service
  440. <where>
  441. AND del_flag = 'N'
  442. <!--generatedStart-->
  443. <!--generatedEnd-->
  444. </where>
  445. ORDER BY id DESC
  446. </select>
  447. </mapper>