Browse Source

商城首页增加新品橱窗楼层

Duan_xu 2 years ago
parent
commit
ca67858b63
23 changed files with 773 additions and 417 deletions
  1. 2 0
      src/main/java/com/caimei365/commodity/components/SearchOpenService.java
  2. 2 2
      src/main/java/com/caimei365/commodity/controller/ProductPageApi.java
  3. 2 2
      src/main/java/com/caimei365/commodity/controller/ProductShopApi.java
  4. 4 0
      src/main/java/com/caimei365/commodity/mapper/PageMapper.java
  5. 2 0
      src/main/java/com/caimei365/commodity/mapper/PriceMapper.java
  6. 1 1
      src/main/java/com/caimei365/commodity/mapper/ShopMapper.java
  7. 7 0
      src/main/java/com/caimei365/commodity/model/dto/ProductDto.java
  8. 3 0
      src/main/java/com/caimei365/commodity/model/dto/SecondDto.java
  9. 4 0
      src/main/java/com/caimei365/commodity/model/po/ProductPo.java
  10. 5 0
      src/main/java/com/caimei365/commodity/model/search/ProductDO.java
  11. 5 0
      src/main/java/com/caimei365/commodity/model/vo/FloorImageVo.java
  12. 8 3
      src/main/java/com/caimei365/commodity/model/vo/PageFloorVo.java
  13. 6 0
      src/main/java/com/caimei365/commodity/model/vo/ProductFormVo.java
  14. 88 0
      src/main/java/com/caimei365/commodity/model/vo/ProductItemVo.java
  15. 1 1
      src/main/java/com/caimei365/commodity/service/ShopService.java
  16. 68 45
      src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java
  17. 2 0
      src/main/java/com/caimei365/commodity/service/impl/SearchProductServiceImpl.java
  18. 1 0
      src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java
  19. 9 2
      src/main/java/com/caimei365/commodity/service/impl/ShopServiceImpl.java
  20. 66 8
      src/main/resources/mapper/PageMapper.xml
  21. 2 1
      src/main/resources/mapper/PriceMapper.xml
  22. 2 1
      src/main/resources/mapper/SearchMapper.xml
  23. 483 351
      src/main/resources/mapper/ShopMapper.xml

+ 2 - 0
src/main/java/com/caimei365/commodity/components/SearchOpenService.java

@@ -100,8 +100,10 @@ public class SearchOpenService {
         String tracer = jsonObj.getString("tracer");
         JSONObject result = jsonObj.getJSONObject("result");
         JSONArray errors = jsonObj.getJSONArray("errors");
+        Integer newvalidflag=jsonObj.getInt("p_newvalidflag");
         log.info(">>>>>>query(" + queryStr + "): " + status + ",request_id=" + requestId + ",errors=" + errors.toString() + ",tracer=" + tracer);
         log.info("查询结果---------------------------------------------》result: "+result.toString());
+        log.info("新品结果---------------------->"+newvalidflag);
         if ("OK".equals(status)) {
             result.put("status", 1);
         } else {

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

@@ -99,10 +99,10 @@ public class ProductPageApi {
     })
     @ApiOperation("新品橱窗列表")
     @GetMapping("/home/NewFloorList")
-    public ResponseJson<PaginationVo<ProductItemVo>> getNewFloorList(@RequestParam(value = "brandID")List<String> brandID,@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+    public ResponseJson<PaginationVo<ProductItemVo>> getNewFloorList(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(null,brandID,pageNum,pageSize);
+        return pageService.getNewFloorList(userId,brandID,pageNum,pageSize);
     }
 
     @ApiOperation("新品橱窗品牌查询")

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

@@ -63,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,
+    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,newvalidFlag, pageNum, pageSize);
+        return shopService.getShopProducts(showFlag,shopId, name, productCode, validFlag, featuredFlag, commodityType, bigTypeId, smallTypeId, tinyTypeId,newvalidFlag, pageNum, pageSize);
     }
 
     /**

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

@@ -375,5 +375,9 @@ public interface PageMapper {
      */
     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();
 }

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

@@ -30,7 +30,7 @@ public interface ShopMapper {
     /**
      * 获取供应商-我的商品列表
      */
-    List<ProductItemVo> getShopProductsSelect(Integer newvalidFlag,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);
     /**
      * 列表显示分类
      */

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

@@ -198,4 +198,11 @@ public class ProductDto implements Serializable {
     @ApiModelProperty("培训费用(售价未包含)")
     private BigDecimal trainingFee;
 
+    @ApiModelProperty("新品参与状态:1.参与2.未参与")
+    /**
+     * 新品参与状态: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;
+
 }

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

@@ -239,6 +239,10 @@ public class ProductPo implements Serializable {
      * 新品商品状态  0.参与 , 1.审核通过, 2.未参与 ,3.审核未通过'
      */
     private Integer newvalidFlag;
+    /**
+     * 新品参与状态:1.参与2.未参与
+     */
+    private Integer newProductType;
     /**
      * 新品展示状态1,已展示2,已下线3,展示过期
      */

+ 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/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;
+
+
 }

+ 8 - 3
src/main/java/com/caimei365/commodity/model/vo/PageFloorVo.java

@@ -33,10 +33,12 @@ public class PageFloorVo implements Serializable {
      * 楼层相关商品图片3
      */
     private List<FloorImageVo> floorImageList3;
+
     /**
-     * 固定楼层相关商品图片
+     * 固定楼层相关商品
      */
-    private List<ProductItemVo> newfloorlist;
+    private List<FloorImageVo> floorImageList4;
+
     private List<PageFloorVo> subFloors;
     private List<ImageLinkVo> floorData;
     /**
@@ -54,7 +56,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;
 }

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

@@ -261,6 +261,94 @@ public class ProductItemVo implements Serializable {
      * 展示开始时间
      */
     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 +
+                '}';
+    }
 }

