huangzhiguo 2 سال پیش
والد
کامیت
ef887a2bf7

+ 73 - 0
src/main/java/com/caimei365/manager/controller/caimei/svip/CmSvipHistoryApi.java

@@ -0,0 +1,73 @@
+package com.caimei365.manager.controller.caimei.svip;
+
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.svip.CmSvipHistory;
+import com.caimei365.manager.entity.caimei.svip.CmSvipPackage;
+import com.caimei365.manager.entity.caimei.svip.CmSvipProduct;
+import com.caimei365.manager.service.caimei.svip.CmSvipHistoryService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@RestController
+@RequestMapping("/svip/member")
+public class CmSvipHistoryApi {
+
+    @Autowired private CmSvipHistoryService historyService;
+
+    /**
+     * 超级会员列表
+     * @param vip
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/memberList")
+    public ResponseJson<PaginationVo<CmSvipHistory>> memberList(CmSvipHistory vip,
+                                                 @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                 @RequestParam(value = "pageSize",defaultValue = "20")int pageSize) {
+
+        return historyService.memberList(vip, pageNum, pageSize);
+    }
+
+    /**
+     * 超级会员商品列表
+     * @param cmSvipProduct
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/findProductList")
+    public ResponseJson<PaginationVo<CmSvipProduct>> findProductList (CmSvipProduct cmSvipProduct,
+                                                                      @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                      @RequestParam(value = "pageSize",defaultValue = "20")int pageSize) {
+
+        return historyService.findProductList(cmSvipProduct, pageNum, pageSize);
+    }
+
+    /**
+     * 套餐配置
+     * @return
+     */
+    @GetMapping("/findPackage")
+    public ResponseJson<CmSvipPackage> findPackage() {
+        return historyService.findPackage();
+    }
+
+    /**
+     * 更新超级会员套餐配置
+     * @param cmSvipPackage
+     * @return
+     */
+    @PostMapping("/updatePrice")
+    public ResponseJson updatePrice(CmSvipPackage cmSvipPackage) {
+        return historyService.updatePrice(cmSvipPackage);
+    }
+}

+ 69 - 0
src/main/java/com/caimei365/manager/dao/svip/CmSvipHistoryDao.java

@@ -0,0 +1,69 @@
+package com.caimei365.manager.dao.svip;
+
+import com.caimei365.manager.entity.caimei.svip.CmSku;
+import com.caimei365.manager.entity.caimei.svip.CmSvipHistory;
+import com.caimei365.manager.entity.caimei.svip.CmSvipPackage;
+import com.caimei365.manager.entity.caimei.svip.CmSvipProduct;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Mapper
+public interface CmSvipHistoryDao {
+
+    /**
+     * 超级会员列表
+     * @param vip
+     * @return
+     */
+    List<CmSvipHistory> superFind(CmSvipHistory vip);
+
+    /**
+     * 获取状态
+     * @param userId
+     * @return
+     */
+    CmSvipHistory findEndTime(Long userId);
+
+    /**
+     * 超级会员优惠商品
+     * @param svipProduct
+     * @return
+     */
+    List<CmSvipProduct> findProductList(CmSvipProduct svipProduct);
+
+    /**
+     * 商品sku数据
+     * @param productId
+     * @return
+     */
+    CmSku findSku(Integer productId);
+
+    /**
+     * 商品sku
+     * @param productId
+     * @return
+     */
+    CmSku findSvipSku(Integer productId);
+
+    /**
+     * 套餐配置
+     * @return
+     */
+    List<CmSvipPackage> findPackage();
+
+    /**
+     * 更新超级会员套餐信息
+     * @param price
+     * @param duration
+     * @param proportion
+     */
+    void updatePrice(@Param("price") Double price, @Param("duration") Integer duration, @Param("proportion") Integer proportion);
+}

+ 64 - 0
src/main/java/com/caimei365/manager/entity/caimei/svip/CmLadderPrice.java

@@ -0,0 +1,64 @@
+package com.caimei365.manager.entity.caimei.svip;
+
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Data
+public class CmLadderPrice {
+
+    /**
+     * 主键 id
+     */
+    private Integer id;
+    /**
+     * skuId
+     */
+    private Integer skuId;
+    /**
+     * 商品id
+     */
+    private Integer productId;
+    /**
+     * 用户类型,1游客,2普通用户,3会员用户
+     */
+    private Integer userType;
+    /**
+     * 第几阶梯
+     */
+    private Integer ladderNum;
+    /**
+     * 购买数量
+     */
+    private Integer buyNum;
+    /**
+     * 购买价格
+     */
+    private Double buyPrice;
+    /**
+     * 创建人ID
+     */
+    private String createBy;
+    /**
+     * 创建时间
+     */
+    private Date createDate;
+    /**
+     * 最后更新人ID(用户ID)
+     */
+    private String updateBy;
+    /**
+     * 最后更新时间
+     */
+    private Date updateDate;
+    /**
+     * 删除标记 0正常 其它为已删除(使用时间戳记录) 默认值 = 0
+     */
+    private String delFlag;
+}

