<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="com.dsh.activity.mapper.UserPointsMerchandiseMapper">
|
<update id="changeState">
|
update t_user_points_merchandise set
|
state = #{state}
|
<where>
|
<if test="ids != null and ids.size()>0">
|
AND t_user_points_merchandise.id IN
|
<foreach collection="ids" separator="," item="id" open="(" close=")">
|
#{id}
|
</foreach>
|
</if>
|
</where>
|
|
|
</update>
|
|
|
<select id="getAmount" resultType="com.dsh.activity.model.PointMerchandiseIncomeVo">
|
select t1.insertTime,t2.cash from t_user_points_merchandise t1
|
left join t_points_merchandise t2 on t1.pointsMerchandiseId = t2.id
|
where t1.payStatus =2
|
</select>
|
<select id="getConsumeDetails" resultType="com.dsh.activity.entity.ConsumeDetail">
|
|
SELECT
|
CASE tm.type
|
WHEN 1 THEN '兑换实体商品'
|
WHEN 2 THEN '兑换运动营商品'
|
WHEN 3 THEN '兑换门票'
|
WHEN 4 THEN '兑换优惠券'
|
END AS consumeName ,DATE_FORMAT(pm.insertTime, '%m-%d %H:%i')as `consumeTime`,2 as type,CONCAT('-',tm.cash) as
|
consumeAmount,
|
UNIX_TIMESTAMP(pm.insertTime) * 1000 as dateTime
|
FROM t_user_points_merchandise pm
|
LEFT JOIN t_points_merchandise tm ON tm.id = pm.pointsMerchandiseId
|
WHERE pm.payStatus = 2 and pm.state = 1 and pm.pointsMerchandiseId IN(
|
SELECT id
|
FROM t_points_merchandise WHERE redemptionMethod IN (2,3)
|
)
|
<if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
|
and DATE_FORMAT(pm.insertTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
|
</if>
|
<if test="null != appUserId and '' != appUserId ">
|
and pm.userId = #{appUserId}
|
</if>
|
</select>
|
|
<select id="getConsumeDetails1" resultType="com.dsh.activity.entity.ConsumeDetail">
|
SELECT
|
'兑换优惠券' AS consumeName ,
|
DATE_FORMAT(paymentTime, '%m-%d %H:%i') as `consumeTime`,
|
2 as type,
|
CONCAT('-',cash) as consumeAmount,
|
UNIX_TIMESTAMP(paymentTime) * 1000 as dateTime
|
FROM t_user_coupon_payment
|
where status = 2 and payType = 2
|
<if test="null != monthStart and '' != monthStart and null != monthEnd and '' != monthEnd">
|
and DATE_FORMAT(paymentTime, '%Y-%m-%d %H:%i:%s') between #{monthStart} and #{monthEnd}
|
</if>
|
<if test="null != appUserId and '' != appUserId ">
|
and userId = #{appUserId}
|
</if>
|
</select>
|
|
</mapper>
|