zhijiezhao 2 éve
szülő
commit
fd57893eba

+ 19 - 1
src/main/java/com/caimei/modules/bulkpurchase/entity/PurchaseProduct.java

@@ -1,6 +1,7 @@
 package com.caimei.modules.bulkpurchase.entity;
 
 import com.caimei.modules.product.entity.CmPromotion;
+import com.caimei.modules.product.entity.CmSku;
 import com.caimei.po.ProductLadderPrice;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 import org.hibernate.validator.constraints.Length;
@@ -65,7 +66,8 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
     private String oldProductFlag;//是否是旧商品 0否 1是
     private String commodityType; //商品属性:1产品,2仪器
     private Integer couponsLogo;    //显示优惠券查看: 1不显示 2显示
-
+    private List<CmSku> skuList;
+    private Integer skuStr;
 
     /**
      * 超级会员优惠价格标识:0不是,1是
@@ -92,6 +94,14 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
      */
     private Double svipTaxReduction;
 
+    public Integer getSkuStr() {
+        return skuStr;
+    }
+
+    public void setSkuStr(Integer skuStr) {
+        this.skuStr = skuStr;
+    }
+
     public String getDiscounts() {
         return discounts;
     }
@@ -104,6 +114,14 @@ public class PurchaseProduct extends DataEntity<PurchaseProduct> {
         return ladderPriceFlag;
     }
 
+    public List<CmSku> getSkuList() {
+        return skuList;
+    }
+
+    public void setSkuList(List<CmSku> skuList) {
+        this.skuList = skuList;
+    }
+
     public void setLadderPriceFlag(Integer ladderPriceFlag) {
         this.ladderPriceFlag = ladderPriceFlag;
     }

+ 8 - 9
src/main/java/com/caimei/modules/bulkpurchase/web/PurchaseProductController.java