+ 81 - 0
src/main/java/com/caimei365/manager/entity/caimei/svip/CmSku.java

@@ -0,0 +1,81 @@
+package com.caimei365.manager.entity.caimei.svip;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Data
+public class CmSku {
+
+    /**
+     * skuId
+     */
+    private Integer skuId;
+    /**
+     * 商品Id
+     */
+    private Integer productId;
+    /**
+     * 单品促销优惠价
+     */
+    private Double touchPrice;
+    /**
+     * 包装规格
+     */
+    private String unit;
+    /**
+     * 市场价
+     */
+    private Double normalPrice;
+    /**
+     * 库存
+     */
+    private String stock;
+    /**
+     * 成本价选中标志:1固定成本 2比例成本
+     */
+    private Integer costCheckFlag;
+    /**
+     * 比例成本百分比
+     */
+    private Double costProportional;
+    /**
+     * 成本价
+     */
+    private Double costPrice;
+    /**
+     * 机构价
+     */
+    private Double price;
+    /**
+     * 启用阶梯价格标识 0否 1是
+     */
+    private Integer ladderPriceFlag;
+    /**
+     * 无阶梯价起订量
+     */
+    private Integer minBuyNumber;
+    /**
+     * 拼团价
+     */
+    private Double collagePrice;
+    /**
+     * 限时特价(在采美超级会员商品中指超级会员价)
+     */
+    private Double discountPrice;
+    private List<CmLadderPrice> ladderPriceList;
+    /**
+     * 超级会员会员折扣
+     */
+    private Double discount;
+    /**
+     * 超级会员价类型:1折扣,2优惠价
+     */
+    private Integer priceType;
+}

+ 69 - 0
src/main/java/com/caimei365/manager/entity/caimei/svip/CmSvipHistory.java

@@ -0,0 +1,69 @@
+package com.caimei365.manager.entity.caimei.svip;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Data
+public class CmSvipHistory {
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+    /**
+     * 超级会员套餐ID
+     */
+    private Integer packageId;
+    /**
+     * 生效时间
+     */
+    private String beginTime;
+    /**
+     * 到期时间
+     */
+    private String endTime;
+    private String updateTime;
+    /**
+     * 用户付款方式:1线上,2线下,3余额抵扣,4采美豆抵扣
+     */
+    private String payWay;
+    /**
+     * 付款类型:1建设银行7297、2广发银行0115、3中信银行7172、4中信银行0897、5中信银行0897-财付通、6中信银行0897-支付宝、7线上-支付宝、8线上-微信支付、9线上-快钱支付、10口头返佣、11广发银行5461、12PC-B2B网银、13PC-微信支付、14PC-支付宝、15小程序-微信支付、16余额抵扣、17PC-B2C网银
+     */
+    private String payType;
+    /**
+     * 支付金额
+     */
+    private String price;
+    /**
+     * 抵扣采美豆数量
+     */
+    private String userBeans;
+    /**
+     * 购买时间
+     */
+    private String payTime;
+    /**
+     * jsp页面虚拟字段
+     */
+    private String status;
+    /**
+     * 赠送套餐的月份数
+     */
+    private String giveMonth;
+    private String clubName;
+    private String linkMan;
+    private String mobile;
+    private String startPayTime;
+    private String endPayTime;
+    private String startEndTime;
+    private String endEndTime;
+}

+ 42 - 0
src/main/java/com/caimei365/manager/entity/caimei/svip/CmSvipPackage.java

@@ -0,0 +1,42 @@
+package com.caimei365.manager.entity.caimei.svip;
+
+import lombok.Data;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Data
+public class CmSvipPackage {
+
+    /**
+     * 套餐名称
+     */
+    private String name;
+    /**
+     * 价格
+     */
+    private String price;
+    /**
+     * 套餐价格
+     */
+    private String price1;
+    /**
+     * 套餐价格
+     */
+    private String price2;
+    /**
+     * 套餐价格
+     */
+    private String price3;
+    /**
+     * 套餐时长(月)
+     */
+    private String duration;
+    /**
+     * 采美豆现金兑换比例
+     */
+    private String proportion;
+}

+ 98 - 0
src/main/java/com/caimei365/manager/entity/caimei/svip/CmSvipProduct.java

