GiftCarMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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.GiftCarMapper" >
  4. <resultMap id="BaseResultMap" type="com.juxiao.xchat.module.xbd.domain.mall.GiftCar" >
  5. <id column="car_id" property="carId" jdbcType="INTEGER" />
  6. <result column="car_name" property="carName" jdbcType="VARCHAR" />
  7. <result column="gold_price" property="goldPrice" jdbcType="BIGINT" />
  8. <result column="seq_no" property="seqNo" jdbcType="INTEGER" />
  9. <result column="car_status" property="carStatus" jdbcType="TINYINT" />
  10. <result column="pic_url" property="picUrl" jdbcType="VARCHAR" />
  11. <result column="has_gif_pic" property="hasGifPic" jdbcType="BIT" />
  12. <result column="gif_url" property="gifUrl" jdbcType="VARCHAR" />
  13. <result column="has_vgg_pic" property="hasVggPic" jdbcType="BIT" />
  14. <result column="vgg_url" property="vggUrl" jdbcType="VARCHAR" />
  15. <result column="is_time_limit" property="isTimeLimit" jdbcType="BIT" />
  16. <result column="effective_time" property="effectiveTime" jdbcType="BIGINT" />
  17. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  18. <result column="allow_purse" property="allowPurse" jdbcType="TINYINT" />
  19. <result column="left_level" property="leftLevel" jdbcType="INTEGER" />
  20. <result column="mark_pic" property="markPic" jdbcType="VARCHAR" />
  21. <result column="buy_type" property="buyType" jdbcType="INTEGER" />
  22. </resultMap>
  23. <resultMap id="BaseCarVOResultMap" type="com.juxiao.xchat.module.xbd.vo.GiftCarVO" >
  24. <id column="car_id" property="carId" jdbcType="INTEGER" />
  25. <result column="car_name" property="carName" jdbcType="VARCHAR" />
  26. <result column="gold_price" property="goldPrice" jdbcType="BIGINT" />
  27. <result column="seq_no" property="seqNo" jdbcType="INTEGER" />
  28. <result column="car_status" property="carStatus" jdbcType="TINYINT" />
  29. <result column="pic_url" property="picUrl" jdbcType="VARCHAR" />
  30. <result column="has_gif_pic" property="hasGifPic" jdbcType="BIT" />
  31. <result column="gif_url" property="gifUrl" jdbcType="VARCHAR" />
  32. <result column="has_vgg_pic" property="hasVggPic" jdbcType="BIT" />
  33. <result column="vgg_url" property="vggUrl" jdbcType="VARCHAR" />
  34. <result column="is_time_limit" property="isTimeLimit" jdbcType="BIT" />
  35. <result column="effective_time" property="effectiveTime" jdbcType="BIGINT" />
  36. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  37. <result column="allow_purse" property="allowPurse" jdbcType="TINYINT" />
  38. <result column="left_level" property="leftLevel" jdbcType="INTEGER" />
  39. <result column="mark_pic" property="markPic" jdbcType="VARCHAR" />
  40. <result column="buy_type" property="buyType" jdbcType="INTEGER" />
  41. </resultMap>
  42. <sql id="Base_Column_List" >
  43. car_id, car_name, gold_price, seq_no, car_status, pic_url, has_gif_pic, gif_url,
  44. has_vgg_pic, vgg_url, is_time_limit, effective_time, create_time, allow_purse, left_level,
  45. mark_pic,buy_type
  46. </sql>
  47. <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  48. select
  49. <include refid="Base_Column_List" />
  50. from gift_car
  51. where car_id = #{carId,jdbcType=INTEGER}
  52. </select>
  53. <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  54. update gift_car set del_flag = 2
  55. where car_id = #{carId,jdbcType=INTEGER}
  56. </delete>
  57. <insert id="insert" parameterType="com.juxiao.xchat.module.xbd.domain.mall.GiftCar" >
  58. insert into gift_car (car_id, car_name, gold_price,
  59. seq_no, car_status, pic_url,
  60. has_gif_pic, gif_url, has_vgg_pic,
  61. vgg_url, is_time_limit, effective_time,
  62. create_time, allow_purse, left_level,
  63. mark_pic)
  64. values (#{carId,jdbcType=INTEGER}, #{carName,jdbcType=VARCHAR}, #{goldPrice,jdbcType=BIGINT},
  65. #{seqNo,jdbcType=INTEGER}, #{carStatus,jdbcType=TINYINT}, #{picUrl,jdbcType=VARCHAR},
  66. #{hasGifPic,jdbcType=BIT}, #{gifUrl,jdbcType=VARCHAR}, #{hasVggPic,jdbcType=BIT},
  67. #{vggUrl,jdbcType=VARCHAR}, #{isTimeLimit,jdbcType=BIT}, #{effectiveTime,jdbcType=BIGINT},
  68. #{createTime,jdbcType=TIMESTAMP}, #{allowPurse,jdbcType=TINYINT}, #{leftLevel,jdbcType=INTEGER},
  69. #{markPic,jdbcType=VARCHAR})
  70. </insert>
  71. <insert id="insertSelective" parameterType="com.juxiao.xchat.module.xbd.domain.mall.GiftCar" useGeneratedKeys="true" keyColumn="car_id" keyProperty="carId">
  72. insert into gift_car
  73. <trim prefix="(" suffix=")" suffixOverrides="," >
  74. <if test="carId != null" >
  75. car_id,
  76. </if>
  77. <if test="carName != null" >
  78. car_name,
  79. </if>
  80. <if test="goldPrice != null" >
  81. gold_price,
  82. </if>
  83. <if test="seqNo != null" >
  84. seq_no,
  85. </if>
  86. <if test="carStatus != null" >
  87. car_status,
  88. </if>
  89. <if test="picUrl != null" >
  90. pic_url,
  91. </if>
  92. <if test="hasGifPic != null" >
  93. has_gif_pic,
  94. </if>
  95. <if test="gifUrl != null" >
  96. gif_url,
  97. </if>
  98. <if test="hasVggPic != null" >
  99. has_vgg_pic,
  100. </if>
  101. <if test="vggUrl != null" >
  102. vgg_url,
  103. </if>
  104. <if test="isTimeLimit != null" >
  105. is_time_limit,
  106. </if>
  107. <if test="effectiveTime != null" >
  108. effective_time,
  109. </if>
  110. <if test="createTime != null" >
  111. create_time,
  112. </if>
  113. <if test="allowPurse != null" >
  114. allow_purse,
  115. </if>
  116. <if test="leftLevel != null" >
  117. left_level,
  118. </if>
  119. <if test="markPic != null" >
  120. mark_pic,
  121. </if>
  122. <if test="buyType != null" >
  123. buy_type,
  124. </if>
  125. </trim>
  126. <trim prefix="values (" suffix=")" suffixOverrides="," >
  127. <if test="carId != null" >
  128. #{carId,jdbcType=INTEGER},
  129. </if>
  130. <if test="carName != null" >
  131. #{carName,jdbcType=VARCHAR},
  132. </if>
  133. <if test="goldPrice != null" >
  134. #{goldPrice,jdbcType=BIGINT},
  135. </if>
  136. <if test="seqNo != null" >
  137. #{seqNo,jdbcType=INTEGER},
  138. </if>
  139. <if test="carStatus != null" >
  140. #{carStatus,jdbcType=TINYINT},
  141. </if>
  142. <if test="picUrl != null" >
  143. #{picUrl,jdbcType=VARCHAR},
  144. </if>
  145. <if test="hasGifPic != null" >
  146. #{hasGifPic,jdbcType=BIT},
  147. </if>
  148. <if test="gifUrl != null" >
  149. #{gifUrl,jdbcType=VARCHAR},
  150. </if>
  151. <if test="hasVggPic != null" >
  152. #{hasVggPic,jdbcType=BIT},
  153. </if>
  154. <if test="vggUrl != null" >
  155. #{vggUrl,jdbcType=VARCHAR},
  156. </if>
  157. <if test="isTimeLimit != null" >
  158. #{isTimeLimit,jdbcType=BIT},
  159. </if>
  160. <if test="effectiveTime != null" >
  161. #{effectiveTime,jdbcType=BIGINT},
  162. </if>
  163. <if test="createTime != null" >
  164. #{createTime,jdbcType=TIMESTAMP},
  165. </if>
  166. <if test="allowPurse != null" >
  167. #{allowPurse,jdbcType=TINYINT},
  168. </if>
  169. <if test="leftLevel != null" >
  170. #{leftLevel,jdbcType=INTEGER},
  171. </if>
  172. <if test="markPic != null" >
  173. #{markPic,jdbcType=VARCHAR},
  174. </if>
  175. <if test="buyType != null" >
  176. #{buyType,jdbcType=INTEGER},
  177. </if>
  178. </trim>
  179. </insert>
  180. <update id="updateByPrimaryKeySelective" parameterType="com.juxiao.xchat.module.xbd.domain.mall.GiftCar" >
  181. update gift_car
  182. <set >
  183. <if test="carName != null" >
  184. car_name = #{carName,jdbcType=VARCHAR},
  185. </if>
  186. <if test="goldPrice != null" >
  187. gold_price = #{goldPrice,jdbcType=BIGINT},
  188. </if>
  189. <if test="seqNo != null" >
  190. seq_no = #{seqNo,jdbcType=INTEGER},
  191. </if>
  192. <if test="carStatus != null" >
  193. car_status = #{carStatus,jdbcType=TINYINT},
  194. </if>
  195. <if test="picUrl != null" >
  196. pic_url = #{picUrl,jdbcType=VARCHAR},
  197. </if>
  198. <if test="hasGifPic != null" >
  199. has_gif_pic = #{hasGifPic,jdbcType=BIT},
  200. </if>
  201. <if test="gifUrl != null" >
  202. gif_url = #{gifUrl,jdbcType=VARCHAR},
  203. </if>
  204. <if test="hasVggPic != null" >
  205. has_vgg_pic = #{hasVggPic,jdbcType=BIT},
  206. </if>
  207. <if test="vggUrl != null" >
  208. vgg_url = #{vggUrl,jdbcType=VARCHAR},
  209. </if>
  210. <if test="isTimeLimit != null" >
  211. is_time_limit = #{isTimeLimit,jdbcType=BIT},
  212. </if>
  213. <if test="effectiveTime != null" >
  214. effective_time = #{effectiveTime,jdbcType=BIGINT},
  215. </if>
  216. <if test="createTime != null" >
  217. create_time = #{createTime,jdbcType=TIMESTAMP},
  218. </if>
  219. <if test="allowPurse != null" >
  220. allow_purse = #{allowPurse,jdbcType=TINYINT},
  221. </if>
  222. <if test="leftLevel != null" >
  223. left_level = #{leftLevel,jdbcType=INTEGER},
  224. </if>
  225. <if test="markPic != null" >
  226. mark_pic = #{markPic,jdbcType=VARCHAR},
  227. </if>
  228. <if test="buyType != null" >
  229. buy_type = #{buyType,jdbcType=INTEGER},
  230. </if>
  231. </set>
  232. where car_id = #{carId,jdbcType=INTEGER}
  233. </update>
  234. <update id="updateByPrimaryKey" parameterType="com.juxiao.xchat.module.xbd.domain.mall.GiftCar" >
  235. update gift_car
  236. set car_name = #{carName,jdbcType=VARCHAR},
  237. gold_price = #{goldPrice,jdbcType=BIGINT},
  238. seq_no = #{seqNo,jdbcType=INTEGER},
  239. car_status = #{carStatus,jdbcType=TINYINT},
  240. pic_url = #{picUrl,jdbcType=VARCHAR},
  241. has_gif_pic = #{hasGifPic,jdbcType=BIT},
  242. gif_url = #{gifUrl,jdbcType=VARCHAR},
  243. has_vgg_pic = #{hasVggPic,jdbcType=BIT},
  244. vgg_url = #{vggUrl,jdbcType=VARCHAR},
  245. is_time_limit = #{isTimeLimit,jdbcType=BIT},
  246. effective_time = #{effectiveTime,jdbcType=BIGINT},
  247. create_time = #{createTime,jdbcType=TIMESTAMP},
  248. allow_purse = #{allowPurse,jdbcType=TINYINT},
  249. left_level = #{leftLevel,jdbcType=INTEGER},
  250. mark_pic = #{markPic,jdbcType=VARCHAR}
  251. where car_id = #{carId,jdbcType=INTEGER}
  252. </update>
  253. <select id="selectGiftCarByList" resultMap="BaseCarVOResultMap">
  254. select
  255. <include refid="Base_Column_List" />
  256. from gift_car
  257. where del_flag = 1
  258. <if test="name != null and name != ''">
  259. and car_name LIKE CONCAT('%',#{name},'%')
  260. </if>
  261. <if test="status != null">
  262. and car_status = #{status}
  263. </if>
  264. <if test="type != null">
  265. and allow_purse = #{type}
  266. </if>
  267. <if test="buyType != null">
  268. and buy_type = #{buyType}
  269. </if>
  270. order by seq_no asc , create_time desc
  271. </select>
  272. <delete id="deleteGiftCarByIds" parameterType="java.lang.Long">
  273. update gift_car set del_flag = 2 where car_id in
  274. <foreach collection="array" item="carId" open="(" separator="," close=")">
  275. #{carId}
  276. </foreach>
  277. </delete>
  278. <select id="selectByGiftCarName" resultMap="BaseResultMap">
  279. select
  280. <include refid="Base_Column_List" />
  281. from gift_car
  282. where del_flag = 1 and car_name = #{carName}
  283. </select>
  284. <select id="selectCarIdByValid" resultType="java.lang.String">
  285. SELECT car_id FROM gift_car WHERE car_status = 1 and del_flag = 1 ORDER BY seq_no ASC
  286. </select>
  287. <select id="selectCarIdByValidMall" resultType="java.lang.String">
  288. SELECT car_id FROM gift_car WHERE car_status = 1 and del_flag = 1 AND allow_purse = 1 and buy_type = 1 ORDER BY seq_no ASC
  289. </select>
  290. <select id="selectGiftCarByValid" resultMap="BaseResultMap">
  291. select
  292. <include refid="Base_Column_List" />
  293. from gift_car
  294. where del_flag = 1 and car_status = 1 and buy_type = 1
  295. </select>
  296. <select id="selectCarIdByValidPoint" resultType="java.lang.String">
  297. SELECT car_id FROM gift_car WHERE car_status = 1 and del_flag = 1 AND allow_purse = 1 and buy_type = 2 ORDER BY seq_no ASC
  298. </select>
  299. </mapper>