CaseInfoMapper.xml 19 KB

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