@@ -98,6 +98,14 @@ public class PurchaseProductController extends BaseController {
         }
         for (PurchaseProduct p : list) {
             if (p != null) {
+                //是否有优惠券可以查看
+                Boolean couponsLogo = cmCouponService.setCouponsLogo(userId, p.getProductId().intValue(), Integer.valueOf(p.getShopId()), p.getCommodityType());
+                if (couponsLogo) {
+                    p.setCouponsLogo(2);
+                } else {
+                    p.setCouponsLogo(1);
+                }
+                p.setSkuList(productDao.findSkuList(p.getProductId().intValue()));
                 long productId = p.getProductId();
                 String discountPrice = p.getPrice();//默认折扣单价
                 if (priceFlag) {
@@ -189,15 +197,6 @@ public class PurchaseProductController extends BaseController {
                     }
                 }
             }
-            if (p != null) {
-                //是否有优惠券可以查看
-                Boolean couponsLogo = cmCouponService.setCouponsLogo(userId, p.getProductId().intValue(), Integer.valueOf(p.getShopId()), p.getCommodityType());
-                if (couponsLogo) {
-                    p.setCouponsLogo(2);
-                } else {
-                    p.setCouponsLogo(1);
-                }
-            }
         }
         model.addAttribute("page", page);
         if (StringUtils.equals(purchaseProduct.getFlag(), "1")) {

+ 10 - 1
src/main/java/com/caimei/modules/product/dao/ProductDao.java

@@ -17,7 +17,6 @@ public interface ProductDao extends CrudDao<Product> {
     List<ActType> getAllActType();
 
 
-
     int saveSort(@Param("sort") String sort, @Param("id") String id);
 
     int findLadderPriceByNum(@Param("productID") String productID);
@@ -194,4 +193,14 @@ public interface ProductDao extends CrudDao<Product> {
     String getSplitCodeByProductId(Integer productID);
 
     List<CmSplitCode> findSplitCodesByShopId(Integer shopID);
+
+    void insertSku(CmSku s);
+
+    void insertCmLadderPrice(CmLadderPrice l);
+
+    void deleteSkus(Integer productID);
+
+    List<CmSku> findSkuList(Integer productID);
+
+    List<CmLadderPrice> findLadderPriceBySku(@Param("skuId") Integer skuId, @Param("productId") Integer productId);
 }

+ 32 - 0
src/main/java/com/caimei/modules/product/entity/CmLadderPrice.java

@@ -0,0 +1,32 @@
+package com.caimei.modules.product.entity;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author zzj
+ */
+@Data
+@SuppressWarnings("all")
+@Accessors(fluent = true)
+public class CmLadderPrice implements Serializable{
+    private static final long serialVersionUID = 1L;
+    /**
+     * 主键 id
+     */
+    private Integer id;
+    private Integer skuId;
+    private Integer productId; // 商品id
+    private Integer userType;  // 用户类型,1游客,2普通用户,3会员用户
+    private Integer ladderNum;  // 第几阶梯
+    private Integer buyNum; // 购买数量
+    private Double buyPrice; // 购买价格
+    private String createBy; // 创建人ID
+    private Date createDate; // 创建时间
+    private String updateBy; //  最后更新人ID(用户ID)
+    private Date updateDate; // 最后更新时间
+    private String delFlag; // 删除标记 0正常 其它为已删除(使用时间戳记录) 默认值 = 0
+}

+ 124 - 0
src/main/java/com/caimei/modules/product/entity/CmSku.java

@@ -0,0 +1,124 @@
+package com.caimei.modules.product.entity;
+
+import com.caimei.po.ProductLadderPrice;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+/**
+ * @author zzj
+ */
+@SuppressWarnings("all")
+@Data
+@Accessors(fluent = true)
+public class CmSku {
+    private Integer skuId;
+    private Integer productId;
+    private String unit;        // 包装规格
+    private Double normalPrice;        // 市场价
+    private String stock;        // 库存
+    private Integer costCheckFlag;        // 成本价选中标志:1固定成本 2比例成本
+    private Integer costProportional;        // 比例成本百分比
+    private Double costPrice;        // 成本价
+    private Double price;        // 机构价
+    private Integer ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
+    private Integer minBuyNumber;        // 无阶梯价起订量
+    private List<CmLadderPrice> ladderPriceList;
+
+    public Integer getProductId() {
+        return productId;
+    }
+
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
+    public String getUnit() {
+        return unit;
+    }
+
+    public void setUnit(String unit) {
+        this.unit = unit;
+    }
+
+    public Double getNormalPrice() {
+        return normalPrice;
+    }
+
+    public void setNormalPrice(Double normalPrice) {
+        this.normalPrice = normalPrice;
+    }
+
+    public String getStock() {
+        return stock;
+    }
+
+    public void setStock(String stock) {
+        this.stock = stock;
+    }
+
+    public Integer getCostCheckFlag() {
+        return costCheckFlag;
+    }
+
+    public void setCostCheckFlag(Integer costCheckFlag) {
+        this.costCheckFlag = costCheckFlag;
+    }
+
+    public Integer getCostProportional() {
+        return costProportional;
+    }
+
+    public void setCostProportional(Integer costProportional) {
+        this.costProportional = costProportional;
+    }
+
+    public Double getCostPrice() {
+        return costPrice;
+    }
+
+    public void setCostPrice(Double costPrice) {
+        this.costPrice = costPrice;
+    }
+
+    public Double getPrice() {
+        return price;
+    }
+
+    public void setPrice(Double price) {
+        this.price = price;
+    }
+
+    public Integer getLadderPriceFlag() {
+        return ladderPriceFlag;
+    }
+
+    public void setLadderPriceFlag(Integer ladderPriceFlag) {
+        this.ladderPriceFlag = ladderPriceFlag;
+    }
+
+    public Integer getMinBuyNumber() {
+        return minBuyNumber;
+    }
+
+    public void setMinBuyNumber(Integer minBuyNumber) {
+        this.minBuyNumber = minBuyNumber;
+    }
+
+    public List<CmLadderPrice> getLadderPriceList() {
+        return ladderPriceList;
+    }
+
+    public void setLadderPriceList(List<CmLadderPrice> ladderPriceList) {
+        this.ladderPriceList = ladderPriceList;
+    }
+}

+ 19 - 14
src/main/java/com/caimei/modules/product/entity/Product.java

@@ -29,7 +29,7 @@ public class Product extends DataEntity<Product> {
     private String searchKey;        // 搜索关键词
     private String productRemarks;//商品备注
     private Double normalPrice;        // 市场价
-    private Double price;        // price
+    private Double price;        // 机构价
     private String priceFlag;        // 会员用户价格展示标志 0 否 1 是
     private String beautyActFlag;        // 游客价格文字
     private String ladderPriceFlag;        // 启用阶梯价格标识 0否 1是
@@ -87,7 +87,9 @@ public class Product extends DataEntity<Product> {
     private Integer combinationID;//商品组合Id
     private String productDetail; //普通机构商品详情1同资质机构商品详情,2用普通机构商品详情
     private String splitCode; //  该商品分账商户号
+    private List<CmSku> skuList;
     //-----------------  虚拟字段 ----
+    private Integer skuId;
     private Integer shopType; //供应商类别,0未审核的二手供应商,普通1,新品供应商2,二手供应商3
     private boolean customClass = false;  //是否有自定义分类
     private String brandName;//品牌名称
@@ -171,19 +173,6 @@ public class Product extends DataEntity<Product> {
      * 商品别名
      */
     private String aliasName;
-//    /**
-//     * 普通用户价格等级(范围1-5)
-//     */
-//    private String price0Grade;
-//    /**
-//     * 会员用户价格等级(范围1-5)
-//     */
-//    private String price1Grade;
-//
-//    /**
-//     * 游客用户价格等级(范围1-5)
-//     */
-//    private String price8Grade;
     /**
      * (3:高可见度,2:中可见度,1:低可见度)
      */
@@ -292,6 +281,22 @@ public class Product extends DataEntity<Product> {
     //税率
     private Double taxRate;
 
+    public Integer getSkuId() {
+        return skuId;
+    }
+
+    public void setSkuId(Integer skuId) {
+        this.skuId = skuId;
+    }
+
+    public List<CmSku> getSkuList() {
+        return skuList;
+    }
+
+    public void setSkuList(List<CmSku> skuList) {
+        this.skuList = skuList;
+    }
+
     public String[] getValidFlagString() {
         return validFlagString;
     }

+ 37 - 35
src/main/java/com/caimei/modules/product/service/CmProductCombinationService.java

@@ -2,6 +2,7 @@ package com.caimei.modules.product.service;
 
 import java.util.List;
 
+import com.caimei.modules.product.dao.ProductDao;
 import com.caimei.modules.product.entity.Product;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Service;
@@ -16,6 +17,7 @@ import javax.annotation.Resource;
 
 /**
  * 组合商品Service
+ *
  * @author lijun
  * @version 2020-04-29
  */
@@ -25,62 +27,62 @@ public class CmProductCombinationService extends CrudService<CmProductCombinatio
 	@Resource
 	public CmProductCombinationDao CmProductCombinationDao;
 
-	public CmProductCombination get(String id) {
-		return super.get(id);
-	}
+    public CmProductCombination get(String id) {
+        return super.get(id);
+    }
 
-	public List<CmProductCombination> findList(CmProductCombination cmProductCombination) {
-		return super.findList(cmProductCombination);
-	}
+    public List<CmProductCombination> findList(CmProductCombination cmProductCombination) {
+        return super.findList(cmProductCombination);
+    }
 
-	public Page<CmProductCombination> findPage(Page<CmProductCombination> page, CmProductCombination cmProductCombination) {
-		return super.findPage(page, cmProductCombination);
-	}
+    public Page<CmProductCombination> findPage(Page<CmProductCombination> page, CmProductCombination cmProductCombination) {
+        return super.findPage(page, cmProductCombination);
+    }
 
-	@Transactional(readOnly = false)
-	public void save(CmProductCombination cmProductCombination) {
-		super.save(cmProductCombination);
-	}
+    @Transactional(readOnly = false)
+    public void save(CmProductCombination cmProductCombination) {
+        super.save(cmProductCombination);
+    }
 
-	@Transactional(readOnly = false)
-	public void saveSort(String sort,String id ) {
-		CmProductCombinationDao.saveSort(sort,id);
-	}
+    @Transactional(readOnly = false)
+    public void saveSort(String sort, String id) {
+        CmProductCombinationDao.saveSort(sort, id);
+    }
 
-	@Transactional(readOnly = false)
-	public void delete(CmProductCombination cmProductCombination) {
-		super.delete(cmProductCombination);
-	}
+    @Transactional(readOnly = false)
+    public void delete(CmProductCombination cmProductCombination) {
+        super.delete(cmProductCombination);
+    }
 
 
-	@Transactional(readOnly = false)
-	public void untieProduct(String combinationId) {
-		CmProductCombinationDao.untieProduct(combinationId);
-	}
+    @Transactional(readOnly = false)
+    public void untieProduct(String combinationId) {
+        CmProductCombinationDao.untieProduct(combinationId);
+    }
 
 	@Transactional(readOnly = false)
 	public void addProductCombination(@Param("id")String id, @Param("productIds")String[] productIds){
 		CmProductCombinationDao.addProductCombination(id,productIds);
 	}
 
-	@Transactional(readOnly = false)
-	public void untieProductByProductId(Integer combinationId) {
-		CmProductCombinationDao.untieProductByProductId(combinationId);
-	}
+    @Transactional(readOnly = false)
+    public void untieProductByProductId(Integer skuId) {
+        CmProductCombinationDao.untieProductByProductId(skuId);
+    }
 
 
-	public List<Product> findCombinationProductList(String id) {
-		return CmProductCombinationDao.findCombinationProductList(id);
-	}
+    public List<Product> findCombinationProductList(String id) {
+        return CmProductCombinationDao.findCombinationProductList(id);
+    }
 
 
 	public List<Product> findProductList(Product product) {
 		return CmProductCombinationDao.findProductList(product);
 	}
 
-	public List<CmProductCombination> findProductCombinationList(){
-		return CmProductCombinationDao.findProductCombinationList();
-	}
+    public List<CmProductCombination> findProductCombinationList() {
+        return CmProductCombinationDao.findProductCombinationList();
+    }
 
 
 }

+ 53 - 38
src/main/java/com/caimei/modules/product/service/ProductService.java

@@ -346,7 +346,7 @@ public class ProductService extends CrudService<ProductDao, Product> {
         return productDao.queryProductDetailInfo(productID);
     }
 
-    public Product qualification(Integer productID){
+    public Product qualification(Integer productID) {
         return productDao.qualification(productID);
     }
 
@@ -374,9 +374,6 @@ public class ProductService extends CrudService<ProductDao, Product> {
 
     @Transactional(readOnly = false)
     public void saveProduct(Product product, ProductDetailInfo productDetailInfo) {
-        String detailInfo = product.getDetailInfo();
-        String orderInfo = product.getOrderInfo();
-        String serviceInfo = product.getServiceInfo();
         List<ProductLadderPrice> ladderPriceList = product.getLadderPriceList();
         // 上传商品图片
         String qualificationImg = product.getQualificationImg();
@@ -395,36 +392,26 @@ public class ProductService extends CrudService<ProductDao, Product> {
             }
         }
         product.setQualificationImg(res);
-        if(product.getNewProductType()==1){
+        if (product.getNewProductType() == 1) {
             product.setShowFlag(1);
-        }else if(product.getNewProductType()==2){
+        } else if (product.getNewProductType() == 2) {
             product.setShowFlag(3);
         }
-        if(product.getVisibility()==null){
+        if (product.getVisibility() == null) {
             product.setVisibility("3");
         }
-//        if(StringUtils.isNotBlank(product.getSplitCode())&&"0".equals(product.getSplitCode())){
-//            product.setSplitCode(null);
-//        }
         if (null != product.getShopType() && 2 == product.getShopType()) {
             product.setValidFlag("2");
-            if(StringUtils.isNotBlank(product.getCostPrice())){
-                product.setSqlCostPrice(Double.valueOf(product.getCostPrice()));
-            }
-            if(StringUtils.isNotBlank(product.getTaxPoint())){
+            if (StringUtils.isNotBlank(product.getTaxPoint())) {
                 product.setSqlTaxPoint(Double.valueOf(product.getTaxPoint()));
             }
-            if(StringUtils.isNotBlank(product.getSupplierTaxPoint())){
+            if (StringUtils.isNotBlank(product.getSupplierTaxPoint())) {
                 product.setSqlSupplierTaxPoint(Double.valueOf(product.getSupplierTaxPoint()));
             }
-            if(StringUtils.isNotBlank(product.getCostProportional())){
-                product.setSqlCostProportional(Double.valueOf(product.getCostProportional()));
-            }
-
-
-logger.info("+++++++++++++++++++++++"+product);
             //保存商品信息
             productDao.insert(product);
+            //保存sku
+            addSkus(product);
             productDetailInfo.setProductID(product.getProductID());
             // 保存商品图片
             String image1 = product.getImage1();
@@ -436,12 +423,12 @@ logger.info("+++++++++++++++++++++++"+product);
             String image2 = product.getImage2();
             if (StringUtils.isNotEmpty(image2)) {
                 String imageUrl = getImageUrl(image2);
-                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
             }
             String image3 = product.getImage3();
             if (StringUtils.isNotEmpty(image3)) {
                 String imageUrl = getImageUrl(image3);
-                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
             }
             String image4 = product.getImage4();
             if (StringUtils.isNotEmpty(image4)) {
@@ -451,11 +438,14 @@ logger.info("+++++++++++++++++++++++"+product);
             String image5 = product.getImage5();
             if (StringUtils.isNotEmpty(image5)) {
                 String imageUrl = getImageUrl(image5);
-                addProductImage(imageUrl, "0",  product.getProductID(), product.getShopID());
+                addProductImage(imageUrl, "0", product.getProductID(), product.getShopID());
             }
             productDao.updateMainImage(product);
-        }else{
+        } else {
             productDao.updateByPrimaryKeySelective(product);
+            //删除旧sku,insert新的
+            productDao.deleteSkus(product.getProductID());
+            addSkus(product);
         }
         ProductDetailInfo queryProductDetailInfo = productDao.queryProductDetailInfo(product.getProductID());
         if (queryProductDetailInfo != null) {
@@ -494,6 +484,23 @@ logger.info("+++++++++++++++++++++++"+product);
         }
     }
 
+    public void addSkus(Product product) {
+        //保存sku
+        List<CmSku> skuList = product.getSkuList();
+        if (null != skuList && skuList.size() > 0) {
+            skuList.forEach(s -> {
+                s.productId(product.getProductID());
+                productDao.insertSku(s);
+                if (null != s.ladderPriceFlag() && 1 == s.ladderPriceFlag()) {
+                    s.ladderPriceList().forEach(l -> {
+                        l.skuId(s.skuId());
+                        productDao.insertCmLadderPrice(l);
+                    });
+                }
+            });
+        }
+    }
+
     public void addProductImage(String image, String mainFlag, Integer productID, Integer shopID) {
         SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String dateStr = simpleDateFormat.format(new Date());
@@ -572,22 +579,22 @@ logger.info("+++++++++++++++++++++++"+product);
     public Page<Product> newfindProductImage(Page<Product> page, Product product) {
         product.setPage(page);
         List<Product> productList = productDao.newfindProductImage(product);
-        int num=0;
+        int num = 0;
 
-        for (int i=0;i<productList.size();i++){
+        for (int i = 0; i < productList.size(); i++) {
             Date currentTime = new Date();
-                SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-                String dateString = formatter.format(currentTime);
+            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String dateString = formatter.format(currentTime);
             /**
              *如果有设置展示开始时间就当前时间判断,如果没有就用商品创建时间判断当前时间;
              */
-                if(productList.get(i).getShowTime()!=null){
-                    num=productList.get(i).getShowTime().compareTo(dateString);
-                }else if(productList.get(i).getAddTime()!=null) {
-                    num=productList.get(i).getAddTime().compareTo(dateString);
-                }
-            if(num<0){
-              product.setShowFlag(2);
+            if (productList.get(i).getShowTime() != null) {
+                num = productList.get(i).getShowTime().compareTo(dateString);
+            } else if (productList.get(i).getAddTime() != null) {
+                num = productList.get(i).getAddTime().compareTo(dateString);
+            }
+            if (num < 0) {
+                product.setShowFlag(2);
                 product.setRecommend(0);
                 product.setProductID(productList.get(i).getProductID());
                 newPageFloorDao.updatshowFlag(product);
@@ -599,9 +606,9 @@ logger.info("+++++++++++++++++++++++"+product);
         }
         page.setList(productList);
         return page;
-   }
+    }
 
-    public Product productList(Product product){
+    public Product productList(Product product) {
 
         return productDao.productList(product);
     }
@@ -621,4 +628,12 @@ logger.info("+++++++++++++++++++++++"+product);
     public List<CmSplitCode> getCodes(Integer shopId) {
         return productDao.findSplitCodesByShopId(shopId);
     }
+
+    public List<CmSku> findSkuList(Integer productID) {
+        List<CmSku> skus = productDao.findSkuList(productID);
+        skus.forEach(s -> {
+            s.ladderPriceList(productDao.findLadderPriceBySku(s.skuId(), s.productId()));
+        });
+        return skus;
+    }
 }

+ 51 - 59
src/main/java/com/caimei/modules/product/web/ProductNewController.java

@@ -1,5 +1,6 @@
 package com.caimei.modules.product.web;
 
+import com.alibaba.fastjson.JSON;
 import com.caimei.dfs.image.beens.ImageUploadInfo;
 import com.caimei.modules.brand.entity.CmBrand;
 import com.caimei.modules.brand.service.CmBrandService;
@@ -114,7 +115,7 @@ public class ProductNewController extends BaseController {
     @RequiresPermissions("product:product:view")
     @RequestMapping(value = {"list", ""})
     public String list(Product product, HttpServletRequest request, HttpServletResponse response, Model model) {
-      Product pro=product;
+        Product pro = product;
         String id = product.getId();
         if (StringUtils.isEmpty(id)) {
             String shopName = product.getSearchShopName();
@@ -151,8 +152,8 @@ public class ProductNewController extends BaseController {
                 product.setTinyTypeID(searchTinyTypeID);
             }
             if (StringUtils.isNotEmpty(searchValidFlag) && !"on".equals(searchValidFlag)) {
-                if(searchValidFlag.contains("7")){
-                    searchValidFlag=searchValidFlag.replace("7","10");
+                if (searchValidFlag.contains("7")) {
+                    searchValidFlag = searchValidFlag.replace("7", "10");
                 }
                 String[] split = searchValidFlag.split(",");
                 product.setValidFlagString(split);
@@ -321,16 +322,6 @@ public class ProductNewController extends BaseController {
     public String editProduct(Product product, Model model) {
         if (null != product.getProductID()) {
             ProductDetailInfo productDetailInfo = productService.getProductDetailInfo(product.getProductID());
-//            Product produ=productService.qualification(product.getProductID());
-//            if(null != produ){
-//                product.setQualificationLink(produ.getQualificationLink());
-//                product.setQualificationNo(produ.getQualificationNo());
-//                product.setQualificationTime(produ.getQualificationTime());
-//                product.setProductName(produ.getProductName());
-//            }
-
-
-            List<ProductLadderPrice> ladderPriceList = productService.findLadderPrice(product.getProductID());
             if (null != productDetailInfo) {
                 product.setDetailInfo(productDetailInfo.getDetailInfo());
                 product.setServiceInfo(productDetailInfo.getServiceInfo());
@@ -338,8 +329,8 @@ public class ProductNewController extends BaseController {
                 product.setCommonDetailInfo(productDetailInfo.getCommonDetailInfo());
             }
             product.setProductDescribe(productService.findProductDescribe(product.getProductID()));
-            product.setLadderPriceList(ladderPriceList);
             product.setProductDetail(productService.findProductDetail(product.getProductID()));
+            product.setSkuList(productService.findSkuList(product.getProductID()));
         } else {
             //发布特殊商品给默认值
             product.setIncludedTax("2");
@@ -397,13 +388,14 @@ public class ProductNewController extends BaseController {
             product.setSupplierTaxPoint(product.getTaxPoint());
         }
         List<SplitCode> splitCodeList = productNewDao.findSplitCode(product.getShopID());
-        model.addAttribute("splitCodeList",splitCodeList);
+        model.addAttribute("splitCodeList", splitCodeList);
         model.addAttribute("combinationList", combinationList);
         model.addAttribute("brandList", brandList);
         model.addAttribute("shopList", shopList);
         model.addAttribute("classify", classify);
         model.addAttribute("provinceList", provinceList);
         model.addAttribute("product", product);
+        model.addAttribute("productJson", JSON.toJSONString(product));
         return "modules/product-new/productEdit";
     }
 
@@ -469,7 +461,6 @@ public class ProductNewController extends BaseController {
     @RequiresPermissions("product:product:edit")
     @RequestMapping(value = "productSave")
     public String productSave(Product product, ProductDetailInfo productDetailInfo, RedirectAttributes redirectAttributes) {
-
         // 组合搜索关键词
         List<String> searchKeyList = product.getSearchKeyList();
         String searchKeyStr = "";
@@ -867,7 +858,7 @@ public class ProductNewController extends BaseController {
 
     @RequestMapping("auditProduct")
     @ResponseBody
-    public Map<String, Object> auditProduct(String validFlag,Integer newvalidFlag,String showtime, Integer productID, String remarks) {
+    public Map<String, Object> auditProduct(String validFlag, Integer newvalidFlag, String showtime, Integer productID, String remarks) {
         Map<String, Object> map = Maps.newLinkedHashMap();
         try {
             if (StringUtils.isBlank(validFlag) || null == productID) {
@@ -900,48 +891,48 @@ public class ProductNewController extends BaseController {
                 }
             }
 
-            productNewService.auditProduct(validFlag,newvalidFlag,showtime, beforeValidFlag, productID);
+            productNewService.auditProduct(validFlag, newvalidFlag, showtime, beforeValidFlag, productID);
             SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             String current = dateFormat.format(new Date());
             MessageCenter messageCenter = new MessageCenter();
-           Integer shopid= messageCenterDao.shopID(productID);
-           if("8".equals(validFlag)){
-               messageCenter.setShopId(shopid);
-               messageCenter.setClubId(null);
-               messageCenter.setUserType(2);
-               messageCenter.setMessageType(2);
-               messageCenter.setShopMessType(3);
-               messageCenter.setContent(null);
-               messageCenter.setProductId(productID);
-               messageCenter.setTime(current);
-               messageCenterDao.addMessageCenter(messageCenter);
-               Product pro=new Product();
-               pro=productNewDao.validIList(productID);
-                   String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
-                   boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
-                   if(sendSms){
-                       logger.info(">>>>>>>发送成功");
-                   }
-               try {
-                   logger.info("********供应商审核失败微信公众号推送********");
-                   String unionid = newShopOrderDao.UnionId(pro.getUserId());
-                   logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid);
-                   List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
+            Integer shopid = messageCenterDao.shopID(productID);
+            if ("8".equals(validFlag)) {
+                messageCenter.setShopId(shopid);
+                messageCenter.setClubId(null);
+                messageCenter.setUserType(2);
+                messageCenter.setMessageType(2);
+                messageCenter.setShopMessType(3);
+                messageCenter.setContent(null);
+                messageCenter.setProductId(productID);
+                messageCenter.setTime(current);
+                messageCenterDao.addMessageCenter(messageCenter);
+                Product pro = new Product();
+                pro = productNewDao.validIList(productID);
+                String content = "【采美365】您有商品未通过审核,暂时不能上架采美商城。请登录采美平台修改商品信息后重新发布。";
+                boolean sendSms = newOrderService.getSendSms(9, pro.getMobile(), content);
+                if (sendSms) {
+                    logger.info(">>>>>>>发送成功");
+                }
+                try {
+                    logger.info("********供应商审核失败微信公众号推送********");
+                    String unionid = newShopOrderDao.UnionId(pro.getUserId());
+                    logger.info("userid>>>>>>>>>>>>>>>" + pro.getUserId() + "unionid》》》》》》》》》》" + unionid);
+                    List<String> openidList = newShopOrderDao.getOpenidListByPermission(unionid);
 
-                   String accessToken = weChatService.getAccessToken();
-                   Date date=new Date();
-                   String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
+                    String accessToken = weChatService.getAccessToken();
+                    Date date = new Date();
+                    String auditTime = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
 
-                   String pagePath = "/pages/login/apply-supplier";
-                   for (String openid : openidList) {
-                       weChatService.sendTemp(accessToken, openid,pro.getName(),auditTime, pagePath);
-                   }
-               } catch (Exception e) {
-                   logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
-               }
-           }
-            if(newvalidFlag!=null){
-                if(newvalidFlag ==2) {
+                    String pagePath = "/pages/login/apply-supplier";
+                    for (String openid : openidList) {
+                        weChatService.sendTemp(accessToken, openid, pro.getName(), auditTime, pagePath);
+                    }
+                } catch (Exception e) {
+                    logger.error("【供应商审核失败通知】获取微信公众号access_token异常!", e);
+                }
+            }
+            if (newvalidFlag != null) {
+                if (newvalidFlag == 2) {
                     messageCenter.setShopId(shopid);
                     messageCenter.setClubId(null);
                     messageCenter.setUserType(2);
@@ -989,7 +980,7 @@ public class ProductNewController extends BaseController {
             if (null == validFlag || "".equals(validFlag) || null == productID) {
                 throw new Exception("参数错误!");
             }
-            productNewService.auditProduct(validFlag,null,null,null, productID);
+            productNewService.auditProduct(validFlag, null, null, null, productID);
             map.put("success", true);
             map.put("msg", "操作成功");
             // 更新二手商品上架信息
@@ -1050,7 +1041,7 @@ public class ProductNewController extends BaseController {
 
             }
             // 更新商品库上下架状态
-            productNewService.auditProduct(validFlag,null, null,null, productId);
+            productNewService.auditProduct(validFlag, null, null, null, productId);
             map.put("success", true);
             cleanRedisCache();
         } catch (Exception e) {
@@ -1184,18 +1175,19 @@ public class ProductNewController extends BaseController {
      */
     @RequestMapping("/hehe/move")
     @ResponseBody
-    public String moveHeheProducts(){
+    public String moveHeheProducts() {
         productNewService.moveHeheProducts();
         return "success";
     }
 
     /**
      * 补充数据
+     *
      * @return
      */
     @RequestMapping("/hehe/data/add")
     @ResponseBody
-    public String addProductData(){
+    public String addProductData() {
         productNewService.addProductData();
         return "success";
     }
@@ -1205,7 +1197,7 @@ public class ProductNewController extends BaseController {
      */
     @RequestMapping("/hehe/back")
     @ResponseBody
-    public String backHeheProducts(){
+    public String backHeheProducts() {
         productNewService.backHeheProducts();
         return "success";
     }

+ 5 - 4
src/main/resources/config/dev/caimei.properties

@@ -12,9 +12,9 @@
 #mysql database setting
 jdbc.type=mysql
 jdbc.driver=com.mysql.cj.jdbc.Driver
-jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
+jdbc.url=jdbc:mysql://192.168.2.100:3306/caimei?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
 jdbc.username=developer
-jdbc.password=J5p3tgOVazNl4ydf
+jdbc.password=05bZ/OxTB:X+yd%1
 
 #jdbc.url=jdbc:mysql://120.79.25.27:3306/caimei?characterEncoding=UTF8&serverTimezone=Asia/Shanghai
 #jdbc.username=developer
@@ -40,9 +40,10 @@ jdbc.pool.maxActive=20
 jdbc.testSql=SELECT 'x' FROM DUAL
 
 #redis settings
-redis.host=47.119.112.46
+redis.keyPrefix=caimei-manager
+redis.host=192.168.2.100
 redis.port=6379
-redis.pass=6#xsI%b4o@5c3RoE
+redis.pass=123456
 redis.timeout=100000
 #\u6700\u5927\u8FDE\u63A5\u6570
 redis.pool.maxActive=300

+ 1872 - 1839
src/main/resources/mappings/modules/product/ProductMapper.xml

@@ -2,13 +2,13 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei.modules.product.dao.ProductDao">
 
-	<resultMap  id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
-		<id  property="id" column="id"/>
-		<result  property="name" column="name"/>
-	</resultMap>
+    <resultMap id="productModelResultMap" type="com.caimei.modules.product.entity.Product">
+        <id property="id" column="id"/>
+        <result property="name" column="name"/>
+    </resultMap>
 
-	<sql id="productColumns">
-		a.productID AS "id",
+    <sql id="productColumns">
+        a.productID AS "id",
 		a.productID AS "productID",
 		a.brandID AS "brandID",
 		a.bigTypeID AS "bigTypeID",
@@ -101,333 +101,325 @@
 
     </sql>
 
-	<sql id="productJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID
+    <sql id="productJoins">
+        LEFT JOIN shop s on s.shopID = a.shopID
 		left join product p on a.productID = p.productId
-	</sql>
-	<sql id="ActivityJoins">
-		LEFT JOIN shop s on s.shopID = a.shopID
-	</sql>
-
-	<update id="saveSort">
-		UPDATE cm_search_recommend_product SET
-			sort = #{sort}
-		WHERE id = #{id}
-	</update>
-
-	<select id="findLadderPriceByNum" resultType="Integer">
-		select IFNULL(buyNum,1)
-		FROM product_ladder_price
-		WHERE  userType = 3 and ladderNum = 1 and delFlag = 0  and productID = #{productID}
-	</select>
-
-	<select id="get" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		WHERE a.productID = #{id}
-	</select>
-
-
-	<select id="getAllExistsProductList" resultType="Integer">
-		SELECT
-			a.productID
-		FROM cm_mall_organize_products a
-		WHERE a.delFlag = 0 and a.organizeID = #{organizeID}
-	</select>
-
-	<select id="findRecommendPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null and productID !=''">
-				AND a.productID=#{productID}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</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="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="speCommisionFlag !=null and speCommisionFlag !=''">
-				AND a.speCommisionFlag=#{speCommisionFlag}
-			</if>
-			<if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
-				AND a.displayOnCRMFlag=#{displayOnCRMFlag}
-			</if>
-			<if test="crmBigTypeId !=null and crmBigTypeId !=''">
-				AND a.crmBigTypeId=#{crmBigTypeId}
-			</if>
-			<if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
-				AND a.crmSmallTypeId=#{crmSmallTypeId}
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			<choose>
-				<when test="actType != null and actType != ''">
-					AND a.actType = #{actType}
-				</when>
-				<otherwise>
-					AND a.actType != 3
-				</otherwise>
-			</choose>
-			AND a.validFlag != 0
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
-	<select id="findListBuyMall" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null and productID !=''">
-				AND a.productID=#{productID}
-			</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="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			AND a.validFlag in (2,3,9)
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findList" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</if>
-			<if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
-				<if test="preferredFlag/100>=1">
-					AND a.preferredFlag in (100,101,110,111)
-				</if>
-				<if test="(preferredFlag%100)/10>=1">
-					AND a.preferredFlag in (10,11,110,111)
-				</if>
-				<if test="preferredFlag%10>=1">
-					AND a.preferredFlag in (1,11,101,111)
-				</if>
-			</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="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actType !=null and actType !=''">
-				AND a.actType=#{actType}
-			</if>
-			<if test="speCommisionFlag !=null and speCommisionFlag !=''">
-				AND a.speCommisionFlag=#{speCommisionFlag}
-			</if>
-			<if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
-				AND a.displayOnCRMFlag=#{displayOnCRMFlag}
-			</if>
-			<if test="crmBigTypeId !=null and crmBigTypeId !=''">
-				AND a.crmBigTypeId=#{crmBigTypeId}
-			</if>
-			<if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
-				AND a.crmSmallTypeId=#{crmSmallTypeId}
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag != 0
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findAllList" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-			</otherwise>
-
-		</choose>
-	</select>
+    </sql>
+    <sql id="ActivityJoins">
+        LEFT JOIN shop s on s.shopID = a.shopID
+    </sql>
+
+    <update id="saveSort">
+        UPDATE cm_search_recommend_product
+        SET sort = #{sort}
+        WHERE id = #{id}
+    </update>
+
+    <select id="findLadderPriceByNum" resultType="Integer">
+        select IFNULL(buyNum, 1)
+        FROM product_ladder_price
+        WHERE userType = 3
+          and ladderNum = 1
+          and delFlag = 0
+          and productID = #{productID}
+    </select>
+
+    <select id="get" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        WHERE a.productID = #{id}
+    </select>
+
+
+    <select id="getAllExistsProductList" resultType="Integer">
+        SELECT a.productID
+        FROM cm_mall_organize_products a
+        WHERE a.delFlag = 0
+          and a.organizeID = #{organizeID}
+    </select>
+
+    <select id="findRecommendPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null and productID !=''">
+                AND a.productID=#{productID}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </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="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="speCommisionFlag !=null and speCommisionFlag !=''">
+                AND a.speCommisionFlag=#{speCommisionFlag}
+            </if>
+            <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
+                AND a.displayOnCRMFlag=#{displayOnCRMFlag}
+            </if>
+            <if test="crmBigTypeId !=null and crmBigTypeId !=''">
+                AND a.crmBigTypeId=#{crmBigTypeId}
+            </if>
+            <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
+                AND a.crmSmallTypeId=#{crmSmallTypeId}
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            <choose>
+                <when test="actType != null and actType != ''">
+                    AND a.actType = #{actType}
+                </when>
+                <otherwise>
+                    AND a.actType != 3
+                </otherwise>
+            </choose>
+            AND a.validFlag != 0
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <!--小程序商品获取采美2已上架 3已下架 9已冻结的商品-->
+    <select id="findListBuyMall" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null and productID !=''">
+                AND a.productID=#{productID}
+            </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="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            AND a.validFlag in (2,3,9)
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findList" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </if>
+            <if test="preferredFlag != null and preferredFlag != ''and preferredFlag != 0">
+                <if test="preferredFlag/100>=1">
+                    AND a.preferredFlag in (100,101,110,111)
+                </if>
+                <if test="(preferredFlag%100)/10>=1">
+                    AND a.preferredFlag in (10,11,110,111)
+                </if>
+                <if test="preferredFlag%10>=1">
+                    AND a.preferredFlag in (1,11,101,111)
+                </if>
+            </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="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            <if test="speCommisionFlag !=null and speCommisionFlag !=''">
+                AND a.speCommisionFlag=#{speCommisionFlag}
+            </if>
+            <if test="displayOnCRMFlag !=null and displayOnCRMFlag !=''">
+                AND a.displayOnCRMFlag=#{displayOnCRMFlag}
+            </if>
+            <if test="crmBigTypeId !=null and crmBigTypeId !=''">
+                AND a.crmBigTypeId=#{crmBigTypeId}
+            </if>
+            <if test="crmSmallTypeId !=null and crmSmallTypeId !=''">
+                AND a.crmSmallTypeId=#{crmSmallTypeId}
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag != 0
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllList" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+            </otherwise>
+
+        </choose>
+    </select>
 
     <insert id="insert" parameterType="Product" keyProperty="productID" keyColumn="productID" useGeneratedKeys="true">
         INSERT INTO product(brandID,
-                            bigTypeID,
-                            smallTypeID,
-                            tinyTypeID,
-                            selfTypeID,
-                            shopID,
-                            aliasName,
-                            name,
-                            searchKey,
-                            normalPrice,
-                            price,
-                            priceFlag,
-                            beautyActFlag,
-                            ladderPriceFlag,
-                             <if test="stock !=''">
-	                        	stock,
-                            </if>
-                            hasSkuFlag,
-                            mainImage,
-                            propertiesInfo,
-                            addTime,
-                            updateTime,
-                            weekSellNumber,
-                            beforeValidFlag,
-                            validFlag,
-                            favoriteTimes,
-                            commentScore,
-                            commentTimes,
-                            selfRecommendFlag,
-                            sysRecommendFlag,
-                            sortIndex,
-                            featuredFlag,
-                            featuredSortIndex,
-                            productCode,
-                            unit,
-                            synToERPFlag,
-                            allAreaFlag,
-                            provinceIDs,
-                            serviceNumber,
-                            maxBuyNumber,
-                            minBuyNumber,
-                            packageCount,
-                            byFlag,
-                            normalProductFlag,
-                            wholeSaleProductFlag,
-                            promotionProductFlag,
-                            groupBuyProductFlag,
-                            step,
-                            actFlag,
-                            actType,
-                            actSort,
-                            onlineTime,
-                            downlineTime,
-                            freePostFlag,
-                            costPrice,
-                            costProportional,
-                            costCheckFlag,
-                            precisehKey,
-                            visibility,
-							commodityDetailsFlag,
-                            productType,
-                            qualificationImg,
-                            invoiceType,
-                            taxPoint,
-                            supplierTaxPoint,
-                            tags,
-                            recommendType,
-                            machineType,
-                            includedTax,
-                            commodityType,
-                            trainingMethod,
-                            trainingType,
-                            trainingFee,
-                            productDescribe,
-                            splitCode,
-                            productDetail,
-                            announType,
-							newProductType,
-		<if test="qualificationNo != null and  qualificationNo != ''">
-			qualificationNo,
-		</if>
-		<if test="productName != null and  productName != ''">
-			productName,
-		</if>
-		<if test="qualificationTime != null and  qualificationTime != ''">
-			qualificationTime,
-		</if>
-		<if test="qualificationLink != null and  qualificationLink != ''">
-			qualificationLink,
-		</if>
-		showFlag)
+        bigTypeID,
+        smallTypeID,
+        tinyTypeID,
+        selfTypeID,
+        shopID,
+        aliasName,
+        name,
+        searchKey,
+        priceFlag,
+        beautyActFlag,
+        hasSkuFlag,
+        mainImage,
+        propertiesInfo,
+        addTime,
+        updateTime,
+        weekSellNumber,
+        beforeValidFlag,
+        validFlag,
+        favoriteTimes,
+        commentScore,
+        commentTimes,
+        selfRecommendFlag,
+        sysRecommendFlag,
+        sortIndex,
+        featuredFlag,
+        featuredSortIndex,
+        productCode,
+        synToERPFlag,
+        allAreaFlag,
+        provinceIDs,
+        serviceNumber,
+        maxBuyNumber,
+        packageCount,
+        byFlag,
+        normalProductFlag,
+        wholeSaleProductFlag,
+        promotionProductFlag,
+        groupBuyProductFlag,
+        step,
+        actFlag,
+        actType,
+        actSort,
+        onlineTime,
+        downlineTime,
+        freePostFlag,
+        precisehKey,
+        visibility,
+        commodityDetailsFlag,
+        productType,
+        qualificationImg,
+        invoiceType,
+        taxPoint,
+        supplierTaxPoint,
+        tags,
+        recommendType,
+        machineType,
+        includedTax,
+        commodityType,
+        trainingMethod,
+        trainingType,
+        trainingFee,
+        productDescribe,
+        splitCode,
+        productDetail,
+        announType,
+        newProductType,
+        <if test="qualificationNo != null and  qualificationNo != ''">
+            qualificationNo,
+        </if>
+        <if test="productName != null and  productName != ''">
+            productName,
+        </if>
+        <if test="qualificationTime != null and  qualificationTime != ''">
+            qualificationTime,
+        </if>
+        <if test="qualificationLink != null and  qualificationLink != ''">
+            qualificationLink,
+        </if>
+        showFlag)
         VALUES (#{brandID},
         #{bigTypeID},
         #{smallTypeID},
@@ -437,14 +429,8 @@
         #{aliasName},
         #{name},
         #{searchKey},
-        #{normalPrice},
-        #{price},
         #{priceFlag},
         #{beautyActFlag},
-        #{ladderPriceFlag},
-		<if test="stock !=''">
-			#{stock},
-		</if>
         #{hasSkuFlag},
         #{mainImage},
         #{propertiesInfo},
@@ -462,13 +448,11 @@
         #{featuredFlag},
         #{featuredSortIndex},
         #{productCode},
-        #{unit},
         #{synToERPFlag},
         #{allAreaFlag},
         #{provinceIDs},
         #{serviceNumber},
         #{maxBuyNumber},
-        #{minBuyNumber},
         #{packageCount},
         #{byFlag},
         #{normalProductFlag},
@@ -482,9 +466,6 @@
         #{onlineTime},
         #{downlineTime},
         #{freePostFlag},
-        #{SqlCostPrice},
-        #{sqlCostProportional},
-        #{costCheckFlag},
         #{precisehKey},
         #{visibility},
         #{commodityDetailsFlag},
@@ -521,1504 +502,1556 @@
         #{showFlag})
     </insert>
 
-	<update id="update">
-		UPDATE product SET
-						   productID = #{id},
-						   brandID = #{brandID},
-						   tinyTypeID = #{tinyTypeID},
-						   selfTypeID = #{selfTypeID},
-						   shopID = #{shopID},
-						   name = #{name},
-						   searchKey = #{searchKey},
-						   normalPrice = #{normalPrice},
-						   price = #{price},
-						   priceFlag = #{priceFlag},
-						   beautyActFlag = #{beautyActFlag},
-						   ladderPriceFlag = #{ladderPriceFlag},
-						   stock = #{stock},
-						   hasSkuFlag = #{hasSkuFlag},
-						   mainImage = #{mainImage},
-						   propertiesInfo = #{propertiesInfo},
-						   addTime = #{addTime},
-						   updateTime = #{updateTime},
-						   sellNumber = #{sellNumber},
-						   weekSellNumber = #{weekSellNumber},
-						   beforeValidFlag = #{beforeValidFlag},
-						   validFlag = #{validFlag},
-						   favoriteTimes = #{favoriteTimes},
-						   commentScore = #{commentScore},
-						   commentTimes = #{commentTimes},
-						   selfRecommendFlag = #{selfRecommendFlag},
-						   sysRecommendFlag = #{sysRecommendFlag},
-						   sortIndex = #{sortIndex},
-						   featuredFlag = #{featuredFlag},
-						   featuredSortIndex = #{featuredSortIndex},
-						   productCode = #{productCode},
-						   unit = #{unit},
-						   synToERPFlag = #{synToERPFlag},
-						   allAreaFlag = #{allAreaFlag},
-						   provinceIDs = #{provinceIDs},
-						   serviceNumber = #{serviceNumber},
-						   maxBuyNumber = #{maxBuyNumber},
-						   minBuyNumber = #{minBuyNumber},
-						   packageCount = #{packageCount},
-						   byFlag = #{byFlag},
-						   normalProductFlag = #{normalProductFlag},
-						   wholeSaleProductFlag = #{wholeSaleProductFlag},
-						   promotionProductFlag = #{promotionProductFlag},
-						   groupBuyProductFlag = #{groupBuyProductFlag},
-						   step = #{step},
-						   actFlag = #{actFlag},
-						   actType = #{actType},
-						   onlineTime = #{onlineTime},
-						   downlineTime = #{downlineTime},
-						   freePostFlag = #{freePostFlag},
-						   costPrice = #{costPrice},
-						   costProportional = #{costProportional},
-						   costCheckFlag = #{costCheckFlag},
-						   precisehKey = #{precisehKey},
-						   actSort = #{actSort},
-						   newProductType=#{newProductType}
-
-		WHERE productID = #{id}
-	</update>
-	<select id="productList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		*
-		FROM product a
-		<where>
-			a.newvalidFlag=1
-			<if test="productID !=null and productID !=''">
-				and a.productID=#{productID}
-			</if>
-		</where>
-	</select>
-	<select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="productID !=null">
-				AND a.productID=#{productID}
-			</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="showFlag !=null and showFlag !=''">
-				AND a.showFlag=#{showFlag}
-			</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>
-			AND p.newvalidFlag = 1
-			AND p.newProductType=1
-			AND p.validFlag = 2
-			AND p.showFlag!=2
-
-		</where>
-# 		在设置重点关注时给排序值1000为了让重点关注始终在列表前端
-		order by a.sortIndex desc,a.newshowTime DESC
-	</select>
-	<update id="updateActive">
-		UPDATE product
-		<set>
-			<if test="actFlag != null and actFlag != ''">
-				actFlag = #{actFlag},
-			</if>
-			<if test="actType != null and actType != ''">
-				actType = #{actType},
-			</if>
-			<if test="actSort != null and actSort != ''">
-				actSort = #{actSort},
-			</if>
-			<if test="actCreateTime != null and actCreateTime != ''">
-				actCreateTime = #{actCreateTime},
-			</if>
-		</set>
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updatePreferred">
-		UPDATE product SET preferredFlag = #{preferredFlag}
-		WHERE productID = #{productID}
-	</update>
-
-	<delete id="delete">
-		DELETE FROM product
-		WHERE id = #{id}
-	</delete>
-
-	<update id="deleteProduct">
-		UPDATE cm_search_recommend_product
-		SET delFlag = #{DateTime}
-		WHERE id = #{id}
-	</update>
-
-
-	<select id="getAllActType" resultType="com.caimei.po.ActType">
-		SELECT
-			*
-		FROM acttype
-		where validFlag = 1
-	</select>
-
-
-
-	<select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		*
-		FROM
-		product
-		<where>
-			<if test="name != null and name != ''">
-				AND name LIKE concat('%',#{name},'%')
-			</if>
-			AND shopID = #{shopID}
-			AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag =  9)
-		</where>
-		ORDER BY addTime desc
-	</select>
-
-	<select id="getGiftProductInfo" parameterType="com.caimei.modules.product.entity.GiftProduct" resultType="com.caimei.modules.product.entity.GiftProduct">
-		SELECT
-		g.id as "id",
-		g.fullGiftProductId as "fullGiftProductId",
-		g.giftProductId as "giftProductId",
-		g.actType as "actType",
-		g.giftProductNum as "giftProductNum",
-		p.name as "productName"
-		FROM
-		gift_product g
-		left join  product p on p.productID = g.giftProductId
-		<where>
-			g.fullGiftProductId = #{fullGiftProductId}
-			AND g.actType = #{actType}
-			<if test="giftProductId != null and giftProductId != ''">
-				AND g.giftProductId =  #{giftProductId}
-			</if>
-			<if test="delFlag != null and delFlag != ''">
-				AND g.delFlag =  #{delFlag}
-			</if>
-			and p.productCategory = 1
-		</where>
-	</select>
-
-	<select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
-		SELECT
-		*
-		FROM
-		sku
-		<where>
-			productID = #{productId}
-			AND  validFlag = 1
-		</where>
-	</select>
-
-	<select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
-		SELECT
-		tb.name
-		FROM
-		bigType AS tb
-		INNER JOIN smallType AS ts
-		ON tb.bigTypeID = ts.bigTypeID
-		INNER JOIN tinyType AS tt
-		ON ts.smallTypeID = tt.smallTypeID
-		INNER JOIN product AS tp
-		ON tt.tinyTypeID = tp.tinyTypeID
-		<where>
-			tp.productID = #{productId}
-			and tp.productCategory = 1
-		</where>
-	</select>
-
-	<update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
-		update gift_product
-		<set >
-			<if test="fullGiftProductId != null and  !=''" >
-				fullGiftProductId = #{fullGiftProductId},
-			</if>
-			<if test="giftProductId != null and  !=''" >
-				giftProductId = #{giftProductId},
-			</if>
-			<if test="productName != null and  !=''" >
-				productName = #{productName},
-			</if>
-			<if test="actType != null and  !=''" >
-				actType = #{actType},
-			</if>
-			<if test="giftProductNum != null and  !=''" >
-				giftProductNum = #{giftProductNum},
-			</if>
-			<if test="createBy != null and  !=''" >
-				createBy = #{createBy.id},
-			</if>
-			<if test="createDate != null and  !=''" >
-				createDate = #{createDate},
-			</if>
-
-			<if test="updateBy != null and  !=''" >
-				updateBy = #{updateBy.id},
-			</if>
-			<if test="updateDate != null and  !=''" >
-				updateDate = #{updateDate},
-			</if>
-			<if test="delFlag != null and  !=''" >
-				delFlag = #{delFlag},
-			</if>
-		</set>
-		where id = #{id}
-	</update>
-
-	<insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct"  keyProperty="id" useGeneratedKeys="true">
-		INSERT INTO gift_product(
-			fullGiftProductId,
-			giftProductId,
-			productName,
-			actType,
-			giftProductNum,
-			createBy,
-			createDate,
-			updateBy,
-			updateDate,
-			delFlag
-		) VALUES (
-					 #{fullGiftProductId},
-					 #{giftProductId},
-					 #{productName},
-					 #{actType},
-					 #{giftProductNum},
-					 #{createBy.id},
-					 #{createDate},
-					 #{updateBy.id},
-					 #{updateDate},
-					 #{delFlag}
-				 )
-	</insert>
-
-
-	<insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"  keyProperty="productPriceRecordID" useGeneratedKeys="true">
-		INSERT INTO productpricerecord(
-			`productID`,
-			`shopID`,
-			`highestUserLevelPrice`,
-			`lowestUserLevelPrice`,
-			`lowestUserLevelID`,
-			`price0`,
-			`price1`,
-			`updateTime`
-		)
-		VALUES
-			(
-				#{productID},
-				#{shopID},
-				#{highestUserLevelPrice},
-				#{lowestUserLevelPrice},
-				#{lowestUserLevelID},
-				#{price0},
-				#{price1},
-				#{updateTime}
-			)
-	</insert>
-
-	<!--	<update id="updateCRMFlag">-->
-	<!--		UPDATE product a SET a.displayOnCRMFlag = #{param1}-->
-	<!--		WHERE  a.productID IN-->
-	<!--		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >-->
-	<!--			#{id}-->
-	<!--		</foreach>-->
-	<!--	</update>-->
-
-	<update id="deleteActive">
-		UPDATE product a SET a.actFlag = 0
-		WHERE  a.productID = #{id}
-	</update>
-
-
-	<update id="updatePostFlag">
-		UPDATE product a SET a.freePostFlag = #{param1}
-		WHERE  a.productID IN
-		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >
-			#{id}
-		</foreach>
-	</update>
-
-
-	<select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
-		select * from bigtype
-		<where>
-			validFlag = 1
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND bigTypeID = #{bigTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
-		select * from smalltype
-		<where>
-			validFlag = 1
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND bigTypeID = #{bigTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
-		select * from tinytype
-		<where>
-			validFlag = 1
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND smallTypeID = #{smallTypeID}
-			</if>
-		</where>
-	</select>
-
-	<select id="getProductTypeNameAndID" resultType="map">
-		select
-			b.name AS bigTypeName,
-			b.bigTypeID AS bigTypeID,
-			s.name AS smallTypeName,
-			s.smallTypeID AS smallTypeID,
-			t.name AS tinyTypeName,
-			t.tinyTypeID AS tinyTypeID
-		from tinytype AS t
-				 join smalltype AS s on t.smallTypeID = s.smallTypeID
-				 JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
-		where t.tinyTypeID = #{tinyTypeID}
-	</select>
-
-	<delete id="deleteCustomClassification">
-		delete from product_custom_classification
-		where productID = #{productID}
-	</delete>
-
-	<insert id="insertCustomClassification" parameterType="com.caimei.modules.product.entity.ProductCustomClassification"  keyProperty="userId" useGeneratedKeys="true">
-		INSERT INTO product_custom_classification(
-			productID,
-			bigTypeID,
-			smallTypeID,
-			tinyTypeID,
-			createDate,
-			updateDate
-		) VALUES (
-					 #{productID},
-					 #{bigTypeID},
-					 #{smallTypeID},
-					 #{tinyTypeID},
-					 #{createDate},
-					 #{updateDate}
-				 )
-	</insert>
-
-	<insert id="insertAddProduct">
-		INSERT INTO cm_search_recommend_product(
-			productID,
-			tinyTypeID,
-			sort,
-			delFlag
-		) VALUES (
-					 #{productID},
-					 #{tinyTypeID},
-					 0,
-					 0
-				 )
-	</insert>
-	<insert id="insertLadderPrice">
-		insert into product_ladder_price (productId, userType, ladderNum,
-										  buyNum, buyPrice, createBy, createDate, delFlag)
-		values (#{productId}, 3, #{ladderNum},
-				#{buyNum}, #{buyPrice}, #{createBy},
-				#{createDate},'0')
-	</insert>
-
-	<insert id="insertProduct" keyColumn="productID" keyProperty="productID"  parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
-		INSERT INTO `product` (
-		`brandID`,
-		`tinyTypeID`,
-		<if test="productCategory != null and  productCategory != '' ">
-			`productCategory`,
-		</if>
-		`preferredFlag`,
-		`selfTypeID`,
-		`shopID`,
-		`name`,
-		`aliasName`,
-		`searchKey`,
-		`productRemarks`,
-		`normalPrice`,
-		`price`,
-		`priceFlag`,
-		`beautyActFlag`,
-		`ladderPriceFlag`,
-		<if test="stock != null and  stock != '' ">
-		`stock`,
-		</if>
-		`hasSkuFlag`,
-		`mainImage`,
-		`propertiesInfo`,
-		`addTime`,
-		`updateTime`,
-		`weekSellNumber`,
-		`beforeValidFlag`,
-		`validFlag`,
-		`favoriteTimes`,
-		`commentScore`,
-		`commentTimes`,
-		`selfRecommendFlag`,
-		`sysRecommendFlag`,
-		`sortIndex`,
-		`featuredFlag`,
-		`featuredSortIndex`,
-		`productCode`,
-		`unit`,
-		`synToERPFlag`,
-		`allAreaFlag`,
-		`provinceIDs`,
-		`serviceNumber`,
-		`maxBuyNumber`,
-		`minBuyNumber`,
-		`packageCount`,
-		`byFlag`,
-		`normalProductFlag`,
-		`wholeSaleProductFlag`,
-		`promotionProductFlag`,
-		`groupBuyProductFlag`,
-		`step`,
-		`actFlag`,
-		`actStatus`,
-		`actSort`,
-		`actType`,
-		`visibility`,
-		`onlineTime`,
-		`downlineTime`,
-		`freePostFlag`,
-		`costPrice`,
-		`costProportional`,
-		`costCheckFlag`,
-		`precisehKey`,
-		`tags`,
-		`productType`,
-		`machineType`,
-		`qualificationImg`,
-		`includedTax`,
-		`taxPoint`,
-		`invoiceType`,
-		`recommendType`,
-		`combinationID`,
-		`combinationSort`,
-		announType
-		)
-		VALUES
-		(
-		#{brandID},
-		#{tinyTypeID},
-		<if test="productCategory != null and  productCategory != '' ">
-			#{productCategory},
-		</if>
-		#{preferredFlag},
-		#{selfTypeID},
-		#{shopID},
-		#{name},
-		#{aliasName},
-		#{searchKey},
-		#{productRemarks},
-		#{normalPrice},
-		#{price},
-		#{priceFlag},
-		#{beautyActFlag},
-		#{ladderPriceFlag},
-		<if test="stock != null and  stock != '' ">
-		#{stock},
-		</if>
-		#{hasSkuFlag},
-		#{mainImage},
-		#{propertiesInfo},
-		#{addTime},
-		#{updateTime},
-		#{weekSellNumber},
-		#{beforeValidFlag},
-		#{validFlag},
-		#{favoriteTimes},
-		#{commentScore},
-		#{commentTimes},
-		#{selfRecommendFlag},
-		#{sysRecommendFlag},
-		#{sortIndex},
-		#{featuredFlag},
-		#{featuredSortIndex},
-		#{productCode},
-		#{unit},
-		#{synToERPFlag},
-		#{allAreaFlag},
-		#{provinceIDs},
-		#{serviceNumber},
-		#{maxBuyNumber},
-		#{minBuyNumber},
-		#{packageCount},
-		#{byFlag},
-		#{normalProductFlag},
-		#{wholeSaleProductFlag},
-		#{promotionProductFlag},
-		#{groupBuyProductFlag},
-		#{step},
-		#{actFlag},
-		#{actStatus},
-		#{actSort},
-		#{actType},
-		#{visibility},
-		#{onlineTime},
-		#{downlineTime},
-		#{freePostFlag},
-		#{costPrice},
-		#{costProportional},
-		#{costCheckFlag},
-		#{precisehKey},
-		#{tags},
-		#{productType},
-		#{machineType},
-		#{qualificationImg},
-		#{includedTax},
-		#{taxPoint},
-		#{invoiceType},
-		#{recommendType},
-		#{combinationID},
-		#{combinationSort},
-		#{announType}
-		)
-	</insert>
-
-	<insert id="insertProductDetailInfo">
-		insert into productdetailinfo
-		<trim prefix="(" suffix=")" suffixOverrides=",">
-			<if test="productID != null">
-				`productID`,
-			</if>
-			<if test="detailInfo != null and detailInfo != ''">
-				`detailInfo`,
-			</if>
-			<if test="serviceInfo != null and serviceInfo != ''">
-				`serviceInfo`,
-			</if>
-			<if test="orderInfo != null and orderInfo != ''">
-				`orderInfo`,
-			</if>
-		</trim>
-		<trim prefix="values (" suffix=")" suffixOverrides=",">
-			<if test="productID != null">
-				#{productID},
-			</if>
-			<if test="detailInfo != null and detailInfo != ''">
-				#{detailInfo},
-			</if>
-			<if test="serviceInfo != null and serviceInfo != ''">
-				#{serviceInfo},
-			</if>
-			<if test="orderInfo != null and orderInfo != ''">
-				#{orderInfo},
-			</if>
-		</trim>
-	</insert>
-
-	<select id="getrecommendProductList" resultType="product">
-		select
-		a.*,
-		csrp.sort AS sort,
-		csrp.id AS recommendProductId,
-		b.name AS brandName,
-		s.name AS shopName
-		FROM
-		cm_search_recommend_product csrp
-		LEFT JOIN  product a on a.productID = csrp.productID
-		LEFT JOIN shop s on s.shopID = a.shopID
-		left join cm_brand b on b.id = a.brandID
-		WHERE
-		csrp.tinyTypeId = #{tinyTypeID}
-		<if test="name != null and name != ''">
-			AND a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="validFlag !=null and validFlag !=''">
-			AND a.validFlag=#{validFlag}
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		and a.productCategory = 1
-		AND a.validFlag != 0
-		AND csrp.delFlag =0
-		ORDER BY csrp.sort DESC
-	</select>
-
-
-	<select id="relatedProductList" resultType="product">
-		select
-		<include refid="productColumns"/>,
-		b.name AS brandName,
-		(case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
-		FROM product a
-		<include refid="productJoins"/>
-		left join brand b on b.brandID = a.brandID
-		WHERE (a.productID
-		IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
-		OR a.tinyTypeID = #{tinyTypeID})
-		<if test="name != null and name != ''">
-			AND a.name like concat('%', #{name} ,'%')
-		</if>
-		<if test="validFlag !=null and validFlag !=''">
-			AND a.validFlag=#{validFlag}
-		</if>
-		<if test="shopName != null and shopName != ''">
-			AND s.name like concat('%', #{shopName} ,'%')
-		</if>
-		<if test="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		AND a.validFlag != 0
-		and a.productCategory = 1
-	</select>
-
-	<delete id="deleteProductCustomClassification">
-		delete from product_custom_classification
-		where productID = #{productID} and tinyTypeID = #{tinyTypeID}
-	</delete>
-	<delete id="deleteLadderPriceByProductId">
-		DELETE FROM product_ladder_price where productId = #{productID}
-	</delete>
-	<delete id="deleteLadderPriceById">
-		DELETE FROM product_ladder_price where id = #{id}
-	</delete>
-
-	<select id="toAddProductCustomClassificationList" resultType="product">
-		select
-		<include refid="productColumns"/>,
-		b.name AS brandName
-		FROM product a
-		<include refid="productJoins"/>
-		left join cm_brand b on b.id = a.brandID
-		WHERE a.tinyTypeID != #{tinyTypeID}
-		and not exists
-		(select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID = #{tinyTypeID})
-		and a.validFlag = '2'
-		and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]> 5
-		<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="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-	</select>
-
-
-	<select id="toAddProductList" resultType="product">
-		select
-		a.*,
-		b.name AS brandName,
-		s.name AS shopName
-		FROM product a
-		LEFT JOIN shop s on s.shopID = a.shopID
-		left join cm_brand b on b.id = a.brandID
-		WHERE
-		NOT EXISTS (select * from cm_search_recommend_product csrp where  csrp.productID = a.productID  and csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
-		and a.validFlag = '2'
-		<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="brandName != null and brandName != ''">
-			AND b.name like concat('%', #{brandName} ,'%')
-		</if>
-		and a.productCategory = 1
-	</select>
-
-	<select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
-		select *
-		from product_custom_classification where productID = #{productID}
-	</select>
-
-
-	<select id="findRecommendActivityListPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</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="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-
-
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag = 2
-			AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findGroupActivityListPage" resultType="Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</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="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actStatus != null and actStatus != '' and actStatus == 1">
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
-			</if>
-			<if test="actStatus != null and actStatus != '' and actStatus == 2">
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  >  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
-				AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
-			</if>
-			<if test="sqlMap !=null and sqlMap !=''">
-				${sqlMap.dsf}
-			</if>
-			AND a.validFlag = 2
-			AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
-			AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
-		SELECT
-		*
-		FROM bigtype a
-		<where>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</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>
-
-		</where>
-	</select>
-	<select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
-		SELECT
-		*
-		FROM smalltype a
-		<where>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</if>
-			<if test="bigTypeID != null and bigTypeID != ''">
-				AND a.bigTypeID = #{bigTypeID}
-			</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>
-		</where>
-	</select>
-	<select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
-		SELECT
-		*
-		FROM tinytype a
-		<where>
-			<if test="tinyTypeID != null and tinyTypeID != ''">
-				AND a.tinyTypeID = #{tinyTypeID}
-			</if>
-			<if test="smallTypeID != null and smallTypeID != ''">
-				AND a.smallTypeID = #{smallTypeID}
-			</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>
-		</where>
-	</select>
-
-	<select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-			cpr.id AS id,
-			cpr.productID AS productID,
-			cpr.recommendProductID AS recommendProductID,
-			cpr.sort AS sort,
-			pro.name AS productName,
-			pro.unit AS unit,
-			pro.mainImage AS img,
-			cpr.shopName AS shopName
-		from cm_product_recommend cpr
-				 join product pro on cpr.recommendProductID = pro.productID
-		where cpr.productID = #{productID}
-		order by cpr.sort desc
-	</select>
-
-	<select id="findProductRecommendCount" resultType="int">
-		select
-			count(1)
-		from cm_product_recommend cpr
-		where cpr.productID = #{productID}
-	</select>
-
-	<select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-		a.productID AS productID,
-		a.name AS productName,
-		a.unit AS unit,
-		a.mainImage AS img,
-		s.name AS shopName
-		from product a
-		<include refid="ActivityJoins"/>
-		<where>
-			<choose>
-				<when test="commodityType != null and commodityType != ''">
-					AND a.commodityType = #{commodityType}
-				</when>
-				<when test="bigTypeID != null and bigTypeID != ''">
-					AND a.bigTypeID = #{bigTypeID}
-				</when>
-				<when test="smallTypeID != null and smallTypeID != ''">
-					AND a.smallTypeID = #{smallTypeID}
-				</when>
-				<when test="tinyTypeID != null and tinyTypeID != ''">
-					AND a.tinyTypeID = #{tinyTypeID}
-				</when>
-			</choose>
-			<if test="productName != null and productName != ''">
-				and a.name like concat('%', #{productName} ,'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				and s.name like concat('%', #{shopName} ,'%')
-			</if>
-			and a.productCategory = 1
-		</where>
-		<!--		limit 0, 10-->
-	</select>
-
-	<update id="updateRecommendType">
-		UPDATE product SET
-			recommendType = #{recommendType}
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updateBrnadId">
-		UPDATE product
-		set brandID = #{brandID}
-		WHERE productID = #{productID}
-	</update>
-
-	<update id="updateProductByBrandId">
-		UPDATE product
-		set  brandID = null
-		WHERE brandID = #{brandId}
-	</update>
-	<select id="getProductIdByBrandId" resultType="java.lang.Integer">
-		SELECT productID FROM product WHERE brandID = #{brandId}
-	</select>
-	<update id="updateTinyType">
-		UPDATE product
-		set tinyTypeID = #{tinyTypeID}
-		WHERE productID = #{productID}
-	</update>
-	<update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
-		update product
-		<set>
-			<if test="productDescribe != null and productDescribe != ''">
-				productDescribe = #{productDescribe},
-			</if>
-			<if test="productDetail != null and productDetail != ''">
-				productDetail = #{productDetail},
-			</if>
-			<if test="brandID != null and brandID != ''">
-				brandID = #{brandID},
-			</if>
-			<if test="bigTypeID != null and bigTypeID !=''">
-				bigTypeID = #{bigTypeID},
-				smallTypeID = #{smallTypeID},
-				tinyTypeID = #{tinyTypeID},
-			</if>
-			<if test="preferredFlag != null and preferredFlag !=''">
-				preferredFlag = #{preferredFlag},
-			</if>
-			<if test="shopID != null and shopID !=''">
-				shopID = #{shopID},
-			</if>
-			<if test="name != null and name !=''">
-				`name` = #{name},
-			</if>
-			<if test="aliasName != null and aliasName !=''">
-				aliasName = #{aliasName},
-			</if>
-			<if test="searchKey != null and searchKey !=''">
-				searchKey = #{searchKey},
-			</if>
-			<if test="productRemarks != null and productRemarks !=''">
-				productRemarks = #{productRemarks},
-			</if>
-			<if test="combinationID != null and combinationID !=''">
-				combinationID = #{combinationID},
-			</if>
-			<if test="normalPrice != null and normalPrice !=''">
-				normalPrice = #{normalPrice},
-			</if>
-			<if test="price != null and price !=''">
-				price = #{price},
-			</if>
-			<if test="priceFlag != null and priceFlag !=''">
-				priceFlag = #{priceFlag},
-			</if>
-			<if test="beautyActFlag != null and beautyActFlag !=''">
-				beautyActFlag = #{beautyActFlag},
-			</if>
-			<if test="ladderPriceFlag != null and ladderPriceFlag !=''">
-				ladderPriceFlag = #{ladderPriceFlag},
-			</if>
-			<if test="stock != null and stock !=''">
-				stock = #{stock},
-			</if>
-			<if test="hasSkuFlag != null and hasSkuFlag !=''">
-				hasSkuFlag = #{hasSkuFlag},
-			</if>
-			<if test="mainImage != null and mainImage !=''">
-				mainImage = #{mainImage},
-			</if>
-			<if test="propertiesInfo != null and propertiesInfo !=''">
-				propertiesInfo = #{propertiesInfo},
-			</if>
-			<if test="addTime != null and addTime !=''">
-				addTime = #{addTime},
-			</if>
-			<if test="updateTime != null and updateTime !=''">
-				updateTime = #{updateTime},
-			</if>
-			<if test="weekSellNumber != null and weekSellNumber !=''">
-				weekSellNumber = #{weekSellNumber},
-			</if>
-			<if test="beforeValidFlag != null and beforeValidFlag !=''">
-				beforeValidFlag = #{beforeValidFlag},
-			</if>
-			<if test="validFlag != null and validFlag !=''">
-				validFlag = #{validFlag},
-			</if>
-			<if test="favoriteTimes != null and favoriteTimes !=''">
-				favoriteTimes = #{favoriteTimes},
-			</if>
-			<if test="commentScore != null and commentScore !=''">
-				commentScore = #{commentScore},
-			</if>
-			<if test="commentTimes != null and commentTimes !=''">
-				commentTimes = #{commentTimes},
-			</if>
-			<if test="selfRecommendFlag != null and selfRecommendFlag !=''">
-				selfRecommendFlag = #{selfRecommendFlag},
-			</if>
-			<if test="sysRecommendFlag != null and sysRecommendFlag !=''">
-				sysRecommendFlag = #{sysRecommendFlag},
-			</if>
-			<if test="sortIndex != null and sortIndex != ''">
-				sortIndex = #{sortIndex},
-			</if>
-			<if test="featuredFlag != null and featuredFlag !=''">
-				featuredFlag = #{featuredFlag},
-			</if>
-			<if test="featuredSortIndex != null and featuredSortIndex !=''">
-				featuredSortIndex = #{featuredSortIndex},
-			</if>
-			<if test="productCode != null and productCode !=''">
-				productCode = #{productCode},
-			</if>
-			<if test="unit != null and unit !=''">
-				unit = #{unit},
-			</if>
-			<if test="synToERPFlag != null and synToERPFlag !=''">
-				synToERPFlag = #{synToERPFlag},
-			</if>
-			<if test="allAreaFlag != null and allAreaFlag !=''">
-				allAreaFlag = #{allAreaFlag},
-			</if>
-			<if test="provinceIDs != null and provinceIDs !=''">
-				provinceIDs = #{provinceIDs},
-			</if>
-			<if test="serviceNumber != null and serviceNumber !=''">
-				serviceNumber = #{serviceNumber},
-			</if>
-			<if test="maxBuyNumber != null and maxBuyNumber !=''">
-				maxBuyNumber = #{maxBuyNumber},
-			</if>
-			<if test="minBuyNumber != null and minBuyNumber !=''">
-				minBuyNumber = #{minBuyNumber},
-			</if>
-			<if test="packageCount != null and packageCount !=''">
-				packageCount = #{packageCount},
-			</if>
-			<if test="byFlag != null and byFlag !=''">
-				byFlag = #{byFlag},
-			</if>
-			<if test="normalProductFlag != null and normalProductFlag !=''">
-				normalProductFlag = #{normalProductFlag},
-			</if>
-			<if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
-				wholeSaleProductFlag = #{wholeSaleProductFlag},
-			</if>
-			<if test="promotionProductFlag != null and promotionProductFlag !=''">
-				promotionProductFlag = #{promotionProductFlag},
-			</if>
-			<if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
-				groupBuyProductFlag = #{groupBuyProductFlag},
-			</if>
-			<if test="step != null and step !=''">
-				step = #{step},
-			</if>
-			<if test="actFlag != null and actFlag !=''">
-				actFlag = #{actFlag},
-			</if>
-			<if test="actSort != null and actSort !=''">
-				actSort = #{actSort},
-			</if>
-			<if test="actType != null and actType !=''">
-				actType = #{actType},
-			</if>
-			<if test="onlineTime != null and onlineTime !=''">
-				onlineTime = #{onlineTime},
-			</if>
-			<if test="downlineTime != null and downlineTime !=''">
-				downlineTime = #{downlineTime},
-			</if>
-			<if test="freePostFlag != null and freePostFlag !=''">
-				freePostFlag = #{freePostFlag},
-			</if>
-			<if test="costPrice != null and costPrice != ''">
-				costPrice = #{costPrice},
-			</if>
-			<if test="costProportional != null and costProportional !=''">
-				costProportional = #{costProportional},
-			</if>
-			<if test="costCheckFlag != null and costCheckFlag !=''">
-				costCheckFlag = #{costCheckFlag},
-			</if>
-			<if test="precisehKey != null and precisehKey !=''">
-				precisehKey = #{precisehKey},
-			</if>
-			<if test="visibility != null and visibility !=''">
-				visibility = #{visibility},
-			</if>
-		    <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
-				commodityDetailsFlag = #{commodityDetailsFlag},
-			</if>
-			<if test="productType != null and productType !=''">
-				productType = #{productType},
-			</if>
-			<if test="qualificationImg != null and qualificationImg !=''">
-				qualificationImg = #{qualificationImg},
-			</if>
-			<if test="qualificationImg != null and qualificationImg !=''">
-				qualificationImg = #{qualificationImg},
-			</if>
-			<if test="invoiceType != null and invoiceType !=''">
-				invoiceType = #{invoiceType},
-			</if>
-			<if test="taxPoint != null and taxPoint !=''">
-				taxPoint = #{taxPoint},
-			</if>
-			<if test="supplierTaxPoint != null and supplierTaxPoint !=''">
-				supplierTaxPoint = #{supplierTaxPoint},
-			</if>
-			<if test="endTimeStr != null and endTimeStr !=''">
-				endTimeStr = #{endTimeStr},
-			</if>
-			<if test="tags != null and tags !=''">
-				tags = #{tags},
-			</if>
-			<if test="recommendType != null and recommendType !=''">
-				recommendType = #{recommendType},
-			</if>
-			<if test="machineType != null and machineType !=''">
-				machineType = #{machineType},
-			</if>
-			<if test="includedTax != null and includedTax !=''">
-				includedTax = #{includedTax},
-			</if>
-			<if test="invoiceType != null and invoiceType !=''">
-				invoiceType = #{invoiceType},
-			</if>
-			<if test="commodityType != null and commodityType != ''">
-				commodityType = #{commodityType},
-			</if>
-			<if test="trainingMethod != null">
-				trainingMethod = #{trainingMethod},
-			</if>
-			<if test="trainingType != null">
-				trainingType = #{trainingType},
-			</if>
-			<if test="trainingFee != null">
-				trainingFee = #{trainingFee},
-			</if>
-		    <if test="qualificationNo !=null and qualificationNo != ''">
-				qualificationNo=#{qualificationNo},
-			</if>
-			<if test="productName !=null and productName !=''">
-				productName=#{productName},
-			</if>
-			<if test="qualificationTime !=null and qualificationTime!=''">
-				qualificationTime=#{qualificationTime},
-			</if>
-			<if test="qualificationLink !=null and qualificationLink!=''">
-				qualificationLink=#{qualificationLink},
-			</if>
-
-			newProductType=#{newProductType},
-			showFlag=#{showFlag},
-			announType=#{announType},
-			splitCode = #{splitCode}
-		</set>
-		where productID = #{productID}
-	</update>
-	<update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
-		update productdetailinfo
-		<set>
-			<if test="propValueAlias != null and propValueAlias != ''">
-				propValueAlias = #{propValueAlias},
-			</if>
-			<if test="propValueImages != null and propValueImages !=''">
-				propValueImages = #{propValueImages},
-			</if>
-			<if test="detailInfo != null">
-				detailInfo = #{detailInfo},
-			</if>
-			<if test="commonDetailInfo != null">
-				commonDetailInfo = #{commonDetailInfo},
-			</if>
-			<if test="detailInfoTxt != null">
-				detailInfoTxt = #{detailInfoTxt},
-			</if>
-			<if test="seoTitle != null and seoTitle !=''">
-				seoTitle = #{seoTitle},
-			</if>
-			<if test="seoKeyword != null and seoKeyword !=''">
-				seoKeyword = #{seoKeyword},
-			</if>
-			<if test="seoDes != null and seoDes !=''">
-				seoDes = #{seoDes},
-			</if>
-			<if test="serviceInfo != null ">
-				serviceInfo = #{serviceInfo},
-			</if>
-			<if test="orderInfo != null ">
-				orderInfo = #{orderInfo},
-			</if>
-		</set>
-		where productID = #{productID}
-	</update>
-	<update id="updateLadderPrice">
-		update product_ladder_price
-		set productId = #{productId},
-			ladderNum = #{ladderNum},
-			buyNum = #{buyNum},
-			buyPrice = #{buyPrice},
-			updateBy = #{updateBy},
-			updateDate = #{updateDate},
-			delFlag = #{delFlag}
-		where id = #{id}
-	</update>
-	<update id="updateMainImage">
-		update product
-		set mainImage =#{mainImage}
-		where productID=#{productID}
-	</update>
-
-	<select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
-		select
-			b.name AS "bigTypeName",b.bigTypeID,s.`name` AS "smallTypeName",s.smalltypeID,t.name AS "tinyTypeName" ,t.tinytypeID
-		from tinytype  t LEFT JOIN smalltype  s on  t.smallTypeID = s.smallTypeID  LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
-		where  b.`name` = #{name} AND s.`name` = #{name1} AND t.name = #{name2}
-	</select>
-
-	<select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
-		select
-			p.productID AS recommendProductID,
-			p.name AS productName,
-			p.unit AS unit,
-			p.mainImage AS img,
-			s.name AS shopName
-		from product p
-				 left join shop s on s.shopID = p.shopID
-		where p.tinyTypeID = #{tinyTypeID} and p.productCategory = 1
-		order by p.sellNumber
-				desc limit 0, 7
-	</select>
-
-	<select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
-		select p.productID AS id,
-			   1 AS type,
-			   p.name AS name,
-			   p.unit AS unit,
-			   p.mainImage AS img,
-			   s.name AS shopName,
-			   p.productCategory as "productCategory"
-		from product p
-				 left join shop s on s.shopID = p.shopID
-		where p.productID = #{productID}
-		  AND p.validFlag = '2'
-	</select>
-
-	<select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
-		select
-		p.productID AS id,
-		1 AS type,
-		p.name AS name,
-		p.unit AS unit,
-		p.mainImage AS img,
-		s.name AS shopName,
-		p.productCategory as "productCategory"
-		from product p
-		left join shop s on s.shopID = p.shopID
-		<where>
-			<if test="productID != null and productID != ''">
-				p.productID = #{productID}
-			</if>
-			<if test="productName != null and productName != ''">
-				and p.name like concat('%', #{productName} ,'%')
-			</if>
-			AND p.validFlag = '2'
-			and p.productCategory = #{queryProductType}
-		</where>
-		limit 0, 10
-	</select>
-	<select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
-		SELECT * FROM
-			productdetailinfo
-		where productID = #{productID}
-	</select>
-	<select id="qualification" resultType="com.caimei.modules.product.entity.Product">
-		SELECT qualificationNo,productName,qualificationTime,qualificationLink FROM product
-		where productID = #{productID}
-	</select>
-	<select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
-		SELECT *
-		FROM product_ladder_price
-		WHERE
-			productId = #{productId}
-		  AND userType = #{userType}
-		  AND buyNum is NOT null
-		  AND buyPrice is NOT null
-		  AND delFlag = 0
-		ORDER BY ladderNum ASC
-	</select>
-	<select id="findActList" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<where>
-			<if test="id !=null and id !=''">
-				AND a.productID=#{id}
-			</if>
-			<if test="shopID != null and shopID != ''">
-				AND a.shopID = #{shopID}
-			</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="shopName != null and shopName != ''">
-				AND s.name LIKE
-				<if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
-				<if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
-				<if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
-			</if>
-			<if test="validFlag !=null and validFlag !=''">
-				AND a.validFlag=#{validFlag}
-			</if>
-			<if test="actFlag !=null and actFlag !=''">
-				AND a.actFlag=#{actFlag}
-			</if>
-			<if test="actType !=null and actType !=''">
-				AND a.actType=#{actType}
-			</if>
-			AND a.actStatus = 1
-			and a.productCategory = 1
-		</where>
-		<choose>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
-			</otherwise>
-		</choose>
-	</select>
-
-	<select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
-		select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
-		<where>
-			(p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
-			<if test="productIds != null and productIds != '' ">
-				and p.productID != #{productIds}
-			</if>
-			<if test="productID != null and productID != ''">
-				and p.productID = #{productID}
-			</if>
-			<if test="name != null and name != ''">
-				and p.name like concat('%',#{name},'%')
-			</if>
-			<if test="shopName != null and shopName != ''">
-				and s.name like concat('%',#{shopName},'%')
-			</if>
-		</where>
-		order by productID asc
-	</select>
-
-	<select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
-		SELECT
-		<include refid="productColumns"/>
-		FROM product a
-		<include refid="productJoins"/>
-		<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>
-			<when test="page !=null and page.orderBy != null and page.orderBy != ''">
-				ORDER BY ${page.orderBy}
-			</when>
-			<otherwise>
-				order by a.productID asc
-			</otherwise>
-		</choose>
-	</select>
-	<select id="findProductDetail" resultType="java.lang.String">
-		select productDetail from product where productID = #{productID}
-	</select>
-	<select id="findProductDescribe" resultType="java.lang.String">
-		select productDescribe from product where productID = #{productID}
-	</select>
-	<select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
-		select name,shopID
-		from shop
-		where shopType=2
-	</select>
+    <update id="update">
+        UPDATE product
+        SET productID            = #{id},
+            brandID              = #{brandID},
+            tinyTypeID           = #{tinyTypeID},
+            selfTypeID           = #{selfTypeID},
+            shopID               = #{shopID},
+            name                 = #{name},
+            searchKey            = #{searchKey},
+            normalPrice          = #{normalPrice},
+            price                = #{price},
+            priceFlag            = #{priceFlag},
+            beautyActFlag        = #{beautyActFlag},
+            ladderPriceFlag      = #{ladderPriceFlag},
+            stock                = #{stock},
+            hasSkuFlag           = #{hasSkuFlag},
+            mainImage            = #{mainImage},
+            propertiesInfo       = #{propertiesInfo},
+            addTime              = #{addTime},
+            updateTime           = #{updateTime},
+            sellNumber           = #{sellNumber},
+            weekSellNumber       = #{weekSellNumber},
+            beforeValidFlag      = #{beforeValidFlag},
+            validFlag            = #{validFlag},
+            favoriteTimes        = #{favoriteTimes},
+            commentScore         = #{commentScore},
+            commentTimes         = #{commentTimes},
+            selfRecommendFlag    = #{selfRecommendFlag},
+            sysRecommendFlag     = #{sysRecommendFlag},
+            sortIndex            = #{sortIndex},
+            featuredFlag         = #{featuredFlag},
+            featuredSortIndex    = #{featuredSortIndex},
+            productCode          = #{productCode},
+            unit                 = #{unit},
+            synToERPFlag         = #{synToERPFlag},
+            allAreaFlag          = #{allAreaFlag},
+            provinceIDs          = #{provinceIDs},
+            serviceNumber        = #{serviceNumber},
+            maxBuyNumber         = #{maxBuyNumber},
+            minBuyNumber         = #{minBuyNumber},
+            packageCount         = #{packageCount},
+            byFlag               = #{byFlag},
+            normalProductFlag    = #{normalProductFlag},
+            wholeSaleProductFlag = #{wholeSaleProductFlag},
+            promotionProductFlag = #{promotionProductFlag},
+            groupBuyProductFlag  = #{groupBuyProductFlag},
+            step                 = #{step},
+            actFlag              = #{actFlag},
+            actType              = #{actType},
+            onlineTime           = #{onlineTime},
+            downlineTime         = #{downlineTime},
+            freePostFlag         = #{freePostFlag},
+            costPrice            = #{costPrice},
+            costProportional     = #{costProportional},
+            costCheckFlag        = #{costCheckFlag},
+            precisehKey          = #{precisehKey},
+            actSort              = #{actSort},
+            newProductType=#{newProductType}
+
+        WHERE productID = #{id}
+    </update>
+    <select id="productList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        *
+        FROM product a
+        <where>
+            a.newvalidFlag=1
+            <if test="productID !=null and productID !=''">
+                and a.productID=#{productID}
+            </if>
+        </where>
+    </select>
+    <select id="newfindProductImage" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="productID !=null">
+                AND a.productID=#{productID}
+            </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="showFlag !=null and showFlag !=''">
+                AND a.showFlag=#{showFlag}
+            </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>
+            AND p.newvalidFlag = 1
+            AND p.newProductType=1
+            AND p.validFlag = 2
+            AND p.showFlag!=2
+
+        </where>
+        # 在设置重点关注时给排序值1000为了让重点关注始终在列表前端
+        order by a.sortIndex desc,a.newshowTime DESC
+    </select>
+    <update id="updateActive">
+        UPDATE product
+        <set>
+            <if test="actFlag != null and actFlag != ''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="actType != null and actType != ''">
+                actType = #{actType},
+            </if>
+            <if test="actSort != null and actSort != ''">
+                actSort = #{actSort},
+            </if>
+            <if test="actCreateTime != null and actCreateTime != ''">
+                actCreateTime = #{actCreateTime},
+            </if>
+        </set>
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updatePreferred">
+        UPDATE product
+        SET preferredFlag = #{preferredFlag}
+        WHERE productID = #{productID}
+    </update>
+
+    <delete id="delete">
+        DELETE
+        FROM product
+        WHERE id = #{id}
+    </delete>
+
+    <update id="deleteProduct">
+        UPDATE cm_search_recommend_product
+        SET delFlag = #{DateTime}
+        WHERE id = #{id}
+    </update>
+
+
+    <select id="getAllActType" resultType="com.caimei.po.ActType">
+        SELECT *
+        FROM acttype
+        where validFlag = 1
+    </select>
+
+
+    <select id="getSupplierProductList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        *
+        FROM
+        product
+        <where>
+            <if test="name != null and name != ''">
+                AND name LIKE concat('%',#{name},'%')
+            </if>
+            AND shopID = #{shopID}
+            AND (validFlag = 1 or validFlag = 2 or validFlag = 3 or validFlag = 9)
+        </where>
+        ORDER BY addTime desc
+    </select>
+
+    <select id="getGiftProductInfo" parameterType="com.caimei.modules.product.entity.GiftProduct"
+            resultType="com.caimei.modules.product.entity.GiftProduct">
+        SELECT
+        g.id as "id",
+        g.fullGiftProductId as "fullGiftProductId",
+        g.giftProductId as "giftProductId",
+        g.actType as "actType",
+        g.giftProductNum as "giftProductNum",
+        p.name as "productName"
+        FROM
+        gift_product g
+        left join product p on p.productID = g.giftProductId
+        <where>
+            g.fullGiftProductId = #{fullGiftProductId}
+            AND g.actType = #{actType}
+            <if test="giftProductId != null and giftProductId != ''">
+                AND g.giftProductId = #{giftProductId}
+            </if>
+            <if test="delFlag != null and delFlag != ''">
+                AND g.delFlag = #{delFlag}
+            </if>
+            and p.productCategory = 1
+        </where>
+    </select>
+
+    <select id="getProductSku" resultType="com.caimei.modules.product.entity.Sku">
+        SELECT
+        *
+        FROM
+        sku
+        <where>
+            productID = #{productId}
+            AND validFlag = 1
+        </where>
+    </select>
+
+    <select id="findProductBigTypeByProductID" parameterType="java.lang.Integer" resultType="java.lang.String">
+        SELECT
+        tb.name
+        FROM
+        bigType AS tb
+        INNER JOIN smallType AS ts
+        ON tb.bigTypeID = ts.bigTypeID
+        INNER JOIN tinyType AS tt
+        ON ts.smallTypeID = tt.smallTypeID
+        INNER JOIN product AS tp
+        ON tt.tinyTypeID = tp.tinyTypeID
+        <where>
+            tp.productID = #{productId}
+            and tp.productCategory = 1
+        </where>
+    </select>
+
+    <update id="updateGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct">
+        update gift_product
+        <set>
+            <if test="fullGiftProductId != null and  !=''">
+                fullGiftProductId = #{fullGiftProductId},
+            </if>
+            <if test="giftProductId != null and  !=''">
+                giftProductId = #{giftProductId},
+            </if>
+            <if test="productName != null and  !=''">
+                productName = #{productName},
+            </if>
+            <if test="actType != null and  !=''">
+                actType = #{actType},
+            </if>
+            <if test="giftProductNum != null and  !=''">
+                giftProductNum = #{giftProductNum},
+            </if>
+            <if test="createBy != null and  !=''">
+                createBy = #{createBy.id},
+            </if>
+            <if test="createDate != null and  !=''">
+                createDate = #{createDate},
+            </if>
+
+            <if test="updateBy != null and  !=''">
+                updateBy = #{updateBy.id},
+            </if>
+            <if test="updateDate != null and  !=''">
+                updateDate = #{updateDate},
+            </if>
+            <if test="delFlag != null and  !=''">
+                delFlag = #{delFlag},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <insert id="insertGiftProudct" parameterType="com.caimei.modules.product.entity.GiftProduct" keyProperty="id"
+            useGeneratedKeys="true">
+        INSERT INTO gift_product(fullGiftProductId,
+                                 giftProductId,
+                                 productName,
+                                 actType,
+                                 giftProductNum,
+                                 createBy,
+                                 createDate,
+                                 updateBy,
+                                 updateDate,
+                                 delFlag)
+        VALUES (#{fullGiftProductId},
+                #{giftProductId},
+                #{productName},
+                #{actType},
+                #{giftProductNum},
+                #{createBy.id},
+                #{createDate},
+                #{updateBy.id},
+                #{updateDate},
+                #{delFlag})
+    </insert>
+
+
+    <insert id="insertProductPriceRecord" parameterType="com.caimei.modules.product.entity.ProductPriceRecord"
+            keyProperty="productPriceRecordID" useGeneratedKeys="true">
+        INSERT INTO productpricerecord(`productID`,
+                                       `shopID`,
+                                       `highestUserLevelPrice`,
+                                       `lowestUserLevelPrice`,
+                                       `lowestUserLevelID`,
+                                       `price0`,
+                                       `price1`,
+                                       `updateTime`)
+        VALUES (#{productID},
+                #{shopID},
+                #{highestUserLevelPrice},
+                #{lowestUserLevelPrice},
+                #{lowestUserLevelID},
+                #{price0},
+                #{price1},
+                #{updateTime})
+    </insert>
+
+    <!--	<update id="updateCRMFlag">-->
+    <!--		UPDATE product a SET a.displayOnCRMFlag = #{param1}-->
+    <!--		WHERE  a.productID IN-->
+    <!--		<foreach collection="param2" item="id" index="index" open="(" separator="," close=")" >-->
+    <!--			#{id}-->
+    <!--		</foreach>-->
+    <!--	</update>-->
+
+    <update id="deleteActive">
+        UPDATE product a
+        SET a.actFlag = 0
+        WHERE a.productID = #{id}
+    </update>
+
+
+    <update id="updatePostFlag">
+        UPDATE product a SET a.freePostFlag = #{param1}
+        WHERE a.productID IN
+        <foreach collection="param2" item="id" index="index" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </update>
+
+
+    <select id="getBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
+        select * from bigtype
+        <where>
+            validFlag = 1
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND bigTypeID = #{bigTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
+        select * from smalltype
+        <where>
+            validFlag = 1
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND bigTypeID = #{bigTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
+        select * from tinytype
+        <where>
+            validFlag = 1
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND smallTypeID = #{smallTypeID}
+            </if>
+        </where>
+    </select>
+
+    <select id="getProductTypeNameAndID" resultType="map">
+        select b.name        AS bigTypeName,
+               b.bigTypeID   AS bigTypeID,
+               s.name        AS smallTypeName,
+               s.smallTypeID AS smallTypeID,
+               t.name        AS tinyTypeName,
+               t.tinyTypeID  AS tinyTypeID
+        from tinytype AS t
+                 join smalltype AS s on t.smallTypeID = s.smallTypeID
+                 JOIN bigtype AS b on b.bigTypeID = s.bigTypeID
+        where t.tinyTypeID = #{tinyTypeID}
+    </select>
+
+    <delete id="deleteCustomClassification">
+        delete
+        from product_custom_classification
+        where productID = #{productID}
+    </delete>
+
+    <insert id="insertCustomClassification"
+            parameterType="com.caimei.modules.product.entity.ProductCustomClassification" keyProperty="userId"
+            useGeneratedKeys="true">
+        INSERT INTO product_custom_classification(productID,
+                                                  bigTypeID,
+                                                  smallTypeID,
+                                                  tinyTypeID,
+                                                  createDate,
+                                                  updateDate)
+        VALUES (#{productID},
+                #{bigTypeID},
+                #{smallTypeID},
+                #{tinyTypeID},
+                #{createDate},
+                #{updateDate})
+    </insert>
+
+    <insert id="insertAddProduct">
+        INSERT INTO cm_search_recommend_product(productID,
+                                                tinyTypeID,
+                                                sort,
+                                                delFlag)
+        VALUES (#{productID},
+                #{tinyTypeID},
+                0,
+                0)
+    </insert>
+    <insert id="insertLadderPrice">
+        insert into product_ladder_price (productId, userType, ladderNum,
+                                          buyNum, buyPrice, createBy, createDate, delFlag)
+        values (#{productId}, 3, #{ladderNum},
+                #{buyNum}, #{buyPrice}, #{createBy},
+                #{createDate}, '0')
+    </insert>
+
+    <insert id="insertProduct" keyColumn="productID" keyProperty="productID"
+            parameterType="com.caimei.modules.product.entity.Product" useGeneratedKeys="true">
+        INSERT INTO `product` (
+        `brandID`,
+        `tinyTypeID`,
+        <if test="productCategory != null and  productCategory != '' ">
+            `productCategory`,
+        </if>
+        `preferredFlag`,
+        `selfTypeID`,
+        `shopID`,
+        `name`,
+        `aliasName`,
+        `searchKey`,
+        `productRemarks`,
+        `normalPrice`,
+        `price`,
+        `priceFlag`,
+        `beautyActFlag`,
+        `ladderPriceFlag`,
+        <if test="stock != null and  stock != '' ">
+            `stock`,
+        </if>
+        `hasSkuFlag`,
+        `mainImage`,
+        `propertiesInfo`,
+        `addTime`,
+        `updateTime`,
+        `weekSellNumber`,
+        `beforeValidFlag`,
+        `validFlag`,
+        `favoriteTimes`,
+        `commentScore`,
+        `commentTimes`,
+        `selfRecommendFlag`,
+        `sysRecommendFlag`,
+        `sortIndex`,
+        `featuredFlag`,
+        `featuredSortIndex`,
+        `productCode`,
+        `unit`,
+        `synToERPFlag`,
+        `allAreaFlag`,
+        `provinceIDs`,
+        `serviceNumber`,
+        `maxBuyNumber`,
+        `minBuyNumber`,
+        `packageCount`,
+        `byFlag`,
+        `normalProductFlag`,
+        `wholeSaleProductFlag`,
+        `promotionProductFlag`,
+        `groupBuyProductFlag`,
+        `step`,
+        `actFlag`,
+        `actStatus`,
+        `actSort`,
+        `actType`,
+        `visibility`,
+        `onlineTime`,
+        `downlineTime`,
+        `freePostFlag`,
+        `costPrice`,
+        `costProportional`,
+        `costCheckFlag`,
+        `precisehKey`,
+        `tags`,
+        `productType`,
+        `machineType`,
+        `qualificationImg`,
+        `includedTax`,
+        `taxPoint`,
+        `invoiceType`,
+        `recommendType`,
+        `combinationID`,
+        `combinationSort`,
+        announType
+        )
+        VALUES
+        (
+        #{brandID},
+        #{tinyTypeID},
+        <if test="productCategory != null and  productCategory != '' ">
+            #{productCategory},
+        </if>
+        #{preferredFlag},
+        #{selfTypeID},
+        #{shopID},
+        #{name},
+        #{aliasName},
+        #{searchKey},
+        #{productRemarks},
+        #{normalPrice},
+        #{price},
+        #{priceFlag},
+        #{beautyActFlag},
+        #{ladderPriceFlag},
+        <if test="stock != null and  stock != '' ">
+            #{stock},
+        </if>
+        #{hasSkuFlag},
+        #{mainImage},
+        #{propertiesInfo},
+        #{addTime},
+        #{updateTime},
+        #{weekSellNumber},
+        #{beforeValidFlag},
+        #{validFlag},
+        #{favoriteTimes},
+        #{commentScore},
+        #{commentTimes},
+        #{selfRecommendFlag},
+        #{sysRecommendFlag},
+        #{sortIndex},
+        #{featuredFlag},
+        #{featuredSortIndex},
+        #{productCode},
+        #{unit},
+        #{synToERPFlag},
+        #{allAreaFlag},
+        #{provinceIDs},
+        #{serviceNumber},
+        #{maxBuyNumber},
+        #{minBuyNumber},
+        #{packageCount},
+        #{byFlag},
+        #{normalProductFlag},
+        #{wholeSaleProductFlag},
+        #{promotionProductFlag},
+        #{groupBuyProductFlag},
+        #{step},
+        #{actFlag},
+        #{actStatus},
+        #{actSort},
+        #{actType},
+        #{visibility},
+        #{onlineTime},
+        #{downlineTime},
+        #{freePostFlag},
+        #{costPrice},
+        #{costProportional},
+        #{costCheckFlag},
+        #{precisehKey},
+        #{tags},
+        #{productType},
+        #{machineType},
+        #{qualificationImg},
+        #{includedTax},
+        #{taxPoint},
+        #{invoiceType},
+        #{recommendType},
+        #{combinationID},
+        #{combinationSort},
+        #{announType}
+        )
+    </insert>
+
+    <insert id="insertProductDetailInfo">
+        insert into productdetailinfo
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="productID != null">
+                `productID`,
+            </if>
+            <if test="detailInfo != null and detailInfo != ''">
+                `detailInfo`,
+            </if>
+            <if test="serviceInfo != null and serviceInfo != ''">
+                `serviceInfo`,
+            </if>
+            <if test="orderInfo != null and orderInfo != ''">
+                `orderInfo`,
+            </if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="productID != null">
+                #{productID},
+            </if>
+            <if test="detailInfo != null and detailInfo != ''">
+                #{detailInfo},
+            </if>
+            <if test="serviceInfo != null and serviceInfo != ''">
+                #{serviceInfo},
+            </if>
+            <if test="orderInfo != null and orderInfo != ''">
+                #{orderInfo},
+            </if>
+        </trim>
+    </insert>
+    <insert id="insertSku" keyColumn="skuId" keyProperty="skuId" parameterType="com.caimei.modules.product.entity.CmSku"
+            useGeneratedKeys="true">
+        insert into cm_sku
+        (productId,
+         normalPrice,
+         price,
+         ladderPriceFlag,
+         costCheckFlag,
+         costprice,
+         stock,
+         minBuyNumber,
+         unit)
+        values (#{productId},
+                #{normalPrice},
+                #{price},
+                #{ladderPriceFlag},
+                1,
+                #{costPrice},
+                #{stock},
+                #{minBuyNumber},
+                #{unit})
+    </insert>
+    <insert id="insertCmLadderPrice">
+        insert into product_ladder_price (skuId, productId, userType, ladderNum,
+                                          buyNum, buyPrice, createBy, createDate, delFlag)
+        values (#{skuId}, #{productId}, 3, #{ladderNum},
+                #{buyNum}, #{buyPrice}, #{createBy},
+                #{createDate}, '0')
+    </insert>
+
+    <select id="getrecommendProductList" resultType="product">
+        select
+        a.*,
+        csrp.sort AS sort,
+        csrp.id AS recommendProductId,
+        b.name AS brandName,
+        s.name AS shopName
+        FROM
+        cm_search_recommend_product csrp
+        LEFT JOIN product a on a.productID = csrp.productID
+        LEFT JOIN shop s on s.shopID = a.shopID
+        left join cm_brand b on b.id = a.brandID
+        WHERE
+        csrp.tinyTypeId = #{tinyTypeID}
+        <if test="name != null and name != ''">
+            AND a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="validFlag !=null and validFlag !=''">
+            AND a.validFlag=#{validFlag}
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        and a.productCategory = 1
+        AND a.validFlag != 0
+        AND csrp.delFlag =0
+        ORDER BY csrp.sort DESC
+    </select>
+
+
+    <select id="relatedProductList" resultType="product">
+        select
+        <include refid="productColumns"/>,
+        b.name AS brandName,
+        (case when a.tinyTypeID = #{tinyTypeID} then '1' else '0' end) AS defaultType
+        FROM product a
+        <include refid="productJoins"/>
+        left join brand b on b.brandID = a.brandID
+        WHERE (a.productID
+        IN (select productID from product_custom_classification where tinyTypeID = #{tinyTypeID})
+        OR a.tinyTypeID = #{tinyTypeID})
+        <if test="name != null and name != ''">
+            AND a.name like concat('%', #{name} ,'%')
+        </if>
+        <if test="validFlag !=null and validFlag !=''">
+            AND a.validFlag=#{validFlag}
+        </if>
+        <if test="shopName != null and shopName != ''">
+            AND s.name like concat('%', #{shopName} ,'%')
+        </if>
+        <if test="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        AND a.validFlag != 0
+        and a.productCategory = 1
+    </select>
+
+    <delete id="deleteProductCustomClassification">
+        delete
+        from product_custom_classification
+        where productID = #{productID}
+          and tinyTypeID = #{tinyTypeID}
+    </delete>
+    <delete id="deleteLadderPriceByProductId">
+        DELETE
+        FROM product_ladder_price
+        where productId = #{productID}
+    </delete>
+    <delete id="deleteLadderPriceById">
+        DELETE
+        FROM product_ladder_price
+        where id = #{id}
+    </delete>
+    <delete id="deleteSkus">
+        delete
+        from cm_sku
+        where productId = #{productID}
+    </delete>
+
+    <select id="toAddProductCustomClassificationList" resultType="product">
+        select
+        <include refid="productColumns"/>,
+        b.name AS brandName
+        FROM product a
+        <include refid="productJoins"/>
+        left join cm_brand b on b.id = a.brandID
+        WHERE a.tinyTypeID != #{tinyTypeID}
+        and not exists
+        (select pcc.id from product_custom_classification pcc where pcc.productID = a.productID and pcc.tinyTypeID =
+        #{tinyTypeID})
+        and a.validFlag = '2'
+        and (select count(id) from product_custom_classification pcc where pcc.productID = a.productID) <![CDATA[ < ]]>
+        5
+        <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="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+    </select>
+
+
+    <select id="toAddProductList" resultType="product">
+        select
+        a.*,
+        b.name AS brandName,
+        s.name AS shopName
+        FROM product a
+        LEFT JOIN shop s on s.shopID = a.shopID
+        left join cm_brand b on b.id = a.brandID
+        WHERE
+        NOT EXISTS (select * from cm_search_recommend_product csrp where csrp.productID = a.productID and
+        csrp.tinyTypeID = #{tinyTypeID} AND csrp.delFlag = 0)
+        and a.validFlag = '2'
+        <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="brandName != null and brandName != ''">
+            AND b.name like concat('%', #{brandName} ,'%')
+        </if>
+        and a.productCategory = 1
+    </select>
+
+    <select id="getProductTypes" resultType="com.caimei.modules.product.entity.ProductCustomClassification">
+        select *
+        from product_custom_classification
+        where productID = #{productID}
+    </select>
+
+
+    <select id="findRecommendActivityListPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </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="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+
+
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag = 2
+            AND (a.actType != 3 or a.`actType` IS NULL or (a.actType = 3 and STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
+            <![CDATA[  <  ]]> STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i')))
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findGroupActivityListPage" resultType="Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </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="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actStatus != null and actStatus != '' and actStatus == 1">
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
+            </if>
+            <if test="actStatus != null and actStatus != '' and actStatus == 2">
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  >  ]]> STR_TO_DATE(a.beginTime,'%Y-%m-%d %H:%i')
+                AND STR_TO_DATE(SYSDATE(),'%Y-%m-%d %H:%i') <![CDATA[  <  ]]> STR_TO_DATE(a.endTime,'%Y-%m-%d %H:%i')
+            </if>
+            <if test="sqlMap !=null and sqlMap !=''">
+                ${sqlMap.dsf}
+            </if>
+            AND a.validFlag = 2
+            AND ((a.actType != 1 AND a.actType != 2 OR a.`actType` IS NULL) or a.actFlag = 0)
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findBigTypeList" resultType="com.caimei.modules.product.entity.ProductBigType">
+        SELECT
+        *
+        FROM bigtype a
+        <where>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </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>
+
+        </where>
+    </select>
+    <select id="findSmallTypeList" resultType="com.caimei.modules.product.entity.ProductSmallType">
+        SELECT
+        *
+        FROM smalltype a
+        <where>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != ''">
+                AND a.bigTypeID = #{bigTypeID}
+            </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>
+        </where>
+    </select>
+    <select id="findTinyTypeList" resultType="com.caimei.modules.product.entity.ProducTinyType">
+        SELECT
+        *
+        FROM tinytype a
+        <where>
+            <if test="tinyTypeID != null and tinyTypeID != ''">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != ''">
+                AND a.smallTypeID = #{smallTypeID}
+            </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>
+        </where>
+    </select>
+
+    <select id="findProductRecommendList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select cpr.id                 AS id,
+               cpr.productID          AS productID,
+               cpr.recommendProductID AS recommendProductID,
+               cpr.sort               AS sort,
+               pro.name               AS productName,
+               pro.unit               AS unit,
+               pro.mainImage          AS img,
+               cpr.shopName           AS shopName
+        from cm_product_recommend cpr
+                 join product pro on cpr.recommendProductID = pro.productID
+        where cpr.productID = #{productID}
+        order by cpr.sort desc
+    </select>
+
+    <select id="findProductRecommendCount" resultType="int">
+        select count(1)
+        from cm_product_recommend cpr
+        where cpr.productID = #{productID}
+    </select>
+
+    <select id="findProductList" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select
+        a.productID AS productID,
+        a.name AS productName,
+        a.unit AS unit,
+        a.mainImage AS img,
+        s.name AS shopName
+        from product a
+        <include refid="ActivityJoins"/>
+        <where>
+            <choose>
+                <when test="commodityType != null and commodityType != ''">
+                    AND a.commodityType = #{commodityType}
+                </when>
+                <when test="bigTypeID != null and bigTypeID != ''">
+                    AND a.bigTypeID = #{bigTypeID}
+                </when>
+                <when test="smallTypeID != null and smallTypeID != ''">
+                    AND a.smallTypeID = #{smallTypeID}
+                </when>
+                <when test="tinyTypeID != null and tinyTypeID != ''">
+                    AND a.tinyTypeID = #{tinyTypeID}
+                </when>
+            </choose>
+            <if test="productName != null and productName != ''">
+                and a.name like concat('%', #{productName} ,'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                and s.name like concat('%', #{shopName} ,'%')
+            </if>
+            and a.productCategory = 1
+        </where>
+        <!--		limit 0, 10-->
+    </select>
+
+    <update id="updateRecommendType">
+        UPDATE product
+        SET recommendType = #{recommendType}
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updateBrnadId">
+        UPDATE product
+        set brandID = #{brandID}
+        WHERE productID = #{productID}
+    </update>
+
+    <update id="updateProductByBrandId">
+        UPDATE product
+        set brandID = null
+        WHERE brandID = #{brandId}
+    </update>
+    <select id="getProductIdByBrandId" resultType="java.lang.Integer">
+        SELECT productID
+        FROM product
+        WHERE brandID = #{brandId}
+    </select>
+    <update id="updateTinyType">
+        UPDATE product
+        set tinyTypeID = #{tinyTypeID}
+        WHERE productID = #{productID}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.caimei.modules.product.entity.Product">
+        update product
+        <set>
+            <if test="productDescribe != null and productDescribe != ''">
+                productDescribe = #{productDescribe},
+            </if>
+            <if test="productDetail != null and productDetail != ''">
+                productDetail = #{productDetail},
+            </if>
+            <if test="brandID != null and brandID != ''">
+                brandID = #{brandID},
+            </if>
+            <if test="bigTypeID != null and bigTypeID !=''">
+                bigTypeID = #{bigTypeID},
+                smallTypeID = #{smallTypeID},
+                tinyTypeID = #{tinyTypeID},
+            </if>
+            <if test="preferredFlag != null and preferredFlag !=''">
+                preferredFlag = #{preferredFlag},
+            </if>
+            <if test="shopID != null and shopID !=''">
+                shopID = #{shopID},
+            </if>
+            <if test="name != null and name !=''">
+                `name` = #{name},
+            </if>
+            <if test="aliasName != null and aliasName !=''">
+                aliasName = #{aliasName},
+            </if>
+            <if test="searchKey != null and searchKey !=''">
+                searchKey = #{searchKey},
+            </if>
+            <if test="productRemarks != null and productRemarks !=''">
+                productRemarks = #{productRemarks},
+            </if>
+            <if test="combinationID != null and combinationID !=''">
+                combinationID = #{combinationID},
+            </if>
+            <if test="priceFlag != null and priceFlag !=''">
+                priceFlag = #{priceFlag},
+            </if>
+            <if test="beautyActFlag != null and beautyActFlag !=''">
+                beautyActFlag = #{beautyActFlag},
+            </if>
+            <if test="hasSkuFlag != null and hasSkuFlag !=''">
+                hasSkuFlag = #{hasSkuFlag},
+            </if>
+            <if test="mainImage != null and mainImage !=''">
+                mainImage = #{mainImage},
+            </if>
+            <if test="propertiesInfo != null and propertiesInfo !=''">
+                propertiesInfo = #{propertiesInfo},
+            </if>
+            <if test="addTime != null and addTime !=''">
+                addTime = #{addTime},
+            </if>
+            <if test="updateTime != null and updateTime !=''">
+                updateTime = #{updateTime},
+            </if>
+            <if test="weekSellNumber != null and weekSellNumber !=''">
+                weekSellNumber = #{weekSellNumber},
+            </if>
+            <if test="beforeValidFlag != null and beforeValidFlag !=''">
+                beforeValidFlag = #{beforeValidFlag},
+            </if>
+            <if test="validFlag != null and validFlag !=''">
+                validFlag = #{validFlag},
+            </if>
+            <if test="favoriteTimes != null and favoriteTimes !=''">
+                favoriteTimes = #{favoriteTimes},
+            </if>
+            <if test="commentScore != null and commentScore !=''">
+                commentScore = #{commentScore},
+            </if>
+            <if test="commentTimes != null and commentTimes !=''">
+                commentTimes = #{commentTimes},
+            </if>
+            <if test="selfRecommendFlag != null and selfRecommendFlag !=''">
+                selfRecommendFlag = #{selfRecommendFlag},
+            </if>
+            <if test="sysRecommendFlag != null and sysRecommendFlag !=''">
+                sysRecommendFlag = #{sysRecommendFlag},
+            </if>
+            <if test="sortIndex != null and sortIndex != ''">
+                sortIndex = #{sortIndex},
+            </if>
+            <if test="featuredFlag != null and featuredFlag !=''">
+                featuredFlag = #{featuredFlag},
+            </if>
+            <if test="featuredSortIndex != null and featuredSortIndex !=''">
+                featuredSortIndex = #{featuredSortIndex},
+            </if>
+            <if test="productCode != null and productCode !=''">
+                productCode = #{productCode},
+            </if>
+            <if test="synToERPFlag != null and synToERPFlag !=''">
+                synToERPFlag = #{synToERPFlag},
+            </if>
+            <if test="allAreaFlag != null and allAreaFlag !=''">
+                allAreaFlag = #{allAreaFlag},
+            </if>
+            <if test="provinceIDs != null and provinceIDs !=''">
+                provinceIDs = #{provinceIDs},
+            </if>
+            <if test="serviceNumber != null and serviceNumber !=''">
+                serviceNumber = #{serviceNumber},
+            </if>
+            <if test="maxBuyNumber != null and maxBuyNumber !=''">
+                maxBuyNumber = #{maxBuyNumber},
+            </if>
+            <if test="packageCount != null and packageCount !=''">
+                packageCount = #{packageCount},
+            </if>
+            <if test="byFlag != null and byFlag !=''">
+                byFlag = #{byFlag},
+            </if>
+            <if test="normalProductFlag != null and normalProductFlag !=''">
+                normalProductFlag = #{normalProductFlag},
+            </if>
+            <if test="wholeSaleProductFlag != null and wholeSaleProductFlag !=''">
+                wholeSaleProductFlag = #{wholeSaleProductFlag},
+            </if>
+            <if test="promotionProductFlag != null and promotionProductFlag !=''">
+                promotionProductFlag = #{promotionProductFlag},
+            </if>
+            <if test="groupBuyProductFlag != null and groupBuyProductFlag !=''">
+                groupBuyProductFlag = #{groupBuyProductFlag},
+            </if>
+            <if test="step != null and step !=''">
+                step = #{step},
+            </if>
+            <if test="actFlag != null and actFlag !=''">
+                actFlag = #{actFlag},
+            </if>
+            <if test="actSort != null and actSort !=''">
+                actSort = #{actSort},
+            </if>
+            <if test="actType != null and actType !=''">
+                actType = #{actType},
+            </if>
+            <if test="onlineTime != null and onlineTime !=''">
+                onlineTime = #{onlineTime},
+            </if>
+            <if test="downlineTime != null and downlineTime !=''">
+                downlineTime = #{downlineTime},
+            </if>
+            <if test="freePostFlag != null and freePostFlag !=''">
+                freePostFlag = #{freePostFlag},
+            </if>
+            <if test="precisehKey != null and precisehKey !=''">
+                precisehKey = #{precisehKey},
+            </if>
+            <if test="visibility != null and visibility !=''">
+                visibility = #{visibility},
+            </if>
+            <if test="commodityDetailsFlag != null and commodityDetailsFlag != ''">
+                commodityDetailsFlag = #{commodityDetailsFlag},
+            </if>
+            <if test="productType != null and productType !=''">
+                productType = #{productType},
+            </if>
+            <if test="qualificationImg != null and qualificationImg !=''">
+                qualificationImg = #{qualificationImg},
+            </if>
+            <if test="qualificationImg != null and qualificationImg !=''">
+                qualificationImg = #{qualificationImg},
+            </if>
+            <if test="invoiceType != null and invoiceType !=''">
+                invoiceType = #{invoiceType},
+            </if>
+            <if test="taxPoint != null and taxPoint !=''">
+                taxPoint = #{taxPoint},
+            </if>
+            <if test="supplierTaxPoint != null and supplierTaxPoint !=''">
+                supplierTaxPoint = #{supplierTaxPoint},
+            </if>
+            <if test="endTimeStr != null and endTimeStr !=''">
+                endTimeStr = #{endTimeStr},
+            </if>
+            <if test="tags != null and tags !=''">
+                tags = #{tags},
+            </if>
+            <if test="recommendType != null and recommendType !=''">
+                recommendType = #{recommendType},
+            </if>
+            <if test="machineType != null and machineType !=''">
+                machineType = #{machineType},
+            </if>
+            <if test="includedTax != null and includedTax !=''">
+                includedTax = #{includedTax},
+            </if>
+            <if test="invoiceType != null and invoiceType !=''">
+                invoiceType = #{invoiceType},
+            </if>
+            <if test="commodityType != null and commodityType != ''">
+                commodityType = #{commodityType},
+            </if>
+            <if test="trainingMethod != null">
+                trainingMethod = #{trainingMethod},
+            </if>
+            <if test="trainingType != null">
+                trainingType = #{trainingType},
+            </if>
+            <if test="trainingFee != null">
+                trainingFee = #{trainingFee},
+            </if>
+            <if test="qualificationNo !=null and qualificationNo != ''">
+                qualificationNo=#{qualificationNo},
+            </if>
+            <if test="productName !=null and productName !=''">
+                productName=#{productName},
+            </if>
+            <if test="qualificationTime !=null and qualificationTime!=''">
+                qualificationTime=#{qualificationTime},
+            </if>
+            <if test="qualificationLink !=null and qualificationLink!=''">
+                qualificationLink=#{qualificationLink},
+            </if>
+
+            newProductType=#{newProductType},
+            showFlag=#{showFlag},
+            announType=#{announType},
+            splitCode = #{splitCode}
+        </set>
+        where productID = #{productID}
+    </update>
+    <update id="updateproductDetailInfo" parameterType="com.caimei.modules.product.entity.ProductDetailInfo">
+        update productdetailinfo
+        <set>
+            <if test="propValueAlias != null and propValueAlias != ''">
+                propValueAlias = #{propValueAlias},
+            </if>
+            <if test="propValueImages != null and propValueImages !=''">
+                propValueImages = #{propValueImages},
+            </if>
+            <if test="detailInfo != null">
+                detailInfo = #{detailInfo},
+            </if>
+            <if test="commonDetailInfo != null">
+                commonDetailInfo = #{commonDetailInfo},
+            </if>
+            <if test="detailInfoTxt != null">
+                detailInfoTxt = #{detailInfoTxt},
+            </if>
+            <if test="seoTitle != null and seoTitle !=''">
+                seoTitle = #{seoTitle},
+            </if>
+            <if test="seoKeyword != null and seoKeyword !=''">
+                seoKeyword = #{seoKeyword},
+            </if>
+            <if test="seoDes != null and seoDes !=''">
+                seoDes = #{seoDes},
+            </if>
+            <if test="serviceInfo != null ">
+                serviceInfo = #{serviceInfo},
+            </if>
+            <if test="orderInfo != null ">
+                orderInfo = #{orderInfo},
+            </if>
+        </set>
+        where productID = #{productID}
+    </update>
+    <update id="updateLadderPrice">
+        update product_ladder_price
+        set productId  = #{productId},
+            ladderNum  = #{ladderNum},
+            buyNum     = #{buyNum},
+            buyPrice   = #{buyPrice},
+            updateBy   = #{updateBy},
+            updateDate = #{updateDate},
+            delFlag    = #{delFlag}
+        where id = #{id}
+    </update>
+    <update id="updateMainImage">
+        update product
+        set mainImage =#{mainImage}
+        where productID = #{productID}
+    </update>
+
+    <select id="getProductByTypeName" resultType="com.caimei.modules.brand.entity.BrandAndProductType">
+        select b.name   AS "bigTypeName",
+               b.bigTypeID,
+               s.`name` AS "smallTypeName",
+               s.smalltypeID,
+               t.name   AS "tinyTypeName",
+               t.tinytypeID
+        from tinytype t
+                 LEFT JOIN smalltype s on t.smallTypeID = s.smallTypeID
+                 LEFT JOIN bigtype b ON b.bigTypeID = s.bigTypeID
+        where b.`name` = #{name}
+          AND s.`name` = #{name1}
+          AND t.name = #{name2}
+    </select>
+
+    <select id="findRecommendBySys" resultType="com.caimei.modules.product.entity.CmProductRecommend">
+        select p.productID AS recommendProductID,
+               p.name      AS productName,
+               p.unit      AS unit,
+               p.mainImage AS img,
+               s.name      AS shopName
+        from product p
+                 left join shop s on s.shopID = p.shopID
+        where p.tinyTypeID = #{tinyTypeID}
+          and p.productCategory = 1
+        order by p.sellNumber
+                desc
+        limit 0, 7
+    </select>
+
+    <select id="getSecondHandRecommend" resultType="CmSecondHandRecommendVo">
+        select p.productID       AS id,
+               1                 AS type,
+               p.name            AS name,
+               p.unit            AS unit,
+               p.mainImage       AS img,
+               s.name            AS shopName,
+               p.productCategory as "productCategory"
+        from product p
+                 left join shop s on s.shopID = p.shopID
+        where p.productID = #{productID}
+          AND p.validFlag = '2'
+    </select>
+
+    <select id="querySecondHandRecommend" resultType="CmSecondHandRecommendVo">
+        select
+        p.productID AS id,
+        1 AS type,
+        p.name AS name,
+        p.unit AS unit,
+        p.mainImage AS img,
+        s.name AS shopName,
+        p.productCategory as "productCategory"
+        from product p
+        left join shop s on s.shopID = p.shopID
+        <where>
+            <if test="productID != null and productID != ''">
+                p.productID = #{productID}
+            </if>
+            <if test="productName != null and productName != ''">
+                and p.name like concat('%', #{productName} ,'%')
+            </if>
+            AND p.validFlag = '2'
+            and p.productCategory = #{queryProductType}
+        </where>
+        limit 0, 10
+    </select>
+    <select id="queryProductDetailInfo" resultType="com.caimei.modules.product.entity.ProductDetailInfo">
+        SELECT *
+        FROM productdetailinfo
+        where productID = #{productID}
+    </select>
+    <select id="qualification" resultType="com.caimei.modules.product.entity.Product">
+        SELECT qualificationNo, productName, qualificationTime, qualificationLink
+        FROM product
+        where productID = #{productID}
+    </select>
+    <select id="findProductLadderPrice" resultType="com.caimei.po.ProductLadderPrice">
+        SELECT *
+        FROM product_ladder_price
+        WHERE productId = #{productId}
+          AND userType = #{userType}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY ladderNum ASC
+    </select>
+    <select id="findActList" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <where>
+            <if test="id !=null and id !=''">
+                AND a.productID=#{id}
+            </if>
+            <if test="shopID != null and shopID != ''">
+                AND a.shopID = #{shopID}
+            </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="shopName != null and shopName != ''">
+                AND s.name LIKE
+                <if test="dbName == 'oracle'">'%'||#{shopName}||'%'</if>
+                <if test="dbName == 'mssql'">'%'+#{shopName}+'%'</if>
+                <if test="dbName == 'mysql'">concat('%',#{shopName},'%')</if>
+            </if>
+            <if test="validFlag !=null and validFlag !=''">
+                AND a.validFlag=#{validFlag}
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            AND a.actStatus = 1
+            and a.productCategory = 1
+        </where>
+        <choose>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by case WHEN a.validFlag = 1 then 0 else 1 END asc,a.productID desc
+            </otherwise>
+        </choose>
+    </select>
+
+    <select id="findAllProduct" resultType="com.caimei.modules.product.entity.Product">
+        select p.productID,p.mainImage,p.name,s.name as shopName from product p left join shop s on p.shopID = s.shopID
+        <where>
+            (p.actFlag=0 or p.actType is null) and p.validFlag = 2 and p.productCategory = 1
+            <if test="productIds != null and productIds != '' ">
+                and p.productID != #{productIds}
+            </if>
+            <if test="productID != null and productID != ''">
+                and p.productID = #{productID}
+            </if>
+            <if test="name != null and name != ''">
+                and p.name like concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                and s.name like concat('%',#{shopName},'%')
+            </if>
+        </where>
+        order by productID asc
+    </select>
+
+    <select id="findProductImage" resultType="com.caimei.modules.product.entity.Product">
+        SELECT
+        <include refid="productColumns"/>
+        FROM product a
+        <include refid="productJoins"/>
+        <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>
+            <when test="page !=null and page.orderBy != null and page.orderBy != ''">
+                ORDER BY ${page.orderBy}
+            </when>
+            <otherwise>
+                order by a.productID asc
+            </otherwise>
+        </choose>
+    </select>
+    <select id="findProductDetail" resultType="java.lang.String">
+        select productDetail
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findProductDescribe" resultType="java.lang.String">
+        select productDescribe
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findSepcialShopList" resultType="com.caimei.modules.product.entity.CmShop">
+        select name, shopID
+        from shop
+        where shopType = 2
+    </select>
     <select id="getSplitCodeByProductId" resultType="java.lang.String">
-		select splitCode from product where productID = #{productID}
-	</select>
-	<select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
-		select shopId,commercialCode as splitCode,codeDetail as codeName,email
-		from cm_shop_splitcode
-		where shopId = #{shopID}
-	</select>
+        select splitCode
+        from product
+        where productID = #{productID}
+    </select>
+    <select id="findSplitCodesByShopId" resultType="com.caimei.modules.product.entity.CmSplitCode">
+        select shopId, commercialCode as splitCode, codeDetail as codeName, email
+        from cm_shop_splitcode
+        where shopId = #{shopID}
+    </select>
+    <select id="findSkuList" resultType="com.caimei.modules.product.entity.CmSku">
+        select skuId,
+               productId,
+               unit,
+               normalPrice,
+               stock,
+               costCheckFlag,
+               costProportional,
+               costPrice,
+               price,
+               ladderPriceFlag,
+               minBuyNumber
+        from cm_sku
+        where productId = #{productID}
+    </select>
+    <select id="findLadderPriceBySku" resultType="com.caimei.modules.product.entity.CmLadderPrice">
+        select skuId,productId,userType,ladderNum,buyNum,buyPrice
+        FROM product_ladder_price
+        WHERE productId = #{productId}
+          AND userType = 3
+          AND skuId=#{skuId}
+          AND buyNum is NOT null
+          AND buyPrice is NOT null
+          AND delFlag = 0
+        ORDER BY ladderNum ASC
+    </select>
 </mapper>

+ 186 - 55
src/main/webapp/WEB-INF/views/modules/bulkpurchase/orderPurchaseProductList.jsp

@@ -6,20 +6,80 @@
     <title>直接生成订单的添加商品页面</title>
     <meta name="decorator" content="default"/>
     <style type="text/css">
-        .table th{text-align:center;white-space:nowrap}
-        .table td{text-align:center;white-space:nowrap}
-        .sel{background:RGB(232,232,232)}
-        #contentTable input{text-align:center}
-        #contentTable input[readonly]{border:0 solid #ccc;border-radius:4px;background:#fff}
-        #contentTable tr:hover input[readonly]{background:#e8e8e8}
-        #contentTable input[type="text"]{height:17px;line-height:17px;margin-bottom:0;border:0}
-        .ladderPrice>span{text-decoration:underline;color:red}
-        .ladderPrice .list{display:none;position:absolute;background:#FFF;white-space:nowrap;border:1px solid #EEE;padding:10px 0;color:#333}
-        .ladderPrice:hover .list{display:block}
-        .ladderPrice .list span{margin:0 20px;width:60px;text-align:center;display:inline-block}
-        .ladderPrice .list span.price{color:red}
-        input[type=number]{-moz-appearance:textfield;margin:0}
-        input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
+        .table th {
+            text-align: center;
+            white-space: nowrap
+        }
+
+        .table td {
+            text-align: center;
+            white-space: nowrap
+        }
+
+        .sel {
+            background: RGB(232, 232, 232)
+        }
+
+        #contentTable input {
+            text-align: center
+        }
+
+        #contentTable input[readonly] {
+            border: 0 solid #ccc;
+            border-radius: 4px;
+            background: #fff
+        }
+
+        #contentTable tr:hover input[readonly] {
+            background: #e8e8e8
+        }
+
+        #contentTable input[type="text"] {
+            height: 17px;
+            line-height: 17px;
+            margin-bottom: 0;
+            border: 0
+        }
+
+        .ladderPrice > span {
+            text-decoration: underline;
+            color: red
+        }
+
+        .ladderPrice .list {
+            display: none;
+            position: absolute;
+            background: #FFF;
+            white-space: nowrap;
+            border: 1px solid #EEE;
+            padding: 10px 0;
+            color: #333
+        }
+
+        .ladderPrice:hover .list {
+            display: block
+        }
+
+        .ladderPrice .list span {
+            margin: 0 20px;
+            width: 60px;
+            text-align: center;
+            display: inline-block
+        }
+
+        .ladderPrice .list span.price {
+            color: red
+        }
+
+        input[type=number] {
+            -moz-appearance: textfield;
+            margin: 0
+        }
+
+        input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button {
+            -webkit-appearance: none;
+            margin: 0
+        }
     </style>
     <script type="text/javascript">
         $(document).ready(function () {
@@ -224,9 +284,32 @@
             items.push(json);
             return items;
         }
+
         function onlynum(obj) {
             obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
         }
+
+        function checkSkuValue(ind) {
+            var c = "#" + "ints" + ind;
+            var skuStr = $(c).val();
+            var $checkItem = eval('(' + $("#check-item" + ind).val() + ')');
+            $checkItem["skuStr"] = skuStr;
+            //切换价格
+            var price = "priceLabel" + ind;//单价
+            var singlePrice = "#" + "discountPrice" + ind;
+            var totalFee = "#"+"totalFee" + ind;
+            var skus = JSON.parse($("#hideSkus").val());
+            var skuIndex = skuStr.split("/")[1];
+            console.log(skus[skuIndex].price);
+            //页面价格赋值
+            document.getElementById(price).innerHTML = skus[skuIndex].price;
+            $(singlePrice).val(skus[skuIndex].price);
+            $(totalFee).val(skus[skuIndex].price);
+            $checkItem["price"] = skus[skuIndex].price;
+            $checkItem["discountPrice"] = skus[skuIndex].price;
+            $checkItem["totalFee"] = skus[skuIndex].price;
+            $("#check-item" + ind).val(JSON.stringify($checkItem));
+        }
     </script>
 </head>
 <body>
@@ -247,7 +330,8 @@
             <label>商品名称:</label>
             <form:input path="purchaseProductName" htmlEscape="false" maxlength="30" class="input-medium"/>
             <label>商品ID:</label>
-            <form:input path="productId" htmlEscape="false" maxlength="11" class="input-medium" onkeyup="onlynum(this)"/>
+            <form:input path="productId" htmlEscape="false" maxlength="11" class="input-medium"
+                        onkeyup="onlynum(this)"/>
             <label>供应商名称:</label>
             <form:input path="shopName" htmlEscape="false" maxlength="20" class="input-medium"/>
             &nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
@@ -266,6 +350,7 @@
             <th>商品名称</th>
             <th>商品编码</th>
             <th>供应商名称</th>
+            <th>规格</th>
             <th>当前单价</th>
             <th>折扣</th>
             <th>折后单价</th>
@@ -289,7 +374,8 @@
                 <th><input class="check-item" type="radio" name="cmClub" id="check-item${state.index}"
                            value='${fns:toJson(purchaseProduct)}'/></th>
                 <td>
-                    <label id="productId${state.index}" value="${purchaseProduct.productId}" disabled>${purchaseProduct.productId}</label>
+                    <label id="productId${state.index}" value="${purchaseProduct.productId}"
+                           disabled>${purchaseProduct.productId}</label>
                     <c:if test="${purchaseProduct.buyAgainPriceFlag eq 1}">
                         <font color="red">(曾购)</font>
                     </c:if>
@@ -298,8 +384,18 @@
                 <td>${purchaseProduct.productNo}</td>
                 <td title="${purchaseProduct.shopName}">${fns:abbr(purchaseProduct.shopName,10)}</td>
                 <td>
-                    <label id="priceLabel${state.index}" style=" ${purchaseProduct.svipPriceFlag eq 1 or purchaseProduct.cmPromotion.mode eq 1?'text-decoration:line-through':'' }">${purchaseProduct.price}</label>
-                    <label id="svipDiscountPrice${state.index}"  style="display:none">${purchaseProduct.svipDiscountPrice}</label>
+                    <input id="hideSkus" value='${fns:toJson(purchaseProduct.skuList)}' hidden/>
+                    <select onchange="checkSkuValue(${state.index});" id="ints${state.index}">
+                        <c:forEach items="${purchaseProduct.skuList}" var="skus" varStatus="ind">
+                            <option value="${skus.skuId}/${ind.index}">${skus.unit}</option>
+                        </c:forEach>
+                    </select>
+                </td>
+                <td>
+                    <label id="priceLabel${state.index}"
+                           style=" ${purchaseProduct.svipPriceFlag eq 1 or purchaseProduct.cmPromotion.mode eq 1?'text-decoration:line-through':'' }">${purchaseProduct.skuList.get(0).price}</label>
+                    <label id="svipDiscountPrice${state.index}"
+                           style="display:none">${purchaseProduct.svipDiscountPrice}</label>
                     <label style="color: red">
                         <c:if test="${(purchaseProduct.includedTax != null and purchaseProduct.includedTax != '' and purchaseProduct.includedTax ne 2)
                          or purchaseProduct.svipPriceFlag eq 1}">
@@ -316,19 +412,22 @@
                         </c:if>
                     </label>
-                    <input type="hidden" id="price${state.index}" value="${purchaseProduct.price}"></td>
-                <td><input type="text" name="discount" id="discount${state.index}"
+                    <input type="hidden" id="price${state.index}" value="${purchaseProduct.skuList.get(0).price}">
+                </td>
+                <td>
+                    <input type="text" name="discount" id="discount${state.index}"
                            value="${empty purchaseProduct.discount ?100:(purchaseProduct.discount)}"
                            onchange="discountPriceVal(${state.index})"
-                           ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
-                           or purchaseProduct.ladderPriceFlag eq 1
-                           or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
+                    ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                            or purchaseProduct.ladderPriceFlag eq 1
+                            or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                            style="width: 50px">%
                 </td>
-                <td><input name="discountPrice" id="discountPrice${state.index}"
+                <td>
+                    <input name="discountPrice" id="discountPrice${state.index}"
                            value="${empty purchaseProduct.discount ?(purchaseProduct.svipPriceFlag eq 1?purchaseProduct.svipDiscountPrice: purchaseProduct.price):(purchaseProduct.discount)}"
                            onchange="countDiscount(${state.index})"
-                            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
+                    ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)
                             or purchaseProduct.ladderPriceFlag eq 1
                             or purchaseProduct.svipPriceFlag eq 1?'readonly="readonly"':''}
                            style="width: 80px;text-decoration: ${purchaseProduct.cmPromotion.mode eq 1?'line-through':''}">
@@ -337,7 +436,8 @@
                             <div class="list">
                                 <p><span>起订量</span><span>价格</span></p>
                                 <c:forEach items="${purchaseProduct.ladderPriceList}" var="ladderPrice">
-                                    <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNumRangeShow}</span><span class="price">${ladderPrice.buyPrice}</span></p>
+                                    <p data-num="${ladderPrice.buyNum}"><span>${ladderPrice.buyNumRangeShow}</span><span
+                                            class="price">${ladderPrice.buyPrice}</span></p>
                                 </c:forEach>
                             </div>
                         </a>
@@ -345,7 +445,8 @@
                 </td>
                 <td>
                     <button class="decrease" onclick="presentNum('${state.index}','del')">-</button>
-                    <input type="number" name="num" id="num${state.index}" style="width: 25px" min="${purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1}"
+                    <input type="number" name="num" id="num${state.index}" style="width: 25px"
+                           min="${purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1}"
                            onchange="changenum(${state.index})"
                            value="${(not empty purchaseProduct.num)?(purchaseProduct.num):(purchaseProduct.ladderPriceFlag eq 1?purchaseProduct.ladderPriceList[0].buyNum:1)}">
                     <button class="increase" onclick="presentNum('${state.index}','add')">+</button>
@@ -355,7 +456,7 @@
                         <td><input type="text" name="presentNum" id="presentNum${state.index}"
                                    onchange="giveNum(${state.index})"
                                    value="${(empty orderProduct.giveNum)?'0':(orderProduct.giveNum)}" class="required2 "
-                                    ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
+                            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
                                    style="width: 50px"></td>
                     </c:when>
                     <c:when test="${purchaseProduct.cmPromotion ne null}">
@@ -368,14 +469,15 @@
 
                 <td><input type="text" name="taxRate" id="taxRate${state.index}"
                            value="${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?0:(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'---': purchaseProduct.taxRate}"
-                            ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
-                           ${purchaseProduct.includedTax eq 1?'readonly="readonly"':(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3) )?'readonly="readonly"':''}
-                           onchange="taxRateVal(${state.index})" style="width: 50px">${(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'':'%'}
+                    ${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?'readonly="readonly"':''}
+                    ${purchaseProduct.includedTax eq 1?'readonly="readonly"':(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3) )?'readonly="readonly"':''}
+                           onchange="taxRateVal(${state.index})"
+                           style="width: 50px">${(purchaseProduct.includedTax != '' and purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)?'':'%'}
                 </td>
                 <td><input name="addedValueTax" id="addedValueTax${state.index}"
                            value="${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?0:(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 1 or (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)))?'---': empty purchaseProduct.addedValueTax ?0:(purchaseProduct.addedValueTax)}"
                            readonly style="width: 80px">
-               </td>
+                </td>
                 <td><input name="totalAddedValueTax" id="totalAddedValueTax${state.index}"
                            value="${(purchaseProduct.productId ge 6060 and purchaseProduct.productId le 6069)?0:(purchaseProduct.includedTax ne '' and (purchaseProduct.includedTax eq 1 or (purchaseProduct.includedTax eq 0 and purchaseProduct.invoiceType eq 3)))?'---': empty purchaseProduct.totalAddedValueTax ?0:(purchaseProduct.totalAddedValueTax)}"
                            readonly style="width: 80px">
@@ -393,7 +495,7 @@
                                 <option value="0">否</option>
                             </c:when>
                             <c:otherwise>
-                                <option value="1" selected="checked" >是</option>
+                                <option value="1" selected="checked">是</option>
                                 <option value="0">否</option>
                             </c:otherwise>
                         </c:choose>
@@ -401,15 +503,21 @@
                 </td>
                 <td id="promotion${state.index}">
                     <c:if test="${purchaseProduct.cmPromotion.mode eq 1}">
-                        <label style="float: left;cursor: default"><a href="javascript:void(0);" onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label style="background: green;color: white;">${purchaseProduct.cmPromotion.name}</label>
+                        <label style="float: left;cursor: default"><a href="javascript:void(0);"
+                                                                      onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label
+                                style="background: green;color: white;">${purchaseProduct.cmPromotion.name}</label>
                             <label>优惠价:${purchaseProduct.cmPromotion.touchPrice}</label></a></label>
                     </c:if>
                     <c:if test="${purchaseProduct.cmPromotion.mode eq 2}">
-                        <label style="float: left"><a href="javascript:void(0);" onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label style="background: #F60;color: white;" >${purchaseProduct.cmPromotion.name}</label>
+                        <label style="float: left"><a href="javascript:void(0);"
+                                                      onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label
+                                style="background: #F60;color: white;">${purchaseProduct.cmPromotion.name}</label>
                             <label>满${purchaseProduct.cmPromotion.touchPrice},减${purchaseProduct.cmPromotion.reducedPrice}</label></a></label>
                     </c:if>
                     <c:if test="${purchaseProduct.cmPromotion.mode eq 3}">
-                        <label style="float: left"><a href="javascript:void(0);" onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label style="background: purple;color: white;" >${purchaseProduct.cmPromotion.name}</label>
+                        <label style="float: left"><a href="javascript:void(0);"
+                                                      onclick="showPromotionDetail('iframe:${ctx}/bulkpurchase/purchaseProduct/promotionDetail?promotionId=${purchaseProduct.cmPromotion.id}','${purchaseProduct.cmPromotion.name}')"><label
+                                style="background: purple;color: white;">${purchaseProduct.cmPromotion.name}</label>
                             <label>满${purchaseProduct.cmPromotion.touchPrice},赠送商品</label></a></label>
                     </c:if>
                 </td>
@@ -431,75 +539,98 @@
                 </td>
                     <%--促销活动mode--%>
                 <td style="display: none">
-                    <input name="mode"  id="mode${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.mode: '0'}" readonly  style="width: 80px">
+                    <input name="mode" id="mode${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.mode: '0'}" readonly
+                           style="width: 80px">
                 </td>
                     <%--促销活动touchPrice--%>
                 <td style="display: none">
-                    <input name="touchPrice"  id="touchPrice${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.touchPrice: '0'}" readonly  style="width: 80px">
+                    <input name="touchPrice" id="touchPrice${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.touchPrice: '0'}"
+                           readonly style="width: 80px">
                 </td>
                     <%--促销活动reducedPrice--%>
                 <td style="display: none">
-                    <input name="touchPrice"  id="reducedPrice${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.reducedPrice: '0'}" readonly  style="width: 80px">
+                    <input name="touchPrice" id="reducedPrice${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.reducedPrice: '0'}"
+                           readonly style="width: 80px">
                 </td>
                     <%--name--%>
                 <td style="display: none">
-                    <input name="name"  id="promotionName${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.name: '0'}" readonly  style="width: 80px">
+                    <input name="name" id="promotionName${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.name: '0'}" readonly
+                           style="width: 80px">
                 </td>
                     <%--promotionsId--%>
                 <td style="display: none">
-                    <input name="promotionsId"  id="promotionsId${state.index}" value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.id: '0'}" readonly  style="width: 80px">
+                    <input name="promotionsId" id="promotionsId${state.index}"
+                           value="${purchaseProduct.cmPromotion ne null?purchaseProduct.cmPromotion.id: '0'}" readonly
+                           style="width: 80px">
                 </td>
                     <%--${ctx}--%>
                 <td style="display: none">
-                    <input name="ctx"  id="ctx${state.index}" value="${ctx}" readonly  style="width: 80px">
+                    <input name="ctx" id="ctx${state.index}" value="${ctx}" readonly style="width: 80px">
                 </td>
                     <%--是否含税--%>
                 <td style="display: none">
-                    <input name="includedTax"  id="includedTax${state.index}" value="${purchaseProduct.includedTax}" readonly  style="width: 80px">
+                    <input name="includedTax" id="includedTax${state.index}" value="${purchaseProduct.includedTax}"
+                           readonly style="width: 80px">
                 </td>
                     <%--发票类型--%>
                 <td style="display: none">
-                    <input name="invoiceType"  id="invoiceType${state.index}" value="${purchaseProduct.invoiceType}" readonly  style="width: 80px">
+                    <input name="invoiceType" id="invoiceType${state.index}" value="${purchaseProduct.invoiceType}"
+                           readonly style="width: 80px">
                 </td>
                     <%--供应商税率--%>
                 <td style="display: none">
-                    <input name="supplierTaxRate"  id="supplierTaxRate${state.index}" value="${purchaseProduct.supplierTaxRate}" readonly  style="width: 80px">
+                    <input name="supplierTaxRate" id="supplierTaxRate${state.index}"
+                           value="${purchaseProduct.supplierTaxRate}" readonly style="width: 80px">
                 </td>
                     <%--供应商税费(单)--%>
                 <td style="display: none">
-                    <input name="singleShouldPayTotalTax"  id="singleShouldPayTotalTax${state.index}" value="${purchaseProduct.singleShouldPayTotalTax}" readonly  style="width: 80px">
+                    <input name="singleShouldPayTotalTax" id="singleShouldPayTotalTax${state.index}"
+                           value="${purchaseProduct.singleShouldPayTotalTax}" readonly style="width: 80px">
                 </td>
                     <%--供应商税费(总)--%>
                 <td style="display: none">
-                    <input name="shouldPayTotalTax"  id="shouldPayTotalTax${state.index}" value="${purchaseProduct.shouldPayTotalTax}" readonly  style="width: 80px">
+                    <input name="shouldPayTotalTax" id="shouldPayTotalTax${state.index}"
+                           value="${purchaseProduct.shouldPayTotalTax}" readonly style="width: 80px">
                 </td>
                     <%--成本价选中标志:1固定成本 2比例成--%>
                 <td style="display: none">
-                    <input name="costCheckFlag"  id="costCheckFlag${state.index}" value="${purchaseProduct.costCheckFlag}" readonly  style="width: 80px">
+                    <input name="costCheckFlag" id="costCheckFlag${state.index}"
+                           value="${purchaseProduct.costCheckFlag}" readonly style="width: 80px">
                 </td>
                     <%--成本价--%>
                 <td style="display: none">
-                    <input name="costPrice"  id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly  style="width: 80px">
+                    <input name="costPrice" id="costPrice${state.index}" value="${purchaseProduct.costPrice}" readonly
+                           style="width: 80px">
                 </td>
                     <%--比例成本百分比90%--%>
                 <td style="display: none">
-                    <input name="costProportional"  id="costProportional${state.index}" value="${purchaseProduct.costProportional}" readonly  style="width: 80px">
+                    <input name="costProportional" id="costProportional${state.index}"
+                           value="${purchaseProduct.costProportional}" readonly style="width: 80px">
                 </td>
                     <%--旧商品标志,供应商税率跟随机构税率变动--%>
                 <td style="display: none">
-                    <input name="oldProductFlag"  id="oldProductFlag${state.index}" value="${purchaseProduct.oldProductFlag}" readonly  style="width: 80px">
+                    <input name="oldProductFlag" id="oldProductFlag${state.index}"
+                           value="${purchaseProduct.oldProductFlag}" readonly style="width: 80px">
                 </td>
                 <td style="display: none">
-                    <input name="svipReduction" id="svipReduction${state.index}" value="${purchaseProduct.svipReduction}">
+                    <input name="svipReduction" id="svipReduction${state.index}"
+                           value="${purchaseProduct.svipReduction}">
                 </td>
                 <td style="display: none">
-                    <input name="svipTaxReduction" id="svipTaxReduction${state.index}"  value="${purchaseProduct.svipTaxReduction}">
+                    <input name="svipTaxReduction" id="svipTaxReduction${state.index}"
+                           value="${purchaseProduct.svipTaxReduction}">
                 </td>
                 <td style="display: none">
-                    <input name="svipPriceFlag" id="svipPriceFlag${state.index}" value="${purchaseProduct.svipPriceFlag}">
+                    <input name="svipPriceFlag" id="svipPriceFlag${state.index}"
+                           value="${purchaseProduct.svipPriceFlag}">
                 </td>
                 <td style="display: none">
-                    <input name="svipPriceType" id="svipPriceType${state.index}" value="${purchaseProduct.svipPriceType}">
+                    <input name="svipPriceType" id="svipPriceType${state.index}"
+                           value="${purchaseProduct.svipPriceType}">
                 </td>
                 <td>
                     <c:if test="${purchaseProduct.couponsLogo eq 1}">

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 581 - 378
src/main/webapp/WEB-INF/views/modules/product-new/productEdit.jsp


+ 54 - 10
src/main/webapp/static/modules/bulkpurchase/orderForm.js

@@ -472,7 +472,7 @@ function setPageCoupon() {
         html += '            <span>' + item.couponName + '</span>';
         html += redemptionCode;
         html += '            <span>' + item.couponDesc + '</span>';
-        html += '            <span>有效期:'+item.receiveDate+' - '+item.useEndDate+'</span>';
+        html += '            <span>有效期:' + item.receiveDate + ' - ' + item.useEndDate + '</span>';
         html += '</span></label></li>';
     });
     $("#couponBox").find(".couponContent").html(html);
@@ -602,10 +602,19 @@ function deleteShop(obj) {
 function resetProductList(setData) {
     var productList = [];
     var productIdList = [];
+    var skuIds = [];
     //var if (promotionsIds.indexOf(tempId)>=0) {
     $('.productTable tbody tr:not(.gift)').each(function (index, element) {
         var data = JSON.parse($(this).attr("data-value"));
         productList.push(data);
+        if(data.skuStr){
+            var strings = data.skuStr.split("/");
+            var skuId = strings[0];
+            skuIds.push(skuId);
+        }else{
+            var skuId=data.skuList[0].skuId;
+            skuIds.push(skuId);
+        }
         productIdList.push(data.productId);
     });
     $('.productTable').each(function (index, element) {
@@ -620,7 +629,14 @@ function resetProductList(setData) {
             setProductList(data, false);
         });
     } else {
-        if (productIdList.indexOf(setData.productId) >= 0) {
+        var skuId;
+        if(setData.skuStr){
+            var strings = setData.skuStr.split("/");
+            skuId = strings[0];
+        }else{
+            skuId=setData.skuList[0].skuId;
+        }
+        if (skuIds.indexOf(skuId) >= 0) {
             //设置
             productList.forEach(function (data) {
                 if (setData.productId == data.productId) {
@@ -884,15 +900,28 @@ function setProductList(data) {
     if (data.couponsLogo * 1 === 2) {
         cmCouponBtn = '<a href="javascript:;" onclick="showCouponDetail(' + userId + ',' + data.productId + ')">查看</a>';
     }
+
+    var skuStr = "<td>" + data.skuList[0].unit + "</td>";
+    var skuIdStr = "<td>" + data.skuList[0].skuId + "</td>";
+    if (data.skuStr) {
+        var strings = data.skuStr.split("/");
+        var skuId = strings[0];
+        var index = strings[1] * 1;
+        skuStr = "<td>" + data.skuList[index].unit + "</td>";
+        skuIdStr = "<td>" + skuId + "</td>";
+    }
+
     var str =
         "<tr id='product_" + data.productId + "' data-value='" + JSON.stringify(data) + "' data-index='" +
         product_index + "'>" +
         "<td>" + data.productId + "</td>" +
+        skuIdStr +
         "<td hidden><input type='hidden' name='orderProduct[" + product_index + "].enabledStatus' id='orderProduct" +
         product_index + ".enabledStatus' value='" + JSON.stringify(data) + "'/>" + data.shopId + "</td>" +
         "<td hidden>" + data.shopName + "</td>" +
         "<td class='fix-width'>" + data.name + "</td><td hidden></td>" +
         (data.productCategory == 2 ? "" : ("<td>" + data.shopName + "</td>")) +
+        skuStr +
         "<td>" + data.num + (data.presentNum > 0 ? "(" + data.presentNum + ")" : "") + "</td>" +
         (data.svipPriceFlag == 1 ? "<td>" + data.discountPrice :
             (data.discount * 1 === 100 && data.cmPromotion && data.cmPromotion.mode == 1 ? ("<td><del>" + data.price +
@@ -935,8 +964,19 @@ function appendProductList(str, data, cmPromotion) {
     //把表中存在的删除
     var removeBeforeSoon = false; //是这一次移除
     var removeEle;
+
+    var skuId;
+    if (data.skuStr) {
+        var strings = data.skuStr.split("/");
+        skuId = strings[0];
+    } else {
+        skuId = data.skuList[0].skuId;
+    }
+    console.log("skuId---------------->" + skuId);
+
     $('.productTable tbody tr:not(.gift)').each(function (index, element) {
-        if ($(this).find("td:nth-child(1)").html() == data.productId) {
+        console.log("我看看-------------" + $(this).find("td:nth-child(2)").html());
+        if ($(this).find("td:nth-child(2)").html() == skuId) {
             removeEle = $(this).parent();
             $(this).remove();
             removeBeforeSoon = true;
@@ -944,6 +984,7 @@ function appendProductList(str, data, cmPromotion) {
     });
     if (removeBeforeSoon) {
         //走到这里 说明是修改
+        console.log("修改------------");
         removeEle.append(str);
     } else {
         //这里就是新加了 //先看有没有这个 当前这个商品的供应商的table
@@ -980,10 +1021,12 @@ function appendShopOrderHead(data, str, cmPromotion) {
         '<thead>' +
         '<tr>' +
         '<th>商品ID</th>' +
+        '<th>skuId</th>' +
         '<th hidden></th>' +
         '<th hidden></th>' +
         '<th class="fix-width">商品名称</th><th hidden></th>' +
         ((data.productCategory == 2) ? '' : '<th>供应商名称</th>') +
+        '<th>规格</th>' +
         '<th>数量(赠品数)</th>' +
         '<th>单价</th>' +
         '<th>折扣</th>' +
@@ -1273,7 +1316,7 @@ function setOrderFee() { //不考虑经理折扣、运费,此时 商品总金
             });
             if (touchPrice >= item.touchPrice) {
                 if (item.discount * 1 === 1) {
-                    var b = Math.floor(touchPrice/item.touchPrice);
+                    var b = Math.floor(touchPrice / item.touchPrice);
                     reducedPrice += (b * item.reducedPrice);
                     payTotalFee -= reducedPrice;
                 } else {
@@ -2056,7 +2099,7 @@ function setProductTotalFee() {
             });
             if (touchPrice >= item.touchPrice) {
                 if (item.discount * 1 === 1) {
-                    var b = Math.floor(touchPrice/item.touchPrice);
+                    var b = Math.floor(touchPrice / item.touchPrice);
                     reducedPrice += (b * item.reducedPrice);
                     payTotalFee -= reducedPrice;
                 } else {
@@ -2214,9 +2257,9 @@ function showPromotionDetail(iframe, title) {
  * 改变返佣标识
  */
 function updateRebateFlag() {
-    var rebateFlag = $("#rebateFlag").val()*1;
+    var rebateFlag = $("#rebateFlag").val() * 1;
     console.log(rebateFlag);
-    if (1===rebateFlag) {
+    if (1 === rebateFlag) {
         // $("#rebateFlag").val(1);
         //选中返佣订单后不可用优惠券
         // $("#couponBox").find("input[name=clubCouponId]").prop('checked', 'checked');
@@ -2288,13 +2331,14 @@ function updateRebateFlags() {
     }
 }
 
-function checkRebateFee(rebateFlag){
-    if(2===rebateFlag){
+function checkRebateFee(rebateFlag) {
+    if (2 === rebateFlag) {
         $("#rebateFee").show();
-    }else {
+    } else {
         $("#rebateFee").hide();
     }
 }
+
 /**
  * 修改返佣选项是否可见
  */

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott