Przeglądaj źródła

二手小程序

zhijiezhao 1 tydzień temu
rodzic
commit
1d8aef5e44
23 zmienionych plików z 1246 dodań i 43 usunięć
  1. 2 2
      src/main/java/com/caimei365/manager/controller/caimei/AreaApi.java
  2. 70 0
      src/main/java/com/caimei365/manager/controller/caimei/CmSecondInfoController.java
  3. 43 2
      src/main/java/com/caimei365/manager/controller/caimei/product/ProductApi.java
  4. 48 25
      src/main/java/com/caimei365/manager/controller/caimei/svip/CmSvipHistoryApi.java
  5. 1 0
      src/main/java/com/caimei365/manager/dao/AddressMapper.java
  6. 71 0
      src/main/java/com/caimei365/manager/dao/CmSecondInfoDao.java
  7. 42 0
      src/main/java/com/caimei365/manager/dao/product/ProductMapper.java
  8. 12 0
      src/main/java/com/caimei365/manager/entity/caimei/AddressSelectVo.java
  9. 31 0
      src/main/java/com/caimei365/manager/entity/caimei/CmSecondInfo.java
  10. 3 6
      src/main/java/com/caimei365/manager/entity/caimei/brand/CmBrand.java
  11. 147 0
      src/main/java/com/caimei365/manager/entity/caimei/product/CmSecondHandDetail.java
  12. 7 2
      src/main/java/com/caimei365/manager/entity/caimei/product/Product.java
  13. 34 0
      src/main/java/com/caimei365/manager/entity/caimei/product/ProductImagePo.java
  14. 1 1
      src/main/java/com/caimei365/manager/service/caimei/AddressService.java
  15. 54 0
      src/main/java/com/caimei365/manager/service/caimei/CmSecondInfoService.java
  16. 15 4
      src/main/java/com/caimei365/manager/service/caimei/impl/AddressServiceImpl.java
  17. 75 0
      src/main/java/com/caimei365/manager/service/caimei/impl/CmSecondInfoServiceImpl.java
  18. 24 0
      src/main/java/com/caimei365/manager/service/caimei/product/ProductService.java
  19. 111 0
      src/main/java/com/caimei365/manager/service/caimei/product/impl/ProductServiceImpl.java
  20. 1 1
      src/main/java/com/caimei365/manager/service/caimei/svip/impl/CmSvipHistoryServiceImpl.java
  21. 11 0
      src/main/resources/mapper/AddressMapper.xml
  22. 89 0
      src/main/resources/mapper/CmSecondInfoDao.xml
  23. 354 0
      src/main/resources/mapper/product/ProductMapper.xml

+ 2 - 2
src/main/java/com/caimei365/manager/controller/caimei/AreaApi.java

@@ -18,8 +18,8 @@ public class AreaApi {
     private AddressService addressService;
 
     @GetMapping("/select")
-    public ResponseJson<List<AddressSelectVo>> getSelectAddress() {
-        return addressService.getSelectAddress();
+    public ResponseJson<List<AddressSelectVo>> getSelectAddress(Integer parentId, Integer type) {
+        return addressService.getSelectAddress(parentId, type);
     }
 
 }

+ 70 - 0
src/main/java/com/caimei365/manager/controller/caimei/CmSecondInfoController.java

@@ -0,0 +1,70 @@
+package com.caimei365.manager.controller.caimei;
+
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.CmSecondInfo;
+import com.caimei365.manager.service.caimei.CmSecondInfoService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+
+/**
+ * 二手小程序信息中心文章(CmSecondInfo)表控制层
+ */
+@RestController
+@RequestMapping("cmSecondInfo")
+public class CmSecondInfoController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private CmSecondInfoService cmSecondInfoService;
+
+    /**
+     * 分页查询
+     *
+     * @param cmSecondInfo 筛选条件
+     * @return 查询结果
+     */
+    @GetMapping("/list")
+    public ResponseJson<PaginationVo<CmSecondInfo>> queryByPage(String title,
+                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        return cmSecondInfoService.queryByPage(title, pageNum, pageSize);
+    }
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 主键
+     * @return 单条数据
+     */
+    @GetMapping("/form")
+    public ResponseJson<CmSecondInfo> queryById(Integer id) {
+        return cmSecondInfoService.queryById(id);
+    }
+
+
+    @PostMapping("/edit")
+    public ResponseJson edit(@RequestBody CmSecondInfo cmSecondInfo) {
+        if (cmSecondInfo.getId() == null) {
+            cmSecondInfoService.insert(cmSecondInfo);
+        } else {
+            cmSecondInfoService.update(cmSecondInfo);
+        }
+        return ResponseJson.success();
+    }
+
+    /**
+     * 删除数据
+     *
+     * @param id 主键
+     * @return 删除是否成功
+     */
+    @GetMapping("/del")
+    public ResponseJson deleteById(Integer id) {
+        return cmSecondInfoService.deleteById(id);
+    }
+
+}
+

+ 43 - 2
src/main/java/com/caimei365/manager/controller/caimei/product/ProductApi.java

@@ -1,7 +1,15 @@
 package com.caimei365.manager.controller.caimei.product;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.brand.CmBrand;
