TestBbbMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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.TestBbbMapper" >
  4. <resultMap id="BaseResultMap" type="com.izouma.awesomeadmin.model.TestBbb" >
  5. <id column="id" property="id" jdbcType="INTEGER" />
  6. <result column="del_flag" property="delFlag" jdbcType="CHAR" />
  7. <result column="name_aaa" property="nameAaa" jdbcType="VARCHAR" />
  8. <result column="name_bbb" property="nameBbb" jdbcType="VARCHAR" />
  9. <result column="name_ccc" property="nameCcc" jdbcType="VARCHAR" />
  10. <result column="name_ddd" property="nameDdd" jdbcType="VARCHAR" />
  11. </resultMap>
  12. <sql id="Base_Column_List" >
  13. <trim suffixOverrides="," >
  14. id,
  15. del_flag,
  16. name_aaa,
  17. name_bbb,
  18. name_ccc,
  19. name_ddd,
  20. </trim>
  21. </sql>
  22. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  23. select
  24. <include refid="Base_Column_List" />
  25. from test_bbb
  26. where id = #{id,jdbcType=INTEGER}
  27. </select>
  28. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  29. delete from test_bbb
  30. where id = #{id,jdbcType=INTEGER}
  31. </delete>
  32. <insert id="insertSelective" parameterType="com.izouma.awesomeadmin.model.TestBbb" useGeneratedKeys="true" keyProperty="id">
  33. insert into test_bbb
  34. <trim prefix="(" suffix=")" suffixOverrides="," >
  35. <if test="id!= null" >
  36. id,
  37. </if>
  38. <if test="delFlag!= null" >
  39. del_flag,
  40. </if>
  41. <if test="nameAaa!= null" >
  42. name_aaa,
  43. </if>
  44. <if test="nameBbb!= null" >
  45. name_bbb,
  46. </if>
  47. <if test="nameCcc!= null" >
  48. name_ccc,
  49. </if>
  50. <if test="nameDdd!= null" >
  51. name_ddd,
  52. </if>
  53. </trim>
  54. <trim prefix="values (" suffix=")" suffixOverrides="," >
  55. <if test="id != null" >
  56. #{id,jdbcType=INTEGER},
  57. </if>
  58. <if test="delFlag != null" >
  59. #{delFlag,jdbcType=CHAR},
  60. </if>
  61. <if test="nameAaa != null" >
  62. #{nameAaa,jdbcType=VARCHAR},
  63. </if>
  64. <if test="nameBbb != null" >
  65. #{nameBbb,jdbcType=VARCHAR},
  66. </if>
  67. <if test="nameCcc != null" >
  68. #{nameCcc,jdbcType=VARCHAR},
  69. </if>
  70. <if test="nameDdd != null" >
  71. #{nameDdd,jdbcType=VARCHAR},
  72. </if>
  73. </trim>
  74. </insert>
  75. <update id="updateByPrimaryKeySelective" parameterType="com.izouma.awesomeadmin.model.TestBbb" >
  76. update test_bbb
  77. <set >
  78. <if test="id != null" >
  79. id= #{id,jdbcType=INTEGER},
  80. </if>
  81. <if test="delFlag != null" >
  82. del_flag= #{delFlag,jdbcType=CHAR},
  83. </if>
  84. <if test="nameAaa != null" >
  85. name_aaa= #{nameAaa,jdbcType=VARCHAR},
  86. </if>
  87. <if test="nameBbb != null" >
  88. name_bbb= #{nameBbb,jdbcType=VARCHAR},
  89. </if>
  90. <if test="nameCcc != null" >
  91. name_ccc= #{nameCcc,jdbcType=VARCHAR},
  92. </if>
  93. <if test="nameDdd != null" >
  94. name_ddd= #{nameDdd,jdbcType=VARCHAR},
  95. </if>
  96. </set>
  97. where id = #{id,jdbcType=INTEGER}
  98. </update>
  99. <select id="queryTestBbbByPage" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestBbb">
  100. select <include refid="Base_Column_List"/> from test_bbb
  101. <where>
  102. and del_flag = 'N'
  103. <if test="record.id != null and !&quot;&quot;.equals(record.id)">
  104. and id = #{record.id}
  105. </if>
  106. <if test="record.delFlag != null and !&quot;&quot;.equals(record.delFlag)">
  107. and del_flag = #{record.delFlag}
  108. </if>
  109. <if test="record.nameAaa != null and !&quot;&quot;.equals(record.nameAaa)">
  110. and name_aaa = #{record.nameAaa}
  111. </if>
  112. <if test="record.nameBbb != null and !&quot;&quot;.equals(record.nameBbb)">
  113. and name_bbb = #{record.nameBbb}
  114. </if>
  115. <if test="record.nameCcc != null and !&quot;&quot;.equals(record.nameCcc)">
  116. and name_ccc = #{record.nameCcc}
  117. </if>
  118. <if test="record.nameDdd != null and !&quot;&quot;.equals(record.nameDdd)">
  119. and name_ddd = #{record.nameDdd}
  120. </if>
  121. <if test="record.searchKey != null and !&quot;&quot;.equals(record.searchKey)">
  122. <trim prefix="and (" suffix=")" prefixOverrides="OR" >
  123. OR name_aaa LIKE concat('%',#{record.searchKey},'%')
  124. OR name_bbb LIKE concat('%',#{record.searchKey},'%')
  125. OR name_ccc LIKE concat('%',#{record.searchKey},'%')
  126. OR name_ddd LIKE concat('%',#{record.searchKey},'%')
  127. </trim>
  128. </if>
  129. <if test="record.advancedQuery != null and !&quot;&quot;.equals(record.advancedQuery)">
  130. <foreach item="item" index="index" collection="record.advancedQuery.split('_;')">
  131. <choose>
  132. <when test="item.indexOf('like') != -1">
  133. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  134. <if test="detailIndex == 3">
  135. concat('%',#{itemDetail},'%')
  136. </if>
  137. <if test="detailIndex &lt; 3">
  138. ${itemDetail}
  139. </if>
  140. </foreach>
  141. </when>
  142. <otherwise>
  143. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  144. <if test="detailIndex == 3">
  145. #{itemDetail}
  146. </if>
  147. <if test="detailIndex &lt; 3">
  148. ${itemDetail}
  149. </if>
  150. </foreach>
  151. </otherwise>
  152. </choose>
  153. </foreach>
  154. </if>
  155. </where>
  156. order by id desc
  157. </select>
  158. <select id="queryAllTestBbb" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestBbb">
  159. select <include refid="Base_Column_List"/> from test_bbb
  160. <where>
  161. and del_flag = 'N'
  162. <if test="id != null and !&quot;&quot;.equals(id)">
  163. and id = #{id}
  164. </if>
  165. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  166. and del_flag = #{delFlag}
  167. </if>
  168. <if test="nameAaa != null and !&quot;&quot;.equals(nameAaa)">
  169. and name_aaa = #{nameAaa}
  170. </if>
  171. <if test="nameBbb != null and !&quot;&quot;.equals(nameBbb)">
  172. and name_bbb = #{nameBbb}
  173. </if>
  174. <if test="nameCcc != null and !&quot;&quot;.equals(nameCcc)">
  175. and name_ccc = #{nameCcc}
  176. </if>
  177. <if test="nameDdd != null and !&quot;&quot;.equals(nameDdd)">
  178. and name_ddd = #{nameDdd}
  179. </if>
  180. <if test="searchKey != null and !&quot;&quot;.equals(searchKey)">
  181. <trim prefix="and (" suffix=")" prefixOverrides="OR" >
  182. OR name_aaa LIKE concat('%',#{searchKey},'%')
  183. OR name_bbb LIKE concat('%',#{searchKey},'%')
  184. OR name_ccc LIKE concat('%',#{searchKey},'%')
  185. OR name_ddd LIKE concat('%',#{searchKey},'%')
  186. </trim>
  187. </if>
  188. <if test="advancedQuery != null and !&quot;&quot;.equals(advancedQuery)">
  189. <foreach item="item" index="index" collection="advancedQuery.split('_;')">
  190. <choose>
  191. <when test="item.indexOf('like') != -1">
  192. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  193. <if test="detailIndex == 3">
  194. concat('%',#{itemDetail},'%')
  195. </if>
  196. <if test="detailIndex &lt; 3">
  197. ${itemDetail}
  198. </if>
  199. </foreach>
  200. </when>
  201. <otherwise>
  202. <foreach item="itemDetail" index="detailIndex" collection="item.split('_,')">
  203. <if test="detailIndex == 3">
  204. #{itemDetail}
  205. </if>
  206. <if test="detailIndex &lt; 3">
  207. ${itemDetail}
  208. </if>
  209. </foreach>
  210. </otherwise>
  211. </choose>
  212. </foreach>
  213. </if>
  214. </where>
  215. order by id desc
  216. </select>
  217. <select id="queryTestBbb" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestBbb">
  218. select <include refid="Base_Column_List"/> from test_bbb
  219. <where>
  220. and del_flag = 'N'
  221. <if test="id != null and !&quot;&quot;.equals(id)">
  222. and id = #{id}
  223. </if>
  224. <if test="delFlag != null and !&quot;&quot;.equals(delFlag)">
  225. and del_flag = #{delFlag}
  226. </if>
  227. <if test="nameAaa != null and !&quot;&quot;.equals(nameAaa)">
  228. and name_aaa = #{nameAaa}
  229. </if>
  230. <if test="nameBbb != null and !&quot;&quot;.equals(nameBbb)">
  231. and name_bbb = #{nameBbb}
  232. </if>
  233. <if test="nameCcc != null and !&quot;&quot;.equals(nameCcc)">
  234. and name_ccc = #{nameCcc}
  235. </if>
  236. <if test="nameDdd != null and !&quot;&quot;.equals(nameDdd)">
  237. and name_ddd = #{nameDdd}
  238. </if>
  239. </where>
  240. LIMIT 1
  241. </select>
  242. <update id="delete">
  243. UPDATE test_bbb SET del_flag = 'Y'
  244. <where>
  245. AND id = #{id}
  246. </where>
  247. </update>
  248. <select id="query" parameterType="java.util.Map" resultType="com.izouma.awesomeadmin.model.TestBbb">
  249. select <include refid="Base_Column_List"/> from test_bbb
  250. <where>
  251. and del_flag = 'N'
  252. </where>
  253. order by id desc
  254. </select>
  255. </mapper>