GiftMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  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.juxiao.xchat.module.xbd.mapper.mall.GiftMapper">
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.mall.Gift">
  5. <id column="gift_id" jdbcType="INTEGER" property="giftId" />
  6. <result column="gift_name" jdbcType="VARCHAR" property="giftName" />
  7. <result column="gold_price" jdbcType="BIGINT" property="goldPrice" />
  8. <result column="seq_no" jdbcType="INTEGER" property="seqNo" />
  9. <result column="noble_id" jdbcType="INTEGER" property="nobleId" />
  10. <result column="noble_name" jdbcType="VARCHAR" property="nobleName" />
  11. <result column="is_noble_gift" jdbcType="BIT" property="isNobleGift" />
  12. <result column="gift_type" jdbcType="TINYINT" property="giftType" />
  13. <result column="gift_status" jdbcType="TINYINT" property="giftStatus" />
  14. <result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
  15. <result column="has_gif_pic" jdbcType="BIT" property="hasGifPic" />
  16. <result column="gif_url" jdbcType="VARCHAR" property="gifUrl" />
  17. <result column="has_vgg_pic" jdbcType="BIT" property="hasVggPic" />
  18. <result column="vgg_url" jdbcType="VARCHAR" property="vggUrl" />
  19. <result column="is_latest" jdbcType="BIT" property="isLatest" />
  20. <result column="is_time_limit" jdbcType="BIT" property="isTimeLimit" />
  21. <result column="has_effect" jdbcType="BIT" property="hasEffect" />
  22. <result column="start_valid_time" jdbcType="TIMESTAMP" property="startValidTime" />
  23. <result column="end_valid_time" jdbcType="TIMESTAMP" property="endValidTime" />
  24. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  25. <result column="is_express_gift" jdbcType="BIT" property="isExpressGift" />
  26. <result column="is_can_give" jdbcType="BIT" property="isCanGive" />
  27. </resultMap>
  28. <resultMap id="BaseGiftVOResultMap" type="com.juxiao.xchat.module.xbd.vo.GiftVO">
  29. <id column="gift_id" jdbcType="INTEGER" property="giftId" />
  30. <result column="gift_name" jdbcType="VARCHAR" property="giftName" />
  31. <result column="gold_price" jdbcType="BIGINT" property="goldPrice" />
  32. <result column="seq_no" jdbcType="INTEGER" property="seqNo" />
  33. <result column="noble_id" jdbcType="INTEGER" property="nobleId" />
  34. <result column="noble_name" jdbcType="VARCHAR" property="nobleName" />
  35. <result column="is_noble_gift" jdbcType="BIT" property="isNobleGift" />
  36. <result column="gift_type" jdbcType="TINYINT" property="giftType" />
  37. <result column="gift_status" jdbcType="TINYINT" property="giftStatus" />
  38. <result column="pic_url" jdbcType="VARCHAR" property="picUrl" />
  39. <result column="has_gif_pic" jdbcType="BIT" property="hasGifPic" />
  40. <result column="gif_url" jdbcType="VARCHAR" property="gifUrl" />
  41. <result column="has_vgg_pic" jdbcType="BIT" property="hasVggPic" />
  42. <result column="vgg_url" jdbcType="VARCHAR" property="vggUrl" />
  43. <result column="is_latest" jdbcType="BIT" property="isLatest" />
  44. <result column="is_time_limit" jdbcType="BIT" property="isTimeLimit" />
  45. <result column="has_effect" jdbcType="BIT" property="hasEffect" />
  46. <result column="start_valid_time" jdbcType="TIMESTAMP" property="startValidTime" />
  47. <result column="end_valid_time" jdbcType="TIMESTAMP" property="endValidTime" />
  48. <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  49. <result column="is_express_gift" jdbcType="BIT" property="isExpressGift" />
  50. <result column="is_can_give" jdbcType="BIT" property="isCanGive" />
  51. </resultMap>
  52. <sql id="Base_Column_List">
  53. gift_id, gift_name, gold_price, seq_no, noble_id, noble_name, is_noble_gift, gift_type,
  54. gift_status, pic_url, has_gif_pic, gif_url, has_vgg_pic, vgg_url, is_latest, is_time_limit,
  55. has_effect, start_valid_time, end_valid_time, create_time, is_express_gift, is_can_give
  56. </sql>
  57. <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  58. select
  59. <include refid="Base_Column_List" />
  60. from gift
  61. where gift_id = #{giftId,jdbcType=INTEGER}
  62. </select>
  63. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.mall.Gift">
  64. insert into gift (gift_id, gift_name, gold_price,
  65. seq_no, noble_id, noble_name,
  66. is_noble_gift, gift_type, gift_status,
  67. pic_url, has_gif_pic, gif_url,
  68. has_vgg_pic, vgg_url, is_latest,
  69. is_time_limit, has_effect, start_valid_time,
  70. end_valid_time, create_time, is_express_gift,
  71. is_can_give)
  72. values (#{giftId,jdbcType=INTEGER}, #{giftName,jdbcType=VARCHAR}, #{goldPrice,jdbcType=BIGINT},
  73. #{seqNo,jdbcType=INTEGER}, #{nobleId,jdbcType=INTEGER}, #{nobleName,jdbcType=VARCHAR},
  74. #{isNobleGift,jdbcType=BIT}, #{giftType,jdbcType=TINYINT}, #{giftStatus,jdbcType=TINYINT},
  75. #{picUrl,jdbcType=VARCHAR}, #{hasGifPic,jdbcType=BIT}, #{gifUrl,jdbcType=VARCHAR},
  76. #{hasVggPic,jdbcType=BIT}, #{vggUrl,jdbcType=VARCHAR}, #{isLatest,jdbcType=BIT},
  77. #{isTimeLimit,jdbcType=BIT}, #{hasEffect,jdbcType=BIT}, #{startValidTime,jdbcType=TIMESTAMP},
  78. #{endValidTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{isExpressGift,jdbcType=BIT},
  79. #{isCanGive,jdbcType=BIT})
  80. </insert>
  81. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.mall.Gift" useGeneratedKeys="true" keyProperty="giftId" keyColumn="gift_id">
  82. insert into gift
  83. <trim prefix="(" suffix=")" suffixOverrides=",">
  84. <if test="giftId != null">
  85. gift_id,
  86. </if>
  87. <if test="giftName != null">
  88. gift_name,
  89. </if>
  90. <if test="goldPrice != null">
  91. gold_price,
  92. </if>
  93. <if test="seqNo != null">
  94. seq_no,
  95. </if>
  96. <if test="nobleId != null">
  97. noble_id,
  98. </if>
  99. <if test="nobleName != null">
  100. noble_name,
  101. </if>
  102. <if test="isNobleGift != null">
  103. is_noble_gift,
  104. </if>
  105. <if test="giftType != null">
  106. gift_type,
  107. </if>
  108. <if test="giftStatus != null">
  109. gift_status,
  110. </if>
  111. <if test="picUrl != null">
  112. pic_url,
  113. </if>
  114. <if test="hasGifPic != null">
  115. has_gif_pic,
  116. </if>
  117. <if test="gifUrl != null">
  118. gif_url,
  119. </if>
  120. <if test="hasVggPic != null">
  121. has_vgg_pic,
  122. </if>
  123. <if test="vggUrl != null">
  124. vgg_url,
  125. </if>
  126. <if test="isLatest != null">
  127. is_latest,
  128. </if>
  129. <if test="isTimeLimit != null">
  130. is_time_limit,
  131. </if>
  132. <if test="hasEffect != null">
  133. has_effect,
  134. </if>
  135. <if test="startValidTime != null">
  136. start_valid_time,
  137. </if>
  138. <if test="endValidTime != null">
  139. end_valid_time,
  140. </if>
  141. <if test="createTime != null">
  142. create_time,
  143. </if>
  144. <if test="isExpressGift != null">
  145. is_express_gift,
  146. </if>
  147. <if test="isCanGive != null">
  148. is_can_give,
  149. </if>
  150. </trim>
  151. <trim prefix="values (" suffix=")" suffixOverrides=",">
  152. <if test="giftId != null">
  153. #{giftId,jdbcType=INTEGER},
  154. </if>
  155. <if test="giftName != null">
  156. #{giftName,jdbcType=VARCHAR},
  157. </if>
  158. <if test="goldPrice != null">
  159. #{goldPrice,jdbcType=BIGINT},
  160. </if>
  161. <if test="seqNo != null">
  162. #{seqNo,jdbcType=INTEGER},
  163. </if>
  164. <if test="nobleId != null">
  165. #{nobleId,jdbcType=INTEGER},
  166. </if>
  167. <if test="nobleName != null">
  168. #{nobleName,jdbcType=VARCHAR},
  169. </if>
  170. <if test="isNobleGift != null">
  171. #{isNobleGift,jdbcType=BIT},
  172. </if>
  173. <if test="giftType != null">
  174. #{giftType,jdbcType=TINYINT},
  175. </if>
  176. <if test="giftStatus != null">
  177. #{giftStatus,jdbcType=TINYINT},
  178. </if>
  179. <if test="picUrl != null">
  180. #{picUrl,jdbcType=VARCHAR},
  181. </if>
  182. <if test="hasGifPic != null">
  183. #{hasGifPic,jdbcType=BIT},
  184. </if>
  185. <if test="gifUrl != null">
  186. #{gifUrl,jdbcType=VARCHAR},
  187. </if>
  188. <if test="hasVggPic != null">
  189. #{hasVggPic,jdbcType=BIT},
  190. </if>
  191. <if test="vggUrl != null">
  192. #{vggUrl,jdbcType=VARCHAR},
  193. </if>
  194. <if test="isLatest != null">
  195. #{isLatest,jdbcType=BIT},
  196. </if>
  197. <if test="isTimeLimit != null">
  198. #{isTimeLimit,jdbcType=BIT},
  199. </if>
  200. <if test="hasEffect != null">
  201. #{hasEffect,jdbcType=BIT},
  202. </if>
  203. <if test="startValidTime != null">
  204. #{startValidTime,jdbcType=TIMESTAMP},
  205. </if>
  206. <if test="endValidTime != null">
  207. #{endValidTime,jdbcType=TIMESTAMP},
  208. </if>
  209. <if test="createTime != null">
  210. #{createTime,jdbcType=TIMESTAMP},
  211. </if>
  212. <if test="isExpressGift != null">
  213. #{isExpressGift,jdbcType=BIT},
  214. </if>
  215. <if test="isCanGive != null">
  216. #{isCanGive,jdbcType=BIT},
  217. </if>
  218. </trim>
  219. </insert>
  220. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.mall.Gift">
  221. update gift
  222. <set>
  223. <if test="giftName != null">
  224. gift_name = #{giftName,jdbcType=VARCHAR},
  225. </if>
  226. <if test="goldPrice != null">
  227. gold_price = #{goldPrice,jdbcType=BIGINT},
  228. </if>
  229. <if test="seqNo != null">
  230. seq_no = #{seqNo,jdbcType=INTEGER},
  231. </if>
  232. <if test="nobleId != null">
  233. noble_id = #{nobleId,jdbcType=INTEGER},
  234. </if>
  235. <if test="nobleName != null">
  236. noble_name = #{nobleName,jdbcType=VARCHAR},
  237. </if>
  238. <if test="isNobleGift != null">
  239. is_noble_gift = #{isNobleGift,jdbcType=BIT},
  240. </if>
  241. <if test="giftType != null">
  242. gift_type = #{giftType,jdbcType=TINYINT},
  243. </if>
  244. <if test="giftStatus != null">
  245. gift_status = #{giftStatus,jdbcType=TINYINT},
  246. </if>
  247. <if test="picUrl != null">
  248. pic_url = #{picUrl,jdbcType=VARCHAR},
  249. </if>
  250. <if test="hasGifPic != null">
  251. has_gif_pic = #{hasGifPic,jdbcType=BIT},
  252. </if>
  253. <if test="gifUrl != null">
  254. gif_url = #{gifUrl,jdbcType=VARCHAR},
  255. </if>
  256. <if test="hasVggPic != null">
  257. has_vgg_pic = #{hasVggPic,jdbcType=BIT},
  258. </if>
  259. <if test="vggUrl != null">
  260. vgg_url = #{vggUrl,jdbcType=VARCHAR},
  261. </if>
  262. <if test="isLatest != null">
  263. is_latest = #{isLatest,jdbcType=BIT},
  264. </if>
  265. <if test="isTimeLimit != null">
  266. is_time_limit = #{isTimeLimit,jdbcType=BIT},
  267. </if>
  268. <if test="hasEffect != null">
  269. has_effect = #{hasEffect,jdbcType=BIT},
  270. </if>
  271. <if test="startValidTime != null">
  272. start_valid_time = #{startValidTime,jdbcType=TIMESTAMP},
  273. </if>
  274. <if test="endValidTime != null">
  275. end_valid_time = #{endValidTime,jdbcType=TIMESTAMP},
  276. </if>
  277. <if test="createTime != null">
  278. create_time = #{createTime,jdbcType=TIMESTAMP},
  279. </if>
  280. <if test="isExpressGift != null">
  281. is_express_gift = #{isExpressGift,jdbcType=BIT},
  282. </if>
  283. <if test="isCanGive != null">
  284. is_can_give = #{isCanGive,jdbcType=BIT},
  285. </if>
  286. </set>
  287. where gift_id = #{giftId,jdbcType=INTEGER}
  288. </update>
  289. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.mall.Gift">
  290. update gift
  291. set gift_name = #{giftName,jdbcType=VARCHAR},
  292. gold_price = #{goldPrice,jdbcType=BIGINT},
  293. seq_no = #{seqNo,jdbcType=INTEGER},
  294. noble_id = #{nobleId,jdbcType=INTEGER},
  295. noble_name = #{nobleName,jdbcType=VARCHAR},
  296. is_noble_gift = #{isNobleGift,jdbcType=BIT},
  297. gift_type = #{giftType,jdbcType=TINYINT},
  298. gift_status = #{giftStatus,jdbcType=TINYINT},
  299. pic_url = #{picUrl,jdbcType=VARCHAR},
  300. has_gif_pic = #{hasGifPic,jdbcType=BIT},
  301. gif_url = #{gifUrl,jdbcType=VARCHAR},
  302. has_vgg_pic = #{hasVggPic,jdbcType=BIT},
  303. vgg_url = #{vggUrl,jdbcType=VARCHAR},
  304. is_latest = #{isLatest,jdbcType=BIT},
  305. is_time_limit = #{isTimeLimit,jdbcType=BIT},
  306. has_effect = #{hasEffect,jdbcType=BIT},
  307. start_valid_time = #{startValidTime,jdbcType=TIMESTAMP},
  308. end_valid_time = #{endValidTime,jdbcType=TIMESTAMP},
  309. create_time = #{createTime,jdbcType=TIMESTAMP},
  310. is_express_gift = #{isExpressGift,jdbcType=BIT},
  311. is_can_give = #{isCanGive,jdbcType=BIT}
  312. where gift_id = #{giftId,jdbcType=INTEGER}
  313. </update>
  314. <select id="selectByGiftType" resultMap="BaseResultMap">
  315. select
  316. <include refid="Base_Column_List" />
  317. from gift
  318. where gift_type = #{type}
  319. </select>
  320. <select id="selectGiftByList" resultMap="BaseGiftVOResultMap">
  321. select
  322. <include refid="Base_Column_List" />
  323. from gift
  324. where del_flag = 1
  325. <if test="name != null and name != ''">
  326. and gift_name LIKE CONCAT('%',#{name},'%')
  327. </if>
  328. <if test="status != null">
  329. and gift_status = #{status}
  330. </if>
  331. <if test="type != null">
  332. and gift_type = #{type}
  333. </if>
  334. order by seq_no asc , create_time desc
  335. </select>
  336. <select id="selectByGiftName" resultMap="BaseResultMap">
  337. select
  338. <include refid="Base_Column_List" />
  339. from gift
  340. where del_flag = 1 and gift_name = #{giftName}
  341. </select>
  342. <delete id="deleteGiftByIds" parameterType="java.lang.Long">
  343. update gift set del_flag = 2 , gift_status = 2 where gift_id in
  344. <foreach collection="array" item="giftId" open="(" separator="," close=")">
  345. #{giftId}
  346. </foreach>
  347. </delete>
  348. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  349. update gift set , gift_status = 2 del_flag = 2
  350. where gift_id = #{giftId,jdbcType=INTEGER}
  351. </delete>
  352. <select id="selectValidGiftById" resultMap="BaseResultMap">
  353. select
  354. <include refid="Base_Column_List" />
  355. from gift
  356. where del_flag = 1 and gift_id = #{giftId} and gift_status = 1
  357. </select>
  358. <select id="selectGiftValidByList" resultMap="BaseResultMap">
  359. select
  360. <include refid="Base_Column_List" />
  361. from gift
  362. where del_flag = 1 and gift_status = 1
  363. </select>
  364. <select id="selectGifts" resultMap="BaseResultMap">
  365. select
  366. <include refid="Base_Column_List" />
  367. from gift
  368. where del_flag = 1
  369. </select>
  370. </mapper>