TestBbbMapper.xml 9.8 KB

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