+import com.caimei365.manager.entity.caimei.product.CmSecondHandDetail;
+import com.caimei365.manager.entity.caimei.product.Product;
+import com.caimei365.manager.service.caimei.product.ProductService;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.List;
 
 /**
  * 商品管理接口
@@ -10,5 +18,38 @@ import org.springframework.web.bind.annotation.RestController;
 @RequestMapping("/product")
 public class ProductApi {
 
+    @Resource
+    private ProductService productService;
+
+    @GetMapping("/brand/list")
+    public ResponseJson<List<CmBrand>> brandList() {
+        return productService.brandList();
+    }
+
+    @GetMapping("/second/list")
+    public ResponseJson<PaginationVo<Product>> secondProductList(Product product,
+                                                           @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                           @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        return productService.secondProductList(product, pageNum, pageSize);
+    }
+
+    @PostMapping("/update/status")
+    public ResponseJson updateStatus(@RequestBody Product product) {
+        return productService.updateStatus(product);
+    }
+
+    @PostMapping("/update/shop")
+    public ResponseJson updateShop(@RequestBody Product product) {
+        return productService.updateShop(product);
+    }
+
+    @PostMapping("/save/second")
+    public ResponseJson saveSecond(@RequestBody CmSecondHandDetail product) {
+        return productService.saveSecond(product);
+    }
 
+    @GetMapping("/second/detail")
+    public ResponseJson<CmSecondHandDetail> secondDetail(Integer productId) {
+        return productService.secondDetail(productId);
+    }
 }

+ 48 - 25
src/main/java/com/caimei365/manager/controller/caimei/svip/CmSvipHistoryApi.java

@@ -1,7 +1,6 @@
 package com.caimei365.manager.controller.caimei.svip;
 
 import com.caimei.utils.StringUtils;
-import com.caimei365.manager.config.utils.UploadPicUtils;
 import com.caimei365.manager.entity.PaginationVo;
 import com.caimei365.manager.entity.ResponseJson;
 import com.caimei365.manager.entity.caimei.CmUser;
@@ -23,10 +22,12 @@ import java.util.Map;
 @RequestMapping("/svip/member")
 public class CmSvipHistoryApi {
 
-    @Autowired private CmSvipHistoryService historyService;
+    @Autowired
+    private CmSvipHistoryService historyService;
 
     /**
      * 超级会员列表
+     *
      * @param vip
      * @param pageNum
      * @param pageSize
@@ -34,14 +35,15 @@ public class CmSvipHistoryApi {
      */
     @GetMapping("/memberList")
     public ResponseJson<PaginationVo<CmSvipHistory>> memberList(CmSvipHistory vip,
-                                                 @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                 @RequestParam(value = "pageSize",defaultValue = "20")int pageSize) {
+                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
 
         return historyService.memberList(vip, pageNum, pageSize);
     }
 
     /**
      * 获取机构信息
+     *
      * @param clubId
      * @param name
      * @param shortName
@@ -51,14 +53,15 @@ public class CmSvipHistoryApi {
      */
     @GetMapping("/findClubList")
     public ResponseJson<PaginationVo<CmUser>> findClubList(Integer clubId, String name, String shortName,
-                                                            @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                            @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+                                                           @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                           @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
 
         return historyService.findClubList(clubId, name, shortName, pageNum, pageSize);
     }
 
     /**
      * 赠送超级会员
+     *
      * @param cmSvipGive
      * @return
      * @throws Exception
@@ -73,6 +76,7 @@ public class CmSvipHistoryApi {
 
     /**
      * 机构购买记录
+     *
      * @param cmSvipHistory
      * @param pageNum
      * @param pageSize
@@ -83,13 +87,14 @@ public class CmSvipHistoryApi {
                                                                  @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                  @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
         if (null == cmSvipHistory.getUserId()) {
-            return ResponseJson.error(-1,"",null);
+            return ResponseJson.error(-1, "", null);
         }
         return historyService.findHistory(cmSvipHistory, pageNum, pageSize);
     }
 
     /**
      * 超级会员专属优惠券
+     *
      * @param cmVipCoupon
      * @param pageNum
      * @param pageSize
@@ -104,6 +109,7 @@ public class CmSvipHistoryApi {
 
     /**
      * 编辑超级会员优惠券  |  超级会员专属优惠券配置
+     *
      * @param id
      * @param configure
      * @return
@@ -111,13 +117,14 @@ public class CmSvipHistoryApi {
     @GetMapping(value = "/svipCoupon")
     public ResponseJson<Map<String, Object>> formSvipCoupon(Integer id, Integer configure) {
         if (null == configure) {
-            return ResponseJson.error(-1,"优惠券类型不能为空",null);
+            return ResponseJson.error(-1, "优惠券类型不能为空", null);
         }
-        return historyService.cmVipCouponForm(id,configure);
+        return historyService.cmVipCouponForm(id, configure);
     }
 
     /**
      * 保存超级会员优惠券 | 保存专属优惠券配置
+     *
      * @param svipcouponForm
      * @return
      */
