JtVoucherMapper.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  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.JtVoucherMapper">
  4. <resultMap id="BaseResultMap" type="com.goafanti.common.model.JtVoucher">
  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="name" jdbcType="VARCHAR" property="name" />
  12. <result column="source" jdbcType="INTEGER" property="source" />
  13. <result column="money" jdbcType="DECIMAL" property="money" />
  14. <result column="duration_day" jdbcType="INTEGER" property="durationDay" />
  15. <result column="active_state" jdbcType="INTEGER" property="activeState" />
  16. <result column="granting_uid" jdbcType="VARCHAR" property="grantingUid" />
  17. <result column="limit_use" jdbcType="INTEGER" property="limitUse" />
  18. <result column="limit_project_id" jdbcType="VARCHAR" property="limitProjectId" />
  19. </resultMap>
  20. <sql id="Example_Where_Clause">
  21. <!--
  22. WARNING - @mbg.generated
  23. This element is automatically generated by MyBatis Generator, do not modify.
  24. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  25. -->
  26. <where>
  27. <foreach collection="oredCriteria" item="criteria" separator="or">
  28. <if test="criteria.valid">
  29. <trim prefix="(" prefixOverrides="and" suffix=")">
  30. <foreach collection="criteria.criteria" item="criterion">
  31. <choose>
  32. <when test="criterion.noValue">
  33. and ${criterion.condition}
  34. </when>
  35. <when test="criterion.singleValue">
  36. and ${criterion.condition} #{criterion.value}
  37. </when>
  38. <when test="criterion.betweenValue">
  39. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  40. </when>
  41. <when test="criterion.listValue">
  42. and ${criterion.condition}
  43. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  44. #{listItem}
  45. </foreach>
  46. </when>
  47. </choose>
  48. </foreach>
  49. </trim>
  50. </if>
  51. </foreach>
  52. </where>
  53. </sql>
  54. <sql id="Update_By_Example_Where_Clause">
  55. <!--
  56. WARNING - @mbg.generated
  57. This element is automatically generated by MyBatis Generator, do not modify.
  58. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  59. -->
  60. <where>
  61. <foreach collection="example.oredCriteria" item="criteria" separator="or">
  62. <if test="criteria.valid">
  63. <trim prefix="(" prefixOverrides="and" suffix=")">
  64. <foreach collection="criteria.criteria" item="criterion">
  65. <choose>
  66. <when test="criterion.noValue">
  67. and ${criterion.condition}
  68. </when>
  69. <when test="criterion.singleValue">
  70. and ${criterion.condition} #{criterion.value}
  71. </when>
  72. <when test="criterion.betweenValue">
  73. and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
  74. </when>
  75. <when test="criterion.listValue">
  76. and ${criterion.condition}
  77. <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
  78. #{listItem}
  79. </foreach>
  80. </when>
  81. </choose>
  82. </foreach>
  83. </trim>
  84. </if>
  85. </foreach>
  86. </where>
  87. </sql>
  88. <sql id="Base_Column_List">
  89. <!--
  90. WARNING - @mbg.generated
  91. This element is automatically generated by MyBatis Generator, do not modify.
  92. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  93. -->
  94. id, name, source, money, duration_day, active_state, granting_uid, limit_use, limit_project_id
  95. </sql>
  96. <select id="selectByExample" parameterType="com.goafanti.common.model.JtVoucherExample" resultMap="BaseResultMap">
  97. <!--
  98. WARNING - @mbg.generated
  99. This element is automatically generated by MyBatis Generator, do not modify.
  100. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  101. -->
  102. select
  103. <if test="distinct">
  104. distinct
  105. </if>
  106. <include refid="Base_Column_List" />
  107. from jt_voucher
  108. <if test="_parameter != null">
  109. <include refid="Example_Where_Clause" />
  110. </if>
  111. <if test="orderByClause != null">
  112. order by ${orderByClause}
  113. </if>
  114. </select>
  115. <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  116. <!--
  117. WARNING - @mbg.generated
  118. This element is automatically generated by MyBatis Generator, do not modify.
  119. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  120. -->
  121. select
  122. <include refid="Base_Column_List" />
  123. from jt_voucher
  124. where id = #{id,jdbcType=VARCHAR}
  125. </select>
  126. <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
  127. <!--
  128. WARNING - @mbg.generated
  129. This element is automatically generated by MyBatis Generator, do not modify.
  130. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  131. -->
  132. delete from jt_voucher
  133. where id = #{id,jdbcType=VARCHAR}
  134. </delete>
  135. <delete id="deleteByExample" parameterType="com.goafanti.common.model.JtVoucherExample">
  136. <!--
  137. WARNING - @mbg.generated
  138. This element is automatically generated by MyBatis Generator, do not modify.
  139. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  140. -->
  141. delete from jt_voucher
  142. <if test="_parameter != null">
  143. <include refid="Example_Where_Clause" />
  144. </if>
  145. </delete>
  146. <insert id="insert" parameterType="com.goafanti.common.model.JtVoucher">
  147. <!--
  148. WARNING - @mbg.generated
  149. This element is automatically generated by MyBatis Generator, do not modify.
  150. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  151. -->
  152. insert into jt_voucher (id, name, source,
  153. money, duration_day, active_state,
  154. granting_uid, limit_use, limit_project_id
  155. )
  156. values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{source,jdbcType=INTEGER},
  157. #{money,jdbcType=DECIMAL}, #{durationDay,jdbcType=INTEGER}, #{activeState,jdbcType=INTEGER},
  158. #{grantingUid,jdbcType=VARCHAR}, #{limitUse,jdbcType=INTEGER}, #{limitProjectId,jdbcType=VARCHAR}
  159. )
  160. </insert>
  161. <insert id="insertSelective" parameterType="com.goafanti.common.model.JtVoucher">
  162. <!--
  163. WARNING - @mbg.generated
  164. This element is automatically generated by MyBatis Generator, do not modify.
  165. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  166. -->
  167. insert into jt_voucher
  168. <trim prefix="(" suffix=")" suffixOverrides=",">
  169. <if test="id != null">
  170. id,
  171. </if>
  172. <if test="name != null">
  173. name,
  174. </if>
  175. <if test="source != null">
  176. source,
  177. </if>
  178. <if test="money != null">
  179. money,
  180. </if>
  181. <if test="durationDay != null">
  182. duration_day,
  183. </if>
  184. <if test="activeState != null">
  185. active_state,
  186. </if>
  187. <if test="grantingUid != null">
  188. granting_uid,
  189. </if>
  190. <if test="limitUse != null">
  191. limit_use,
  192. </if>
  193. <if test="limitProjectId != null">
  194. limit_project_id,
  195. </if>
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test="id != null">
  199. #{id,jdbcType=VARCHAR},
  200. </if>
  201. <if test="name != null">
  202. #{name,jdbcType=VARCHAR},
  203. </if>
  204. <if test="source != null">
  205. #{source,jdbcType=INTEGER},
  206. </if>
  207. <if test="money != null">
  208. #{money,jdbcType=DECIMAL},
  209. </if>
  210. <if test="durationDay != null">
  211. #{durationDay,jdbcType=INTEGER},
  212. </if>
  213. <if test="activeState != null">
  214. #{activeState,jdbcType=INTEGER},
  215. </if>
  216. <if test="grantingUid != null">
  217. #{grantingUid,jdbcType=VARCHAR},
  218. </if>
  219. <if test="limitUse != null">
  220. #{limitUse,jdbcType=INTEGER},
  221. </if>
  222. <if test="limitProjectId != null">
  223. #{limitProjectId,jdbcType=VARCHAR},
  224. </if>
  225. </trim>
  226. </insert>
  227. <select id="countByExample" parameterType="com.goafanti.common.model.JtVoucherExample" resultType="java.lang.Long">
  228. <!--
  229. WARNING - @mbg.generated
  230. This element is automatically generated by MyBatis Generator, do not modify.
  231. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  232. -->
  233. select count(*) from jt_voucher
  234. <if test="_parameter != null">
  235. <include refid="Example_Where_Clause" />
  236. </if>
  237. </select>
  238. <update id="updateByExampleSelective" parameterType="map">
  239. <!--
  240. WARNING - @mbg.generated
  241. This element is automatically generated by MyBatis Generator, do not modify.
  242. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  243. -->
  244. update jt_voucher
  245. <set>
  246. <if test="record.id != null">
  247. id = #{record.id,jdbcType=VARCHAR},
  248. </if>
  249. <if test="record.name != null">
  250. name = #{record.name,jdbcType=VARCHAR},
  251. </if>
  252. <if test="record.source != null">
  253. source = #{record.source,jdbcType=INTEGER},
  254. </if>
  255. <if test="record.money != null">
  256. money = #{record.money,jdbcType=DECIMAL},
  257. </if>
  258. <if test="record.durationDay != null">
  259. duration_day = #{record.durationDay,jdbcType=INTEGER},
  260. </if>
  261. <if test="record.activeState != null">
  262. active_state = #{record.activeState,jdbcType=INTEGER},
  263. </if>
  264. <if test="record.grantingUid != null">
  265. granting_uid = #{record.grantingUid,jdbcType=VARCHAR},
  266. </if>
  267. <if test="record.limitUse != null">
  268. limit_use = #{record.limitUse,jdbcType=INTEGER},
  269. </if>
  270. <if test="record.limitProjectId != null">
  271. limit_project_id = #{record.limitProjectId,jdbcType=VARCHAR},
  272. </if>
  273. </set>
  274. <if test="_parameter != null">
  275. <include refid="Update_By_Example_Where_Clause" />
  276. </if>
  277. </update>
  278. <update id="updateByExample" parameterType="map">
  279. <!--
  280. WARNING - @mbg.generated
  281. This element is automatically generated by MyBatis Generator, do not modify.
  282. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  283. -->
  284. update jt_voucher
  285. set id = #{record.id,jdbcType=VARCHAR},
  286. name = #{record.name,jdbcType=VARCHAR},
  287. source = #{record.source,jdbcType=INTEGER},
  288. money = #{record.money,jdbcType=DECIMAL},
  289. duration_day = #{record.durationDay,jdbcType=INTEGER},
  290. active_state = #{record.activeState,jdbcType=INTEGER},
  291. granting_uid = #{record.grantingUid,jdbcType=VARCHAR},
  292. limit_use = #{record.limitUse,jdbcType=INTEGER},
  293. limit_project_id = #{record.limitProjectId,jdbcType=VARCHAR}
  294. <if test="_parameter != null">
  295. <include refid="Update_By_Example_Where_Clause" />
  296. </if>
  297. </update>
  298. <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.JtVoucher">
  299. <!--
  300. WARNING - @mbg.generated
  301. This element is automatically generated by MyBatis Generator, do not modify.
  302. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  303. -->
  304. update jt_voucher
  305. <set>
  306. <if test="name != null">
  307. name = #{name,jdbcType=VARCHAR},
  308. </if>
  309. <if test="source != null">
  310. source = #{source,jdbcType=INTEGER},
  311. </if>
  312. <if test="money != null">
  313. money = #{money,jdbcType=DECIMAL},
  314. </if>
  315. <if test="durationDay != null">
  316. duration_day = #{durationDay,jdbcType=INTEGER},
  317. </if>
  318. <if test="activeState != null">
  319. active_state = #{activeState,jdbcType=INTEGER},
  320. </if>
  321. <if test="grantingUid != null">
  322. granting_uid = #{grantingUid,jdbcType=VARCHAR},
  323. </if>
  324. <if test="limitUse != null">
  325. limit_use = #{limitUse,jdbcType=INTEGER},
  326. </if>
  327. <if test="limitProjectId != null">
  328. limit_project_id = #{limitProjectId,jdbcType=VARCHAR},
  329. </if>
  330. </set>
  331. where id = #{id,jdbcType=VARCHAR}
  332. </update>
  333. <update id="updateByPrimaryKey" parameterType="com.goafanti.common.model.JtVoucher">
  334. <!--
  335. WARNING - @mbg.generated
  336. This element is automatically generated by MyBatis Generator, do not modify.
  337. This element was generated on Tue Oct 16 15:59:34 CST 2018.
  338. -->
  339. update jt_voucher
  340. set name = #{name,jdbcType=VARCHAR},
  341. source = #{source,jdbcType=INTEGER},
  342. money = #{money,jdbcType=DECIMAL},
  343. duration_day = #{durationDay,jdbcType=INTEGER},
  344. active_state = #{activeState,jdbcType=INTEGER},
  345. granting_uid = #{grantingUid,jdbcType=VARCHAR},
  346. limit_use = #{limitUse,jdbcType=INTEGER},
  347. limit_project_id = #{limitProjectId,jdbcType=VARCHAR}
  348. where id = #{id,jdbcType=VARCHAR}
  349. </update>
  350. <select id="selectVoucherList" resultType="com.goafanti.voucher.bo.JtVoucherListBo">
  351. select
  352. id, name, source, money, duration_day as durationDay, active_state as activeState, granting_uid as grantingUid,
  353. limit_use as limitUse, limit_project_id as limitProjectId
  354. from jt_voucher
  355. where 1=1
  356. <if test="uid != null">
  357. and granting_uid = #{uid,jdbcType=VARCHAR}
  358. </if>
  359. <if test="name != null">
  360. and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  361. </if>
  362. <if test="limitUse != null">
  363. and limit_use = #{limitUse,jdbcType=INTEGER}
  364. </if>
  365. <if test="activeState != null">
  366. and active_state = #{activeState,jdbcType=INTEGER}
  367. </if>
  368. <if test="source != null">
  369. and source = #{source,jdbcType=INTEGER}
  370. </if>
  371. order by name
  372. <if test="page_sql!=null">
  373. ${page_sql}
  374. </if>
  375. </select>
  376. <select id="selectVoucherCount" resultType="java.lang.Integer">
  377. select
  378. count(*)
  379. from jt_voucher
  380. where 1=1
  381. <if test="uid != null">
  382. and granting_uid = #{uid,jdbcType=VARCHAR}
  383. </if>
  384. <if test="name != null">
  385. and name like CONCAT('%',#{name,jdbcType=VARCHAR},'%')
  386. </if>
  387. <if test="limitUse != null">
  388. and limit_use = #{limitUse,jdbcType=INTEGER}
  389. </if>
  390. <if test="activeState != null">
  391. and active_state = #{activeState,jdbcType=INTEGER}
  392. </if>
  393. <if test="source != null">
  394. and source = #{source,jdbcType=INTEGER}
  395. </if>
  396. </select>
  397. <select id="getSourceVoucher" resultType="java.lang.String">
  398. select id from jt_voucher where active_state=1 and source= #{source,jdbcType=INTEGER}
  399. </select>
  400. <select id="selectVoucherByClassify" resultType="com.goafanti.voucher.bo.JtVoucherListBo">
  401. select a.id,a.name,a.source,a.active_state as activeState,a.money,a.duration_day as durationDay,
  402. a.granting_uid as grantingUid,a.limit_use as limitUse,a.limit_project_id as limitProjectId
  403. from jt_voucher a
  404. left join jt_business_project b on a.limit_project_id=b.id
  405. left join jt_business_category c on b.category_id=c.id
  406. where a.source=4 and a.active_state=1
  407. <if test="name != null">
  408. and c.name= #{name,jdbcType=VARCHAR}
  409. </if>
  410. <if test="isHot != null">
  411. and b.is_hot= #{isHot,jdbcType=VARCHAR}
  412. </if>
  413. limit #{size,jdbcType=INTEGER}
  414. </select>
  415. <select id="selectByName" resultType="com.goafanti.voucher.bo.JtVoucherListBo">
  416. select a.id,a.name,a.source,a.active_state as activeState,a.money,a.duration_day as durationDay,
  417. a.granting_uid as grantingUid,a.limit_use as limitUse,a.limit_project_id as limitProjectId
  418. from jt_voucher a
  419. where a.source=4 and a.active_state=1
  420. and a.name= #{name,jdbcType=VARCHAR}
  421. limit #{size}
  422. </select>
  423. </mapper>