JtVoucherDetailMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368
  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.goafanti.common.dao.JtVoucherDetailMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtVoucherDetail">
  5. <!--
  6. WARNING - @mbg.generated
  7. This element is automatically generated by MyBatis Generator, do not modify.
  8. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  9. -->
  10. <id column="id" jdbcType="VARCHAR" property="id" />
  11. <result column="voucher_id" jdbcType="VARCHAR" property="voucherId" />
  12. <result column="use_uid" jdbcType="VARCHAR" property="useUid" />
  13. <result column="use_time" jdbcType="TIMESTAMP" property="useTime" />
  14. <result column="receive_time" jdbcType="TIMESTAMP" property="receiveTime" />
  15. <result column="status" jdbcType="INTEGER" property="status" />
  16. </resultMap>
  17. <sql id="Example_Where_Clause">
  18. <!--
  19. WARNING - @mbg.generated
  20. This element is automatically generated by MyBatis Generator, do not modify.
  21. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  22. -->
  23. <where>
  24. <foreach collection="oredCriteria" item="criteria" separator="or">
  25. <if test="criteria.valid">
  26. <trim prefix="(" prefixOverrides="and" suffix=")">
  27. <foreach collection="criteria.criteria" item="criterion">
  28. <choose>
  29. <when test="criterion.noValue">
  30. and ${criterion.condition}
  31. </when>
  32. <when test="criterion.singleValue">
  33. and ${criterion.condition} #{criterion.value}
  34. </when>
  35. <when test="criterion.betweenValue">
  36. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  37. </when>
  38. <when test="criterion.listValue">
  39. and ${criterion.condition}
  40. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  41. #{listItem}
  42. </foreach>
  43. </when>
  44. </choose>
  45. </foreach>
  46. </trim>
  47. </if>
  48. </foreach>
  49. </where>
  50. </sql>
  51. <sql id="Update_By_Example_Where_Clause">
  52. <!--
  53. WARNING - @mbg.generated
  54. This element is automatically generated by MyBatis Generator, do not modify.
  55. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  56. -->
  57. <where>
  58. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  59. <if test="criteria.valid">
  60. <trim prefix="(" prefixOverrides="and" suffix=")">
  61. <foreach collection="criteria.criteria" item="criterion">
  62. <choose>
  63. <when test="criterion.noValue">
  64. and ${criterion.condition}
  65. </when>
  66. <when test="criterion.singleValue">
  67. and ${criterion.condition} #{criterion.value}
  68. </when>
  69. <when test="criterion.betweenValue">
  70. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  71. </when>
  72. <when test="criterion.listValue">
  73. and ${criterion.condition}
  74. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  75. #{listItem}
  76. </foreach>
  77. </when>
  78. </choose>
  79. </foreach>
  80. </trim>
  81. </if>
  82. </foreach>
  83. </where>
  84. </sql>
  85. <sql id="Base_Column_List">
  86. <!--
  87. WARNING - @mbg.generated
  88. This element is automatically generated by MyBatis Generator, do not modify.
  89. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  90. -->
  91. id, voucher_id, use_uid, use_time, receive_time, status
  92. </sql>
  93. <select id="selectByExample" parameterType="com.goafanti.common.model.JtVoucherDetailExample" resultMap="BaseResultMap">
  94. <!--
  95. WARNING - @mbg.generated
  96. This element is automatically generated by MyBatis Generator, do not modify.
  97. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  98. -->
  99. select
  100. <if test="distinct">
  101. distinct
  102. </if>
  103. <include refid="Base_Column_List" />
  104. from jt_voucher_detail
  105. <if test="_parameter != null">
  106. <include refid="Example_Where_Clause" />
  107. </if>
  108. <if test="orderByClause != null">
  109. order by ${orderByClause}
  110. </if>
  111. </select>
  112. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  113. <!--
  114. WARNING - @mbg.generated
  115. This element is automatically generated by MyBatis Generator, do not modify.
  116. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  117. -->
  118. select
  119. <include refid="Base_Column_List" />
  120. from jt_voucher_detail
  121. where id = #{id,jdbcType=VARCHAR}
  122. </select>
  123. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  124. <!--
  125. WARNING - @mbg.generated
  126. This element is automatically generated by MyBatis Generator, do not modify.
  127. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  128. -->
  129. delete from jt_voucher_detail
  130. where id = #{id,jdbcType=VARCHAR}
  131. </delete>
  132. <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtVoucherDetailExample">
  133. <!--
  134. WARNING - @mbg.generated
  135. This element is automatically generated by MyBatis Generator, do not modify.
  136. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  137. -->
  138. delete from jt_voucher_detail
  139. <if test="_parameter != null">
  140. <include refid="Example_Where_Clause" />
  141. </if>
  142. </delete>
  143. <insert id="insert" parameterType="com.goafanti.common.model.JtVoucherDetail">
  144. <!--
  145. WARNING - @mbg.generated
  146. This element is automatically generated by MyBatis Generator, do not modify.
  147. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  148. -->
  149. insert into jt_voucher_detail (id, voucher_id, use_uid,
  150. use_time, receive_time, status
  151. )
  152. values (#{id,jdbcType=VARCHAR}, #{voucherId,jdbcType=VARCHAR}, #{useUid,jdbcType=VARCHAR},
  153. #{useTime,jdbcType=TIMESTAMP}, #{receiveTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}
  154. )
  155. </insert>
  156. <insert id="insertSelective" parameterType="com.goafanti.common.model.JtVoucherDetail">
  157. <!--
  158. WARNING - @mbg.generated
  159. This element is automatically generated by MyBatis Generator, do not modify.
  160. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  161. -->
  162. insert into jt_voucher_detail
  163. <trim prefix="(" suffix=")" suffixOverrides=",">
  164. <if test="id != null">
  165. id,
  166. </if>
  167. <if test="voucherId != null">
  168. voucher_id,
  169. </if>
  170. <if test="useUid != null">
  171. use_uid,
  172. </if>
  173. <if test="useTime != null">
  174. use_time,
  175. </if>
  176. <if test="receiveTime != null">
  177. receive_time,
  178. </if>
  179. <if test="status != null">
  180. status,
  181. </if>
  182. </trim>
  183. <trim prefix="values (" suffix=")" suffixOverrides=",">
  184. <if test="id != null">
  185. #{id,jdbcType=VARCHAR},
  186. </if>
  187. <if test="voucherId != null">
  188. #{voucherId,jdbcType=VARCHAR},
  189. </if>
  190. <if test="useUid != null">
  191. #{useUid,jdbcType=VARCHAR},
  192. </if>
  193. <if test="useTime != null">
  194. #{useTime,jdbcType=TIMESTAMP},
  195. </if>
  196. <if test="receiveTime != null">
  197. #{receiveTime,jdbcType=TIMESTAMP},
  198. </if>
  199. <if test="status != null">
  200. #{status,jdbcType=INTEGER},
  201. </if>
  202. </trim>
  203. </insert>
  204. <select id="countByExample" parameterType="com.goafanti.common.model.JtVoucherDetailExample" resultType="java.lang.Long">
  205. <!--
  206. WARNING - @mbg.generated
  207. This element is automatically generated by MyBatis Generator, do not modify.
  208. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  209. -->
  210. select count(*) from jt_voucher_detail
  211. <if test="_parameter != null">
  212. <include refid="Example_Where_Clause" />
  213. </if>
  214. </select>
  215. <update id="updateByExampleSelective" parameterType="map">
  216. <!--
  217. WARNING - @mbg.generated
  218. This element is automatically generated by MyBatis Generator, do not modify.
  219. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  220. -->
  221. update jt_voucher_detail
  222. <set>
  223. <if test="record.id != null">
  224. id = #{record.id,jdbcType=VARCHAR},
  225. </if>
  226. <if test="record.voucherId != null">
  227. voucher_id = #{record.voucherId,jdbcType=VARCHAR},
  228. </if>
  229. <if test="record.useUid != null">
  230. use_uid = #{record.useUid,jdbcType=VARCHAR},
  231. </if>
  232. <if test="record.useTime != null">
  233. use_time = #{record.useTime,jdbcType=TIMESTAMP},
  234. </if>
  235. <if test="record.receiveTime != null">
  236. receive_time = #{record.receiveTime,jdbcType=TIMESTAMP},
  237. </if>
  238. <if test="record.status != null">
  239. status = #{record.status,jdbcType=INTEGER},
  240. </if>
  241. </set>
  242. <if test="_parameter != null">
  243. <include refid="Update_By_Example_Where_Clause" />
  244. </if>
  245. </update>
  246. <update id="updateByExample" parameterType="map">
  247. <!--
  248. WARNING - @mbg.generated
  249. This element is automatically generated by MyBatis Generator, do not modify.
  250. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  251. -->
  252. update jt_voucher_detail
  253. set id = #{record.id,jdbcType=VARCHAR},
  254. voucher_id = #{record.voucherId,jdbcType=VARCHAR},
  255. use_uid = #{record.useUid,jdbcType=VARCHAR},
  256. use_time = #{record.useTime,jdbcType=TIMESTAMP},
  257. receive_time = #{record.receiveTime,jdbcType=TIMESTAMP},
  258. status = #{record.status,jdbcType=INTEGER}
  259. <if test="_parameter != null">
  260. <include refid="Update_By_Example_Where_Clause" />
  261. </if>
  262. </update>
  263. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtVoucherDetail">
  264. <!--
  265. WARNING - @mbg.generated
  266. This element is automatically generated by MyBatis Generator, do not modify.
  267. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  268. -->
  269. update jt_voucher_detail
  270. <set>
  271. <if test="voucherId != null">
  272. voucher_id = #{voucherId,jdbcType=VARCHAR},
  273. </if>
  274. <if test="useUid != null">
  275. use_uid = #{useUid,jdbcType=VARCHAR},
  276. </if>
  277. <if test="useTime != null">
  278. use_time = #{useTime,jdbcType=TIMESTAMP},
  279. </if>
  280. <if test="receiveTime != null">
  281. receive_time = #{receiveTime,jdbcType=TIMESTAMP},
  282. </if>
  283. <if test="status != null">
  284. status = #{status,jdbcType=INTEGER},
  285. </if>
  286. </set>
  287. where id = #{id,jdbcType=VARCHAR}
  288. </update>
  289. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtVoucherDetail">
  290. <!--
  291. WARNING - @mbg.generated
  292. This element is automatically generated by MyBatis Generator, do not modify.
  293. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  294. -->
  295. update jt_voucher_detail
  296. set voucher_id = #{voucherId,jdbcType=VARCHAR},
  297. use_uid = #{useUid,jdbcType=VARCHAR},
  298. use_time = #{useTime,jdbcType=TIMESTAMP},
  299. receive_time = #{receiveTime,jdbcType=TIMESTAMP},
  300. status = #{status,jdbcType=INTEGER}
  301. where id = #{id,jdbcType=VARCHAR}
  302. </update>
  303. <select id="selectVoucherDetailList" resultType="com.goafanti.voucher.bo.JtVoucherDetailListBo">
  304. select
  305. b.id, a.name, a.money, b.receive_time as receiveTime, a.duration_day as durationDay,
  306. IF(date_add(b.receive_time, interval a.duration_day day) &lt; now(),2,b.status) as status,
  307. a.source, b.use_time as useTime, c.mobile as userMobile,
  308. date_format(b.receive_time,'%Y-%m-%d %H:%I:%S')as starTime,
  309. date_format(date_add(b.receive_time, interval a.duration_day day),'%Y-%m-%d %H:%I:%S')as endTime
  310. from jt_voucher_detail b
  311. left join jt_voucher a on a.id=b.voucher_id
  312. left join user c on b.use_uid=c.id
  313. where 1=1
  314. <if test="uid != null">
  315. and b.use_uid = #{uid,jdbcType=VARCHAR}
  316. </if>
  317. <if test="name != null">
  318. and a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  319. </if>
  320. <if test="status != null">
  321. and IF(date_add(b.receive_time, interval a.duration_day day) &lt; now(),2,b.status) = #{status,jdbcType=INTEGER}
  322. </if>
  323. <if test="userMobile != null">
  324. and c.mobile = #{userMobile,jdbcType=VARCHAR}
  325. </if>
  326. <if test="source != null">
  327. and a.source = #{source,jdbcType=INTEGER}
  328. </if>
  329. <if test="sort == 0">
  330. order by a.money
  331. </if>
  332. <if test="sort == 1">
  333. order by b.receive_time
  334. </if>
  335. <if test="sort == 2">
  336. order by endTime
  337. </if>
  338. <if test="sortType != null">
  339. desc
  340. </if>
  341. <if test="page_sql!=null">
  342. ${page_sql}
  343. </if>
  344. </select>
  345. <select id="selectVoucherDetailCount" resultType="java.lang.Integer">
  346. select count(*) from jt_voucher_detail b
  347. left join jt_voucher a on a.id=b.voucher_id
  348. left join user c on b.use_uid=c.id
  349. where 1=1
  350. <if test="uid != null">
  351. and b.use_uid = #{uid,jdbcType=VARCHAR}
  352. </if>
  353. <if test="name != null">
  354. and a.name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  355. </if>
  356. <if test="status != null">
  357. and IF(date_add(b.receive_time, interval a.duration_day day) &lt; now(),2,b.status) = #{status,jdbcType=INTEGER}
  358. </if>
  359. <if test="userMobile != null">
  360. and c.mobile = #{userMobile,jdbcType=VARCHAR}
  361. </if>
  362. <if test="source != null">
  363. and a.source = #{source,jdbcType=INTEGER}
  364. </if>
  365. </select>
  366. </mapper>