123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?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.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="cmCouponJoins">-->
- <!-- </sql>-->
- <!-- 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>
- </mapper>
|