+ 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,Integer newvalidFlag, 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);
 
     /**
      * 供应商-发布商品

+ 68 - 45
src/main/java/com/caimei365/commodity/service/impl/PageServiceImpl.java

@@ -137,12 +137,11 @@ 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<>(3);
+        Map<String, Object> map = new HashMap<>(6);
 
         //楼层管理
         source = source == null ? 1 : source;
         List<PageFloorVo> homePageFloor = pageMapper.getHomePageFloor(source);
-        List<PageFloorVo> pageFloorList = pageMapper.getPageFloor(source);
         Iterator<PageFloorVo> floorIterator = homePageFloor.iterator();
         while (floorIterator.hasNext()) {
             PageFloorVo floor = floorIterator.next();
@@ -154,17 +153,34 @@ public class PageServiceImpl implements PageService {
                 floorIterator.remove();
                 continue;
             }
-            pageFloorList.forEach(pageFloor->{
-                pageFloor.setFloorImageList(floorImageList);
-                if (1 == pageFloor.getFloorType()) {
-                    List<ProductItemVo> newProductList = pageMapper.getNewFloorList(null);
-                    pageFloor.setNewfloorlist(newProductList);
-                }
-            });
             setFloorImageProduct(userId, floorImageList, source);
             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++) {
+                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);
@@ -195,7 +211,7 @@ public class PageServiceImpl implements PageService {
 //                pageFloor.setNewfloorlist(newProductList);
 //            }
 //        });
-        map.put("PageFloor",pageFloorList);
+
 
         return ResponseJson.success(map);
     }
@@ -983,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);
@@ -1006,37 +1023,40 @@ 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();
+
+
+
+                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 {
-                        // 商品价格
-                        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);
+                        iterator.remove();
                     }
                 } else {
-                    iterator.remove();
+                    image.setListType(2);
                 }
-            } else {
-                image.setListType(2);
             }
         }
-    }
 
 
 
@@ -1353,23 +1373,26 @@ public class PageServiceImpl implements PageService {
 
         List<ProductItemVo> list = pageMapper.getNewFloorList(brandID);
 
+
         list.forEach(product -> {
-            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() + ",";
+            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);
+                        System.out.println(Cons);
                     }
-                    Cons = Cons.substring(0, Cons.length() - 1);
-System.out.println(Cons);
                 }
             }
             product.setPriceGrade(priceUtilService.getPriceGrade(product.getPrice()));
-            product.setPrice(0d);
             product.setImage(ImageUtils.getImageURL("product", product.getImage(), 0, domain));
         });
         PaginationVo<ProductItemVo> pageData = new PaginationVo(list);
+        log.info(pageData.toString());
         return ResponseJson.success(pageData);
     }
 

+ 2 - 0
src/main/java/com/caimei365/commodity/service/impl/SearchProductServiceImpl.java

@@ -78,6 +78,7 @@ public class SearchProductServiceImpl implements SearchProductService {
             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");
@@ -268,6 +269,7 @@ public class SearchProductServiceImpl implements SearchProductService {
             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");

+ 1 - 0
src/main/java/com/caimei365/commodity/service/impl/SecondHandServiceImpl.java

@@ -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);
         /* 保存商品图片信息*/

+ 9 - 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,Integer newvalidFlag, 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(newvalidFlag,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,13 @@ 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());
+        if(productDto.getNewProductType()==1){
+            product.setShowFlag(1);
+        }else {
+            product.setShowFlag(3);
+        }
+
 /*        if (null != productDto.getProductId()) {
             product.setProductId(productDto.getProductId());
         }

+ 66 - 8
src/main/resources/mapper/PageMapper.xml

@@ -793,7 +793,6 @@
         p.unit,
         p.productCode as code,
         p.priceFlag,
-        p.price,
         p.shopID as shopId,
         p.searchKey as keyword,
         p.minBuyNumber as minBuyNumber,
@@ -812,7 +811,8 @@
         p.smallTypeID as smallTypeId,
         p.tinyTypeID as tinyTypeId,
         p.productType,
-        p.brandID
+        p.brandID,
+        p.price
         from product p
         <where>
 
@@ -822,9 +822,11 @@
                     p.brandID LIKE CONCAT('%',#{item},'%')
                 </foreach>
             </if>
+            and p.showFlag!=5
             and p.newvalidFlag = 1
-            and p.newvalidFlag!=4
+            and p.newProductType=1
             and p.validFlag = 2
+            and p.showFlag!=2
         </where>
 
 #         order by p.combinationSort != 0 desc, p.combinationSort asc
@@ -832,12 +834,68 @@
         order by p.sortIndex desc
 
     </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 s.brandID as id,s.name FROM product a
-        LEFT JOIN `brand` s ON s.brandID = a.brandID
+        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.brandID is not null
-          and s.name is not null
-          AND a.newvalidFlag!=4
+          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

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

@@ -26,7 +26,8 @@
         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,
+        p.newvalidflag
     </sql>
     <sql id="Product_Joins">
         left join tinytype as t on p.tinyTypeID = t.tinyTypeID

+ 483 - 351
src/main/resources/mapper/ShopMapper.xml

@@ -1,233 +1,238 @@
 <?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
+        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,newvalidFlag
+        <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
         ) 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},#{newvalidFlag}
+        #{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}
         )
     </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},
-                           newvalidFlag=#{newvalidFlag}
-            <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="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">
@@ -239,19 +244,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
@@ -284,54 +288,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=")">
@@ -342,34 +359,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.newvalidFlag
+        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}
@@ -397,32 +414,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="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
@@ -445,92 +468,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>