Procházet zdrojové kódy

Merge remote-tracking branch 'origin/developer' into developerC

zhijiezhao před 2 roky
rodič
revize
6202cf0f17
31 změnil soubory, kde provedl 1098 přidání a 438 odebrání
  1. 4 1
      src/main/java/com/caimei365/commodity/components/SearchOpenService.java
  2. 1 3
      src/main/java/com/caimei365/commodity/controller/HeheApi.java
  3. 31 0
      src/main/java/com/caimei365/commodity/controller/ProductPageApi.java
  4. 1 0
      src/main/java/com/caimei365/commodity/controller/ProductSellerApi.java
  5. 4 3
      src/main/java/com/caimei365/commodity/controller/ProductShopApi.java
  6. 22 0
      src/main/java/com/caimei365/commodity/mapper/PageMapper.java
  7. 2 0
      src/main/java/com/caimei365/commodity/mapper/PriceMapper.java
  8. 3 0
      src/main/java/com/caimei365/commodity/mapper/SearchMapper.java
  9. 1 1
      src/main/java/com/caimei365/commodity/mapper/ShopMapper.java
  10. 6 0
      src/main/java/com/caimei365/commodity/model/dto/ProductDto.java
  11. 3 0
      src/main/java/com/caimei365/commodity/model/dto/SecondDto.java
  12. 30 0
      src/main/java/com/caimei365/commodity/model/po/ProductPo.java
  13. 5 0
      src/main/java/com/caimei365/commodity/model/search/ProductDO.java
  14. 5 0
      src/main/java/com/caimei365/commodity/model/search/ProductListVo.java
  15. 5 0
      src/main/java/com/caimei365/commodity/model/vo/FloorImageVo.java
  16. 13 1
      src/main/java/com/caimei365/commodity/model/vo/PageFloorVo.java
  17. 6 0
      src/main/java/com/caimei365/commodity/model/vo/ProductFormVo.java
  18. 116 0
      src/main/java/com/caimei365/commodity/model/vo/ProductItemVo.java
  19. 9 0
      src/main/java/com/caimei365/commodity/service/PageService.java
  20. 1 1
      src/main/java/com/caimei365/commodity/service/ShopService.java
  21. 119 30
      src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java
  22. 25 11
      src/main/java/com/caimei365/commodity/service/impl/SearchIndexServiceImpl.java
  23. 12 10
      src/main/java/com/caimei365/commodity/service/impl/SearchProductServiceImpl.java
  24. 25 22
      src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java
  25. 10 2
      src/main/java/com/caimei365/commodity/service/impl/ShopServiceImpl.java
  26. 4 0
      src/main/java/com/caimei365/commodity/utils/Json2PojoUtil.java
  27. 131 0
      src/main/resources/mapper/PageMapper.xml
  28. 2 1
      src/main/resources/mapper/PriceMapper.xml
  29. 14 4
      src/main/resources/mapper/SearchMapper.xml
  30. 2 2
      src/main/resources/mapper/SecondHandMapper.xml
  31. 486 346
      src/main/resources/mapper/ShopMapper.xml

+ 4 - 1
src/main/java/com/caimei365/commodity/components/SearchOpenService.java

@@ -225,7 +225,7 @@ public class SearchOpenService {
         config.setStart(num - 1);
         config.setHits(size);
         // 设置搜索结果返回应用中哪些字段
-        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id","p_product_type"));
+        config.setFetchFields(Lists.newArrayList("id", "p_id", "p_name", "p_image", "p_brand_name", "p_unit", "p_code", "p_price_flag", "p_price_grade", "p_supplier_id", "p_keyword", "p_act_flag", "p_brand_id","p_product_type","p_newvalidflag"));
         // 注意:config子句中的rerank_size参数,在Rank类对象中设置
         // 设置返回格式为json格式
         config.setSearchFormat(SearchFormat.JSON);
@@ -468,6 +468,9 @@ public class SearchOpenService {
     public SearchParams getParams(String queryStr, Integer identity, String filter) {
         // 定义Config对象,用于设定config子句参数,指定应用名,分页,数据返回格式等等
         Config config = new Config(Lists.newArrayList(appName));
+        // 当前方法只有查询品牌用,为了显示品牌全数据,尽可能大的查询所有返回结果的商品
+        config.setStart(0);
+        config.setHits(500);
         // 设置搜索结果返回应用中哪些字段
         config.setFetchFields(Lists.newArrayList("p_brand_name", "p_brand_id"));
         // 设置返回格式为json格式

+ 1 - 3
src/main/java/com/caimei365/commodity/controller/HeheApi.java

@@ -107,8 +107,6 @@ public class HeheApi {
     public ResponseJson<Map<String, Object>> getHomeData(Integer userId) {
         return heheService.getHomeData(userId);
     }
-
-
     @ApiOperation("活动专区")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "userId", value = "分销者用户id", required = true),
@@ -151,4 +149,4 @@ public class HeheApi {
     public ResponseJson<HeheProductVo> getProductDetails(Integer productId, Integer userId) {
         return heheService.getProductDetails(productId, userId);
     }
-}
+}

+ 31 - 0
src/main/java/com/caimei365/commodity/controller/ProductPageApi.java

@@ -5,6 +5,7 @@ import com.caimei365.commodity.annotation.Statistics;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.model.po.AnnouncementPo;
 import com.caimei365.commodity.model.po.ProductParameterPo;
+import com.caimei365.commodity.model.po.ProductPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.*;
 import com.caimei365.commodity.service.PageService;
@@ -86,6 +87,36 @@ public class ProductPageApi {
         return pageService.getHomeData(userId, source);
     }
 
+
+    @ApiOperation("新品橱窗重点推荐数据")
+    @GetMapping("/home/recommend")
+    public ResponseJson<List<ProductPo>> getNewFloorRecommend() {
+
+        return pageService.getNewFloorRecommend();
+    }
+
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = false, name = "brandID", value = "品牌id"),
+
+    })
+    @ApiOperation("新品橱窗列表")
+    @GetMapping("/home/NewFloorList")
+    public ResponseJson<PaginationVo<ProductItemVo>> getNewFloorList(Integer source,
+                                                                     Integer userId,
+                                                                     @RequestParam(value = "brandID",required=false)List<String> brandID,
+                                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                     @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+
+        return pageService.getNewFloorList(source,userId,brandID,pageNum,pageSize);
+    }
+
+    @ApiOperation("新品橱窗品牌查询")
+    @GetMapping("/home/BrandName")
+    public ResponseJson <List<BrandVo>>getNewFloorBrand() {
+
+        return pageService.getNewFloorBrand();
+    }
+
     /**
      * 首页基础数据(小程序)
      *

+ 1 - 0
src/main/java/com/caimei365/commodity/controller/ProductSellerApi.java

@@ -26,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController;
 @RequiredArgsConstructor
 @RequestMapping("/commodity/seller")
 public class ProductSellerApi {
+
     private final SellerService sellerService;
 
     /**

+ 4 - 3
src/main/java/com/caimei365/commodity/controller/ProductShopApi.java

@@ -51,6 +51,7 @@ public class ProductShopApi {
     @ApiImplicitParams({
         @ApiImplicitParam(required = true, name = "shopId", value = "供应商Id"),
         @ApiImplicitParam(required = false, name = "name", value = "商品名称"),
+            @ApiImplicitParam(required = false, name = "newvalidFlag", value = "新品商品状态  0.参与 , 1.审核通过, 2.未参与 ,3.审核未通过,4.时间过期"),
         @ApiImplicitParam(required = false, name = "productCode", value = "货号"),
         @ApiImplicitParam(required = false, name = "validFlag", value = "状态:0逻辑删除,1待审核,2已上架,3已下架,8审核未通过,9已隐身,10已冻结"),
         @ApiImplicitParam(required = false, name = "featuredFlag", value = "是否主推:0否,1是"),
@@ -62,11 +63,11 @@ public class ProductShopApi {
         @ApiImplicitParam(required = false, name = "pageSize", value = "每页数量")
     })
     @GetMapping("/product/list")
-    public ResponseJson<Map<String, Object>> getShopProducts(Integer shopId, String name, String productCode,
-                                                             Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId,
+    public ResponseJson<Map<String, Object>> getShopProducts(Integer showFlag,Integer shopId, String name, String productCode,
+                                                             Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId,Integer newvalidFlag,
                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                              @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
-        return shopService.getShopProducts(shopId, name, productCode, validFlag, featuredFlag, commodityType, bigTypeId, smallTypeId, tinyTypeId, pageNum, pageSize);
+        return shopService.getShopProducts(showFlag,shopId, name, productCode, validFlag, featuredFlag, commodityType, bigTypeId, smallTypeId, tinyTypeId,newvalidFlag, pageNum, pageSize);
     }
 
     /**

+ 22 - 0
src/main/java/com/caimei365/commodity/mapper/PageMapper.java

@@ -3,6 +3,7 @@ package com.caimei365.commodity.mapper;
 import com.caimei365.commodity.model.po.ArchiveFilePo;
 import com.caimei365.commodity.model.po.ArchivePo;
 import com.caimei365.commodity.model.po.BrandProductParamPo;
+import com.caimei365.commodity.model.po.ProductPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
@@ -48,6 +49,13 @@ public interface PageMapper {
      */
     List<PageFloorVo> getHomePageFloor(Integer source);
 
+    /**
+     * 首页固定楼层
+     *
+     * @param source
+     */
+    List<PageFloorVo> getPageFloor(Integer source);
+
     /**
      * 查询页面信息商品楼层
      *
@@ -358,4 +366,18 @@ public interface PageMapper {
      * 查找呵呵首页页面
      */
     CmPageVo findHeheHomePage();
+    /**
+     * 新品橱窗重点推荐
+     */
+    List<ProductPo> getNewFloorRecommend();
+    /**
+     * 新品橱窗商品列表
+     */
+    List<ProductItemVo> getNewFloorList(List<String> brandID);
+
+    ProductItemVo getNewFloor(Integer productID);
+
+    List<BrandVo> getNewFloorBrand();
+
+    String findLink(Integer productId);
 }

+ 2 - 0
src/main/java/com/caimei365/commodity/mapper/PriceMapper.java

@@ -75,4 +75,6 @@ public interface PriceMapper {
      * @param sales 销量
      */
     void insertProductSalesRecord(Integer productId, Integer sales);
+
+    void newFlag();
 }

+ 3 - 0
src/main/java/com/caimei365/commodity/mapper/SearchMapper.java

@@ -2,6 +2,7 @@ package com.caimei365.commodity.mapper;
 
 import com.caimei365.commodity.model.po.SearchHistoryPo;
 import com.caimei365.commodity.model.search.*;
+import com.caimei365.commodity.model.vo.PromotionsVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
@@ -254,4 +255,6 @@ public interface SearchMapper {
      */
     int countViewsByDate(Integer productId, Date date);
     int countSalesByDate(Integer productId, Date date);
+
+    List<Integer> findPromotions();
 }

+ 1 - 1
src/main/java/com/caimei365/commodity/mapper/ShopMapper.java

