储值送积分活动
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
<result property="shopId" column="shop_id" jdbcType="INTEGER"/>
|
||||
<result property="amount" column="amount" jdbcType="INTEGER"/>
|
||||
<result property="giftAmount" column="gift_amount" jdbcType="INTEGER"/>
|
||||
<result property="giftPoints" column="gift_points" jdbcType="INTEGER"/>
|
||||
<result property="isUseCoupon" column="is_use_coupon" jdbcType="INTEGER"/>
|
||||
<result property="couponId" column="coupon_id" jdbcType="INTEGER"/>
|
||||
<result property="num" column="num" jdbcType="INTEGER"/>
|
||||
@@ -16,7 +17,7 @@
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, shop_id, amount, gift_amount, is_use_coupon, coupon_id, num, create_time, update_time </sql>
|
||||
, shop_id, amount, gift_amount, gift_points, is_use_coupon, coupon_id, num, create_time, update_time </sql>
|
||||
|
||||
|
||||
<select id="selectByAmount" resultMap="TbActivateMap">
|
||||
@@ -28,6 +29,28 @@
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="selectByAmountScope" resultMap="TbActivateMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from tb_activate
|
||||
where shop_id = #{shopId}
|
||||
<![CDATA[
|
||||
and amount > 0
|
||||
and amount <= #{amount}
|
||||
]]>
|
||||
order by amount desc,gift_points desc,id desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="updateMemberPoints" resultType="int">
|
||||
update tb_shop_user set last_points_change_time = now(),last_float_points = #{points},account_points = account_points + ${points} where id = #{memberId}
|
||||
</select>
|
||||
|
||||
<insert id="insertMemberPointsLog" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_member_points_log(shop_id, member_id, member_name, avatar_url, content, order_no, mobile, float_type, float_points, create_time)
|
||||
values (#{shopId}, #{memberId}, #{memberName}, #{avatarUrl}, #{content}, #{orderNo}, #{mobile}, #{floatType}, #{floatPoints}, now())
|
||||
</insert>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="TbActivateMap">
|
||||
select
|
||||
@@ -56,6 +79,9 @@
|
||||
<if test="giftAmount != null">
|
||||
and gift_amount = #{giftAmount}
|
||||
</if>
|
||||
<if test="giftPoints != null">
|
||||
and gift_points = #{giftPoints}
|
||||
</if>
|
||||
<if test="isUseCoupon != null">
|
||||
and is_use_coupon = #{isUseCoupon}
|
||||
</if>
|
||||
@@ -77,15 +103,15 @@
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate(shop_id, amount, gift_amount, is_use_coupon, coupon_id, num, create_time, update_time)
|
||||
values (#{shopId}, #{amount}, #{giftAmount}, #{isUseCoupon}, #{couponId}, #{num}, #{createTime}, #{updateTime})
|
||||
insert into tb_activate(shop_id, amount, gift_amount, gift_points, is_use_coupon, coupon_id, num, create_time, update_time)
|
||||
values (#{shopId}, #{amount}, #{giftAmount}, #{giftPoints}, #{isUseCoupon}, #{couponId}, #{num}, #{createTime}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into tb_activate(shop_id, amount, gift_amount, is_use_coupon, coupon_id, num, create_time, update_time)
|
||||
insert into tb_activate(shop_id, amount, gift_amount, gift_points, is_use_coupon, coupon_id, num, create_time, update_time)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.shopId}, #{entity.amount}, #{entity.giftAmount}, #{entity.isUseCoupon}, #{entity.couponId},
|
||||
(#{entity.shopId}, #{entity.amount}, #{entity.giftAmount}, #{entity.giftPoints}, #{entity.isUseCoupon}, #{entity.couponId},
|
||||
#{entity.num}, #{entity.createTime}, #{entity.updateTime})
|
||||
</foreach>
|
||||
</insert>
|
||||
@@ -103,6 +129,9 @@
|
||||
<if test="giftAmount != null">
|
||||
gift_amount = #{giftAmount},
|
||||
</if>
|
||||
<if test="giftPoints != null">
|
||||
gift_points = #{giftPoints},
|
||||
</if>
|
||||
<if test="isUseCoupon != null">
|
||||
is_use_coupon = #{isUseCoupon},
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user