123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679 |
- <?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">
- <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.vipFlag AS "vipFlag",
- 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="newCmShopColumns">
- a.shopID AS "shopID",
- a.checkMan as "checkMan",
- a.userID AS "userID",
- a.name AS "name",
- u.userName AS "sname",
- a.logo AS "logo",
- a.legalPerson AS "legalPerson",
- a.businessLicense AS "businessLicense",
- a.businessLicenseImage AS "businessLicenseImage",
- a.taxCertificate AS "taxCertificate",
- a.taxCertificateImage AS "taxCertificateImage",
- a.townID AS "townID",
- d.provinceID AS "provinceID",
- c.cityID AS "cityID",
- a.address AS "address",
- a.registeredCapital AS "registeredCapital",
- a.nature AS "nature",
- a.turnover AS "turnover",
- a.linkMan AS "linkMan",
- a.contractPhone AS "contractPhone",
- ifnull(u.bindMobile,a.contractMobile) AS "contractMobile",
- a.contractEmail AS "contractEmail",
- a.fax AS "fax",
- a.zipCode AS "zipCode",
- a.info AS "info",
- a.productDesc AS "productDesc",
- a.website,
- a.wxOfficialAccount,
- a.wxApplets,
- a.addTime AS "addTime",
- a.auditStatus AS "auditStatus",
- a.auditTime AS "auditTime",
- a.auditNote AS "auditNote",
- a.validFlag AS "validFlag",
- a.status AS "status",
- a.maintenanceFee AS "maintenanceFee",
- a.maintenanceDate AS "maintenanceDate",
- a.businessScope AS "businessScope",
- u.account AS "account",
- u.registerTime AS "registerTime",
- a.firstShopType AS "firstShopType",
- a.secondShopType AS "secondShopType",
- a.medicalPracticeLicenseImg1 AS "medicalPracticeLicenseImg1",
- a.medicalPracticeLicenseImg2 AS "medicalPracticeLicenseImg2",
- a.medicalPracticeLicenseImg3 AS "medicalPracticeLicenseImg3",
- a.mainpro AS "mainpro",
- a.bankAccount AS "bankAccount",
- a.ableRebateAmount AS "ableRebateAmount",
- a.rebateAmount AS "rebateAmount",
- a.bankAccountName AS "bankAccountName",
- a.bankName AS "bankName",
- a.socialCreditCode AS "socialCreditCode",
- u.email,
- u.source AS "source",
- a.shopType AS "shopType",
- a.cardNumber AS "cardNumber",
- a.chargeSupport AS "chargeSupport",
- d.name AS "province",c.name AS "city",b.name AS "town"
- </sql>
- <sql id="productColumns">
- a.productID AS "id",
- a.productID AS "productId",
- a.brandID AS "brandID",
- a.bigTypeID AS "bigTypeID",
- ifnull(a.smallTypeID,-1) AS "smallTypeID",
- ifnull(a.tinyTypeID,-1) AS "tinyTypeID",
- a.selfTypeID AS "selfTypeID",
- a.preferredFlag AS "preferredFlag",
- a.shopID AS "shopId",
- a.name AS "name",
- a.searchKey AS "searchKey",
- a.combinationID AS "combinationID",
- a.productRemarks AS "productRemarks",
- a.priceFlag AS "priceFlag",
- a.beautyActFlag AS "beautyActFlag",
- a.hasSkuFlag AS "hasSkuFlag",
- a.mainImage AS "mainImage",
- a.propertiesInfo AS "propertiesInfo",
- a.addTime AS "addTime",
- a.updateTime AS "updateTime",
- a.sellNumber AS "sellNumber",
- a.weekSellNumber AS "weekSellNumber",
- a.beforeValidFlag AS "beforeValidFlag",
- a.validFlag AS "validFlag",
- a.favoriteTimes AS "favoriteTimes",
- a.commentScore AS "commentScore",
- a.commentTimes AS "commentTimes",
- a.selfRecommendFlag AS "selfRecommendFlag",
- a.sysRecommendFlag AS "sysRecommendFlag",
- a.sortIndex AS "sortIndex",
- a.featuredFlag AS "featuredFlag",
- a.featuredSortIndex AS "featuredSortIndex",
- a.productCode AS "productCode",
- a.synToERPFlag AS "synToERPFlag",
- a.allAreaFlag AS "allAreaFlag",
- a.provinceIDs AS "provinceIDs",
- a.serviceNumber AS "serviceNumber",
- a.packageCount AS "packageCount",
- a.byFlag AS "byFlag",
- a.normalProductFlag AS "normalProductFlag",
- a.wholeSaleProductFlag AS "wholeSaleProductFlag",
- a.promotionProductFlag AS "promotionProductFlag",
- a.groupBuyProductFlag AS "groupBuyProductFlag",
- a.step AS "step",
- a.actStatus AS "actStatus",
- a.actFlag AS "actFlag",
- a.actType AS "actType",
- a.onlineTime AS "onlineTime",
- a.downlineTime AS "downlineTime",
- a.freePostFlag AS "freePostFlag",
- a.precisehKey AS "precisehKey",
- s.name AS "shopName",
- a.actSort AS "actSort",
- a.recommendType AS "recommendType",
- a.aliasName as "aliasName",
- a.visibility as "visibility",
- # a.commodityDetailsFlag as "commodityDetailsFlag",
- a.productType as "productType",
- a.qualificationImg as "qualificationImg",
- a.includedTax as "includedTax",
- a.invoiceType as "invoiceType",
- a.taxPoint as "taxPoint",
- a.tags as "tags",
- a.machineType as "machineType",
- a.trainingMethod as "trainingMethod",
- a.trainingType as "trainingType",
- a.trainingFee as "trainingFee",
- a.commodityType as "commodityType",
- a.splitCode,
- a.announType,
- ifnull(a.newvalidFlag,0),
- ifnull(a.newProductType,2),
- a.showFlag,
- a.showTime,
- a.newshowTime,
- a.recommend,
- a.qualificationNo,
- a.productName,
- a.qualificationTime,
- a.qualificationLink,
- a.labelIds
- </sql>
- <sql id="newCmShopJoins">
- LEFT JOIN user u ON u.userID = a.userID
- LEFT JOIN town b ON b.townID=a.townID
- LEFT JOIN city c ON c.cityID=b.cityID
- LEFT JOIN province d ON d.provinceID=c.provinceID
- </sql>
- <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="findUserList" resultType="com.caimei365.manager.entity.caimei.CmUser">
- SELECT
- clubID as clubId,
- userID as userId,
- name,
- sname AS shortName,
- linkMan,
- contractMobile as contractMobile
- FROM
- club
- WHERE
- status IN (1, 90)
- <if test="clubId != null and clubId != ''">
- AND clubId = #{clubId}
- </if>
- <if test="name != null and name != ''">
- AND name LIKE CONCAT('%',#{name},'%')
- </if>
- <if test="shortName != null and shortName != ''">
- AND sname LIKE CONCAT('%',#{shortName},'%')
- </if>
- ORDER BY clubId ASC
- </select>
- <select id="findVipUser" resultType="com.caimei365.manager.entity.caimei.svip.CmSvipHistory">
- select beginTime, endTime, updateTime, userId
- from cm_svip_user
- where userId = #{userId}
- and delflag = 0
- </select>
- <insert id="addMessageCenter">
- INSERT INTO message_center (shopID, clubID, userType, messageType, content, time, accountType, couponType,
- couponFee, couponMessageType, orderID, orderMessageType, shopMessType, productID)
- VALUES (#{shopId}, #{clubId}, #{userType}, #{messageType}, #{content}, #{time}, #{accountType}, #{couponType},
- #{couponFee}, #{couponMessageType}, #{orderId}, #{orderMessageType}, #{shopMessType}, #{productId})
- </insert>
- <insert id="insertHistory">
- insert into cm_svip_history(userId, packageId, beginTime, endTime, payStatus, payWay, price, userBeans, payTime)
- values (#{userId}, 0, #{beginTime}, #{endTime}, 1, #{payWay}, 0, 0, #{payTime})
- </insert>
- <update id="updateVip">
- UPDATE cm_svip_user
- SET
- <if test="beginTime != null">
- beginTime = #{beginTime},
- </if>
- endTime = #{endTime},
- updateTime = now()
- WHERE userId = #{userId}
- </update>
- <insert id="giveVip">
- insert into cm_svip_user (userId, beginTime, endTime, delFlag, updateTime)
- values (#{userId}, #{beginTime}, #{endTime}, 0, #{beginTime})
- </insert>
- <select id="findHistory" resultType="com.caimei365.manager.entity.caimei.svip.CmSvipHistory">
- select
- cs.id,
- cs.userId,
- cs.packageId,
- u.name as clubName,
- u.userName as linkMan,
- u.bindMobile as mobile,
- cs.beginTime,
- cs.price,
- cs.payWay,
- cs.payType,
- cs.userBeans,
- cs.payTime,
- cs.endTime
- from cm_svip_history cs
- LEFT JOIN club cb ON cs.userId = cb.userId
- left join user u on cs.userId = u.userID
- left join cm_svip_package cp on cp.id = cs.packageId
- where cs.userId = #{userId}
- AND cs.payStatus = '1'
- <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 (cs.endTime between #{startEndTime} and #{endEndTime})
- </if>
- <if test="packageId != null and packageId != 0">
- and cp.duration = #{packageId}
- </if>
- <if test="packageId == 0">
- and cs.packageId = 0
- </if>
- <if test='status == "1"'>
- and (NOW() between cs.beginTime and cs.endTime)
- </if>
- <if test='status == "2"'>
- and NOW() > cs.endTime
- </if>
- <if test='status == "3"'>
- and cs.beginTime > NOW()
- </if>
- order by cs.payTime desc
- </select>
- <select id="findDuration" resultType="java.lang.Integer">
- select duration
- from cm_svip_package
- where id = #{packageId}
- </select>
- <select id="findMonth" resultType="java.lang.String">
- SELECT TIMESTAMPDIFF(MONTH, cs.beginTime, cs.endTime) FROM cm_svip_history cs
- where id = #{id}
- </select>
- <select id="vipCouponGet" resultType="com.caimei365.manager.entity.caimei.svip.CmVipCoupon">
- SELECT DISTINCT id, useTime, status, updateTime, delFlag
- FROM cm_svip_coupon_month
- WHERE id = #{id}
- LIMIT 1
- </select>
- <select id="CmCouponGet" resultType="com.caimei365.manager.entity.caimei.svip.CmCoupon">
- SELECT
- <include refid="cmCouponColumns"/>
- FROM cm_coupon a
- WHERE a.id = #{id}
- </select>
- <select id="newCmShopGet" resultType="com.caimei365.manager.entity.caimei.svip.NewCmShop">
- SELECT
- <include refid="newCmShopColumns"/>
- FROM shop a
- <include refid="newCmShopJoins"/>
- WHERE a.shopID = #{id}
- </select>
- <select id="findRedemptionCodeNum" resultType="java.lang.Integer">
- SELECT COUNT(id) FROM cm_coupon_redemption_code WHERE couponId = #{couponId}
- </select>
- <update id="updateByDelFlag">
- UPDATE cm_coupon SET delFlag = 1 WHERE id = #{couponId}
- </update>
- <update id="updateAssociateByDelFlag">
- UPDATE cm_coupon_product SET delFlag = 1 WHERE couponId = #{couponId}
- </update>
- <update id="updateVipCouponMonth" parameterType="com.caimei365.manager.entity.caimei.svip.CmVipCoupon">
- UPDATE cm_svip_coupon_month SET useTime=#{useTime}, updateTime=#{updateTime}, status=#{status}, delFlag=#{delFlag}
- WHERE id=#{id}
- </update>
- <delete id="deleteByMonthId">
- UPDATE cm_svip_coupon SET delFlag=1 WHERE montId = #{montId}
- </delete>
- <select id="findByCouponId" resultType="java.lang.Integer">
- SELECT id FROM cm_coupon_product WHERE couponId = #{couponId} AND delFlag = 0
- </select>
- <insert id="insertCouponAssociate">
- INSERT INTO `cm_coupon_product` (
- `couponId`, `productId`, `pcStatus`,
- `appletsStatus`,
- `sort`, `addTime`, `delFlag`
- )
- VALUES
- (
- #{couponId}, #{productId}, #{pcStatus},
- #{appletsStatus},
- #{sort}, #{addTime}, #{delFlag}
- )
- </insert>
- <update id="updateCouponAssociate">
- UPDATE
- `cm_coupon_product`
- <set>
- <if test="pcStatus != null and pcStatus != ''">
- `pcStatus` = #{pcStatus},
- </if>
- <if test="appletsStatus != null and appletsStatus != ''">
- `appletsStatus` = #{appletsStatus},
- </if>
- <if test="sort != null">
- `sort` = #{sort},
- </if>
- </set>
- WHERE
- `id` = #{id}
- </update>
- <update id="logicDeleteCouponAssociate">
- UPDATE cm_coupon_product SET delFlag = 1 WHERE id = #{id}
- </update>
- <insert id="insertCoupon" parameterType="com.caimei365.manager.entity.caimei.svip.CmCoupon" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_coupon(
- name,
- couponPayWay,
- couponAmount,
- touchPrice,
- startDate,
- endDate,
- receivePeriod,
- receiveFlag,
- useTimeFlag,
- usePeriod,
- status,
- couponType,
- vipFlag,
- userId,
- shopId,
- productType,
- pcBanner,
- appletsBanner,
- categoryType,
- couponsMode,
- createDate,
- moneyCouponPrice,
- moneyCouponFlag,
- moneyCouponType,
- delFlag,
- configure
- ) VALUES (
- #{name},
- #{couponPayWay},
- #{couponAmount},
- #{touchPrice},
- #{startDate},
- #{endDate},
- #{receivePeriod},
- #{receiveFlag},
- #{useTimeFlag},
- #{usePeriod},
- #{status},
- #{couponType},
- #{vipFlag},
- #{userId},
- #{shopId},
- #{productType},
- #{pcBanner},
- #{appletsBanner},
- #{categoryType},
- #{couponsMode},
- #{createDate},
- #{moneyCouponPrice},
- #{moneyCouponFlag},
- #{moneyCouponType},
- #{delFlag},
- #{configure}
- )
- </insert>
- <update id="updateCoupon">
- UPDATE cm_coupon SET
- name = #{name},
- couponPayWay = #{couponPayWay},
- couponAmount = #{couponAmount},
- touchPrice = #{touchPrice},
- startDate = #{startDate},
- endDate = #{endDate},
- receivePeriod = #{receivePeriod},
- receiveFlag = #{receiveFlag},
- useTimeFlag = #{useTimeFlag},
- usePeriod = #{usePeriod},
- status = #{status},
- couponType = #{couponType},
- vipFlag = #{vipFlag},
- userId = #{userId},
- shopId = #{shopId},
- productType = #{productType},
- pcBanner = #{pcBanner},
- appletsBanner = #{appletsBanner},
- categoryType = #{categoryType},
- couponsMode = #{couponsMode},
- moneyCouponPrice = #{moneyCouponPrice},
- moneyCouponType = #{moneyCouponType},
- configure = #{configure}
- WHERE id = #{id}
- </update>
- <select id="findCouponList" resultType="com.caimei365.manager.entity.caimei.svip.CmVipCoupon">
- SELECT cs.id, cs.useTime, cs.status, cs.updateTime, cs.delFlag
- FROM cm_svip_coupon_month cs
- <where>
- AND cs.delFlag = 0
- <if test="startDate!=null and startDate!=''">
- AND cs.useTime <![CDATA[ >= ]]> #{startDate}
- </if>
- <if test="endDate!=null and endDate!=''">
- AND cs.useTime <![CDATA[ <= ]]> #{endDate}
- </if>
- <!-- 0未生效 1已生效 2已关闭 3已失效 -->
- <if test="status!=null and status!=''">
- <if test='status == "0"'>
- AND cs.status != '2'
- AND cs.useTime <![CDATA[ > ]]> DATE_FORMAT(NOW(), '%Y-%m')
- </if>
- <if test='status == "1"'>
- AND cs.status != '2'
- AND cs.useTime <![CDATA[ = ]]> DATE_FORMAT(NOW(), '%Y-%m')
- </if>
- <if test='status == "2"'>
- AND cs.status = '2'
- </if>
- <if test='status == "3"'>
- AND cs.status != '2'
- AND cs.useTime <![CDATA[ < ]]> DATE_FORMAT(NOW(), '%Y-%m')
- </if>
- </if>
- </where>
- ORDER BY cs.useTime DESC
- </select>
- <select id="getBindCoupons" resultType="java.lang.String">
- SELECT couponId from cm_svip_coupon WHERE montId = #{montId} AND delFlag=0
- </select>
- <select id="getCouponListByIds" resultType="com.caimei365.manager.entity.caimei.svip.CmCoupon">
- 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
- <where>
- AND a.delFlag = 0
- <if test="couponType!=null and couponType!=''">
- AND a.couponType = #{couponType}
- </if>
- <if test="bindCoupons!=null and bindCoupons.size()!=0">
- AND a.id IN
- <foreach collection="bindCoupons" open="(" separator="," close=")" item="couponId">
- #{couponId}
- </foreach>
- </if>
- </where>
- GROUP BY a.id
- ORDER BY a.createDate DESC
- </select>
- <select id="findShopList" resultType="com.caimei365.manager.entity.caimei.svip.NewCmShop">
- SELECT
- s.shopId,
- s.userId,
- IFNULL(s.name, u.name) AS name,
- IFNULL(s.sname, u.realName) AS sname,
- IFNULL(s.contractMobile, u.bindMobile) AS contractMobile,
- IFNULL(s.linkMan, u.userName) AS linkMan
- FROM
- shop s
- LEFT JOIN USER u ON u.`shopID` = s.`shopID`
- WHERE
- s.status = 90
- <if test="shopId != null">
- AND s.shopID = #{shopId}
- </if>
- <if test="name != null and name != ''">
- AND (s.name LIKE CONCAT('%',#{name},'%') OR u.name LIKE CONCAT('%',#{name},'%'))
- </if>
- <if test="sname != null and sname != ''">
- AND (s.sname LIKE CONCAT('%',#{sname},'%') OR u.realName LIKE CONCAT('%',#{sname},'%'))
- </if>
- ORDER BY
- s.shopID
- </select>
- <select id="findProductImage" resultType="com.caimei365.manager.entity.caimei.product.Product">
- SELECT
- <include refid="productColumns"/>
- FROM product a
- LEFT JOIN shop s on s.shopID = a.shopID
- left join product p on a.productID = p.productId
- <where>
- <if test="productId !=null">
- AND a.productID=#{productId}
- </if>
- <if test="shopId != null and shopId != ''">
- AND a.shopID = #{shopId}
- </if>
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name LIKE concat('%',#{shopName},'%')
- </if>
- <if test="validFlag !=null and validFlag !=''">
- AND a.validFlag=#{validFlag}
- </if>
- <if test="productCategory !=null and productCategory !=''">
- AND a.productCategory=#{productCategory}
- </if>
- <if test="ids != null and ids.size() > 0">
- AND a.productID NOT IN
- <foreach collection="ids" close=")" separator="," open="(" item="id">
- #{id}
- </foreach>
- </if>
- </where>
- <choose>
- <otherwise>
- order by a.productID asc
- </otherwise>
- </choose>
- </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>
|