123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?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.caimei365.manager.dao.svip.CmSvipHistoryDao">
- <select id="superFind" resultType="com.caimei365.manager.entity.caimei.svip.CmSvipHistory">
- SELECT u.name as clubName, u.username as linkMan, u.bindMobile as mobile,
- cs.userId,cs.beginTime,cs.endTime,cs.packageId
- FROM cm_svip_history cs
- LEFT JOIN club cb ON cs.userId = cb.userId
- LEFT JOIN cm_svip_user cu ON cs.userId = cu.userId
- left join user u on cs.userId = u.userID
- left join cm_svip_package cp on cp.id = cs.packageId
- <where>
- AND cs.payStatus = '1'
- <if test="clubName != null and clubName != ''">
- and u.name like concat('%',#{clubName},'%')
- </if>
- <if test="linkMan != null and linkMan != ''">
- and u.username like concat('%',#{linkMan},'%')
- </if>
- <if test="mobile != null and mobile != ''">
- and u.bindMobile LIKE concat('%',#{mobile},'%')
- </if>
- <if test="startPayTime !=null and startPayTime != '' and endPayTime !=null and endPayTime!=''">
- and (cs.payTime between #{startPayTime} and #{endPayTime})
- </if>
- <if test="startEndTime !=null and startEndTime!='' and endEndTime!=null and endEndTime!=''">
- and (cu.endTime between #{startEndTime} and #{endEndTime})
- </if>
- <if test="packageId !=null and packageId != '' and packageId != 0">
- and cp.duration = #{packageId}
- </if>
- <if test="packageId == 0">
- and cs.packageId = 0
- </if>
- <if test='status == "1"'>
- and cu.endTime > NOW()
- </if>
- <if test='status == "2"'>
- and now() > cu.endTime
- </if>
- </where>
- group by cs.userId
- order by cs.payTime DESC
- </select>
- <select id="findEndTime" resultType="com.caimei365.manager.entity.caimei.svip.CmSvipHistory">
- select beginTime, endTime, updateTime
- from cm_svip_user
- where userId = #{userId}
- and endTime > now()
- </select>
- <select id="findProductList" resultType="com.caimei365.manager.entity.caimei.svip.CmSvipProduct">
- SELECT
- a.id AS "id",
- a.productId AS "productId",
- a.sort AS "sort",
- a.addTime AS "addTime",
- a.status as "status",
- p.mainImage as "productImage",
- p.name as "productName",
- s.name as "shopName",
- p.includedTax,
- p.invoiceType,
- p.taxPoint,
- p.supplierTaxPoint
- FROM cm_svip_product a
- left join product p on a.productId = p.productID
- left join shop s on s.shopID = p.shopID
- <where>
- <if test="productId != null and productId != ''">
- AND a.productId = #{productId}
- </if>
- <if test="productName != null and productId != ''">
- AND p.name like concat('%',#{productName},'%')
- </if>
- <if test="shopName != null and productId != ''">
- AND s.name like concat('%',#{shopName},'%')
- </if>
- <if test="status !=null and status == 0">
- and a.status=0
- </if>
- <if test="status !=null and status !='' and status == 1">
- and a.status=1
- </if>
- </where>
- order by -sort desc,addTime desc
- </select>
- <select id="findSku" resultType="com.caimei365.manager.entity.caimei.svip.CmSku">
- select price, costPrice, costCheckFlag, costProportional, normalPrice
- from cm_sku
- where productId = #{productId}
- order by price asc
- limit 1
- </select>
- <select id="findSvipSku" resultType="com.caimei365.manager.entity.caimei.svip.CmSku">
- select ifnull(discountPrice, 0) as "discountPrice",
- ifnull(discount, 0) as "discount",
- ifnull(priceType, 0) as "priceType"
- from cm_svip_product_sku csps
- left join cm_sku cs on cs.productId = csps.productId
- where csps.productId = #{productId}
- order by cs.price asc
- limit 1
- </select>
- <select id="findPackage" resultType="com.caimei365.manager.entity.caimei.svip.CmSvipPackage">
- select price, duration, proportion
- from cm_svip_package
- </select>
- <update id="updatePrice">
- update cm_svip_package
- set
- <if test="price != null">
- price = #{price},
- </if>
- <if test="proportion != null">
- proportion = #{proportion}
- </if>
- where duration = #{duration}
- </update>
- </mapper>
|