@@ -30,7 +30,7 @@ public interface ShopMapper {
     /**
      * 获取供应商-我的商品列表
      */
-    List<ProductItemVo> getShopProductsSelect(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId);
+    List<ProductItemVo> getShopProductsSelect(Integer showFlag,Integer newvalidFlag,Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId);
     /**
      * 列表显示分类
      */

+ 6 - 0
src/main/java/com/caimei365/commodity/model/dto/ProductDto.java

@@ -197,5 +197,11 @@ public class ProductDto implements Serializable {
      */
     @ApiModelProperty("培训费用(售价未包含)")
     private BigDecimal trainingFee;
+    /**
+     * 新品参与状态:1.参与2.未参与
+     */
+    @ApiModelProperty("新品参与状态:1.参与2.未参与")
+    private Integer newProductType;
+
 
 }

+ 3 - 0
src/main/java/com/caimei365/commodity/model/dto/SecondDto.java

@@ -175,4 +175,7 @@ public class SecondDto implements Serializable {
     @ApiModelProperty("出让承诺函图片")
     private String commitmentImage;
 
+    @ApiModelProperty("二手商品状态 1.二手预成交商品 2.二手估价商品")
+    private Integer announType;
+
 }

+ 30 - 0
src/main/java/com/caimei365/commodity/model/po/ProductPo.java

@@ -231,5 +231,35 @@ public class ProductPo implements Serializable {
      * 培训费用(售价未包含)
      */
     private BigDecimal trainingFee;
+    /**
+     * 发布类型 1.二手预成交商品 2.二手估价商品
+     */
+    private Integer announType;
+    /**
+     * 新品商品状态  0.参与 , 1.审核通过, 2.未参与 ,3.审核未通过'
+     */
+    private Integer newvalidFlag;
+    /**
+     * 新品参与状态:1.参与2.未参与
+     */
+    private Integer newProductType;
+    /**
+     * 新品展示状态1,已展示2,已下线3,展示过期
+     */
+    private Integer showFlag;
+    /**
+     * 展示结束时间
+     */
+    private String showTime;
+    /**
+     * 重点推荐1,重点
+     */
+    private Integer recommend;
+    /**
+     * 展示开始时间
+     */
+    private String newshowTime;
+
+    private String BrandName;
 
 }

+ 5 - 0
src/main/java/com/caimei365/commodity/model/search/ProductDO.java

@@ -76,5 +76,10 @@ public class ProductDO implements Serializable {
     private Integer p_promotions_id;
     /**商品类型:0其它类型(默认),1妆字号,2械字号 */
     private Integer p_product_type;
+    /**
+     * 新品状态1.新品
+     */
+    private Integer p_newvalidflag;
+
     private static final long serialVersionUID = 1L;
 }

+ 5 - 0
src/main/java/com/caimei365/commodity/model/search/ProductListVo.java

@@ -81,6 +81,11 @@ public class ProductListVo implements Serializable {
      */
     private Integer productType;
 
+    /**
+     * 新品状态 1.已审核表示新品
+     */
+    private Integer newvalidflag;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 5 - 0
src/main/java/com/caimei365/commodity/model/vo/FloorImageVo.java

@@ -4,6 +4,7 @@ import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 /**
@@ -98,6 +99,8 @@ public class FloorImageVo implements Serializable {
      */
     private ProductItemVo product;
 
+    private List<ProductItemVo> products;
+
     /**
      * 呵呵商品信息
      */
@@ -117,4 +120,6 @@ public class FloorImageVo implements Serializable {
      * 链接包含的参数
      */
     private Map<String, Object> linkParam;
+
+
 }

+ 13 - 1
src/main/java/com/caimei365/commodity/model/vo/PageFloorVo.java

@@ -1,6 +1,8 @@
 package com.caimei365.commodity.model.vo;
 
+import com.caimei365.commodity.model.po.ProductPo;
 import lombok.Data;
+import lombok.ToString;
 
 import java.io.Serializable;
 import java.util.List;
@@ -19,6 +21,7 @@ public class PageFloorVo implements Serializable {
     private String title;
     private String detail;
     private String link;
+    private Integer floorType;
     /**
      * 楼层相关商品图片
      */
@@ -31,6 +34,12 @@ public class PageFloorVo implements Serializable {
      * 楼层相关商品图片3
      */
     private List<FloorImageVo> floorImageList3;
+
+    /**
+     * 固定楼层相关商品
+     */
+    private List<FloorImageVo> floorImageList4;
+
     private List<PageFloorVo> subFloors;
     private List<ImageLinkVo> floorData;
     /**
@@ -48,7 +57,10 @@ public class PageFloorVo implements Serializable {
      * 楼层内容模板
      */
     private FloorContentVo floorContent;
-
+    /**
+     * 商品ID
+     */
+    private Integer productID;
     /**
      * 前端pc控制查看更多
      */

+ 6 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductFormVo.java

@@ -258,4 +258,10 @@ public class ProductFormVo implements Serializable {
      * 培训费用(售价未包含)
      */
     private BigDecimal trainingFee;
+
+    //新品参与状态1.参与2.未参与
+    private Integer newProductType;
+
+//新品审核状态 1,审核通过2,审核未通过3,待审核
+    private Integer newvalidFlag;
 }

+ 116 - 0
src/main/java/com/caimei365/commodity/model/vo/ProductItemVo.java

@@ -23,6 +23,8 @@ public class ProductItemVo implements Serializable {
      * 商品productID
      */
     private Integer productId;
+
+    private Integer brandID;
     /**
      * 名称name
      */
@@ -235,4 +237,118 @@ public class ProductItemVo implements Serializable {
      * 超级会员优惠价标签
      */
     private String svipPriceTag;
+    /**
+     * 发布类型 1.二手预成交商品 2.二手估价商品
+     */
+    private Integer announType;
+    /**
+     * 新品商品状态  0.参与 , 1.审核通过, 2.未参与 ,3.审核未通过'
+     */
+    private Integer newvalidFlag;
+    /**
+     * 新品展示状态1,已展示2,已下线3,展示过期
+     */
+    private Integer showFlag;
+    /**
+     * 展示结束时间
+     */
+    private String showTime;
+    /**
+     * 重点推荐1,重点
+     */
+    private Integer recommend;
+    /**
+     * 展示开始时间
+     */
+    private String newshowTime;
+    /**
+     * 新品参与状态1.参与2.未参与
+     */
+    private Integer newProductType;
+
+    private String BrandName;
+
+    /**
+     * 楼层相关商品图片
+     */
+    private List<FloorImageVo> floorImageList;
+    /**
+     * 楼层相关商品图片2
+     */
+    private List<FloorImageVo> floorImageList2;
+    /**
+     * 楼层相关商品图片3
+     */
+    private List<FloorImageVo> floorImageList3;
+
+    @Override
+    public String toString() {
+        return "ProductItemVo{" +
+                "id=" + id +
+                ", productId=" + productId +
+                ", brandID=" + brandID +
+                ", name='" + name + '\'' +
+                ", image='" + image + '\'' +
+                ", brandName='" + brandName + '\'' +
+                ", unit='" + unit + '\'' +
+                ", code='" + code + '\'' +
+                ", price=" + price +
+                ", priceFlag=" + priceFlag +
+                ", priceGrade=" + priceGrade +
+                ", visibility='" + visibility + '\'' +
+                ", shopId=" + shopId +
+                ", keyword='" + keyword + '\'' +
+                ", originalPrice=" + originalPrice +
+                ", costCheckFlag=" + costCheckFlag +
+                ", costPrice=" + costPrice +
+                ", number=" + number +
+                ", productType=" + productType +
+                ", step=" + step +
+                ", minBuyNumber=" + minBuyNumber +
+                ", maxBuyNumber=" + maxBuyNumber +
+                ", validFlag=" + validFlag +
+                ", actStatus=" + actStatus +
+                ", ladderPriceFlag=" + ladderPriceFlag +
+                ", stock=" + stock +
+                ", status=" + status +
+                ", ladderPrices=" + ladderPrices +
+                ", promotions=" + promotions +
+                ", productCategory=" + productCategory +
+                ", productCode='" + productCode + '\'' +
+                ", productsChecked=" + productsChecked +
+                ", repurchasePriceState=" + repurchasePriceState +
+                ", includedTax='" + includedTax + '\'' +
+                ", invoiceType='" + invoiceType + '\'' +
+                ", taxRate=" + taxRate +
+                ", userIdentity=" + userIdentity +
+                ", detailTalkFlag=" + detailTalkFlag +
+                ", aliasName='" + aliasName + '\'' +
+                ", normalPrice=" + normalPrice +
+                ", typeName='" + typeName + '\'' +
+                ", featuredFlag=" + featuredFlag +
+                ", commodityType=" + commodityType +
+                ", bigTypeId=" + bigTypeId +
+                ", smallTypeId=" + smallTypeId +
+                ", tinyTypeId=" + tinyTypeId +
+                ", initProductNum=" + initProductNum +
+                ", totalPrice=" + totalPrice +
+                ", discountPrice=" + discountPrice +
+                ", repurchaseFlag=" + repurchaseFlag +
+                ", isChecked=" + isChecked +
+                ", couponsLogo=" + couponsLogo +
+                ", svipProductFlag=" + svipProductFlag +
+                ", svipPriceTag='" + svipPriceTag + '\'' +
+                ", announType=" + announType +
+                ", newvalidFlag=" + newvalidFlag +
+                ", showFlag=" + showFlag +
+                ", showTime='" + showTime + '\'' +
+                ", recommend=" + recommend +
+                ", newshowTime='" + newshowTime + '\'' +
+                ", newProductType=" + newProductType +
+                ", BrandName='" + BrandName + '\'' +
+                ", floorImageList=" + floorImageList +
+                ", floorImageList2=" + floorImageList2 +
+                ", floorImageList3=" + floorImageList3 +
+                '}';
+    }
 }

+ 9 - 0
src/main/java/com/caimei365/commodity/service/PageService.java

@@ -3,6 +3,7 @@ package com.caimei365.commodity.service;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.model.po.AnnouncementPo;
 import com.caimei365.commodity.model.po.ProductParameterPo;
+import com.caimei365.commodity.model.po.ProductPo;
 import com.caimei365.commodity.model.search.ProductListVo;
 import com.caimei365.commodity.model.vo.*;
 
@@ -41,6 +42,7 @@ public interface PageService {
      */
     ResponseJson<Map<String, Object>> getHomeData(Integer userId, Integer source);
 
+
     /**
      * 首页基础数据(小程序)
      *
@@ -227,6 +229,13 @@ public interface PageService {
 
     ResponseJson<CmPageVo> getFree(Integer id);
 
+    ResponseJson<List<ProductPo>>getNewFloorRecommend();
+
+     ResponseJson <List<BrandVo>>getNewFloorBrand();
+
+    ResponseJson<PaginationVo<ProductItemVo>> getNewFloorList(Integer source,Integer userId,List<String> brandID,int pageNum, int pageSize);
+
+
     /**
      * 设置跳转参数
      * @param floorContent

+ 1 - 1
src/main/java/com/caimei365/commodity/service/ShopService.java

@@ -45,7 +45,7 @@ public interface ShopService {
      * @param pageSize      每页数量
      * @return PageInfo<ProductShopVO>
      */
-    ResponseJson<Map<String, Object>> getShopProducts(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId, int pageNum, int pageSize);
+    ResponseJson<Map<String, Object>> getShopProducts(Integer showFlag,Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId,Integer newvalidFlag, int pageNum, int pageSize);
 
     /**
      * 供应商-发布商品

+ 119 - 30
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -137,7 +137,7 @@ public class PageServiceImpl implements PageService {
     @Cacheable(value = "getHomeCommodityData", key = "#userId +'-'+ #source", unless = "#result == null")
     @Override
     public ResponseJson<Map<String, Object>> getHomeData(Integer userId, Integer source) {
-        Map<String, Object> map = new HashMap<>(2);
+        Map<String, Object> map = new HashMap<>(6);
         //楼层管理
         source = source == null ? 1 : source;
         List<PageFloorVo> homePageFloor = pageMapper.getHomePageFloor(source);
@@ -156,6 +156,33 @@ public class PageServiceImpl implements PageService {
             floor.setFloorImageList(floorImageList);
         }
         map.put("homePageFloor", homePageFloor);
+
+
+
+        List<PageFloorVo> pageFloorList = pageMapper.getPageFloor(source);
+        Iterator<PageFloorVo> floorIterators = pageFloorList.iterator();
+        while (floorIterators.hasNext()) {
+            PageFloorVo floors = floorIterators.next();
+            FloorContentVo floorContent = pageMapper.getFloorContentById(floors.getId());
+            setFloorLinkType(floorContent);
+            floors.setFloorContent(floorContent);
+
+            List<ProductItemVo> newFloorList = pageMapper.getNewFloorList(null);
+            newFloorList.forEach(n -> priceUtilService.setProductDetails(userId, n));
+            List<FloorImageVo> floorImageLists = new ArrayList<>();
+            for (int i = 0; i < newFloorList.size(); i++) {
+                //优惠券标识
+                Boolean couponsLogo = setCouponsLogo(userId, newFloorList.get(i).getProductId(), source);
+                newFloorList.get(i).setCouponsLogo(couponsLogo);
+                FloorImageVo floorImageVo = new FloorImageVo();
+                floorImageVo.setProduct(newFloorList.get(i));
+                floorImageVo.setLink(pageMapper.findLink(newFloorList.get(i).getProductId()));
+                floorImageLists.add(floorImageVo);
+            }
+            pageFloorList.forEach(po -> po.setFloorImageList4(floorImageLists));
+        }
+        map.put("pageFloorList",pageFloorList);
+
         // 优质供应商
         ShopFloorVo supplierImage = pageMapper.getSupplierFloorImage();
         List<ShopImageVo> supplierList = pageMapper.getSupplierImage(source);
@@ -173,6 +200,19 @@ public class PageServiceImpl implements PageService {
             }
         }
         map.put("supplierImage", supplierImage);
+
+//        List<FloorImageVo> floorImageList = pageMapper.getFloorImageById(floor.getId(), source);
+//        setFloorImageProduct(userId, floorImageList, source);
+//        pageFloorList.forEach(pageFloor->{
+//            if (floorImageList == null || floorImageList.size() == 0) {
+//                floorIterator.remove();
+//            }
+//            pageFloor.setFloorImageList(floorImageList);
+//            if (1 == pageFloor.getFloorType()) {
+//                List<ProductPo> newProductList = pageMapper.getNewFloorList(null);
+//                pageFloor.setNewfloorlist(newProductList);
+//            }
+//        });
         return ResponseJson.success(map);
     }
 
@@ -614,9 +654,9 @@ public class PageServiceImpl implements PageService {
             // 没有权限查看该商品
             if (!(pass1 || pass2 || pass3 || pass4 || pass5)) {
                 return ResponseJson.success(1, "没有权限查看该商品", new ProductDetailVo());
-            }//|| 4 == visibility
-        } else if (2 == visibility || 1 == visibility) {
-            return ResponseJson.success(1, "没有权限查看该商品", new ProductDetailVo());
+            }
+        } else if (2 == visibility || 1 == visibility || 4 == visibility) {
+            return ResponseJson.success(1, "没有权限查看该商品,userId为空", new ProductDetailVo());
         }
         // 商品不处于已删除/待审核/审核未通过的状态
         if (0 != product.getValidFlag()) {
@@ -959,9 +999,10 @@ public class PageServiceImpl implements PageService {
      * 设置楼层相关图片的商品信息
      */
     private void setFloorImageProduct(Integer userId, List<FloorImageVo> floorImageList, Integer source) {
+
         Iterator<FloorImageVo> iterator = floorImageList.iterator();
         while (iterator.hasNext()) {
-            FloorImageVo image = iterator.next();
+        FloorImageVo image = iterator.next();
             Integer linkType = AppletsLinkUtil.getLinkType(image.getLink());
             Map<String, Object> linkParam = AppletsLinkUtil.getLinkParam(linkType, image.getLink());
             image.setLinkType(linkType);
@@ -982,37 +1023,44 @@ public class PageServiceImpl implements PageService {
                     clubType = 0;
                 }
             }
-            if (image.getProductId() != null) {
-                // 获取商品及价格
-                ProductItemVo product = pageMapper.getProductItemById(image.getProductId());
-                if (product != null) {
-                    // visibility  3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
-                    String visibility = product.getVisibility();
-                    boolean visibileFlag = "3".equals(visibility) || ("4".equals(visibility) && clubType == 1) || ("1".equals(visibility) && (isSuperVip || identity == 2))
-                            || ("2".equals(visibility) && (isSuperVip || identity == 2 || identity == 4));
-                    if (!visibileFlag) {
-                        iterator.remove();
-                    } else {
-                        // 商品价格
-                        priceUtilService.setProductDetails(userId, product);
-                        // 设置商品主图
-                        image.setListType(1);
-                        image.setName(product.getName());
-                        image.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
-                        //优惠券标识
-                        Boolean couponsLogo = setCouponsLogo(userId, image.getProductId(), source);
-                        product.setCouponsLogo(couponsLogo);
 
-                        image.setProduct(product);
+
+
+                if (image.getProductId() != null) {
+                    // 获取商品及价格
+                    ProductItemVo product = pageMapper.getProductItemById(image.getProductId());
+                    if (product != null) {
+                        // visibility  3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+                        String visibility = product.getVisibility();
+                        boolean visibileFlag = "3".equals(visibility) || ("4".equals(visibility) && clubType == 1) || ("1".equals(visibility) && (isSuperVip || identity == 2))
+                                || ("2".equals(visibility) && (isSuperVip || identity == 2 || identity == 4));
+                        if (!visibileFlag) {
+                            iterator.remove();
+                        } else {
+                            // 商品价格
+                            priceUtilService.setProductDetails(userId, product);
+                            // 设置商品主图
+                            image.setListType(1);
+                            image.setName(product.getName());
+                            image.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
+                            //优惠券标识
+                            Boolean couponsLogo = setCouponsLogo(userId, image.getProductId(), source);
+                            product.setCouponsLogo(couponsLogo);
+
+                            image.setProduct(product);
+                        }
+                    } else {
+                        iterator.remove();
                     }
                 } else {
-                    iterator.remove();
+                    image.setListType(2);
                 }
-            } else {
-                image.setListType(2);
             }
         }
-    }
+
+
+
+
 
     /**
      * 优惠券标识是否显示
@@ -1305,4 +1353,45 @@ public class PageServiceImpl implements PageService {
         CmPageVo cmPageById = pageMapper.findCmPageById(id);
         return ResponseJson.success(cmPageById);
     }
+
+    @Override
+    public ResponseJson<List<ProductPo>>getNewFloorRecommend(){
+        List<ProductPo> floorRecommend=pageMapper.getNewFloorRecommend();
+          return ResponseJson.success(floorRecommend);
+    }
+
+    @Override
+    public ResponseJson <List<BrandVo>>getNewFloorBrand() {
+
+        List<BrandVo> floorBrand = pageMapper.getNewFloorBrand();
+        return ResponseJson.success(floorBrand);
+    }
+   @Override
+    public ResponseJson<PaginationVo<ProductItemVo>> getNewFloorList(Integer source,Integer userId,List<String> brandID,int pageNum, int pageSize) {
+        log.info("pagenum,pagesize,brandId-------------------------------->"+pageNum+"-----"+pageSize+"-=---------------"+brandID.toString());
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProductItemVo> list = pageMapper.getNewFloorList(brandID);
+        log.info("当前分页--------------------》"+list.toString());
+        list.forEach(product -> {
+            Boolean couponsLogo = setCouponsLogo(userId, product.getProductId(), source);
+            product.setCouponsLogo(couponsLogo);
+            if(product.getBrandID()!=null){
+                if (StringUtils.isNotBlank(product.getBrandID().toString())) {
+                    if (product.getBrandID().toString().contains(",")) {
+                        String[] split = product.getBrandID().toString().split(",");
+                        String Cons = "";
+                        for (String con : split) {
+                            Cons += product.getBrandID().toString() + ",";
+                        }
+                        Cons = Cons.substring(0, Cons.length() - 1);
+                    }
+                }
+            }
+            product.setPriceGrade(priceUtilService.getPriceGrade(product.getPrice()));
+            product.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
+        });
+        PaginationVo<ProductItemVo> pageData = new PaginationVo(list);
+        return ResponseJson.success(pageData);
+    }
+
 }

+ 25 - 11
src/main/java/com/caimei365/commodity/service/impl/SearchIndexServiceImpl.java

@@ -13,6 +13,7 @@ import com.caimei365.commodity.components.SearchOpenService;
 import com.caimei365.commodity.mapper.SearchMapper;
 import com.caimei365.commodity.model.ResponseJson;
 import com.caimei365.commodity.model.search.*;
+import com.caimei365.commodity.model.vo.PromotionsVo;
 import com.caimei365.commodity.service.SearchIndexService;
 import com.caimei365.commodity.service.SearchQueryService;
 import com.caimei365.commodity.utils.ImageUtils;
@@ -204,9 +205,14 @@ public class SearchIndexServiceImpl implements SearchIndexService {
         ProductDO product = searchMapper.searchProductById(productId);
         // product p_promotions_id
         if (null != product) {
-            List<Integer> promotionIds = searchMapper.findPromotionId(product.getP_id());
-            if (promotionIds != null && promotionIds.size() > 0) {
-                product.setP_promotions_id(promotionIds.get(0));
+            List<Integer> productIds = searchMapper.findPromotions();
+            if(null!=productIds&&productIds.size()>0){
+                boolean contains = productIds.contains(productId);
+                if(contains){
+                    product.setP_promotions_id(1);
+                }else{
+                    product.setP_promotions_id(0);
+                }
             }
 //            // 定义星范商品数据
 //            List<DocumentDTO<MallProductDO>> mallProductList = new ArrayList<>();
@@ -548,15 +554,15 @@ public class SearchIndexServiceImpl implements SearchIndexService {
             // 获取失效商品IDs
             List<Integer> invalidIds = searchMapper.findProductInvalidIds();
             // 根据商品IDs获取星范IDs
-            List<Integer> mallInvalidIds = searchMapper.findMallInvalidIdsByProductIds(invalidIds);
+//            List<Integer> mallInvalidIds = searchMapper.findMallInvalidIdsByProductIds(invalidIds);
             // 删除文档只需要设置需删除文档主键值即可
             Map<String, Object> deleteDoc = Maps.newLinkedHashMap();
-            if (null != mallInvalidIds) {
-                for (Integer mallId : mallInvalidIds) {
-                    // 根据ID(主键)删除文档
-                    deleteDoc.put("m_id", mallId);
-                }
-            }
+//            if (null != mallInvalidIds) {
+//                for (Integer mallId : mallInvalidIds) {
+//                    // 根据ID(主键)删除文档
+//                    deleteDoc.put("m_id", mallId);
+//                }
+//            }
             for (Integer invalidId : invalidIds) {
                 // 根据ID(主键)删除文档
                 deleteDoc.put("p_id", invalidId);
@@ -602,7 +608,15 @@ public class SearchIndexServiceImpl implements SearchIndexService {
             PageHelper.startPage(i, 100);
             // 获取数据库商品列表的分页数据
             List<ProductDO> dbList = searchMapper.searchProductList();
-
+            List<Integer> promotions=searchMapper.findPromotions();
+            dbList.forEach(d->{
+                boolean contains = promotions.contains(d.getP_id());
+                if(contains){
+                    d.setP_promotions_id(1);
+                }else{
+                    d.setP_promotions_id(0);
+                }
+            });
 //            // 定义星范商品数据
 //            List<DocumentDTO<MallProductDO>> mallProductList = new ArrayList<>();
             // 定义商品文档数据

+ 12 - 10
src/main/java/com/caimei365/commodity/service/impl/SearchProductServiceImpl.java

@@ -73,11 +73,12 @@ public class SearchProductServiceImpl implements SearchProductService {
         }
         List<String> filterList = new ArrayList<>();
         if (newFlag == 1) {
-            Calendar c = Calendar.getInstance();
-            c.setTime(new Date());
-            c.add(Calendar.YEAR, -1);
-            String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
-            filterList.add("p_time > " + time);
+//            Calendar c = Calendar.getInstance();
+//            c.setTime(new Date());
+//            c.add(Calendar.YEAR, -1);
+//            String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
+//            filterList.add("p_time > " + time);
+            filterList.add("p_newvalidflag = 1");
         }
         if (promotionFlag == 1) {
             filterList.add("p_promotions_id > 0");
@@ -257,11 +258,12 @@ public class SearchProductServiceImpl implements SearchProductService {
         }
         List<String> filterList = new ArrayList<>();
         if (newFlag == 1) {
-            Calendar c = Calendar.getInstance();
-            c.setTime(new Date());
-            c.add(Calendar.YEAR, -1);
-            String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
-            filterList.add("p_time > " + time);
+//            Calendar c = Calendar.getInstance();
+//            c.setTime(new Date());
+//            c.add(Calendar.YEAR, -1);
+//            String time = new SimpleDateFormat("yyyyMMdd").format(c.getTime());
+//            filterList.add("p_time > " + time);
+            filterList.add("p_newvalidflag = 1");
         }
         if (promotionFlag == 1) {
             filterList.add("p_promotions_id > 0");

+ 25 - 22
src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java

@@ -283,9 +283,9 @@ public class SecondHandServiceImpl implements SecondHandService {
         if (null == publishIdentity || publishIdentity <= 0) {
             return ResponseJson.error("参数异常:请选择发布者身份");
         }
-        if (StringUtils.isEmpty(fileType)) {
-            return ResponseJson.error("参数异常:请选择包含的文件类型");
-        }
+//        if (StringUtils.isEmpty(fileType)) {
+//            return ResponseJson.error("参数异常:请选择包含的文件类型");
+//        }
         if (StringUtils.isEmpty(secondHandType)) {
             return ResponseJson.error("参数异常:请选择分类");
         } else if (StringUtils.equals("1", secondHandType)) {
@@ -313,30 +313,30 @@ public class SecondHandServiceImpl implements SecondHandService {
         if (StringUtils.isEmpty(name)) {
             return ResponseJson.error("参数异常:请输入商品名称");
         }
-        if (null == price || price <= 0) {
-            return ResponseJson.error("参数异常:请输入交易价");
-        }
-        if (StringUtils.isEmpty(contactName)) {
-            return ResponseJson.error("参数异常:请输入联系人姓名");
-        }
+//        if (null == price || price <= 0) {
+//            return ResponseJson.error("参数异常:请输入交易价");
+//        }
+//        if (StringUtils.isEmpty(contactName)) {
+//            return ResponseJson.error("参数异常:请输入联系人姓名");
+//        }
         if (null == townId) {
             return ResponseJson.error("参数异常:请完善联系地址");
         }
         if (StringUtils.isEmpty(address)) {
             return ResponseJson.error("参数异常:请填写详细地址");
         }
-        if (StringUtils.isEmpty(image)) {
-            return ResponseJson.error("参数异常:请上传图片");
-        }
+//        if (StringUtils.isEmpty(image)) {
+//            return ResponseJson.error("参数异常:请上传图片");
+//        }
         if (StringUtils.isEmpty(productQuality)) {
             return ResponseJson.error("参数异常:请输入商品成色");
         }
         if (StringUtils.isEmpty(source)) {
             return ResponseJson.error("参数异常:请输入发布来源");
         }
-        if (StringUtils.isBlank(cardNumber)) {
-            return ResponseJson.error("参数异常:请输入收款卡号");
-        }
+//        if (StringUtils.isBlank(cardNumber)) {
+//            return ResponseJson.error("参数异常:请输入收款卡号");
+//        }
         // 保存二手商品
         return saveSecondHandProduct(secondDto);
     }
@@ -450,6 +450,7 @@ public class SecondHandServiceImpl implements SecondHandService {
         product.setUpdateTime(current);
         product.setOnlineTime(date);
         product.setOfflineTime(date);
+        product.setAnnounType(secondDto.getAnnounType());
         /* 保存商品表 */
         secondHandMapper.insertProduct(product);
         /* 保存商品图片信息*/
@@ -521,14 +522,16 @@ public class SecondHandServiceImpl implements SecondHandService {
         /* 保存商品二手附加详细信息 */
         secondHandMapper.saveSencondHandProduct(secondPo);
         //保存商品包含文件
-        String fileTypes = secondDto.getFileType();
-        if (fileTypes.contains(",")) {
-            String[] split = fileTypes.split(",");
-            for (String fileType : split) {
-                secondHandMapper.insertSecondFileType(fileType, secondPo.getId(), product.getProductId());
+        if(!"".equals(secondDto.getFileType()) || secondDto.getFileType()!=null) {
+            String fileTypes = secondDto.getFileType();
+            if (fileTypes.contains(",")) {
+                String[] split = fileTypes.split(",");
+                for (String fileType : split) {
+                    secondHandMapper.insertSecondFileType(fileType, secondPo.getId(), product.getProductId());
+                }
+            } else {
+                secondHandMapper.insertSecondFileType(fileTypes, secondPo.getId(), product.getProductId());
             }
-        } else {
-            secondHandMapper.insertSecondFileType(fileTypes, secondPo.getId(), product.getProductId());
         }
         return ResponseJson.success(product.getProductId());
     }

+ 10 - 2
src/main/java/com/caimei365/commodity/service/impl/ShopServiceImpl.java

@@ -101,13 +101,13 @@ public class ShopServiceImpl implements ShopService {
      * @return Map<String, Object>
      */
     @Override
-    public ResponseJson<Map<String, Object>> getShopProducts(Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId, int pageNum, int pageSize) {
+    public ResponseJson<Map<String, Object>> getShopProducts(Integer showFlag,Integer shopId, String name, String productCode, Integer validFlag, Integer featuredFlag, Integer commodityType, Integer bigTypeId, Integer smallTypeId, Integer tinyTypeId,Integer newvalidFlag, int pageNum, int pageSize) {
         if (null == shopId) {
             return ResponseJson.error("参数异常:缺少供应商Id", null);
         }
         Map<String, Object> map = new HashMap<>();
         PageHelper.startPage(pageNum, pageSize);
-        List<ProductItemVo> productList = shopMapper.getShopProductsSelect(shopId, name, productCode, validFlag, featuredFlag, commodityType, bigTypeId, smallTypeId, tinyTypeId);
+        List<ProductItemVo> productList = shopMapper.getShopProductsSelect(showFlag,newvalidFlag,shopId, name, productCode, validFlag, featuredFlag, commodityType, bigTypeId, smallTypeId, tinyTypeId);
         if (null != productList && productList.size() > 0) {
             for (ProductItemVo product : productList) {
                 String typeName = shopMapper.getTypeName(product.getBigTypeId(), product.getSmallTypeId(), product.getTinyTypeId());
@@ -221,6 +221,14 @@ public class ShopServiceImpl implements ShopService {
         String current = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
         //保存或修改商品
         ProductPo product = new ProductPo();
+        product.setNewProductType(productDto.getNewProductType());
+        log.info("打印日志__________>"+productDto.getNewProductType());
+        if(productDto.getNewProductType()==1){
+            product.setShowFlag(0);
+        }else {
+            product.setShowFlag(3);
+        }
+
 /*        if (null != productDto.getProductId()) {
             product.setProductId(productDto.getProductId());
         }

+ 4 - 0
src/main/java/com/caimei365/commodity/utils/Json2PojoUtil.java

@@ -56,6 +56,10 @@ public class Json2PojoUtil {
             product.setBrandId(json.getInt("p_brand_id"));
             /** 商品类型:0其它类型(默认),1妆字号,2械字号*/
             product.setProductType(json.getInt("p_product_type"));
+            /**
+             * 新品状态 1.已审核表示新品
+             */
+//            product.setNewvalidflag(json.getInt("p_newvalidflag"));
             productList.add(product);
         }
         return productList;

+ 131 - 0
src/main/resources/mapper/PageMapper.xml

@@ -44,6 +44,19 @@
         </if>
 		order by -sort desc,createDate desc
     </select>
+    <select id="getPageFloor" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
+        select id, type, floorTitle as title, floorDetail as detail,floorType
+        from new_page_floor
+        where delFlag = 0
+        <if test="source == 1">
+            AND wwwEnabledStatus = 1
+        </if>
+        <if test="source == 2">
+            AND crmEnabledStatus = 1
+        </if>
+        and floorType is not null
+        order by -sort desc,createDate desc
+    </select>
     <select id="getFloorByPageId" resultType="com.caimei365.commodity.model.vo.PageFloorVo">
         select id, title ,description as detail
         from cm_page_centre
@@ -761,4 +774,122 @@
         limit 1
     </select>
 
+    <select id="getNewFloorRecommend" resultType="com.caimei365.commodity.model.po.ProductPo">
+       select
+       *
+        from product
+        where recommend = 1
+          and  newvalidFlag=1
+        limit 5
+    </select>
+    <select id="getNewFloorList" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
+        SELECT DISTINCT
+        p.productID,
+        p.actStatus,
+        p.name,
+        p.aliasName,
+        p.visibility,
+        p.mainImage as image,
+        p.unit,
+        p.productCode as code,
+        p.priceFlag,
+        p.shopID as shopId,
+        p.searchKey as keyword,
+        p.minBuyNumber as minBuyNumber,
+        p.maxBuyNumber as maxBuyNumber,
+        p.ladderPriceFlag,
+        p.normalPrice,
+        p.step,
+        p.taxPoint as taxRate,
+        p.includedTax,
+        p.invoiceType,
+        p.productCategory as productCategory,
+        p.validFlag,
+        p.featuredFlag,
+        p.commodityType,
+        p.bigTypeID as bigTypeId,
+        p.smallTypeID as smallTypeId,
+        p.tinyTypeID as tinyTypeId,
+        p.productType,
+        p.brandID,
+        p.price
+        from product p
+        <where>
+            and p.showFlag!=5
+            and p.newvalidFlag = 1
+            and p.newProductType=1
+            and p.validFlag = 2
+            and p.showFlag!=2
+            <if test="brandID != null and brandID.size > 0">
+                and
+                <foreach collection="brandID" item="item" index="index" open="(" close=")" separator="OR">
+                    p.brandID LIKE CONCAT('%',#{item},'%')
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="getNewFloor" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
+        SELECT
+        p.productID,
+        p.actStatus,
+        p.name,
+        p.aliasName,
+        p.visibility,
+        p.mainImage as image,
+        p.unit,
+        p.productCode as code,
+        p.priceFlag,
+        p.price,
+        p.shopID as shopId,
+        p.searchKey as keyword,
+        p.minBuyNumber as minBuyNumber,
+        p.maxBuyNumber as maxBuyNumber,
+        p.ladderPriceFlag,
+        p.normalPrice,
+        p.step,
+        p.taxPoint as taxRate,
+        p.includedTax,
+        p.invoiceType,
+        p.productCategory as productCategory,
+        p.validFlag,
+        p.featuredFlag,
+        p.commodityType,
+        p.bigTypeID as bigTypeId,
+        p.smallTypeID as smallTypeId,
+        p.tinyTypeID as tinyTypeId,
+        p.productType,
+        p.brandID,
+        p.price
+        from product p
+        <where>
+
+            <if test="productID != null and productID!=''">
+                and productID=#{productID}
+            </if>
+            and p.newvalidFlag = 1
+            and p.newProductType=1
+            and p.validFlag = 2
+        </where>
+
+        #         order by p.combinationSort != 0 desc, p.combinationSort asc
+
+        order by p.sortIndex desc
+
+    </select>
+
+    <select id="getNewFloorBrand" resultType="com.caimei365.commodity.model.vo.BrandVo">
+        SELECT DISTINCT s.`id`,s.`name` FROM product a
+        LEFT JOIN `cm_brand` s ON s.id = a.brandID
+        WHERE  a.newvalidFlag = 1
+          AND s.id IS NOT NULL
+          AND s.name IS NOT NULL
+
+    </select>
+
+    <select id="findLink" resultType="java.lang.String">
+        select link from new_page_floor_image
+        where productId = #{productId}
+        limit 1
+    </select>
 </mapper>

+ 2 - 1
src/main/resources/mapper/PriceMapper.xml

@@ -53,7 +53,8 @@
             csp.priceType as svipPriceType,
             csp.discount as svipDiscount,
             csp.discountPrice as svipDiscountPrice,
-            p.productType
+            p.productType,
+            p.newvalidFlag
         from product p
         left join cm_svip_product csp on p.productID = csp.productId
         where p.productID in

+ 14 - 4
src/main/resources/mapper/SearchMapper.xml

@@ -26,7 +26,9 @@
         p.validFlag as p_valid,
         br.weights as p_sort,
         DATE_FORMAT(p.ADDTIME,'%Y%m%d') as p_time,
-        IFNULL(p.visibility,3) as p_visibility
+        IFNULL(p.visibility,3) as p_visibility,
+        ifnull(p.newvalidflag,0) as p_newvalidflag,
+        p.productType as p_product_type
     </sql>
     <sql id="Product_Joins">
         left join tinytype as t on p.tinyTypeID = t.tinyTypeID
@@ -36,7 +38,7 @@
         left join shop as sh on p.shopID = sh.shopID
     </sql>
     <select id="searchProductById" resultType="com.caimei365.commodity.model.search.ProductDO">
-        select<include refid="Search_Product_List"/>, p.productCategory
+        select<include refid="Search_Product_List"/>
         from product p
         <include refid="Product_Joins"/>
         where p.validFlag in (2,3,9) and p.productCategory = 1
@@ -296,7 +298,7 @@
         p.searchKey as keyword
         from product p
         left join cm_brand as br on p.brandID = br.id
-        where p.productCategory = 1
+        where p.productCategory = 1 and p.newvalidFlag=1
         <choose>
             <when test="identity == 1">
                 and p.validFlag in (2,3,9)
@@ -537,7 +539,7 @@
     <select id="findPromotionId" resultType="java.lang.Integer">
         select pr.id
         from cm_promotions pr
-                 left join cm_promotions_product prp on pr.id = prp.promotionsId
+        left join cm_promotions_product prp on pr.id = prp.promotionsId
         where (prp.productId = #{p_id} or
                prp.supplierId = (select p.shopID from product p where p.productID = #{p_id})
             )
@@ -552,4 +554,12 @@
     <select id="countSalesByDate" resultType="java.lang.Integer">
         select IFNULL(sum(sales),0) from cm_product_sales_record where productId = #{productId} and saleTime > #{date}
     </select>
+    <select id="findPromotions" resultType="java.lang.Integer">
+        SELECT DISTINCT
+        cpp.productId
+        FROM cm_promotions cp
+        LEFT JOIN cm_promotions_product cpp ON cp.id=cpp.promotionsId
+        WHERE (cp.status=1 OR (cp.status=2 AND cp.endTime>NOW()))
+        AND cp.delFlag=0
+    </select>
 </mapper>

+ 2 - 2
src/main/resources/mapper/SecondHandMapper.xml

@@ -26,13 +26,13 @@
             brandId, name, price, stock, aliasName, normalPrice, mainImage, productCategory, preferredFlag, shopId,
             sellNumber, costPrice, costCheckFlag, costProportional, hasSkuFlag, validFlag, ladderPriceFlag, sortIndex, featuredFlag, byFlag,
             step, actFlag, actStatus, freePostFlag, productType, machineType, includedTax, recommendType, invoiceType,
-            visibility, addTime, updateTime, onlineTime, downlineTime
+            visibility, addTime, updateTime, onlineTime, downlineTime,announType
         ) values (
             #{brandId}, #{name}, #{price}, #{stock}, #{aliasName}, #{normalPrice}, #{mainImage}, #{productCategory},
             #{preferredFlag}, #{shopId}, #{sellNumber}, #{costPrice}, #{costCheckFlag}, #{costProportional}, #{hasSkuFlag}, #{validFlag},
             #{ladderPriceFlag}, #{sortIndex}, #{featuredFlag}, #{byFlag}, #{step}, #{actFlag}, #{actStatus},
             #{freePostFlag}, #{productType}, #{machineType}, #{includedTax}, #{recommendType}, #{invoiceType},
-            #{visibility}, #{addTime}, #{updateTime}, #{onlineTime}, #{offlineTime}
+            #{visibility}, #{addTime}, #{updateTime}, #{onlineTime}, #{offlineTime},#{announType}
         )
     </insert>
     <insert id="insertSecondFileType">

+ 486 - 346
src/main/resources/mapper/ShopMapper.xml

@@ -1,231 +1,240 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.commodity.mapper.ShopMapper">
-    <insert id="insertProduct" keyColumn="productID" keyProperty="productId"  parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
+    <insert id="insertProduct" keyColumn="productID" keyProperty="productId"
+            parameterType="com.caimei365.commodity.model.po.ProductPo" useGeneratedKeys="true">
         insert into product (
-            shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
-            brandID, productType, tags, unit, normalPrice, price, includedTax, minBuyNumber, stock,
-            <if test="productCategory != null and  productCategory != ''">
-                productCategory,
-            </if>
-            <if test="serviceNumber != null and  serviceNumber != ''">
-                serviceNumber,
-            </if>
-            <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
-                supplierTaxPoint,
-            </if>
-            <if test="addTime != null and  addTime != ''">
-                addTime,
-            </if>
-            <if test="hasSkuFlag != null and  hasSkuFlag != ''">
-                hasSkuFlag,
-            </if>
-            <if test="sellNumber != null and  sellNumber != ''">
-                sellNumber,
-            </if>
-            <if test="sortIndex != null and  sortIndex != ''">
-                sortIndex,
-            </if>
-            <if test="featuredFlag != null and  featuredFlag != ''">
-                featuredFlag,
-            </if>
-            <if test="costCheckFlag != null and  costCheckFlag != ''">
-                costCheckFlag,
-            </if>
-            <if test="recommendType != null and  recommendType != ''">
-                recommendType,
-            </if>
-            <if test="priceFlag != null and  priceFlag != ''">
-                priceFlag,
-            </if>
-            <if test="actFlag != null and  actFlag != ''">
-                actFlag,
-            </if>
-            <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
-                ladderPriceFlag,
-            </if>
-            <if test="visibility != null and  visibility != ''">
-                visibility,
-            </if>
-            <if test="productCode != null and  productCode != ''">
-                productCode,
-            </if>
-            <if test="searchKey != null and  searchKey != ''">
-                searchKey,
-            </if>
-            <if test="allAreaFlag != null and  allAreaFlag != ''">
-                allAreaFlag,
-            </if>
-            <if test="step != null and  step != ''">
-                step,
-            </if>
-            <if test="costPrice != null and  costPrice != ''">
-                costPrice,
-            </if>
-            <if test="provinceIds != null and  provinceIds != ''">
-                provinceIds,
-            </if>
-            <if test="machineType != null and  machineType != ''">
-                machineType,
-            </if>
-            <if test="qualificationImg != null and  qualificationImg != ''">
-                qualificationImg,
-            </if>
-            <if test="invoiceType != null and  invoiceType != ''">
-                invoiceType,
-            </if>
-            updateTime, validFlag
+        shopID, name, aliasName, commodityType, bigTypeID, smallTypeID, tinyTypeID, mainImage,
+        brandID, productType, tags, unit, normalPrice, price, includedTax, minBuyNumber, stock,
+
+        <if test="productCategory != null and  productCategory != '' ">
+            productCategory,
+        </if>
+        <if test="serviceNumber != null and  serviceNumber != ''">
+            serviceNumber,
+        </if>
+        <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
+            supplierTaxPoint,
+        </if>
+        <if test="addTime != null and  addTime != ''">
+            addTime,
+        </if>
+        <if test="hasSkuFlag != null and  hasSkuFlag != ''">
+            hasSkuFlag,
+        </if>
+        <if test="sellNumber != null and  sellNumber != ''">
+            sellNumber,
+        </if>
+        <if test="sortIndex != null and  sortIndex != ''">
+            sortIndex,
+        </if>
+        <if test="featuredFlag != null and  featuredFlag != ''">
+            featuredFlag,
+        </if>
+        <if test="costCheckFlag != null and  costCheckFlag != ''">
+            costCheckFlag,
+        </if>
+        <if test="recommendType != null and  recommendType != ''">
+            recommendType,
+        </if>
+        <if test="priceFlag != null and  priceFlag != ''">
+            priceFlag,
+        </if>
+        <if test="actFlag != null and  actFlag != ''">
+            actFlag,
+        </if>
+        <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
+            ladderPriceFlag,
+        </if>
+        <if test="visibility != null and  visibility != ''">
+            visibility,
+        </if>
+        <if test="productCode != null and  productCode != ''">
+            productCode,
+        </if>
+        <if test="searchKey != null and  searchKey != ''">
+            searchKey,
+        </if>
+        <if test="allAreaFlag != null and  allAreaFlag != ''">
+            allAreaFlag,
+        </if>
+        <if test="step != null and  step != ''">
+            step,
+        </if>
+        <if test="costPrice != null and  costPrice != ''">
+            costPrice,
+        </if>
+        <if test="provinceIds != null and  provinceIds != ''">
+            provinceIds,
+        </if>
+        <if test="machineType != null and  machineType != ''">
+            machineType,
+        </if>
+        <if test="qualificationImg != null and  qualificationImg != ''">
+            qualificationImg,
+        </if>
+        <if test="invoiceType != null and  invoiceType != ''">
+            invoiceType,
+        </if>
+        updateTime,validFlag,newProductType,showFlag
         ) values (
-            #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
-            #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{includedTax}, #{minBuyNumber}, #{stock},
-            <if test="productCategory != null and  productCategory != ''">
-                #{productCategory},
-            </if>
-            <if test="serviceNumber != null and  serviceNumber != ''">
-                #{serviceNumber},
-            </if>
-            <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
-                #{supplierTaxPoint},
-            </if>
-            <if test="addTime != null and  addTime != ''">
-                #{addTime},
-            </if>
-            <if test="hasSkuFlag != null and  hasSkuFlag != ''">
-                #{hasSkuFlag},
-            </if>
-            <if test="sellNumber != null and  sellNumber != ''">
-                #{sellNumber},
-            </if>
-            <if test="sortIndex != null and  sortIndex != ''">
-                #{sortIndex},
-            </if>
-            <if test="featuredFlag != null and  featuredFlag != ''">
-                #{featuredFlag},
-            </if>
-            <if test="costCheckFlag != null and  costCheckFlag != ''">
-                #{costCheckFlag},
-            </if>
-            <if test="recommendType != null and  recommendType != ''">
-                #{recommendType},
-            </if>
-            <if test="priceFlag != null and  priceFlag != ''">
-                #{priceFlag},
-            </if>
-            <if test="actFlag != null and  actFlag != ''">
-                #{actFlag},
-            </if>
-            <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
-                #{ladderPriceFlag},
-            </if>
-            <if test="visibility != null and  visibility != ''">
-                #{visibility},
-            </if>
-            <if test="productCode != null and  productCode != ''">
-                #{productCode},
-            </if>
-            <if test="searchKey != null and  searchKey != ''">
-                #{searchKey},
-            </if>
-            <if test="allAreaFlag != null and  allAreaFlag != ''">
-                #{allAreaFlag},
-            </if>
-            <if test="step != null and  step != ''">
-                #{step},
-            </if>
-            <if test="costPrice != null and  costPrice != ''">
-                #{costPrice},
-            </if>
-            <if test="provinceIds != null and  provinceIds != ''">
-                #{provinceIds},
-            </if>
-            <if test="machineType != null and  machineType != ''">
-                #{machineType},
-            </if>
-            <if test="qualificationImg != null and  qualificationImg != ''">
-                #{qualificationImg},
-            </if>
-            <if test="invoiceType != null and  invoiceType != ''">
-                #{invoiceType},
-            </if>
-             #{updateTime}, #{validFlag}
+        #{shopId}, #{name}, #{aliasName}, #{commodityType}, #{bigTypeId}, #{smallTypeId}, #{tinyTypeId}, #{mainImage},
+        #{brandId}, #{productType}, #{tags}, #{unit}, #{normalPrice}, #{price}, #{includedTax}, #{minBuyNumber},
+        #{stock},
+        <if test="productCategory != null and  productCategory != '' ">
+            #{productCategory},
+        </if>
+        <if test="serviceNumber != null and  serviceNumber != ''">
+            #{serviceNumber},
+        </if>
+        <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
+            #{supplierTaxPoint},
+        </if>
+        <if test="addTime != null and  addTime != ''">
+            #{addTime},
+        </if>
+        <if test="hasSkuFlag != null and  hasSkuFlag != ''">
+            #{hasSkuFlag},
+        </if>
+        <if test="sellNumber != null and  sellNumber != ''">
+            #{sellNumber},
+        </if>
+        <if test="sortIndex != null and  sortIndex != ''">
+            #{sortIndex},
+        </if>
+        <if test="featuredFlag != null and  featuredFlag != ''">
+            #{featuredFlag},
+        </if>
+        <if test="costCheckFlag != null and  costCheckFlag != ''">
+            #{costCheckFlag},
+        </if>
+        <if test="recommendType != null and  recommendType != ''">
+            #{recommendType},
+        </if>
+        <if test="priceFlag != null and  priceFlag != ''">
+            #{priceFlag},
+        </if>
+        <if test="actFlag != null and  actFlag != ''">
+            #{actFlag},
+        </if>
+        <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
+            #{ladderPriceFlag},
+        </if>
+        <if test="visibility != null and  visibility != ''">
+            #{visibility},
+        </if>
+        <if test="productCode != null and  productCode != ''">
+            #{productCode},
+        </if>
+        <if test="searchKey != null and  searchKey != ''">
+            #{searchKey},
+        </if>
+        <if test="allAreaFlag != null and  allAreaFlag != ''">
+            #{allAreaFlag},
+        </if>
+        <if test="step != null and  step != ''">
+            #{step},
+        </if>
+        <if test="costPrice != null and  costPrice != ''">
+            #{costPrice},
+        </if>
+        <if test="provinceIds != null and  provinceIds != ''">
+            #{provinceIds},
+        </if>
+        <if test="machineType != null and  machineType != ''">
+            #{machineType},
+        </if>
+        <if test="qualificationImg != null and  qualificationImg != ''">
+            #{qualificationImg},
+        </if>
+        <if test="invoiceType != null and  invoiceType != ''">
+            #{invoiceType},
+        </if>
+        #{updateTime}, #{validFlag},#{newProductType},#{showFlag}
         )
     </insert>
     <update id="updateProduct">
         update product set
-            shopID = #{shopId}, name = #{name}, aliasName = #{aliasName}, commodityType = #{commodityType},
-            bigTypeId = #{bigTypeId}, smallTypeId = #{smallTypeId}, tinyTypeId = #{tinyTypeId}, mainImage = #{mainImage},
-            brandId = #{brandId}, productType = #{productType}, tags = #{tags}, unit = #{unit}, normalPrice = #{normalPrice},
-            price = #{price}, price = #{price}, includedTax = #{includedTax}, minBuyNumber = #{minBuyNumber}, stock = #{stock},
-            <if test="productCategory != null and  productCategory != ''">
-                productCategory = #{productCategory},
-            </if>
-            <if test="serviceNumber != null and  serviceNumber != ''">
-                serviceNumber = #{serviceNumber},
-            </if>
-            <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
-                supplierTaxPoint = #{supplierTaxPoint},
-            </if>
-            <if test="addTime != null and  addTime != ''">
-                addTime = #{addTime},
-            </if>
-            <if test="hasSkuFlag != null and  hasSkuFlag != ''">
-                hasSkuFlag = #{hasSkuFlag},
-            </if>
-            <if test="sellNumber != null and  sellNumber != ''">
-                sellNumber = #{sellNumber},
-            </if>
-            <if test="sortIndex != null and  sortIndex != ''">
-                sortIndex = #{sortIndex},
-            </if>
-            <if test="featuredFlag != null and  featuredFlag != ''">
-                featuredFlag = #{featuredFlag},
-            </if>
-            <if test="costCheckFlag != null and  costCheckFlag != ''">
-                costCheckFlag = #{costCheckFlag},
-            </if>
-            <if test="recommendType != null and  recommendType != ''">
-                recommendType = #{recommendType},
-            </if>
-            <if test="priceFlag != null and  priceFlag != ''">
-                priceFlag = #{priceFlag},
-            </if>
-            <if test="actFlag != null and  actFlag != ''">
-                actFlag = #{actFlag},
-            </if>
-            <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
-                ladderPriceFlag = #{ladderPriceFlag},
-            </if>
-            <if test="visibility != null and  visibility != ''">
-                visibility = #{visibility},
-            </if>
-            <if test="productCode != null and  productCode != ''">
-                productCode = #{productCode},
-            </if>
-            <if test="searchKey != null and  searchKey != ''">
-                searchKey = #{searchKey},
-            </if>
-            <if test="allAreaFlag != null and  allAreaFlag != ''">
-                allAreaFlag = #{allAreaFlag},
-            </if>
-            <if test="step != null and  step != ''">
-                step = #{step},
-            </if>
-            <if test="costPrice != null and  costPrice != ''">
-                costPrice = #{costPrice},
-            </if>
-            <if test="provinceIds != null and  provinceIds != ''">
-                provinceIds = #{provinceIds},
-            </if>
-            <if test="machineType != null and  machineType != ''">
-                machineType = #{machineType},
-            </if>
-            <if test="qualificationImg != null and  qualificationImg != ''">
-                qualificationImg = #{qualificationImg},
-            </if>
-            <if test="invoiceType != null and  invoiceType != ''">
-                invoiceType = #{invoiceType},
-            </if>
-            updateTime = #{updateTime}, validFlag = #{validFlag}
+        shopID = #{shopId}, name = #{name}, aliasName = #{aliasName}, commodityType = #{commodityType},
+        bigTypeId = #{bigTypeId}, smallTypeId = #{smallTypeId}, tinyTypeId = #{tinyTypeId}, mainImage = #{mainImage},
+        brandId = #{brandId}, productType = #{productType}, tags = #{tags}, unit = #{unit}, normalPrice = #{normalPrice},
+        price = #{price}, price = #{price}, includedTax = #{includedTax}, minBuyNumber = #{minBuyNumber}, stock =#{stock},
+        newProductType=#{newProductType},
+        <if test="productCategory != null and  productCategory != ''">
+            productCategory = #{productCategory},
+        </if>
+        <if test="trainingFee != null">
+            trainingFee = #{trainingFee},
+        </if>
+        <if test="serviceNumber != null and  serviceNumber != ''">
+            serviceNumber = #{serviceNumber},
+        </if>
+        <if test="supplierTaxPoint != null and  supplierTaxPoint != ''">
+            supplierTaxPoint = #{supplierTaxPoint},
+        </if>
+        <if test="addTime != null and  addTime != ''">
+            addTime = #{addTime},
+        </if>
+        <if test="hasSkuFlag != null and  hasSkuFlag != ''">
+            hasSkuFlag = #{hasSkuFlag},
+        </if>
+        <if test="sellNumber != null and  sellNumber != ''">
+            sellNumber = #{sellNumber},
+        </if>
+        <if test="sortIndex != null and  sortIndex != ''">
+            sortIndex = #{sortIndex},
+        </if>
+        <if test="featuredFlag != null and  featuredFlag != ''">
+            featuredFlag = #{featuredFlag},
+        </if>
+        <if test="costCheckFlag != null and  costCheckFlag != ''">
+            costCheckFlag = #{costCheckFlag},
+        </if>
+        <if test="recommendType != null and  recommendType != ''">
+            recommendType = #{recommendType},
+        </if>
+        <if test="priceFlag != null and  priceFlag != ''">
+            priceFlag = #{priceFlag},
+        </if>
+        <if test="actFlag != null and  actFlag != ''">
+            actFlag = #{actFlag},
+        </if>
+        <if test="ladderPriceFlag != null and  ladderPriceFlag != ''">
+            ladderPriceFlag = #{ladderPriceFlag},
+        </if>
+        <if test="visibility != null and  visibility != ''">
+            visibility = #{visibility},
+        </if>
+        <if test="productCode != null and  productCode != ''">
+            productCode = #{productCode},
+        </if>
+        <if test="searchKey != null and  searchKey != ''">
+            searchKey = #{searchKey},
+        </if>
+        <if test="allAreaFlag != null and  allAreaFlag != ''">
+            allAreaFlag = #{allAreaFlag},
+        </if>
+        <if test="step != null and  step != ''">
+            step = #{step},
+        </if>
+        <if test="costPrice != null and  costPrice != ''">
+            costPrice = #{costPrice},
+        </if>
+        <if test="provinceIds != null and  provinceIds != ''">
+            provinceIds = #{provinceIds},
+        </if>
+        <if test="machineType != null and  machineType != ''">
+            machineType = #{machineType},
+        </if>
+        <if test="qualificationImg != null and  qualificationImg != ''">
+            qualificationImg = #{qualificationImg},
+        </if>
+        <if test="invoiceType != null and  invoiceType != ''">
+            invoiceType = #{invoiceType},
+        </if>
+        updateTime = #{updateTime},
+        validFlag = #{validFlag},
+        showFlag=#{showFlag}
         where productID = #{productId}
     </update>
     <insert id="insertProductImage">
@@ -237,19 +246,18 @@
         values (#{productId}, #{paramsName}, #{paramsContent}, #{delFlag})
     </insert>
     <insert id="insertProductDetailInfo">
-        insert into productdetailinfo (
-          productID, propValueAlias, propValueImages,
-          detailInfo, serviceInfo, orderInfo, detailInfoTxt, seoTitle,
-          seoKeyword, seoDes
-        ) values (
-            #{productId}, #{propValueAlias}, #{propValueImages},
-            #{detailInfo}, #{serviceInfo}, #{orderInfo}, #{detailInfoTxt}, #{seoTitle},
-            #{seoKeyword}, #{seoDes}
-        )
+        insert into productdetailinfo (productID, propValueAlias, propValueImages,
+                                       detailInfo, serviceInfo, orderInfo, detailInfoTxt, seoTitle,
+                                       seoKeyword, seoDes)
+        values (#{productId}, #{propValueAlias}, #{propValueImages},
+                #{detailInfo}, #{serviceInfo}, #{orderInfo}, #{detailInfoTxt}, #{seoTitle},
+                #{seoKeyword}, #{seoDes})
     </insert>
-    <insert id="insertBrand" keyColumn="id" keyProperty="id"  parameterType="com.caimei365.commodity.model.po.BrandPo" useGeneratedKeys="true">
+    <insert id="insertBrand" keyColumn="id" keyProperty="id" parameterType="com.caimei365.commodity.model.po.BrandPo"
+            useGeneratedKeys="true">
         insert into cm_brand (name, source, userID, status, delFlag, createDate, updateDate, logo, description)
-        values (#{name},#{source},#{userId},#{status}, #{delFlag},#{createDate},#{updateDate},#{logo},#{description})
+        values (#{name}, #{source}, #{userId}, #{status}, #{delFlag}, #{createDate}, #{updateDate}, #{logo},
+                #{description})
     </insert>
     <update id="updateBrand">
         update cm_brand
@@ -282,54 +290,67 @@
         where id = #{id}
     </update>
     <update id="updateProductImage">
-        update productimage set productID = #{productId}, shopID = #{shopId}, addTime = #{addTime},
-                                image = #{image}, mainFlag = #{mainFlag}, sortIndex = #{sortIndex}
+        update productimage
+        set productID = #{productId},
+            shopID    = #{shopId},
+            addTime   = #{addTime},
+            image     = #{image},
+            mainFlag  = #{mainFlag},
+            sortIndex = #{sortIndex}
         where productImageId = #{id}
     </update>
     <update id="updateProductDetailInfo">
-        update productdetailinfo set
-          propValueAlias = #{propValueAlias},
-          propValueImages = #{propValueImages},
-          detailInfo = #{detailInfo},
-          detailInfoTxt = #{detailInfoTxt},
-          seoTitle = #{seoTitle},
-          seoKeyword = #{seoKeyword},
-          seoDes = #{seoDes},
-          serviceInfo = #{serviceInfo},
-          orderInfo = #{orderInfo}
-        where
-          productDetailInfoID = #{productDetailInfoId}
+        update productdetailinfo
+        set propValueAlias  = #{propValueAlias},
+            propValueImages = #{propValueImages},
+            detailInfo      = #{detailInfo},
+            detailInfoTxt   = #{detailInfoTxt},
+            seoTitle        = #{seoTitle},
+            seoKeyword      = #{seoKeyword},
+            seoDes          = #{seoDes},
+            serviceInfo     = #{serviceInfo},
+            orderInfo       = #{orderInfo}
+        where productDetailInfoID = #{productDetailInfoId}
     </update>
     <update id="updateProductFeatured">
-        update product set featuredFlag = #{featuredFlag}
+        update product
+        set featuredFlag = #{featuredFlag}
         where productID = #{productId}
-        and shopID = #{shopId}
+          and shopID = #{shopId}
     </update>
     <update id="updateProductValidFlag">
-        update product set validFlag = #{validFlag} where productID = #{productId}
+        update product
+        set validFlag = #{validFlag}
+        where productID = #{productId}
     </update>
     <update id="updateProductCode">
-        update product set productCode = #{productCode} where productID = #{productId}
+        update product
+        set productCode = #{productCode}
+        where productID = #{productId}
     </update>
     <delete id="deleteProductImage">
-        delete from productimage where productImageID = #{id}
+        delete
+        from productimage
+        where productImageID = #{id}
     </delete>
     <delete id="deleteProductParameters">
-        delete from cm_product_related_parameters where productId = #{productId}
+        delete
+        from cm_product_related_parameters
+        where productId = #{productId}
     </delete>
     <select id="getMainProducts" resultType="com.caimei365.commodity.model.search.ProductListVo">
-		select
-			p.productID as productId,
-            p.actStatus,
-			p.shopID as shopId,
-			p.`name` as `name`,
-			p.mainImage as image,
-			p.price as price,
-			p.unit as unit,
-			p.priceFlag as priceFlag,
-            IFNULL(p.visibility,3) as visibility,
-            p.productType
-		from product p
+        select
+        p.productID as productId,
+        p.actStatus,
+        p.shopID as shopId,
+        p.`name` as `name`,
+        p.mainImage as image,
+        p.price as price,
+        p.unit as unit,
+        p.priceFlag as priceFlag,
+        IFNULL(p.visibility,3) as visibility,
+        p.productType
+        from product p
         where p.shopID = #{shopId}
         and p.visibility in
         <foreach collection="visibilityList" item="visibility" index="index" open="(" separator="," close=")">
@@ -340,33 +361,34 @@
     </select>
     <select id="getShopProductsSelect" resultType="com.caimei365.commodity.model.vo.ProductItemVo">
         select
-            p.productID as productId,
-            p.actStatus,
-            p.name,
-            p.aliasName,
-            p.mainImage as image,
-            p.unit,
-            p.productCode as code,
-            p.priceFlag,
-            p.price,
-            p.shopID as shopId,
-            p.searchKey as keyword,
-            p.minBuyNumber as minBuyNumber,
-            p.maxBuyNumber as maxBuyNumber,
-            p.ladderPriceFlag,
-            p.normalPrice,
-            p.step,
-            p.shopID as shopId,
-            p.taxPoint as taxRate,
-            p.includedTax,
-            p.invoiceType,
-            p.productCategory as productCategory,
-            p.validFlag,
-            p.featuredFlag,
-            p.commodityType,
-            p.bigTypeID as bigTypeId,
-            p.smallTypeID as smallTypeId,
-            p.tinyTypeID as tinyTypeId
+        p.productID as productId,
+        p.actStatus,
+        p.name,
+        p.aliasName,
+        p.mainImage as image,
+        p.unit,
+        p.productCode as code,
+        p.priceFlag,
+        p.price,
+        p.searchKey as keyword,
+        p.minBuyNumber as minBuyNumber,
+        p.maxBuyNumber as maxBuyNumber,
+        p.ladderPriceFlag,
+        p.normalPrice,
+        p.step,
+        p.shopID as shopId,
+        p.taxPoint as taxRate,
+        p.includedTax,
+        p.invoiceType,
+        p.productCategory as productCategory,
+        p.validFlag,
+        p.featuredFlag,
+        p.commodityType,
+        p.bigTypeID as bigTypeId,
+        p.smallTypeID as smallTypeId,
+        p.tinyTypeID as tinyTypeId,
+        ifnull(p.newvalidFlag,3) as newvalidFlag,
+        ifnull(p.showFlag,0) as showFlag
         from product p
         <where>
             p.shopID = #{shopId}
@@ -394,29 +416,38 @@
             <if test="name != null and name != ''">
                 and p.name like CONCAT("%",#{name},"%")
             </if>
+            <if test="newvalidFlag !=null and newvalidFlag!=''">
+                and newvalidFlag =#{newvalidFlag}
+            </if>
+            <if test="showFlag != null">
+                and showFlag =#{showFlag}
+            </if>
         </where>
         order by p.productID desc
     </select>
     <select id="getTypeName" resultType="java.lang.String">
-        select
-          CONCAT_WS("-", b.name, s.name, t.name)
-        from
-          bigtype b
-          left join smalltype s on s.smallTypeID = #{smallTypeId}
-          left join tinytype t on t.tinyTypeID = #{tinyTypeId}
-        where
-          b.bigTypeID = #{bigTypeId};
+        select CONCAT_WS("-", b.name, s.name, t.name)
+        from bigtype b
+                 left join smalltype s on s.smallTypeID = #{smallTypeId}
+                 left join tinytype t on t.tinyTypeID = #{tinyTypeId}
+        where b.bigTypeID = #{bigTypeId};
     </select>
     <select id="getUserIdByshopId" resultType="java.lang.Integer">
-        select userID from user where shopID = #{shopId}
+        select userID
+        from user
+        where shopID = #{shopId}
     </select>
     <select id="getMainProductsCount" resultType="java.lang.Integer">
-        select count(*) from  product where shopID = #{shopId}
-        and validFlag = '2' and featuredFlag='1' order by productID desc
+        select count(*)
+        from product
+        where shopID = #{shopId}
+          and validFlag = '2'
+          and featuredFlag = '1'
+        order by productID desc
     </select>
     <select id="getCodeByTypeId" resultType="java.lang.String">
         select
-          CONCAT(IFNULL(b.bigTypeCode,''), IFNULL(s.smallTypeCode,''), IFNULL(t.tinyTypeCode,''))
+        CONCAT(IFNULL(b.bigTypeCode,''), IFNULL(s.smallTypeCode,''), IFNULL(t.tinyTypeCode,''))
         from bigtype b
         left join smalltype s on s.bigTypeID = b.bigTypeID
         left join tinytype t on t.smallTypeID = s.smallTypeID
@@ -439,92 +470,201 @@
         order by mainFlag DESC
     </select>
     <select id="getProductForm" resultType="com.caimei365.commodity.model.vo.ProductFormVo">
-        select productID as productId, shopID as shopId,  name, aliasName, commodityType, mainImage, stock, invoiceType,
-            bigTypeID as bigTypeId, smallTypeID as smallTypeId, tinyTypeID as tinyTypeId, searchKey, visibility,
-            brandID as brandId,  productType, tags, unit, normalPrice, price, includedTax, minBuyNumber,
-            productCategory, serviceNumber, supplierTaxPoint, priceFlag, actFlag, ladderPriceFlag,
-            addTime, hasSkuFlag, sellNumber, sortIndex, featuredFlag, costCheckFlag, recommendType, machineType,
-            productCode, updateTime, validFlag, searchKey, allAreaFlag, step, costPrice, provinceIds, qualificationImg,
-            trainingMethod, trainingType ,trainingFee
+        select productID   as productId,
+               shopID      as shopId,
+               name,
+               aliasName,
+               commodityType,
+               mainImage,
+               stock,
+               invoiceType,
+               bigTypeID   as bigTypeId,
+               smallTypeID as smallTypeId,
+               tinyTypeID  as tinyTypeId,
+               searchKey,
+               visibility,
+               brandID     as brandId,
+               productType,
+               tags,
+               unit,
+               normalPrice,
+               price,
+               includedTax,
+               minBuyNumber,
+               productCategory,
+               serviceNumber,
+               supplierTaxPoint,
+               priceFlag,
+               actFlag,
+               ladderPriceFlag,
+               addTime,
+               hasSkuFlag,
+               sellNumber,
+               sortIndex,
+               featuredFlag,
+               costCheckFlag,
+               recommendType,
+               machineType,
+               productCode,
+               updateTime,
+               validFlag,
+               searchKey,
+               allAreaFlag,
+               step,
+               costPrice,
+               provinceIds,
+               qualificationImg,
+               trainingMethod,
+               trainingType,
+               trainingFee,
+               ifnull(newProductType,2) as newProductType
         from product
         where productID = #{productId}
     </select>
     <select id="getBrandNameById" resultType="java.lang.String">
-        select name from cm_brand where id = #{brandId}
+        select name
+        from cm_brand
+        where id = #{brandId}
     </select>
     <select id="getProductParameters" resultType="com.caimei365.commodity.model.po.ProductParameterPo">
         select id, productID as productId, paramsName, paramsContent
         from cm_product_related_parameters
-        where productId = #{productId} AND delFlag='0'
+        where productId = #{productId}
+          AND delFlag = '0'
     </select>
     <select id="getProductImages" resultType="com.caimei365.commodity.model.po.ProductImagePo">
         select productImageID as id, productID as productId, shopId, addTime, image, mainFlag, sortIndex
         from productimage
-        where productID = #{productId} order by mainFlag desc
+        where productID = #{productId}
+        order by mainFlag desc
     </select>
     <select id="getProductDetailInfo" resultType="com.caimei365.commodity.model.po.ProductDetailInfoPo">
-        select productDetailInfoId, productId, detailInfo, commonDetailInfo,serviceInfo, orderInfo, propValueAlias,
-                propValueImages, detailInfoTxt, seoTitle, seoKeyword, seoDes
+        select productDetailInfoId,
+               productId,
+               detailInfo,
+               commonDetailInfo,
+               serviceInfo,
+               orderInfo,
+               propValueAlias,
+               propValueImages,
+               detailInfoTxt,
+               seoTitle,
+               seoKeyword,
+               seoDes
         from productdetailinfo
         where productId = #{productId}
     </select>
     <select id="getProductShopById" resultType="com.caimei365.commodity.model.vo.ShopVo">
-        select userID as userId, shopID as shopId, name, sname as shortName, linkMan, contractMobile,
-               contractEmail, contractEmail as email, provinceID as proviceId, cityID as cityId, townID as townId,
-               address, socialCreditCode, businessLicenseImage as businessLicense, firstShopType, secondShopType,
-               mainpro as mainProduct, productDesc as mainProductDesc,legalPerson,registeredCapital,fax as faxNumber,
-               nature as companyNature, turnover, medicalPracticeLicenseImg1 as medicalPracticeLicense, info as shopDesc,
-               businessScope, logo, addTime, status, contractPhone, validFlag, website, wxOfficialAccount, wxApplets
-        from shop where shopID = #{shopId}
+        select userID                     as userId,
+               shopID                     as shopId,
+               name,
+               sname                      as shortName,
+               linkMan,
+               contractMobile,
+               contractEmail,
+               contractEmail              as email,
+               provinceID                 as proviceId,
+               cityID                     as cityId,
+               townID                     as townId,
+               address,
+               socialCreditCode,
+               businessLicenseImage       as businessLicense,
+               firstShopType,
+               secondShopType,
+               mainpro                    as mainProduct,
+               productDesc                as mainProductDesc,
+               legalPerson,
+               registeredCapital,
+               fax                        as faxNumber,
+               nature                     as companyNature,
+               turnover,
+               medicalPracticeLicenseImg1 as medicalPracticeLicense,
+               info                       as shopDesc,
+               businessScope,
+               logo,
+               addTime,
+               status,
+               contractPhone,
+               validFlag,
+               website,
+               wxOfficialAccount,
+               wxApplets
+        from shop
+        where shopID = #{shopId}
     </select>
     <select id="getProductNumById" resultType="java.lang.Integer">
-        select COUNT(*) as normalNum from product p
-        where p.shopID = #{shopId} and p.validFlag = 2
+        select COUNT(*) as normalNum
+        from product p
+        where p.shopID = #{shopId}
+          and p.validFlag = 2
         group by p.shopID
     </select>
     <select id="getUserIdentityById" resultType="java.lang.Integer">
-        select userIdentity from user
+        select userIdentity
+        from user
         where userID = #{userId}
     </select>
     <select id="getBrandAssociation" resultType="com.caimei365.commodity.model.vo.BrandVo">
-        select id, name from cm_brand
-        where
-          status = '1' and delFlag = '0'
-          and name like CONCAT("%",#{name},"%")
-        order by
-          case when ( source = '1' and userID = #{userId} )
-               then 0
-               else 1
-          end asc,
-        LENGTH(name) asc
+        select id, name
+        from cm_brand
+        where status = '1'
+          and delFlag = '0'
+          and name like CONCAT("%", #{name}, "%")
+        order by case
+                     when (source = '1' and userID = #{userId})
+                         then 0
+                     else 1
+                     end asc,
+                 LENGTH(name) asc
     </select>
     <select id="getBrandByName" resultType="com.caimei365.commodity.model.vo.BrandVo">
-        select id, name from cm_brand where name = #{name} and delFlag = '0'
+        select id, name
+        from cm_brand
+        where name = #{name}
+          and delFlag = '0'
     </select>
     <select id="getShopBrandList" resultType="com.caimei365.commodity.model.vo.BrandVo">
         select id, name, source, userId, status, auditNote, sort, delFlag, logo, description, createDate, updateDate
         from cm_brand
         <where>
-          userID = #{userId}
-          and delFlag = '0'
-          <if test="name != null and name != ''">
-              and name like CONCAT("%",#{name},"%")
-          </if>
-          <if test="status != null and status != ''">
+            userID = #{userId}
+            and delFlag = '0'
+            <if test="name != null and name != ''">
+                and name like CONCAT("%",#{name},"%")
+            </if>
+            <if test="status != null and status != ''">
                 and status = #{status}
-          </if>
+            </if>
         </where>
         order by createDate desc
     </select>
     <select id="getPcBeautyStatusById" resultType="java.lang.Integer">
-        select i.productId from new_page_floor_image i left join cm_page_centre c on i.centreId = c.id left join cm_page p on c.pageId = p.id
-        where i.productId = #{productId} and i.pcStatus = 1 and p.type = 7 and c.enabledStatus = 1 and p.enabledStatus = 1 limit 1
+        select i.productId
+        from new_page_floor_image i
+                 left join cm_page_centre c on i.centreId = c.id
+                 left join cm_page p on c.pageId = p.id
+        where i.productId = #{productId}
+          and i.pcStatus = 1
+          and p.type = 7
+          and c.enabledStatus = 1
+          and p.enabledStatus = 1
+        limit 1
     </select>
     <select id="getAppletsBeautyStatusById" resultType="java.lang.Integer">
-        select i.productId from new_page_floor_image i left join cm_page_centre c on i.centreId = c.id left join cm_page p on c.pageId = p.id
-        where i.productId = #{productId} and i.appletsStatus = 1  and p.type = 7 and c.crmEnabledStatus = 1 and p.enabledStatus = 1 limit 1
+        select i.productId
+        from new_page_floor_image i
+                 left join cm_page_centre c on i.centreId = c.id
+                 left join cm_page p on c.pageId = p.id
+        where i.productId = #{productId}
+          and i.appletsStatus = 1
+          and p.type = 7
+          and c.crmEnabledStatus = 1
+          and p.enabledStatus = 1
+        limit 1
     </select>
     <select id="getShopNameByShopId" resultType="java.lang.String">
-        select name from shop where shopID = #{shopId}
+        select name
+        from shop
+        where shopID = #{shopId}
     </select>
 </mapper>