@@ -0,0 +1,98 @@
+package com.caimei365.manager.entity.caimei.svip;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Data
+public class CmSvipProduct {
+
+    /**
+     * 商品id
+     */
+    private Integer productId;
+    /**
+     * 会员价类型:1折扣,2优惠价
+     */
+    private Integer priceType;
+    /**
+     * 会员折扣
+     */
+    private BigDecimal discount;
+    /**
+     * 会员价
+     */
+    private BigDecimal discountPrice;
+    /**
+     * 排序值
+     */
+    private Integer sort;
+    /**
+     * 添加时间
+     */
+    private Date addTime;
+    /**
+     * 商品图片
+     */
+    private String productImage;
+    /**
+     * 商品名称
+     */
+    private String productName;
+    /**
+     * 供应商名称
+     */
+    private String shopName;
+    /**
+     * 商品机构价
+     */
+    private BigDecimal price;
+    /**
+     * 是否含税   0不含税,1含税
+     */
+    private String includedTax;
+    /**
+     * 发票类型(基于是否含税基础)   1增值税票,2普通票, 3不能开票
+     */
+    private String invoiceType;
+    /**
+     * 机构开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
+     */
+    private String taxPoint;
+    /**
+     * 供应商开票税点(基于不含税基础) :增值税默认13%,普通票6%取值范围[0-100]
+     */
+    private String supplierTaxPoint;
+    /**
+     * 成本价
+     */
+    private String costPrice;
+    /**
+     * 比例成本百分比
+     */
+    private String costProportional;
+    /**
+     * 成本价选中标志:1固定成本 2比例成
+     */
+    private String costCheckFlag;
+    /**
+     * 超级会员价标识
+     */
+    private Integer svipPriceFlag;
+    /**
+     * 优惠状态 1已下架 0已上架
+     */
+    private Integer status;
+    /**
+     * 商品sku
+     */
+    private List<CmSku> skus;
+}

+ 47 - 0
src/main/java/com/caimei365/manager/service/caimei/svip/CmSvipHistoryService.java

@@ -0,0 +1,47 @@
+package com.caimei365.manager.service.caimei.svip;
+
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.svip.CmSvipHistory;
+import com.caimei365.manager.entity.caimei.svip.CmSvipPackage;
+import com.caimei365.manager.entity.caimei.svip.CmSvipProduct;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+public interface CmSvipHistoryService {
+
+    /**
+     * 超级会员列表
+     * @param vip
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PaginationVo<CmSvipHistory>> memberList(CmSvipHistory vip, Integer pageNum, Integer pageSize);
+
+    /**
+     *超级会员优惠商品
+     * @param svipProduct
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    ResponseJson<PaginationVo<CmSvipProduct>> findProductList(CmSvipProduct svipProduct, Integer pageNum, Integer pageSize);
+
+    /**
+     * 套餐配置
+     * @return
+     */
+    ResponseJson<CmSvipPackage> findPackage();
+
+    /**
+     * 更新超级会员套餐信息
+     * @param cmSvipPackage
+     * @return
+     */
+    ResponseJson updatePrice(CmSvipPackage cmSvipPackage);
+}

+ 133 - 0
src/main/java/com/caimei365/manager/service/caimei/svip/impl/CmSvipHistoryServiceImpl.java

