<?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.CouponMapper">
|
<update id="updateType">
|
update t_user_coupon set status = 2 where id =#{id}
|
</update>
|
|
<select id="queryConponRuleOfJson" resultType="java.util.Map">
|
SELECT JSON_EXTRACT(content, "$.conditionalAmount") as conditionalAmount,
|
JSON_EXTRACT(content, "$.deductionAmount") as deductionAmount,
|
JSON_EXTRACT(content, "$.experienceName") as experienceName
|
FROM t_coupon
|
where 1=1
|
<if test="id != null">
|
and `id` = #{id}
|
</if>
|
</select>
|
<select id="queryCouponListOfSearch" resultType="java.util.Map">
|
SELECT id,
|
`name`,
|
useScope,
|
`type`,
|
distributionMethod,
|
date_format(startTime ,'%Y-%m-%d') as startTime,
|
date_format(endTime ,'%Y-%m-%d') as endTime,
|
userPopulation,
|
quantityIssued,
|
pickUpQuantity,
|
`status`,
|
state,
|
illustrate,
|
auditStatus,
|
publisherType
|
from t_coupon
|
where 1=1
|
<if test="objType == 3">
|
and cityManagerId = #{operatorId}
|
</if>
|
|
<if test="cityCode != null">
|
and id in(
|
SELECT DISTINCT couponId FROM
|
|
(SELECT DISTINCT couponId
|
from t_coupon_store
|
WHERE storeId = #{storeId}
|
UNION ALL
|
SELECT DISTINCT couponId
|
|
from t_coupon_city
|
WHERE provinceCode = #{cityCode}) o)
|
</if>
|
<if test="name != null and name!=''">
|
and `name` like concat('%', #{name}, '%')
|
</if>
|
<if test="type != null">
|
and type = #{type}
|
</if>
|
<if test="distributionMethod != null">
|
and distributionMethod = #{distributionMethod}
|
</if>
|
<if test="userPopulation != null">
|
and userPopulation = #{userPopulation}
|
</if>
|
<if test="status !=null">
|
and `status` = #{status}
|
</if>
|
<if test="state != null">
|
and `state` = #{state}
|
</if>
|
and auditStatus = 2
|
order by insertTime desc
|
</select>
|
<select id="queryCouponListOfSearch1" resultType="java.util.Map">
|
SELECT id,
|
`name`,
|
useScope,
|
`type`,
|
distributionMethod,
|
date_format(startTime ,'%Y-%m-%d') as startTime,
|
date_format(endTime ,'%Y-%m-%d') as endTime,
|
userPopulation,
|
quantityIssued,
|
pickUpQuantity,
|
`status`,
|
state,
|
illustrate
|
from t_coupon
|
where 1 = 1 and distributionMethod = 4
|
and auditStatus = 2
|
and startTime < now()
|
and state= 1
|
<if test="cityCode != null">
|
and id in(
|
SELECT DISTINCT couponId FROM
|
(SELECT DISTINCT couponId
|
from t_coupon_store
|
WHERE storeId = #{storeId}
|
UNION ALL
|
SELECT DISTINCT couponId
|
from t_coupon_city
|
WHERE cityCode = #{cityCode}) o)
|
</if>
|
<if test="name != null">
|
and `name` like concat('%', #{name}, '%')
|
</if>
|
<if test="type != null">
|
and type = #{type}
|
</if>
|
|
<if test="userPopulation != null">
|
and userPopulation = #{userPopulation}
|
</if>
|
<if test="status !=null">
|
and `status` = #{status}
|
</if>
|
<if test="state != null">
|
and `state` = #{state}
|
</if>
|
union all
|
SELECT id,
|
`name`,
|
useScope,
|
`type`,
|
distributionMethod,
|
date_format(startTime ,'%Y-%m-%d') as startTime,
|
date_format(endTime ,'%Y-%m-%d') as endTime,
|
userPopulation,
|
quantityIssued,
|
pickUpQuantity,
|
`status`,
|
state,
|
illustrate
|
from t_coupon
|
where 1 = 1 and distributionMethod = 4 and useScope = 1
|
and auditStatus = 2
|
and state= 1
|
and startTime < now()
|
<if test="name != null">
|
and `name` like concat('%', #{name}, '%')
|
</if>
|
|
|
</select>
|
<select id="queryCouponExamineList" resultType="java.util.Map">
|
SELECT id,
|
`name`,
|
useScope,
|
`type`,
|
distributionMethod,
|
date_format(startTime ,'%Y-%m-%d') as startTime,
|
date_format(endTime ,'%Y-%m-%d') as endTime,
|
userPopulation,
|
quantityIssued,
|
pickUpQuantity,
|
auditStatus,
|
publisherType,
|
cityManagerId
|
from t_coupon
|
where auditStatus != 2
|
<if test="name != null">
|
and `name` like concat('%', #{name}, '%')
|
</if>
|
<if test="type != null">
|
and type = #{type}
|
</if>
|
<if test="distributionMethod != null">
|
and distributionMethod = #{distributionMethod}
|
</if>
|
<if test="userPopulation != null">
|
and userPopulation = #{userPopulation}
|
</if>
|
<if test="auditStatus != null">
|
and auditStatus = #{auditStatus}
|
</if>
|
order by insertTime desc
|
</select>
|
<select id="listRecord" resultType="java.util.Map">
|
select id,userId,status from t_user_coupon where couponId =#{id}
|
and userId in
|
<foreach collection="ids" separator="," open="(" item="i" close=")">
|
#{i}
|
</foreach>
|
<if test="type !=null">
|
and status =#{type}
|
</if>
|
</select>
|
|
|
</mapper>
|