CouponDOMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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.cdu.lys.graduation.repository.dao.CouponDOMapper" >
  4. <resultMap id="BaseResultMap" type="com.cdu.lys.graduation.repository.entity.CouponDO" >
  5. <constructor >
  6. <idArg column="id" jdbcType="INTEGER" javaType="java.lang.Integer" />
  7. <arg column="coupon_name" jdbcType="VARCHAR" javaType="java.lang.String" />
  8. <arg column="reach" jdbcType="DOUBLE" javaType="java.lang.Double" />
  9. <arg column="reduce" jdbcType="DOUBLE" javaType="java.lang.Double" />
  10. <arg column="user_type" jdbcType="INTEGER" javaType="java.lang.Integer" />
  11. <arg column="effective_time" jdbcType="INTEGER" javaType="java.lang.Integer" />
  12. <arg column="deadline" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  13. <arg column="number" jdbcType="INTEGER" javaType="java.lang.Integer" />
  14. <arg column="create_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  15. <arg column="update_time" jdbcType="TIMESTAMP" javaType="java.util.Date" />
  16. <arg column="is_delete" jdbcType="CHAR" javaType="java.lang.String" />
  17. </constructor>
  18. </resultMap>
  19. <sql id="Example_Where_Clause" >
  20. <where >
  21. <foreach collection="oredCriteria" item="criteria" separator="or" >
  22. <if test="criteria.valid" >
  23. <trim prefix="(" suffix=")" prefixOverrides="and" >
  24. <foreach collection="criteria.criteria" item="criterion" >
  25. <choose >
  26. <when test="criterion.noValue" >
  27. and ${criterion.condition}
  28. </when>
  29. <when test="criterion.singleValue" >
  30. and ${criterion.condition} #{criterion.value}
  31. </when>
  32. <when test="criterion.betweenValue" >
  33. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  34. </when>
  35. <when test="criterion.listValue" >
  36. and ${criterion.condition}
  37. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  38. #{listItem}
  39. </foreach>
  40. </when>
  41. </choose>
  42. </foreach>
  43. </trim>
  44. </if>
  45. </foreach>
  46. </where>
  47. </sql>
  48. <sql id="Update_By_Example_Where_Clause" >
  49. <where >
  50. <foreach collection="example.oredCriteria" item="criteria" separator="or" >
  51. <if test="criteria.valid" >
  52. <trim prefix="(" suffix=")" prefixOverrides="and" >
  53. <foreach collection="criteria.criteria" item="criterion" >
  54. <choose >
  55. <when test="criterion.noValue" >
  56. and ${criterion.condition}
  57. </when>
  58. <when test="criterion.singleValue" >
  59. and ${criterion.condition} #{criterion.value}
  60. </when>
  61. <when test="criterion.betweenValue" >
  62. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  63. </when>
  64. <when test="criterion.listValue" >
  65. and ${criterion.condition}
  66. <foreach collection="criterion.value" item="listItem" open="(" close=")" separator="," >
  67. #{listItem}
  68. </foreach>
  69. </when>
  70. </choose>
  71. </foreach>
  72. </trim>
  73. </if>
  74. </foreach>
  75. </where>
  76. </sql>
  77. <sql id="Base_Column_List" >
  78. id, coupon_name, reach, reduce, user_type, effective_time, deadline, number, create_time,
  79. update_time, is_delete
  80. </sql>
  81. <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.cdu.lys.graduation.repository.entity.CouponDOExample" >
  82. select
  83. <if test="distinct" >
  84. distinct
  85. </if>
  86. 'true' as QUERYID,
  87. <include refid="Base_Column_List" />
  88. from tb_coupon
  89. <if test="_parameter != null" >
  90. <include refid="Example_Where_Clause" />
  91. </if>
  92. <if test="orderByClause != null" >
  93. order by ${orderByClause}
  94. </if>
  95. </select>
  96. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  97. select
  98. <include refid="Base_Column_List" />
  99. from tb_coupon
  100. where id = #{id,jdbcType=INTEGER}
  101. </select>
  102. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  103. delete from tb_coupon
  104. where id = #{id,jdbcType=INTEGER}
  105. </delete>
  106. <delete id="deleteByExample" parameterType="com.cdu.lys.graduation.repository.entity.CouponDOExample" >
  107. delete from tb_coupon
  108. <if test="_parameter != null" >
  109. <include refid="Example_Where_Clause" />
  110. </if>
  111. </delete>
  112. <insert id="insert" parameterType="com.cdu.lys.graduation.repository.entity.CouponDO" >
  113. insert into tb_coupon (id, coupon_name, reach,
  114. reduce, user_type, effective_time,
  115. deadline, number, create_time,
  116. update_time, is_delete)
  117. values (#{id,jdbcType=INTEGER}, #{couponName,jdbcType=VARCHAR}, #{reach,jdbcType=DOUBLE},
  118. #{reduce,jdbcType=DOUBLE}, #{userType,jdbcType=INTEGER}, #{effectiveTime,jdbcType=INTEGER},
  119. #{deadline,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
  120. #{updateTime,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=CHAR})
  121. </insert>
  122. <insert id="insertSelective" parameterType="com.cdu.lys.graduation.repository.entity.CouponDO" >
  123. insert into tb_coupon
  124. <trim prefix="(" suffix=")" suffixOverrides="," >
  125. <if test="id != null" >
  126. id,
  127. </if>
  128. <if test="couponName != null" >
  129. coupon_name,
  130. </if>
  131. <if test="reach != null" >
  132. reach,
  133. </if>
  134. <if test="reduce != null" >
  135. reduce,
  136. </if>
  137. <if test="userType != null" >
  138. user_type,
  139. </if>
  140. <if test="effectiveTime != null" >
  141. effective_time,
  142. </if>
  143. <if test="deadline != null" >
  144. deadline,
  145. </if>
  146. <if test="number != null" >
  147. number,
  148. </if>
  149. <if test="createTime != null" >
  150. create_time,
  151. </if>
  152. <if test="updateTime != null" >
  153. update_time,
  154. </if>
  155. <if test="isDelete != null" >
  156. is_delete,
  157. </if>
  158. </trim>
  159. <trim prefix="values (" suffix=")" suffixOverrides="," >
  160. <if test="id != null" >
  161. #{id,jdbcType=INTEGER},
  162. </if>
  163. <if test="couponName != null" >
  164. #{couponName,jdbcType=VARCHAR},
  165. </if>
  166. <if test="reach != null" >
  167. #{reach,jdbcType=DOUBLE},
  168. </if>
  169. <if test="reduce != null" >
  170. #{reduce,jdbcType=DOUBLE},
  171. </if>
  172. <if test="userType != null" >
  173. #{userType,jdbcType=INTEGER},
  174. </if>
  175. <if test="effectiveTime != null" >
  176. #{effectiveTime,jdbcType=INTEGER},
  177. </if>
  178. <if test="deadline != null" >
  179. #{deadline,jdbcType=TIMESTAMP},
  180. </if>
  181. <if test="number != null" >
  182. #{number,jdbcType=INTEGER},
  183. </if>
  184. <if test="createTime != null" >
  185. #{createTime,jdbcType=TIMESTAMP},
  186. </if>
  187. <if test="updateTime != null" >
  188. #{updateTime,jdbcType=TIMESTAMP},
  189. </if>
  190. <if test="isDelete != null" >
  191. #{isDelete,jdbcType=CHAR},
  192. </if>
  193. </trim>
  194. </insert>
  195. <select id="countByExample" parameterType="com.cdu.lys.graduation.repository.entity.CouponDOExample" resultType="java.lang.Integer" >
  196. select count(*) from tb_coupon
  197. <if test="_parameter != null" >
  198. <include refid="Example_Where_Clause" />
  199. </if>
  200. </select>
  201. <update id="updateByExampleSelective" parameterType="map" >
  202. update tb_coupon
  203. <set >
  204. <if test="record.id != null" >
  205. id = #{record.id,jdbcType=INTEGER},
  206. </if>
  207. <if test="record.couponName != null" >
  208. coupon_name = #{record.couponName,jdbcType=VARCHAR},
  209. </if>
  210. <if test="record.reach != null" >
  211. reach = #{record.reach,jdbcType=DOUBLE},
  212. </if>
  213. <if test="record.reduce != null" >
  214. reduce = #{record.reduce,jdbcType=DOUBLE},
  215. </if>
  216. <if test="record.userType != null" >
  217. user_type = #{record.userType,jdbcType=INTEGER},
  218. </if>
  219. <if test="record.effectiveTime != null" >
  220. effective_time = #{record.effectiveTime,jdbcType=INTEGER},
  221. </if>
  222. <if test="record.deadline != null" >
  223. deadline = #{record.deadline,jdbcType=TIMESTAMP},
  224. </if>
  225. <if test="record.number != null" >
  226. number = #{record.number,jdbcType=INTEGER},
  227. </if>
  228. <if test="record.createTime != null" >
  229. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  230. </if>
  231. <if test="record.updateTime != null" >
  232. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  233. </if>
  234. <if test="record.isDelete != null" >
  235. is_delete = #{record.isDelete,jdbcType=CHAR},
  236. </if>
  237. </set>
  238. <if test="_parameter != null" >
  239. <include refid="Update_By_Example_Where_Clause" />
  240. </if>
  241. </update>
  242. <update id="updateByExample" parameterType="map" >
  243. update tb_coupon
  244. set id = #{record.id,jdbcType=INTEGER},
  245. coupon_name = #{record.couponName,jdbcType=VARCHAR},
  246. reach = #{record.reach,jdbcType=DOUBLE},
  247. reduce = #{record.reduce,jdbcType=DOUBLE},
  248. user_type = #{record.userType,jdbcType=INTEGER},
  249. effective_time = #{record.effectiveTime,jdbcType=INTEGER},
  250. deadline = #{record.deadline,jdbcType=TIMESTAMP},
  251. number = #{record.number,jdbcType=INTEGER},
  252. create_time = #{record.createTime,jdbcType=TIMESTAMP},
  253. update_time = #{record.updateTime,jdbcType=TIMESTAMP},
  254. is_delete = #{record.isDelete,jdbcType=CHAR}
  255. <if test="_parameter != null" >
  256. <include refid="Update_By_Example_Where_Clause" />
  257. </if>
  258. </update>
  259. <update id="updateByPrimaryKeySelective" parameterType="com.cdu.lys.graduation.repository.entity.CouponDO" >
  260. update tb_coupon
  261. <set >
  262. <if test="couponName != null" >
  263. coupon_name = #{couponName,jdbcType=VARCHAR},
  264. </if>
  265. <if test="reach != null" >
  266. reach = #{reach,jdbcType=DOUBLE},
  267. </if>
  268. <if test="reduce != null" >
  269. reduce = #{reduce,jdbcType=DOUBLE},
  270. </if>
  271. <if test="userType != null" >
  272. user_type = #{userType,jdbcType=INTEGER},
  273. </if>
  274. <if test="effectiveTime != null" >
  275. effective_time = #{effectiveTime,jdbcType=INTEGER},
  276. </if>
  277. <if test="deadline != null" >
  278. deadline = #{deadline,jdbcType=TIMESTAMP},
  279. </if>
  280. <if test="number != null" >
  281. number = #{number,jdbcType=INTEGER},
  282. </if>
  283. <if test="createTime != null" >
  284. create_time = #{createTime,jdbcType=TIMESTAMP},
  285. </if>
  286. <if test="updateTime != null" >
  287. update_time = #{updateTime,jdbcType=TIMESTAMP},
  288. </if>
  289. <if test="isDelete != null" >
  290. is_delete = #{isDelete,jdbcType=CHAR},
  291. </if>
  292. </set>
  293. where id = #{id,jdbcType=INTEGER}
  294. </update>
  295. <update id="updateByPrimaryKey" parameterType="com.cdu.lys.graduation.repository.entity.CouponDO" >
  296. update tb_coupon
  297. set coupon_name = #{couponName,jdbcType=VARCHAR},
  298. reach = #{reach,jdbcType=DOUBLE},
  299. reduce = #{reduce,jdbcType=DOUBLE},
  300. user_type = #{userType,jdbcType=INTEGER},
  301. effective_time = #{effectiveTime,jdbcType=INTEGER},
  302. deadline = #{deadline,jdbcType=TIMESTAMP},
  303. number = #{number,jdbcType=INTEGER},
  304. create_time = #{createTime,jdbcType=TIMESTAMP},
  305. update_time = #{updateTime,jdbcType=TIMESTAMP},
  306. is_delete = #{isDelete,jdbcType=CHAR}
  307. where id = #{id,jdbcType=INTEGER}
  308. </update>
  309. </mapper>