@@ -0,0 +1,133 @@
+package com.caimei365.manager.service.caimei.svip.impl;
+
+import com.caimei.utils.AppUtils;
+import com.caimei.utils.StringUtil;
+import com.caimei365.manager.dao.svip.CmSvipHistoryDao;
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.svip.CmSku;
+import com.caimei365.manager.entity.caimei.svip.CmSvipHistory;
+import com.caimei365.manager.entity.caimei.svip.CmSvipPackage;
+import com.caimei365.manager.entity.caimei.svip.CmSvipProduct;
+import com.caimei365.manager.service.caimei.svip.CmSvipHistoryService;
+import com.github.pagehelper.PageHelper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/4/7
+ */
+@Service
+public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
+
+    @Autowired private CmSvipHistoryDao historyDao;
+
+    @Override
+    public ResponseJson<PaginationVo<CmSvipHistory>> memberList(CmSvipHistory vip, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmSvipHistory> historyList = historyDao.superFind(vip);
+        for (CmSvipHistory cmSvipHistory : historyList) {
+            CmSvipHistory vp = historyDao.findEndTime(cmSvipHistory.getUserId());
+            if (vp != null) {
+                cmSvipHistory.setStatus("1");
+            } else {
+                cmSvipHistory.setStatus("2");
+            }
+        }
+        PaginationVo<CmSvipHistory> page = new PaginationVo<>(historyList);
+        return ResponseJson.success(page);
+    }
+
+    /**
+     * 超级会员优惠商品
+     *
+     * @param svipProduct
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @Override
+    public ResponseJson<PaginationVo<CmSvipProduct>> findProductList(CmSvipProduct svipProduct, Integer pageNum, Integer pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmSvipProduct> svipProducts = historyDao.findProductList(svipProduct);
+//        String wwwServer = Global.getConfig("wwwServer");
+        svipProducts.forEach(product -> {
+            CmSku sku = historyDao.findSku(product.getProductId());
+            CmSku skuPrice = historyDao.findSvipSku(product.getProductId());
+            if (null != skuPrice) {
+                product.setPriceType(skuPrice.getPriceType());
+                product.setDiscount(BigDecimal.valueOf(skuPrice.getDiscount()));
+                product.setDiscountPrice(BigDecimal.valueOf(skuPrice.getDiscountPrice()));
+            }
+            product.setPrice(BigDecimal.valueOf(sku.getPrice()));
+            if (StringUtil.isNotBlank(product.getProductImage())) {
+                product.setProductImage(AppUtils.getImageURL("product", product.getProductImage(), 0, "wwwServer"));
+                if (!product.getProductImage().contains("https")) {
+                    product.setProductImage("https://admin.caimei365.com/" + product.getProductImage());
+                }
+            }
+        });
+        PaginationVo<CmSvipProduct> page = new PaginationVo<>(svipProducts);
+        return ResponseJson.success(page);
+    }
+
+    @Override
+    public ResponseJson<CmSvipPackage> findPackage() {
+        // 1 套餐12 、2 套餐3月 、3 套餐1月
+        List<CmSvipPackage> aPackage = historyDao.findPackage();
+        CmSvipPackage vip = new CmSvipPackage();
+        for (CmSvipPackage cmSvipPackage : aPackage) {
+            if (cmSvipPackage.getDuration().equals("12")) {
+                vip.setPrice1(cmSvipPackage.getPrice());
+            }
+            if (cmSvipPackage.getDuration().equals("3")) {
+                vip.setPrice2(cmSvipPackage.getPrice());
+            }
+            if (cmSvipPackage.getDuration().equals("1")) {
+                vip.setPrice3(cmSvipPackage.getPrice());
+            }
+            vip.setProportion(cmSvipPackage.getProportion());
+        }
+        String price1 = strs(vip.getPrice1());
+        String price2 = strs(vip.getPrice2());
+        String price3 = strs(vip.getPrice3());
+        vip.setPrice1(price1);
+        vip.setPrice2(price2);
+        vip.setPrice3(price3);
+        return ResponseJson.success(vip);
+    }
+
+    /**
+     * 更新超级会员套餐信息
+     *
+     * @param cmSvipPackage
+     * @return
+     */
+    @Override
+    public ResponseJson updatePrice(CmSvipPackage cmSvipPackage) {
+        //1 套餐12,2 套餐3月,3 套餐1月
+        Double price1 = Double.valueOf(cmSvipPackage.getPrice1());
+        Double price2 = Double.valueOf(cmSvipPackage.getPrice2());
+        String p = cmSvipPackage.getProportion();
+        Integer proportion = Integer.valueOf(p);
+        historyDao.updatePrice(price1, 12, proportion);
+        historyDao.updatePrice(price2, 3, proportion);
+        return ResponseJson.success(1, "", null);
+    }
+
+    private static String strs(String str) {
+        if (str.indexOf(".") > 0) {
+            // 删掉尾数为0的字符
+            str = str.replaceAll("0+?$", "");
+            //结尾如果是小数点,则去掉
+            str = str.replaceAll("[.]$", "");
+        }
+        return str;
+    }
+}

+ 1 - 1
src/main/resources/application.yml

@@ -11,5 +11,5 @@ spring:
     active: @activatedProperties@
 
 mybatis:
-  mapper-locations: classpath:mapper/*.xml
+  mapper-locations: classpath:mapper/*.xml, classpath:mapper/*/*.xml
 

+ 7 - 1
src/main/resources/mapper/CmBehaciorRecordDao.xml

@@ -173,7 +173,13 @@
         ORDER BY accessTime DESC
     </select>
     <select id="searchList" resultType="com.caimei365.manager.entity.caimei.RetuenEntity">
-        select id , keyword as value from cm_user_search_frequency where trueStatus = 1
+        SELECT cusf.id , cusf.keyword AS VALUE
+        FROM cm_user_search_frequency cusf
+         LEFT JOIN cm_shop_label csl ON csl.keywordId = cusf.id
+         LEFT JOIN cm_shop_relevance csr ON csr.id = csl.relevanceId
+        WHERE cusf.trueStatus = 1
+          AND csl.delFlag = 0
+          AND csr.delFlag = 0
     </select>
     <select id="behaviorShopNameList" resultType="com.caimei365.manager.entity.caimei.CmBehaviorRecord">
         SELECT cbs.recordID, cbs.shopID, s.name FROM cm_behavior_shopId cbs LEFT JOIN shop s ON cbs.shopID = s.shopID

+ 123 - 0
src/main/resources/mapper/svip/CmSvipHistoryDao.xml

@@ -0,0 +1,123 @@
+<?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>