|
@@ -2,104 +2,122 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
<mapper namespace="com.caimei.modules.coupon.dao.CmCouponVipDao">
|
|
|
|
|
|
- <sql id="cmCouponColumns">
|
|
|
- a.id AS "id",
|
|
|
- a.name AS "name",
|
|
|
- a.couponAmount AS "couponAmount",
|
|
|
- a.touchPrice AS "touchPrice",
|
|
|
- a.startDate AS "startDate",
|
|
|
- a.endDate AS "endDate",
|
|
|
- a.status AS "status",
|
|
|
- a.couponType AS "couponType",
|
|
|
- a.userId AS "userId",
|
|
|
- a.shopId AS "shopId",
|
|
|
- a.productType AS "productType",
|
|
|
- a.pcBanner AS "pcBanner",
|
|
|
- a.appletsBanner AS "appletsBanner",
|
|
|
- a.categoryType AS "categoryType",
|
|
|
- a.couponsMode AS "couponsMode",
|
|
|
- a.createDate AS "createDate",
|
|
|
- a.delFlag AS "delFlag"
|
|
|
- </sql>
|
|
|
+<!-- <sql id="cmCouponColumns">-->
|
|
|
+<!-- a.id AS "id",-->
|
|
|
+<!-- a.name AS "name",-->
|
|
|
+<!-- a.couponAmount AS "couponAmount",-->
|
|
|
+<!-- a.touchPrice AS "touchPrice",-->
|
|
|
+<!-- a.startDate AS "startDate",-->
|
|
|
+<!-- a.endDate AS "endDate",-->
|
|
|
+<!-- a.status AS "status",-->
|
|
|
+<!-- a.couponType AS "couponType",-->
|
|
|
+<!-- a.userId AS "userId",-->
|
|
|
+<!-- a.shopId AS "shopId",-->
|
|
|
+<!-- a.productType AS "productType",-->
|
|
|
+<!-- a.pcBanner AS "pcBanner",-->
|
|
|
+<!-- a.appletsBanner AS "appletsBanner",-->
|
|
|
+<!-- a.categoryType AS "categoryType",-->
|
|
|
+<!-- a.couponsMode AS "couponsMode",-->
|
|
|
+<!-- a.createDate AS "createDate",-->
|
|
|
+<!-- a.delFlag AS "delFlag"-->
|
|
|
+<!-- </sql>-->
|
|
|
|
|
|
- <sql id="cmCouponJoins">
|
|
|
- </sql>
|
|
|
+<!-- <sql id="cmCouponJoins">-->
|
|
|
+<!-- </sql>-->
|
|
|
|
|
|
- <select id="findAllVipCouponDao" resultType="com.caimei.modules.coupon.entity.CmVipCoupon">
|
|
|
- SELECT
|
|
|
- <include refid="cmCouponColumns"/>,
|
|
|
- u.name AS "clubName",
|
|
|
- s.name AS "shopName"
|
|
|
- FROM cm_coupon a
|
|
|
- LEFT JOIN cm_coupon_club ccc ON ccc.couponId = a.id
|
|
|
- LEFT JOIN USER u ON u.userID = a.userId
|
|
|
- LEFT JOIN shop s ON s.shopID = a.shopId
|
|
|
- <include refid="cmCouponJoins"/>
|
|
|
- <where>
|
|
|
- AND a.delFlag = 0
|
|
|
- <if test="couponType != null">
|
|
|
- AND a.couponType = #{couponType}
|
|
|
- </if>
|
|
|
- <if test="name != null and name != ''">
|
|
|
- AND a.name LIKE
|
|
|
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
|
|
|
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
|
|
|
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
|
|
|
- </if>
|
|
|
- <if test="startDate != null and startDate != ''">
|
|
|
- AND a.startDate <![CDATA[ >= ]]> #{startDate}
|
|
|
- </if>
|
|
|
- <if test="endDate != null and endDate != ''">
|
|
|
- AND a.endDate <![CDATA[ <= ]]> #{endDate}
|
|
|
- </if>
|
|
|
- <if test='status == "0"'>
|
|
|
- AND a.startDate <![CDATA[ > ]]> NOW()
|
|
|
- </if>
|
|
|
- <if test='status == "1"'>
|
|
|
- AND a.startDate <![CDATA[ <= ]]> NOW()
|
|
|
- AND a.endDate <![CDATA[ >= ]]> NOW()
|
|
|
- AND a.status != '2'
|
|
|
- </if>
|
|
|
- <if test='status == "2"'>
|
|
|
- AND a.status = '2'
|
|
|
- </if>
|
|
|
- <if test='status == "3"'>
|
|
|
- AND a.endDate <![CDATA[ < ]]> NOW()
|
|
|
- </if>
|
|
|
- <if test="clubName != null and clubName != ''">
|
|
|
- AND u.name LIKE concat('%',#{clubName},'%')
|
|
|
- </if>
|
|
|
- <if test='claimStatus == "1"'>
|
|
|
- AND ccc.id IS NULL
|
|
|
- </if>
|
|
|
- <if test='claimStatus == "2"'>
|
|
|
- AND ccc.id IS NOT NULL
|
|
|
- </if>
|
|
|
- <if test='useStatus == "1"'>
|
|
|
- AND (ccc.status IS NULL OR ccc.status = #{useStatus})
|
|
|
- </if>
|
|
|
- <if test='useStatus == "2"'>
|
|
|
- AND ccc.status = #{useStatus}
|
|
|
- </if>
|
|
|
- <if test="source != null and source != ''">
|
|
|
- AND ccc.source = #{source}
|
|
|
- </if>
|
|
|
- <if test="shopName != null and shopName != ''">
|
|
|
- AND s.name LIKE concat('%',#{shopName},'%')
|
|
|
- </if>
|
|
|
- <if test="couponsMode != null and couponsMode != ''">
|
|
|
- AND a.couponsMode = #{couponsMode}
|
|
|
- </if>
|
|
|
- </where>
|
|
|
- GROUP BY a.id
|
|
|
- <choose>
|
|
|
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
|
|
|
- ORDER BY ${page.orderBy}
|
|
|
- </when>
|
|
|
- <otherwise>
|
|
|
- ORDER BY createDate DESC
|
|
|
- </otherwise>
|
|
|
- </choose>
|
|
|
+<!-- SELECT-->
|
|
|
+<!-- <include refid="cmCouponColumns"/>,-->
|
|
|
+<!-- u.name AS "clubName",-->
|
|
|
+<!-- s.name AS "shopName"-->
|
|
|
+<!-- FROM cm_coupon a-->
|
|
|
+<!-- LEFT JOIN cm_coupon_club ccc ON ccc.couponId = a.id-->
|
|
|
+<!-- LEFT JOIN USER u ON u.userID = a.userId-->
|
|
|
+<!-- LEFT JOIN shop s ON s.shopID = a.shopId-->
|
|
|
+<!-- <include refid="cmCouponJoins"/>-->
|
|
|
+<!-- <where>-->
|
|
|
+<!-- AND a.delFlag = 0-->
|
|
|
+<!-- <if test="couponType != null">-->
|
|
|
+<!-- AND a.couponType = #{couponType}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="name != null and name != ''">-->
|
|
|
+<!-- AND a.name LIKE-->
|
|
|
+<!-- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>-->
|
|
|
+<!-- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>-->
|
|
|
+<!-- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="startDate != null and startDate != ''">-->
|
|
|
+<!-- AND a.startDate <![CDATA[ >= ]]> #{startDate}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="endDate != null and endDate != ''">-->
|
|
|
+<!-- AND a.endDate <![CDATA[ <= ]]> #{endDate}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='status == "0"'>-->
|
|
|
+<!-- AND a.startDate <![CDATA[ > ]]> NOW()-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='status == "1"'>-->
|
|
|
+<!-- AND a.startDate <![CDATA[ <= ]]> NOW()-->
|
|
|
+<!-- AND a.endDate <![CDATA[ >= ]]> NOW()-->
|
|
|
+<!-- AND a.status != '2'-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='status == "2"'>-->
|
|
|
+<!-- AND a.status = '2'-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='status == "3"'>-->
|
|
|
+<!-- AND a.endDate <![CDATA[ < ]]> NOW()-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="clubName != null and clubName != ''">-->
|
|
|
+<!-- AND u.name LIKE concat('%',#{clubName},'%')-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='claimStatus == "1"'>-->
|
|
|
+<!-- AND ccc.id IS NULL-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='claimStatus == "2"'>-->
|
|
|
+<!-- AND ccc.id IS NOT NULL-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='useStatus == "1"'>-->
|
|
|
+<!-- AND (ccc.status IS NULL OR ccc.status = #{useStatus})-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test='useStatus == "2"'>-->
|
|
|
+<!-- AND ccc.status = #{useStatus}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="source != null and source != ''">-->
|
|
|
+<!-- AND ccc.source = #{source}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="shopName != null and shopName != ''">-->
|
|
|
+<!-- AND s.name LIKE concat('%',#{shopName},'%')-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- <if test="couponsMode != null and couponsMode != ''">-->
|
|
|
+<!-- AND a.couponsMode = #{couponsMode}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- </where>-->
|
|
|
+<!-- GROUP BY a.id-->
|
|
|
+<!-- <choose>-->
|
|
|
+<!-- <when test="page !=null and page.orderBy != null and page.orderBy != ''">-->
|
|
|
+<!-- ORDER BY ${page.orderBy}-->
|
|
|
+<!-- </when>-->
|
|
|
+<!-- <otherwise>-->
|
|
|
+<!-- ORDER BY createDate DESC-->
|
|
|
+<!-- </otherwise>-->
|
|
|
+<!-- </choose>-->
|
|
|
+
|
|
|
+ <select id="findAllVipCoupon" resultType="com.caimei.modules.coupon.entity.CmVipCoupon">
|
|
|
+ SELECT cc.`id` AS "couponId",
|
|
|
+ cc.`couponAmount`,
|
|
|
+ cc.`touchPrice`,
|
|
|
+ cc.`startDate`,
|
|
|
+ cc.`endDate`,
|
|
|
+ cc.`couponType`,
|
|
|
+ cc.`shopId`,
|
|
|
+ cc.`productType`,
|
|
|
+ cc.`categoryType`
|
|
|
+ FROM cm_coupon cc
|
|
|
+ INNER JOIN cm_svip_coupon cs ON cs.couponId = cc.id
|
|
|
+ WHERE cc.delFlag = 0
|
|
|
+ AND cc.status != 2
|
|
|
+ <if test="useTime != null and userTime != ''">
|
|
|
+ AND cs.useTime=#{userTime}
|
|
|
+ </if>
|
|
|
+ ORDER BY cs.created_time DESC
|
|
|
</select>
|
|
|
|
|
|
|