@@ -128,57 +135,63 @@ public class CmSvipHistoryApi {
 
     /**
      * 删除优惠券
+     *
      * @param id
      * @return
      */
     @PostMapping("/delCoupon/{id}")
     public ResponseJson delCoupon(@PathVariable("id") Integer id) {
         if (null == id) {
-            return ResponseJson.error(-1,"参数不能能为空",null);
+            return ResponseJson.error(-1, "参数不能能为空", null);
         }
         return historyService.delCoupon(id);
     }
+
     /**
      * 关闭超级会员专属优惠券
+     *
      * @param id
      * @return
      */
     @PostMapping("/closeCoupon/{id}")
     public ResponseJson closeCoupon(@PathVariable("id") Integer id) {
         if (null == id) {
-            return ResponseJson.error(-1,"参数为空", null);
+            return ResponseJson.error(-1, "参数为空", null);
         }
         return historyService.closeCoupon(id);
     }
 
     /**
      * 开启超级会员专属优惠券
+     *
      * @param id
      * @return
      */
     @PostMapping("/openCoupon/{id}")
     public ResponseJson openCoupon(@PathVariable("id") Integer id) {
         if (null == id) {
-            return ResponseJson.error(-1,"参数为空", null);
+            return ResponseJson.error(-1, "参数为空", null);
         }
         return historyService.openCoupon(id);
     }
 
     /**
      * 删除超级会员专属优惠券
+     *
      * @param id
      * @return
      */
     @PostMapping("/deleteCoupon/{id}")
     public ResponseJson deleteCoupon(@PathVariable("id") Integer id) {
         if (null == id) {
-            return ResponseJson.error(-1,"参数为空", null);
+            return ResponseJson.error(-1, "参数为空", null);
         }
         return historyService.deleteCoupon(id);
     }
 
     /**
      * 获取供应商列表
+     *
      * @param cmShop
      * @param pageNum
      * @param pageSize
@@ -187,13 +200,14 @@ public class CmSvipHistoryApi {
     @GetMapping("/findShopList")
     public ResponseJson<PaginationVo<NewCmShop>> findShopList(NewCmShop cmShop,
                                                               @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                              @RequestParam(value = "pageSize",defaultValue = "20")int pageSize) {
+                                                              @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
 
         return historyService.findShopList(cmShop, pageNum, pageSize);
     }
 
     /**
      * 获取商品信息列表
+     *
      * @param product
      * @param pageNum
      * @param pageSize
@@ -202,54 +216,58 @@ public class CmSvipHistoryApi {
     @GetMapping("/findProductDialogList")
     public ResponseJson<PaginationVo<Product>> findProductList(Product product,
                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                               @RequestParam(value = "pageSize",defaultValue = "20") int pageSize) {
+                                                               @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
         return historyService.findProductDialogList(product, pageNum, pageSize);
     }
 
     /**
      * 超级会员商品列表
+     *
      * @param cmSvipProduct
      * @param pageNum
      * @param pageSize
      * @return
      */
     @GetMapping("/findProductList")
-    public ResponseJson<PaginationVo<CmSvipProduct>> findProductList (CmSvipProduct cmSvipProduct,
-                                                                      @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                                      @RequestParam(value = "pageSize",defaultValue = "20")int pageSize) {
+    public ResponseJson<PaginationVo<CmSvipProduct>> findProductList(CmSvipProduct cmSvipProduct,
+                                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                     @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
 
         return historyService.findProductList(cmSvipProduct, pageNum, pageSize);
     }
 
     /**
      * 商品排序
+     *
      * @param id
      * @param sort
      * @return
      */
     @GetMapping("/updateSort")
-    public ResponseJson updateSort(Integer id , Integer sort) {
+    public ResponseJson updateSort(Integer id, Integer sort) {
         if (null == id) {
-            ResponseJson.error(-1,"参数不能为空",null);
+            ResponseJson.error(-1, "参数不能为空", null);
         }
         return historyService.updateSort(id, sort);
     }
 
     /**
      * 编辑超级会员商品
+     *
      * @param id
      * @return
      */
     @PostMapping("/editSvipProduct/{id}")
     public ResponseJson findSkuList(@PathVariable("id") Integer id) {
         if (null == id) {
-            return ResponseJson.error(-1,"id不能为空",null);
+            return ResponseJson.error(-1, "id不能为空", null);
         }
         return historyService.findSkuList(id);
     }
 
     /**
      * 保存超级会员商品
+     *
      * @param cmSvipProduct
      * @return
      */
@@ -263,29 +281,32 @@ public class CmSvipHistoryApi {
 
     /**
      * 删除超级会员商品
+     *
      * @param id
      * @return
      */
     @PostMapping("/delSvipProduct/{id}")
     public ResponseJson deleteSvipProduct(@PathVariable("id") Integer id) {
         if (null == id) {
-            return ResponseJson.error(-1,"参数id不能为空", null);
+            return ResponseJson.error(-1, "参数id不能为空", null);
         }
         return historyService.deleteSvipProduct(id);
     }
 
     /**
      * 宣传图
+     *
      * @return
      */
     @GetMapping("/getAdsImage")
-    public ResponseJson getAdsImage () {
+    public ResponseJson getAdsImage() {
 
         return historyService.getAdsImage();
     }
 
     /**
      * 保存宣传图
+     *
      * @param adsImage
      * @return
      */
@@ -293,9 +314,9 @@ public class CmSvipHistoryApi {
     public ResponseJson saveAdsImage(@RequestBody CmSvipProductAdsImage adsImage) {
         if (StringUtils.isEmpty(adsImage.getPcImage())) {
 
-            return ResponseJson.error(-1,"请上传PC端宣传图", null);
+            return ResponseJson.error(-1, "请上传PC端宣传图", null);
         } else if (StringUtils.isEmpty(adsImage.getAppletsImage())) {
-            return ResponseJson.error(-1,"请上传小程序端宣传图", null);
+            return ResponseJson.error(-1, "请上传小程序端宣传图", null);
         }
 
         return historyService.saveAdsImage(adsImage);
@@ -303,6 +324,7 @@ public class CmSvipHistoryApi {
 
     /**
      * 套餐配置
+     *
      * @return
      */
     @GetMapping("/findPackage")
@@ -312,6 +334,7 @@ public class CmSvipHistoryApi {
 
     /**
      * 更新超级会员套餐配置
+     *
      * @param cmSvipPackage
      * @return
      */

+ 1 - 0
src/main/java/com/caimei365/manager/dao/AddressMapper.java

@@ -15,4 +15,5 @@ public interface AddressMapper {
 
     List<AddressSelectVo> selectAllAddresses();
 
+    AddressSelectVo getAddByTownId(Integer townId);
 }

+ 71 - 0
src/main/java/com/caimei365/manager/dao/CmSecondInfoDao.java

@@ -0,0 +1,71 @@
+package com.caimei365.manager.dao;
+
+
+import com.caimei365.manager.entity.caimei.CmSecondInfo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+
+@Mapper
+public interface CmSecondInfoDao {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    CmSecondInfo queryById(Integer id);
+
+    /**
+     * 查询指定行数据
+     * @return 对象列表
+     */
+    List<CmSecondInfo> queryAllByLimit(String title);
+
+
+    /**
+     * 新增数据
+     *
+     * @param cmSecondInfo 实例对象
+     * @return 影响行数
+     */
+    int insert(CmSecondInfo cmSecondInfo);
+
+    /**
+     * 批量新增数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<CmSecondInfo> 实例对象列表
+     * @return 影响行数
+     */
+    int insertBatch(@Param("entities") List<CmSecondInfo> entities);
+
+    /**
+     * 批量新增或按主键更新数据(MyBatis原生foreach方法)
+     *
+     * @param entities List<CmSecondInfo> 实例对象列表
+     * @return 影响行数
+     * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参
+     */
+    int insertOrUpdateBatch(@Param("entities") List<CmSecondInfo> entities);
+
+    /**
+     * 修改数据
+     *
+     * @param cmSecondInfo 实例对象
+     * @return 影响行数
+     */
+    int update(CmSecondInfo cmSecondInfo);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+}
+

+ 42 - 0
src/main/java/com/caimei365/manager/dao/product/ProductMapper.java

@@ -0,0 +1,42 @@
+package com.caimei365.manager.dao.product;
+
+import com.caimei365.manager.entity.caimei.brand.CmBrand;
+import com.caimei365.manager.entity.caimei.product.CmSecondHandDetail;
+import com.caimei365.manager.entity.caimei.product.Product;
+import com.caimei365.manager.entity.caimei.product.ProductImagePo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface ProductMapper {
+
+    List<Product> findSecondList(Product product);
+
+    List<CmBrand> brandList();
+
+    void updateStatus(Product product);
+
+    void updateShop(Product product);
+
+    void updateSecondDetail(Product product);
+
+    void updateOnlineDate(Product product);
+
+    void updateSku(CmSecondHandDetail product);
+
+    void updateSecond(CmSecondHandDetail product);
+
+    void insertProductImage(ProductImagePo imagePo);
+
+    void updateMainImage(@Param("productId") Integer productId, @Param("mainImage") String mainImage);
+
+    void delProductImages(CmSecondHandDetail product);
+
+    CmSecondHandDetail findSecondDetail(Integer productId);
+
+    List<String> findProductImages(Integer productId);
+
+    void updateProduct(CmSecondHandDetail product);
+}

+ 12 - 0
src/main/java/com/caimei365/manager/entity/caimei/AddressSelectVo.java

@@ -25,4 +25,16 @@ public class AddressSelectVo implements Serializable {
      * 子级列表
      */
     private List<AddressSelectVo> children;
+    /**
+     * 村镇名
+     */
+    private String town;
+    /**
+     * 城市名称
+     */
+    private String city;
+    /**
+     * 省份名称
+     */
+    private String province;
 }

+ 31 - 0
src/main/java/com/caimei365/manager/entity/caimei/CmSecondInfo.java

@@ -0,0 +1,31 @@
+package com.caimei365.manager.entity.caimei;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+import java.io.Serializable;
+
+/**
+ * 二手小程序信息中心文章(CmSecondInfo)实体类
+ *
+ */
+@Data
+public class CmSecondInfo implements Serializable {
+    private static final long serialVersionUID = -47250179645160397L;
+
+    private Integer id;
+
+    private String title;
+
+    private String link;
+
+    private String image;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date publishTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date addTime;
+}
+

+ 3 - 6
src/main/java/com/caimei365/manager/entity/caimei/brand/CmBrand.java

@@ -2,17 +2,14 @@ package com.caimei365.manager.entity.caimei.brand;
 
 
 import lombok.Data;
+import lombok.experimental.Accessors;
 
-import java.beans.Transient;
 
-/**
- * 采美品牌Entity
- * @author Lijun
- * @version 2019-04-19
- */
 @Data
+@Accessors(chain = true)
 public class CmBrand {
 
+	private Integer id;
 	/**
 	 * 品牌名字
 	 */

+ 147 - 0
src/main/java/com/caimei365/manager/entity/caimei/product/CmSecondHandDetail.java

@@ -0,0 +1,147 @@
+package com.caimei365.manager.entity.caimei.product;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+@Data
+public class CmSecondHandDetail implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    private String mainImage;
+
+    private Integer publishMethod;
+
+    private Integer shopId;
+    /**
+     * 商品ID、(product表productID)
+     */
+    private Integer productId;
+    /**
+     * 是否已售 0和空未出售,1已出售
+     */
+    private Integer sold;
+    /**
+     * 二手商品分类,1二手仪器,2临期产品,3其他
+     */
+    private Integer secondHandType;
+    /**
+     * 二手仪器分类的类型,1轻光电、2重光电、3耗材配件(仅适用于二手仪器分类多个用英文逗号分分隔)
+     */
+    private Integer instrumentType;
+    /**
+     * 出厂日期格式:2020年6月
+     */
+    private String fixedYears;
+    /**
+     * 产品到期日格式:2020年6月(仅适用于临期产品)
+     */
+    private String maturityYears;
+    /**
+     * 是否启用详聊,1不开启,2开启(开启详聊不展示交易价)
+     */
+    private Integer detailTalkFlag;
+    /**
+     * 联系人名字
+     */
+    private String contactName;
+    /**
+     * 联系方式
+     */
+    private String contactMobile;
+
+    /**
+     * 设备类型:1医美、2非医美
+     */
+    private Integer secondProductType;
+    /**
+     * 省市区(地址前部分)
+     */
+    private String provinceCityDistrict;
+    /**
+     * 详细联系地址
+     */
+    private String address;
+    /**
+     * 商品成色
+     */
+    private String productQuality;
+
+    /**
+     * 发布身份1.个人身份,2公司身份
+     */
+    private Integer publishIdentity;
+
+
+    /**
+     * 品牌名称(选择其它品牌(id:161)时手填品牌)
+     */
+    private String brandName;
+    /**
+     * 商品浏览量
+     */
+    private Integer viewingNum;
+    /**
+     * 商品详情
+     */
+    private String productDetails;
+    /**
+     * 后台二手商品发布人员名称
+     */
+    private String publisher;
+
+    /**
+     * 营业执照照片
+     */
+    private String licenseImage;
+
+    /**
+     * 商品状态,见表c_productstatus或枚举ProductStatus,0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
+     */
+    private String validFlag;
+    /**
+     * 商品的类别:1正常商品(默认),2二手商品
+     */
+    private String productCategory;
+    /**
+     * 商品名称
+     */
+    private String name;
+    /**
+     * 机构价、交易价
+     */
+    private Double price;
+
+    private Integer brandId;
+    /**
+     *     信息来源 1网站  2CRM  3后台
+     */
+    private String source;
+    /**
+     * 是否显示联系人,1不显示,2显示
+     */
+    private String showContactFlag;
+
+    /**
+     * 省、市、区
+     */
+    private String province;
+    private String city;
+    private String town;
+    private Integer townId;
+    private Integer cityId;
+    private Integer provinceId;
+
+    private List<String> productImages;
+    /**
+     * 商品可见度:(3:所有人可见,2:普通机构可见,1:会员机构可见)
+     */
+    private String visibility;
+    /**
+     *发布类型1.二手预成交商品 2.二手估价商品
+     */
+    private Integer announType;
+}

+ 7 - 2
src/main/java/com/caimei365/manager/entity/caimei/product/Product.java

@@ -17,6 +17,11 @@ import java.util.List;
  */
 @Data
 public class Product {
+
+    private Integer allocateStatus;
+
+    private Integer publishMethod;
+
     private String name;
     /**
      * 供应商名称
@@ -25,7 +30,7 @@ public class Product {
     /**
      * 0暂存中 1待审核 2已上架 3已下架 8 审核不通过 9已冻结
      */
-    private String validFlag;
+    private Integer validFlag;
     /**
      * 0暂存中 1待审核 2已上架 3已下架 8 审核不通过 9已冻结
      */
@@ -628,7 +633,7 @@ public class Product {
      */
     private Integer searchType;
 
-    /*
+    /**
      *发布类型1.二手预成交商品 2.二手估价商品
      */
     private Integer announType;

+ 34 - 0
src/main/java/com/caimei365/manager/entity/caimei/product/ProductImagePo.java

@@ -0,0 +1,34 @@
+package com.caimei365.manager.entity.caimei.product;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+
+@Data
+public class ProductImagePo implements Serializable {
+    private static final long serialVersionUID = 1L;
+    private Integer id;
+    /** 商品productID */
+    private Integer productId;
+    /**
+     * 所属供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 添加时间
+     */
+    private String addTime;
+    /**
+     * 图
+     */
+    private String image;
+    /**
+     * 是否主图:1是,空或0不是
+     */
+    private Integer mainFlag;
+    /**
+     * 排序值
+     */
+    private Integer sortIndex;
+}

+ 1 - 1
src/main/java/com/caimei365/manager/service/caimei/AddressService.java

@@ -7,5 +7,5 @@ import java.util.List;
 
 public interface AddressService {
 
-    ResponseJson<List<AddressSelectVo>> getSelectAddress();
+    ResponseJson<List<AddressSelectVo>> getSelectAddress(Integer parentId, Integer type);
 }

+ 54 - 0
src/main/java/com/caimei365/manager/service/caimei/CmSecondInfoService.java

@@ -0,0 +1,54 @@
+package com.caimei365.manager.service.caimei;
+
+
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.CmSecondInfo;
+
+/**
+ * 二手小程序信息中心文章(CmSecondInfo)表服务接口
+ *
+ * @author makejava
+ * @since 2025-05-13 10:16:52
+ */
+public interface CmSecondInfoService {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    ResponseJson<CmSecondInfo> queryById(Integer id);
+
+    /**
+     * 分页查询
+     * @return 查询结果
+     */
+    ResponseJson<PaginationVo<CmSecondInfo>> queryByPage(String title, int pageNum, int pageSize);
+
+    /**
+     * 新增数据
+     *
+     * @param cmSecondInfo 实例对象
+     * @return 实例对象
+     */
+    ResponseJson insert(CmSecondInfo cmSecondInfo);
+
+    /**
+     * 修改数据
+     *
+     * @param cmSecondInfo 实例对象
+     * @return 实例对象
+     */
+    ResponseJson update(CmSecondInfo cmSecondInfo);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    ResponseJson deleteById(Integer id);
+
+}

+ 15 - 4
src/main/java/com/caimei365/manager/service/caimei/impl/AddressServiceImpl.java

@@ -19,9 +19,20 @@ public class AddressServiceImpl implements AddressService {
 
 
     @Override
-    public ResponseJson<List<AddressSelectVo>> getSelectAddress() {
-        // 获取所有省份列表
-        List<AddressSelectVo> provinceList = addressMapper.selectAllAddresses();
-        return ResponseJson.success(provinceList);
+    public ResponseJson<List<AddressSelectVo>> getSelectAddress(Integer parentId, Integer type) {
+        if (0 == type) {
+            // 获取所有省份列表
+            List<AddressSelectVo> provinceList = addressMapper.getAllProvinceList();
+            return ResponseJson.success(provinceList);
+        } else if (1 == type) {
+            // 获取当前省份下的所有城市列表
+            List<AddressSelectVo> cityList = addressMapper.getCityListByProvinceId(parentId);
+            return ResponseJson.success(cityList);
+        } else if (2 == type) {
+            // 获取当前城市下的所有地区列表
+            List<AddressSelectVo> townList = addressMapper.getTownListByCityId(parentId);
+            return ResponseJson.success(townList);
+        }
+        return ResponseJson.error("地址选项类型错误!", null);
     }
 }

+ 75 - 0
src/main/java/com/caimei365/manager/service/caimei/impl/CmSecondInfoServiceImpl.java

@@ -0,0 +1,75 @@
+package com.caimei365.manager.service.caimei.impl;
+
+
+import com.caimei365.manager.dao.CmSecondInfoDao;
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.CmSecondInfo;
+import com.caimei365.manager.service.caimei.CmSecondInfoService;
+import com.github.pagehelper.PageHelper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * 二手小程序信息中心文章(CmSecondInfo)表服务实现类
+ */
+@Slf4j
+@Service("cmSecondInfoService")
+public class CmSecondInfoServiceImpl implements CmSecondInfoService {
+
+    @Resource
+    private CmSecondInfoDao cmSecondInfoDao;
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    @Override
+    public ResponseJson<CmSecondInfo> queryById(Integer id) {
+        return ResponseJson.success(cmSecondInfoDao.queryById(id));
+    }
+
+    @Override
+    public ResponseJson<PaginationVo<CmSecondInfo>> queryByPage(String title, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmSecondInfo> cmSecondInfos = cmSecondInfoDao.queryAllByLimit(title);
+        PaginationVo<CmSecondInfo> page = new PaginationVo<>(cmSecondInfos);
+        return ResponseJson.success(page);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson insert(CmSecondInfo cmSecondInfo) {
+        log.info("cmSecondInfo--------->" + cmSecondInfo.toString());
+        cmSecondInfoDao.insert(cmSecondInfo);
+        return ResponseJson.success();
+    }
+
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson update(CmSecondInfo cmSecondInfo) {
+        log.info("cmSecondInfo--------->" + cmSecondInfo.toString());
+        cmSecondInfoDao.update(cmSecondInfo);
+        return ResponseJson.success();
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson deleteById(Integer id) {
+        cmSecondInfoDao.deleteById(id);
+        return ResponseJson.success();
+    }
+}

+ 24 - 0
src/main/java/com/caimei365/manager/service/caimei/product/ProductService.java

@@ -0,0 +1,24 @@
+package com.caimei365.manager.service.caimei.product;
+
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.brand.CmBrand;
+import com.caimei365.manager.entity.caimei.product.CmSecondHandDetail;
+import com.caimei365.manager.entity.caimei.product.Product;
+
+import java.util.List;
+
+public interface ProductService {
+
+    ResponseJson<PaginationVo<Product>> secondProductList(Product product, int pageNum, int pageSize);
+
+    ResponseJson<List<CmBrand>> brandList();
+
+    ResponseJson updateStatus(Product product);
+
+    ResponseJson updateShop(Product product);
+
+    ResponseJson saveSecond(CmSecondHandDetail product);
+
+    ResponseJson<CmSecondHandDetail> secondDetail(Integer productId);
+}

+ 111 - 0
src/main/java/com/caimei365/manager/service/caimei/product/impl/ProductServiceImpl.java

@@ -0,0 +1,111 @@
+package com.caimei365.manager.service.caimei.product.impl;
+
+import com.caimei365.manager.dao.AddressMapper;
+import com.caimei365.manager.dao.product.ProductMapper;
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.AddressSelectVo;
+import com.caimei365.manager.entity.caimei.brand.CmBrand;
+import com.caimei365.manager.entity.caimei.product.CmSecondHandDetail;
+import com.caimei365.manager.entity.caimei.product.Product;
+import com.caimei365.manager.entity.caimei.product.ProductImagePo;
+import com.caimei365.manager.service.caimei.product.ProductService;
+import com.github.pagehelper.PageHelper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service
+@Slf4j
+public class ProductServiceImpl implements ProductService {
+
+    @Resource
+    private ProductMapper productMapper;
+    @Resource
+    private AddressMapper addressMapper;
+
+    @Override
+    public ResponseJson<PaginationVo<Product>> secondProductList(Product product, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<Product> productList = productMapper.findSecondList(product);
+        PaginationVo<Product> paginationVo = new PaginationVo<>(productList);
+        return ResponseJson.success(paginationVo);
+    }
+
+    @Override
+    public ResponseJson<List<CmBrand>> brandList() {
+        List<CmBrand> brands = productMapper.brandList();
+        brands.add(new CmBrand().setName("其他").setId(161));
+        return ResponseJson.success(brands);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson updateStatus(Product product) {
+        productMapper.updateStatus(product);
+        if (2 == product.getValidFlag()) {
+            productMapper.updateOnlineDate(product);
+        }
+        return ResponseJson.success();
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson updateShop(Product product) {
+        productMapper.updateShop(product);
+        productMapper.updateSecondDetail(product);
+        return ResponseJson.success();
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson saveSecond(CmSecondHandDetail product) {
+        if (null == product.getProductId()) {
+            return ResponseJson.error("商品Id不能为空");
+        }
+        productMapper.updateSku(product);
+        // 地址
+        Integer townId = product.getTownId();
+        String provinceCityDistrict = "";
+        if (null != townId) {
+            AddressSelectVo addByTownId = addressMapper.getAddByTownId(townId);
+            if (null != addByTownId) {
+                String province = addByTownId.getProvince();
+                String city = addByTownId.getCity();
+                String town = addByTownId.getTown();
+                provinceCityDistrict = province + "/" + city + "/" + town;
+                product.setProvinceCityDistrict(provinceCityDistrict);
+            }
+        }
+        productMapper.updateSecond(product);
+
+        productMapper.delProductImages(product);
+        if (null != product.getProductImages()) {
+            List<String> productImages = product.getProductImages();
+            for (int i = 0; i < productImages.size(); i++) {
+                ProductImagePo imagePo = new ProductImagePo();
+                imagePo.setProductId(product.getProductId());
+                imagePo.setShopId(product.getShopId());
+                imagePo.setImage(productImages.get(i));
+                int flag = 0 == i ? 1 : 0;
+                imagePo.setMainFlag(flag);
+                if (flag == 1) {
+                    product.setMainImage(productImages.get(i));
+                    productMapper.updateProduct(product);
+                }
+                productMapper.insertProductImage(imagePo);
+            }
+        }
+        return ResponseJson.success();
+    }
+
+    @Override
+    public ResponseJson<CmSecondHandDetail> secondDetail(Integer productId) {
+        CmSecondHandDetail detail = productMapper.findSecondDetail(productId);
+        detail.setProductImages(productMapper.findProductImages(productId));
+        return ResponseJson.success(detail);
+    }
+}

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

@@ -548,7 +548,7 @@ public class CmSvipHistoryServiceImpl implements CmSvipHistoryService {
     @Override
     public ResponseJson<PaginationVo<Product>> findProductDialogList(Product product, int pageNum, int pageSize) {
         PageHelper.startPage(pageNum, pageSize);
-        product.setValidFlag("2");
+        product.setValidFlag(2);
         product.setProductCategory("1");
         List<Product> productList = historyDao.findProductImage(product);
         if (productList != null && productList.size() > 0) {

+ 11 - 0
src/main/resources/mapper/AddressMapper.xml

@@ -52,4 +52,15 @@
         LEFT JOIN city c ON p.provinceId = c.provinceId
         LEFT JOIN town t ON c.cityId = t.cityId
     </select>
+
+    <select id="getAddByTownId" resultType="com.caimei365.manager.entity.caimei.AddressSelectVo">
+        SELECT a.name   as "province"
+             , b.name   as "city"
+             , c.name   as "town"
+             , c.townId as "id"
+        FROM province a
+                 RIGHT JOIN city b ON a.provinceId = b.provinceId
+                 RIGHT JOIN town c ON b.cityId = c.cityId
+        WHERE c.townId = #{townId}
+    </select>
 </mapper>

+ 89 - 0
src/main/resources/mapper/CmSecondInfoDao.xml

@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.manager.dao.CmSecondInfoDao">
+
+    <!--查询单个-->
+    <select id="queryById" resultType="com.caimei365.manager.entity.caimei.CmSecondInfo">
+        select id,
+               title,
+               link,
+               image,
+               publishTime,
+               addTime
+        from cm_second_info
+        where id = #{id}
+    </select>
+
+    <!--查询指定行数据-->
+    <select id="queryAllByLimit" resultType="com.caimei365.manager.entity.caimei.CmSecondInfo">
+        select
+        id, title, link, image, publishTime, addTime
+        from cm_second_info
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="title != null and title != ''">
+                and title like concat ('%', #{title},'%')
+            </if>
+        </where>
+        order by addTime desc
+    </select>
+
+    <!--新增所有列-->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into cm_second_info(title, link, image, publishTime, addTime)
+        values (#{title}, #{link}, #{image}, #{publishTime}, now())
+    </insert>
+
+    <insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into cm_second_info(title, link, image, publishTime, addTime)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.title}, #{entity.link}, #{entity.image}, #{entity.publishtime}, #{entity.addtime})
+        </foreach>
+    </insert>
+
+    <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
+        insert into cm_second_info(title, link, image, publishTime, addTime)
+        values
+        <foreach collection="entities" item="entity" separator=",">
+            (#{entity.title}, #{entity.link}, #{entity.image}, #{entity.publishtime}, #{entity.addtime})
+        </foreach>
+        on duplicate key update
+        title = values(title),
+        link = values(link),
+        image = values(image),
+        publishTime = values(publishTime),
+        addTime = values(addTime)
+    </insert>
+
+    <!--通过主键修改数据-->
+    <update id="update">
+        update cm_second_info
+        <set>
+            <if test="title != null and title != ''">
+                title = #{title},
+            </if>
+            <if test="link != null and link != ''">
+                link = #{link},
+            </if>
+            <if test="image != null and image != ''">
+                image = #{image},
+            </if>
+            <if test="publishTime != null">
+                publishTime = #{publishTime},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from cm_second_info
+        where id = #{id}
+    </delete>
+
+</mapper>
+

+ 354 - 0
src/main/resources/mapper/product/ProductMapper.xml

@@ -0,0 +1,354 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+<mapper namespace="com.caimei365.manager.dao.product.ProductMapper">
+
+    <insert id="insertProductImage">
+        insert into productimage (productID, shopID, addTime, image, mainFlag, sortIndex)
+        values (#{productId}, ifnull(#{shopId},(select shopId from product where productId=#{productId})), #{addTime}, #{image}, #{mainFlag}, #{sortIndex})
+    </insert>
+
+    <update id="updateStatus">
+        update cm_organize_product_info
+        set validFlag = #{validFlag}
+        where productId = #{productId}
+    </update>
+    <update id="updateShop">
+        update product
+        set shopId = #{shopId}
+        where productId = #{productId}
+    </update>
+    <update id="updateSecondDetail">
+        update cm_second_hand_detail
+        set allocateStatus = 2
+        where productId = #{productId}
+    </update>
+    <update id="updateOnlineDate">
+        update cm_second_hand_detail
+        set onLineDate = now()
+        where productId = #{productId}
+    </update>
+    <update id="updateSku">
+        update cm_sku
+        set price = #{price}
+        where productId = #{productId}
+    </update>
+
+    <update id="updateSecond">
+        UPDATE cm_second_hand_detail
+        <set>
+            <if test="sold != null and sold != ''">
+                sold = #{sold},
+            </if>
+            <if test="secondHandType != null and secondHandType != ''">
+                secondHandType = #{secondHandType},
+            </if>
+            <if test="instrumentType != null and instrumentType != ''">
+                instrumentType = #{instrumentType},
+            </if>
+            <if test="fixedYears != null and fixedYears != ''">
+                fixedYears = #{fixedYears},
+            </if>
+            <if test="maturityYears != null and maturityYears != ''">
+                maturityYears = #{maturityYears},
+            </if>
+            <if test="detailTalkFlag != null and detailTalkFlag != ''">
+                detailTalkFlag = #{detailTalkFlag},
+            </if>
+            <if test="contactName != null and contactName != ''">
+                contactName = #{contactName},
+            </if>
+            <if test="contactMobile != null and contactMobile != ''">
+                contactMobile = #{contactMobile},
+            </if>
+            <if test="secondProductType != null and secondProductType != ''">
+                secondProductType = #{secondProductType},
+            </if>
+            <if test="provinceCityDistrict != null and provinceCityDistrict != ''">
+                provinceCityDistrict = #{provinceCityDistrict},
+            </if>
+            <if test="townId != null and townId != ''">
+                townId = #{townId},
+            </if>
+            <if test="address != null and address != ''">
+                address = #{address},
+            </if>
+            <if test="productQuality != null and productQuality != ''">
+                productQuality = #{productQuality},
+            </if>
+            <if test="productDetails != null and productDetails != ''">
+                productDetails = #{productDetails},
+            </if>
+            <if test="viewingNum != null and viewingNum != ''">
+                viewingNum = #{viewingNum},
+            </if>
+            <if test="brandName != null and brandName != ''">
+                brandName = #{brandName},
+            </if>
+            <if test="showContactFlag != null and showContactFlag != ''">
+                showContactFlag = #{showContactFlag},
+            </if>
+            <if test="publisher != null and publisher != ''">
+                publisher = #{publisher},
+            </if>
+            <if test="publishIdentity != null and publishIdentity != ''">
+                publishIdentity = #{publishIdentity},
+            </if>
+        </set>
+        WHERE productID = #{productId}
+    </update>
+
+    <update id="updateMainImage">
+        update product
+        set mainImage = #{mainImage}
+        where productId = #{productId}
+    </update>
+    <update id="updateProduct">
+        update product
+        <set>
+            <if test="name != null and name !=''">
+                name = #{name},
+            </if>
+            <if test="brandId != null and brandId !=''">
+                brandID = #{brandId},
+            </if>
+            <if test="mainImage != null and mainImage !=''">
+                mainImage = #{mainImage}
+            </if>
+        </set>
+        where productID = #{productId}
+    </update>
+    <delete id="delProductImages">
+        delete from productimage
+        where productId = #{productId}
+    </delete>
+
+    <select id="findSecondList" resultType="com.caimei365.manager.entity.caimei.product.Product">
+        SELECT
+        a.newvalidFlag,
+        ifnull(a.newProductType,2) as newProductType,
+        ifnull(a.announType,1) as announType,
+        a.productID AS "id",
+        a.productID AS "productID",
+        a.groundMall AS "groundMall",
+        a.brandID AS "brandID",
+        ifnull(a.bigTypeID,0) AS "bigTypeID",
+        ifnull(a.smallTypeID,0) AS "smallTypeID",
+        ifnull(a.tinyTypeID,0) AS "tinyTypeID",
+        a.productCategory AS "productCategory",
+        a.preferredFlag AS "preferredFlag",
+        a.shopID AS "shopID",
+        a.name AS "name",
+        a.searchKey AS "searchKey",
+        a.combinationID AS "combinationID",
+        a.productRemarks AS "productRemarks",
+        a.priceFlag AS "priceFlag",
+        a.beautyActFlag AS "beautyActFlag",
+        a.hasSkuFlag AS "hasSkuFlag",
+        a.mainImage AS "mainImage",
+        a.propertiesInfo AS "propertiesInfo",
+        a.addTime AS "addTime",
+        a.updateTime AS "updateTime",
+        a.sellNumber AS "sellNumber",
+        a.beforeValidFlag AS "beforeValidFlag",
+        copi.validFlag AS "validFlag",
+        a.favoriteTimes AS "favoriteTimes",
+        a.commentScore AS "commentScore",
+        a.commentTimes AS "commentTimes",
+        a.sortIndex AS "sortIndex",
+        a.featuredFlag AS "featuredFlag",
+        a.featuredSortIndex AS "featuredSortIndex",
+        a.productCode AS "productCode",
+        a.allAreaFlag AS "allAreaFlag",
+        a.provinceIDs AS "provinceIDs",
+        a.serviceNumber AS "serviceNumber",
+        a.packageCount AS "packageCount",
+        a.byFlag AS "byFlag",
+        a.normalProductFlag AS "normalProductFlag",
+        a.step AS "step",
+        a.actStatus AS "actStatus",
+        a.actFlag AS "actFlag",
+        a.actType AS "actType",
+        a.onlineTime AS "onlineTime",
+        a.downlineTime AS "downlineTime",
+        a.freePostFlag AS "freePostFlag",
+        s.name AS "shopName",
+        a.actSort AS "actSort",
+        a.recommendType AS "recommendType",
+        a.aliasName as "aliasName",
+        a.visibility as "visibility",
+        a.commodityDetailsFlag as "commodityDetailsFlag",
+        a.productType as "productType",
+        a.qualificationImg as "qualificationImg",
+        a.includedTax as "includedTax",
+        a.invoiceType as "invoiceType",
+        a.taxPoint as "taxPoint",
+        a.supplierTaxPoint as "supplierTaxPoint",
+        a.tags as "tags",
+        a.machineType as "machineType",
+        a.commodityType as "commodityType",
+        a.trainingMethod as "trainingMethod",
+        a.trainingType as "trainingType",
+        a.trainingFee as "trainingFee",
+        a.splitCode as "splitCode",
+        a.productDescribe as "productDescribe",
+        cshd.secondHandType as "secondHandType",
+        cshd.instrumentType as "instrumentType",
+        cshd.sold as "sold",
+        cshd.payStatus as "payStatus",
+        cshd.contactName as "contactName",
+        cshd.originalPrice as "originalPrice",
+        cshd.submitDate AS "submitDate",
+        cshd.reviewedDate AS "reviewedDate",
+        cshd.onLineDate AS "onLineDate",
+        cshd.brandName AS "otherBrandName",
+        cshd.publisher AS "publisher",
+        cshd.source AS "source",
+        cshd.dockingPeopleName AS "dockingPeopleName",
+        cb.name as "brandName",
+        if(csp.id is not null,1,0) as "svipFlag",
+        cshd.companyName as "companyName",
+        cshd.publishIdentity as "publishIdentity",
+        cshd.publishMethod as "publishMethod",
+        cshd.allocateStatus as "allocateStatus",
+        (select ifnull(price,0) from cm_sku where productId = a.productId limit 1) as price,
+        a.qualificationNo,
+        a.productName,
+        a.qualificationTime,
+        a.qualificationLink,
+        a.returnGoodsStutas,
+        a.labelIds
+        FROM product a
+        LEFT JOIN shop s ON s.shopID = a.shopID
+        LEFT JOIN cm_second_hand_detail cshd ON cshd.productID = a.productID
+        LEFT JOIN cm_brand cb ON a.brandID = cb.id
+        LEFT JOIN cm_svip_product csp on a.productID = csp.productId
+        left join cm_organize_product_info copi on copi.productId = a.productID
+        <where>
+            AND a.productCategory = 2 and copi.validFlag != 0
+            <if test="productId !=null and productId !=''">
+                AND a.productId=#{productId}
+            </if>
+            <if test="commodityType != null and commodityType != ''">
+                AND a.commodityType=#{commodityType}
+            </if>
+            <if test="bigTypeID != null and bigTypeID != 0">
+                AND a.bigTypeID = #{bigTypeID}
+            </if>
+            <if test="smallTypeID != null and smallTypeID != 0">
+                AND a.smallTypeID = #{smallTypeID}
+            </if>
+            <if test="tinyTypeID != null and tinyTypeID != 0">
+                AND a.tinyTypeID = #{tinyTypeID}
+            </if>
+            <if test="validFlag != null and validFlag != ''">
+                AND copi.validFlag = #{validFlag}
+            </if>
+            <if test="validFlag == null and validFlag == ''">
+                AND copi.validFlag != '0'
+            </if>
+            <if test="brandID != null and brandID != ''">
+                AND a.brandID = #{brandID}
+            </if>
+            <if test="shopId != null and shopId != ''">
+                AND a.shopId = #{shopId}
+            </if>
+            <if test="productType != null and productType !=''">
+                AND a.productType = #{productType}
+            </if>
+            <if test="name != null and name != ''">
+                AND a.name LIKE concat('%',#{name},'%')
+            </if>
+            <if test="shopName != null and shopName != ''">
+                AND s.name LIKE concat('%',#{shopName},'%')
+            </if>
+            <if test="actFlag !=null and actFlag !=''">
+                AND a.actFlag=#{actFlag}
+            </if>
+            <if test="actType !=null and actType !=''">
+                AND a.actType=#{actType}
+            </if>
+            <if test="secondHandType !=null and secondHandType !=''">
+                AND cshd.secondHandType=#{secondHandType}
+            </if>
+            <if test="instrumentType !=null and instrumentType !=''">
+                AND cshd.instrumentType like concat('%',#{instrumentType},'%')
+            </if>
+            <if test="sold != null and sold != ''">
+                AND cshd.sold=#{sold}
+            </if>
+            <if test="source != null and source != ''">
+                AND cshd.source=#{source}
+            </if>
+            <if test="publishIdentity != null and publishIdentity !=''">
+                AND cshd.publishIdentity = #{publishIdentity}
+            </if>
+            <if test="announType !=null and announType!= '' and productCategory == 2">
+                AND a.announType=#{announType}
+            </if>
+            <if test="contactName !=null and contactName !=''">
+                AND cshd.contactName LIKE concat('%',#{contactName},'%')
+            </if>
+            <if test="isRelevance != null and isRelevance != ''">
+                <if test="isRelevance == 1">
+                    AND a.labelIds IS NOT NULL
+                </if>
+                <if test="isRelevance == 2">
+                    AND a.labelIds IS NULL
+                </if>
+            </if>
+            AND a.shopID not in (SELECT s.`value` FROM `sys_dict` s WHERE s.type='heheShopID')
+            AND a.productID NOT IN (6060, 6061, 6062, 6063, 6064,6065, 6066, 6067, 6068, 6069)
+        </where>
+        group by a.productID
+        order by a.productID desc
+    </select>
+
+    <select id="brandList" resultType="com.caimei365.manager.entity.caimei.brand.CmBrand">
+        select id, name
+        from cm_brand
+        where delflag = 0 and status = 1
+        order by sort
+    </select>
+    <select id="findSecondDetail" resultType="com.caimei365.manager.entity.caimei.product.CmSecondHandDetail">
+        select cshd.productId,
+               cshd.sold,
+               cshd.secondHandType,
+               cshd.instrumentType,
+               cshd.fixedYears,
+               cshd.companyName,
+               cshd.detailTalkFlag,
+               cshd.contactName,
+               cshd.contactMobile,
+               cshd.secondProductType,
+               cshd.townId,
+               c.cityId,
+               pv.provinceId,
+               cshd.provinceCityDistrict,
+               cshd.address,
+               cshd.productQuality,
+               cshd.productDetails,
+               cshd.viewingNum,
+               cshd.brandName,
+               cshd.source,
+               cshd.showContactFlag,
+               cshd.publisher,
+               cshd.buyFlag,
+               cshd.publishMethod,
+               p.brandId,
+               p.name,
+               (select ifnull(price,0) from cm_sku where productId = cshd.productId limit 1) as price
+        from cm_second_hand_detail cshd
+        left join town t on t.townID = cshd.townId
+        left join city c on t.cityID = c.cityID
+        left join province pv on c.provinceID = pv.provinceID
+        left join product p on cshd.productID  = p.productID
+        where cshd.productId = #{productId}
+    </select>
+    <select id="findProductImages" resultType="java.lang.String">
+        select image
+        from productimage
+        where productID = #{productId}
+        and mainFlag in (0,1)
+        order by mainFlag desc
+    </select>
+</mapper>