Mall2PointsRulesDao.xml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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.vip.Mall2PointsRulesDao">
  4. <resultMap type="com.kmall.admin.entity.vip.Mall2PointsRulesEntity" id="mall2PointsRulesMap">
  5. <result property="mprId" column="mpr_id"/>
  6. <result property="pointsType" column="points_type"/>
  7. <result property="pointsBeginTime" column="points_begin_time"/>
  8. <result property="pointsEndTime" column="points_end_time"/>
  9. <result property="isValid" column="is_valid"/>
  10. <result property="createrSn" column="creater_sn"/>
  11. <result property="createTime" column="create_time"/>
  12. <result property="moderSn" column="moder_sn"/>
  13. <result property="modTime" column="mod_time"/>
  14. <result property="tstm" column="tstm"/>
  15. </resultMap>
  16. <select id="queryObject" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
  17. select
  18. `mpr_id`,
  19. points_type as pointsType,
  20. points_rules_money as pointsRulesMoney,
  21. points_rules_num as pointsRulesNum,
  22. `points_begin_time`,
  23. `points_end_time`,
  24. points_proportion as pointsProportion,
  25. `is_valid`,
  26. `creater_sn`,
  27. `create_time`,
  28. `moder_sn`,
  29. `mod_time`,
  30. `tstm`
  31. from mall2_points_rules
  32. where mpr_id = #{id}
  33. </select>
  34. <select id="queryList" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
  35. select
  36. `mpr_id`,
  37. `points_type`,
  38. points_rules_money as pointsRulesMoney,
  39. points_rules_num as pointsRulesNum,
  40. `points_begin_time`,
  41. `points_end_time`,
  42. points_proportion as pointsProportion,
  43. `is_valid`,
  44. `creater_sn`,
  45. `create_time`,
  46. `moder_sn`,
  47. `mod_time`,
  48. `tstm`
  49. from mall2_points_rules
  50. WHERE 1=1
  51. <if test="name != null and name.trim() != ''">
  52. AND name LIKE concat('%',#{name},'%')
  53. </if>
  54. <choose>
  55. <when test="sidx != null and sidx.trim() != ''">
  56. order by ${sidx} ${order}
  57. </when>
  58. <otherwise>
  59. order by mpr_id desc
  60. </otherwise>
  61. </choose>
  62. <if test="offset != null and limit != null">
  63. limit #{offset}, #{limit}
  64. </if>
  65. </select>
  66. <select id="queryTotal" resultType="int">
  67. select count(*) from mall2_points_rules
  68. WHERE 1=1
  69. <if test="name != null and name.trim() != ''">
  70. AND name LIKE concat('%',#{name},'%')
  71. </if>
  72. </select>
  73. <insert id="save" parameterType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity" useGeneratedKeys="true" keyProperty="id">
  74. insert into mall2_points_rules(
  75. `mpr_id`,
  76. `points_type`,
  77. points_rules_money,
  78. points_rules_num,
  79. `points_begin_time`,
  80. `points_end_time`,
  81. points_proportion,
  82. `is_valid`,
  83. `creater_sn`,
  84. `create_time`,
  85. `moder_sn`,
  86. `mod_time`,
  87. `tstm`)
  88. values(
  89. #{mprId},
  90. #{pointsType},
  91. #{pointsRulesMoney},
  92. #{pointsRulesNum},
  93. #{pointsBeginTime},
  94. #{pointsEndTime},
  95. #{pointsProportion},
  96. #{isValid},
  97. #{createrSn},
  98. #{createTime},
  99. #{moderSn},
  100. #{modTime},
  101. #{tstm})
  102. </insert>
  103. <update id="update" parameterType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
  104. update mall2_points_rules
  105. <set>
  106. <if test="pointsType != null">`points_type` = #{pointsType}, </if>
  107. <if test="pointsRulesMoney != null">`points_rules_money` = #{pointsRulesMoney}, </if>
  108. <if test="pointsRulesNum != null">`points_rules_num` = #{pointsRulesNum}, </if>
  109. <if test="pointsBeginTime != null">`points_begin_time` = #{pointsBeginTime}, </if>
  110. <if test="pointsEndTime != null">`points_end_time` = #{pointsEndTime}, </if>
  111. <if test="pointsProportion != null">`points_proportion` = #{pointsProportion}, </if>
  112. <if test="isValid != null">`is_valid` = #{isValid}, </if>
  113. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  114. <if test="createTime != null">`create_time` = #{createTime}, </if>
  115. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  116. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  117. <if test="tstm != null">`tstm` = #{tstm}</if>
  118. </set>
  119. where mpr_id = #{mprId}
  120. </update>
  121. <delete id="delete">
  122. delete from mall2_points_rules where mpr_id = #{value}
  123. </delete>
  124. <delete id="deleteBatch">
  125. delete from mall2_points_rules where mpr_id in
  126. <foreach item="mprId" collection="array" open="(" separator="," close=")">
  127. #{mprId}
  128. </foreach>
  129. </delete>
  130. <select id="queryRulesDetilId" parameterType="java.lang.Long" resultType="java.lang.Integer">
  131. select points_type from mall2_points_rules where mpr_id=#{mkaId}
  132. </select>
  133. <select id="queryListByTime" resultType="com.kmall.admin.entity.vip.Mall2PointsRulesEntity">
  134. select
  135. `mpr_id`,
  136. `points_type`,
  137. points_rules_money as pointsRulesMoney,
  138. points_rules_num as pointsRulesNum,
  139. `points_begin_time`,
  140. `points_end_time`,
  141. points_proportion as pointsProportion,
  142. `is_valid`,
  143. `creater_sn`,
  144. `create_time`,
  145. `moder_sn`,
  146. `mod_time`,
  147. `tstm`
  148. from mall2_points_rules
  149. where points_begin_time &lt;= #{nowTime} and points_end_time &gt;= #{nowTime}
  150. </select>
  151. </mapper>