UserCampMinusDao.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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.kmall.admin.dao.UserCampMinusDao">
  4. <resultMap type="com.kmall.admin.entity.UserCampMinusEntity" id="userCampMinusMap">
  5. <result property="userCampId" column="user_camp_id"/>
  6. <result property="storeTopicId" column="store_topic_id"/>
  7. <result property="campName" column="camp_name"/>
  8. <result property="userId" column="user_id"/>
  9. <result property="usedTime" column="used_time"/>
  10. <result property="orderId" column="order_id"/>
  11. <result property="endTime" column="end_time"/>
  12. <result property="money" column="money"/>
  13. <result property="isUsed" column="is_used"/>
  14. <result property="createrSn" column="creater_sn"/>
  15. <result property="createTime" column="create_time"/>
  16. <result property="moderSn" column="moder_sn"/>
  17. <result property="modTime" column="mod_time"/>
  18. <result property="tstm" column="tstm"/>
  19. </resultMap>
  20. <select id="queryObject" resultType="com.kmall.admin.entity.UserCampMinusEntity">
  21. select
  22. `user_camp_id`,
  23. `store_topic_id`,
  24. `camp_name`,
  25. `user_id`,
  26. `used_time`,
  27. `order_id`,
  28. `end_time`,
  29. `money`,
  30. `is_used`,
  31. `creater_sn`,
  32. `create_time`,
  33. `moder_sn`,
  34. `mod_time`,
  35. `tstm`
  36. from mall_user_camp_minus
  37. where user_camp_id = #{id}
  38. </select>
  39. <select id="queryUserCampByOrderId" resultType="com.kmall.admin.entity.UserCampMinusEntity">
  40. select user_camp_id from mall_user_camp_minus where order_id = #{orderId}
  41. </select>
  42. <select id="queryCampByStoreTopicId" resultType="com.kmall.admin.entity.UserCampMinusEntity">
  43. select * from mall_user_camp_minus where store_topic_id = #{storeTopicId}
  44. </select>
  45. <update id="cancelUserCampOrder" parameterType="com.kmall.admin.entity.UserCampMinusEntity">
  46. update mall_user_camp_minus
  47. <set>
  48. `used_time` = null,
  49. `order_id` = 0,
  50. is_used = 0
  51. </set>
  52. where user_camp_id = #{userCampId}
  53. </update>
  54. <select id="queryList" resultType="com.kmall.admin.entity.UserCampMinusEntity">
  55. select
  56. `user_camp_id`,
  57. `store_topic_id`,
  58. `camp_name`,
  59. `user_id`,
  60. `used_time`,
  61. `order_id`,
  62. `end_time`,
  63. `money`,
  64. `is_used`,
  65. `creater_sn`,
  66. `create_time`,
  67. `moder_sn`,
  68. `mod_time`,
  69. `tstm`
  70. from mall_user_camp_minus
  71. WHERE 1=1
  72. <if test="name != null and name.trim() != ''">
  73. AND name LIKE concat('%',#{name},'%')
  74. </if>
  75. <choose>
  76. <when test="sidx != null and sidx.trim() != ''">
  77. order by ${sidx} ${order}
  78. </when>
  79. <otherwise>
  80. order by user_camp_id desc
  81. </otherwise>
  82. </choose>
  83. <if test="offset != null and limit != null">
  84. limit #{offset}, #{limit}
  85. </if>
  86. </select>
  87. <select id="queryTotal" resultType="int">
  88. select count(*) from mall_user_camp_minus
  89. WHERE 1=1
  90. <if test="name != null and name.trim() != ''">
  91. AND name LIKE concat('%',#{name},'%')
  92. </if>
  93. </select>
  94. <insert id="save" parameterType="com.kmall.admin.entity.UserCampMinusEntity" useGeneratedKeys="true" keyProperty="userCampId">
  95. insert into mall_user_camp_minus(
  96. `store_topic_id`,
  97. `camp_name`,
  98. `user_id`,
  99. `used_time`,
  100. `order_id`,
  101. `end_time`,
  102. `money`,
  103. `is_used`,
  104. `creater_sn`,
  105. `create_time`,
  106. `moder_sn`,
  107. `mod_time`,
  108. `tstm`)
  109. values(
  110. #{storeTopicId},
  111. #{campName},
  112. #{userId},
  113. #{usedTime},
  114. #{orderId},
  115. #{endTime},
  116. #{money},
  117. #{isUsed},
  118. #{createrSn},
  119. #{createTime},
  120. #{moderSn},
  121. #{modTime},
  122. #{tstm})
  123. </insert>
  124. <update id="update" parameterType="com.kmall.admin.entity.UserCampMinusEntity">
  125. update mall_user_camp_minus
  126. <set>
  127. <if test="storeTopicId != null">`store_topic_id` = #{storeTopicId}, </if>
  128. <if test="campName != null">`camp_name` = #{campName}, </if>
  129. <if test="userId != null">`user_id` = #{userId}, </if>
  130. <if test="usedTime != null">`used_time` = #{usedTime}, </if>
  131. <if test="orderId != null">`order_id` = #{orderId}, </if>
  132. <if test="endTime != null">`end_time` = #{endTime}, </if>
  133. <if test="money != null">`money` = #{money}, </if>
  134. <if test="isUsed != null">`is_used` = #{isUsed}, </if>
  135. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  136. <if test="createTime != null">`create_time` = #{createTime}, </if>
  137. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  138. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  139. <if test="tstm != null">`tstm` = #{tstm}</if>
  140. </set>
  141. where user_camp_id = #{userCampId}
  142. </update>
  143. <delete id="delete">
  144. delete from mall_user_camp_minus where user_camp_id = #{value}
  145. </delete>
  146. <delete id="deleteBatch">
  147. delete from mall_user_camp_minus where user_camp_id in
  148. <foreach item="userCampId" collection="array" open="(" separator="," close=")">
  149. #{userCampId}
  150. </foreach>
  151. </delete>
  152. </mapper>