diff --git a/api-mapper/src/main/java/com/heyu/api/data/config/MyBatisBaomidouServiceImpl.java b/api-mapper/src/main/java/com/heyu/api/data/config/MyBatisBaomidouServiceImpl.java index bb9e075..34eafff 100644 --- a/api-mapper/src/main/java/com/heyu/api/data/config/MyBatisBaomidouServiceImpl.java +++ b/api-mapper/src/main/java/com/heyu/api/data/config/MyBatisBaomidouServiceImpl.java @@ -56,11 +56,11 @@ public class MyBatisBaomidouServiceImpl implements MyBatisBaomidouService { @Override public void info(String info) { - if(info.contains("api_post_code")){ - + if(info.contains("vv_product")){ + //log.info(info); } - // log.info(info); + if (log.isDebugEnabled()) { } diff --git a/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerAddressDao.java b/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerAddressDao.java index f3b508c..f698df2 100644 --- a/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerAddressDao.java +++ b/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerAddressDao.java @@ -8,15 +8,13 @@ package com.heyu.api.data.dao.vv; * @since 2025-08-23 */ +import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.heyu.api.data.entity.vv.VvBuyerAddressEntity; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.lz.mybatis.plugins.interceptor.annotation.Bean2Map; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; -import java.util.Map; @Mapper public interface VvBuyerAddressDao extends BaseMapper { @@ -43,8 +41,10 @@ public interface VvBuyerAddressDao extends BaseMapper { List selectAppByCondition(IPage page, Long buyerId); - @Bean2Map(key = VvBuyerAddressEntity.buyer_id) - Map> selectMapByBuyerIds(List buyerIds); + + + + List selectMapByBuyerIds(List buyerId); } \ No newline at end of file diff --git a/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerDao.java b/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerDao.java index 67a34bf..fbf916b 100644 --- a/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerDao.java +++ b/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvBuyerDao.java @@ -46,5 +46,5 @@ public interface VvBuyerDao extends BaseMapper { @IF @LIKE String buyerWeixin, @IF @GE Long minCreateTimestamp, @IF @LE Long maxCreateTimestamp, - @IF String createTimestampSort); + @OrderBy @IF @Column(VvBuyerEntity.create_timestamp) String createTimestampSort); } \ No newline at end of file diff --git a/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvProductDao.java b/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvProductDao.java index ab01af2..429a5e7 100644 --- a/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvProductDao.java +++ b/api-mapper/src/main/java/com/heyu/api/data/dao/vv/VvProductDao.java @@ -73,6 +73,6 @@ public interface VvProductDao extends BaseMapper { @IF Integer categoryIdTwo, @IF Integer categoryIdThree, @IF @OrderBy(VvProductEntity.show_sale_price) String salePriceSort, - @IF @OrderBy(VvProductEntity.sale_count) String saleCountSort, + @IF @OrderBy(VvProductEntity.show_sale_count) String saleCountSort, @IF @OrderBy(VvProductEntity.create_timestamp) String createTimestampSort); } \ No newline at end of file diff --git a/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductEntity.java b/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductEntity.java index 089efbb..0b22e32 100644 --- a/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductEntity.java +++ b/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductEntity.java @@ -1,16 +1,16 @@ package com.heyu.api.data.entity.vv; - import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; +import com.lz.mybatis.plugin.annotations.AS; import java.math.BigDecimal; -import java.util.Date; +import java.util.Date;import java.util.Date; /** *商品表 * @author quyixiao -* @since 2025-08-21 +* @since 2025-08-23 */ @Data @@ -29,7 +29,7 @@ private static final long serialVersionUID = 1L; public final static String video_url = CLASS_NAME + "video_url"; // 视频url public final static String title_ = CLASS_NAME + "title"; // 商品标题 public final static String show_sale_price = CLASS_NAME + "show_sale_price"; // 销售价格 - public final static String sale_count = CLASS_NAME + "sale_count"; // 销售数量 + public final static String show_sale_count = CLASS_NAME + "show_sale_count"; // 销售数量 public final static String default_sort = CLASS_NAME + "default_sort"; // 默认排序 public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间撮 public final static String modify_timestamp = CLASS_NAME + "modify_timestamp"; // 修改时间撮 @@ -56,8 +56,8 @@ private static final long serialVersionUID = 1L; private String title; //销售价格 private BigDecimal showSalePrice; - //销售数量,用于展示用 - private Integer saleCount; + //销售数量 + private Integer showSaleCount; //默认排序 private Integer defaultSort; //创建时间撮 @@ -200,15 +200,15 @@ private static final long serialVersionUID = 1L; * 销售数量 * @return */ - public Integer getSaleCount() { - return saleCount; + public Integer getShowSaleCount() { + return showSaleCount; } /** * 销售数量 - * @param saleCount + * @param showSaleCount */ - public void setSaleCount(Integer saleCount) { - this.saleCount = saleCount; + public void setShowSaleCount(Integer showSaleCount) { + this.showSaleCount = showSaleCount; } /** @@ -357,7 +357,7 @@ private static final long serialVersionUID = 1L; ",videoUrl=" + videoUrl + ",title=" + title + ",showSalePrice=" + showSalePrice + - ",saleCount=" + saleCount + + ",showSaleCount=" + showSaleCount + ",defaultSort=" + defaultSort + ",createTimestamp=" + createTimestamp + ",modifyTimestamp=" + modifyTimestamp + diff --git a/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductPropertyEntity.java b/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductPropertyEntity.java index a196a23..67458d0 100644 --- a/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductPropertyEntity.java +++ b/api-mapper/src/main/java/com/heyu/api/data/entity/vv/VvProductPropertyEntity.java @@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date; /** *sku 与属性的对应关系 * @author quyixiao -* @since 2025-08-22 +* @since 2025-08-23 */ @Data @@ -26,11 +26,11 @@ private static final long serialVersionUID = 1L; public final static String create_time = CLASS_NAME + "create_time"; // 创建时间 public final static String modify_time = CLASS_NAME + "modify_time"; // 修改时间 public final static String property_id = CLASS_NAME + "property_id"; // 属性id - public final static String sku_id = CLASS_NAME + "sku_id"; // skuid public final static String category_id = CLASS_NAME + "category_id"; // 类目id public final static String property_name = CLASS_NAME + "property_name"; // 属性名称 public final static String category_name = CLASS_NAME + "category_name"; // 类目名称 public final static String defalut_sort = CLASS_NAME + "defalut_sort"; // 默认排序 + public final static String product_id = CLASS_NAME + "product_id"; // 商品id // @TableId(value = "id", type = IdType.AUTO) private Long id; @@ -42,8 +42,6 @@ private static final long serialVersionUID = 1L; private Date modifyTime; //属性id private Long propertyId; - //skuid - private Long skuId; //类目id private Long categoryId; //属性名称 @@ -52,6 +50,8 @@ private static final long serialVersionUID = 1L; private String categoryName; //默认排序 private Integer defalutSort; + //商品id + private Long productId; /** * * @return @@ -127,21 +127,6 @@ private static final long serialVersionUID = 1L; this.propertyId = propertyId; } - /** - * skuid - * @return - */ - public Long getSkuId() { - return skuId; - } - /** - * skuid - * @param skuId - */ - public void setSkuId(Long skuId) { - this.skuId = skuId; - } - /** * 类目id * @return @@ -202,6 +187,21 @@ private static final long serialVersionUID = 1L; this.defalutSort = defalutSort; } + /** + * 商品id + * @return + */ + public Long getProductId() { + return productId; + } + /** + * 商品id + * @param productId + */ + public void setProductId(Long productId) { + this.productId = productId; + } + @Override public String toString() { return "VvProductPropertyEntity{" + @@ -210,11 +210,11 @@ private static final long serialVersionUID = 1L; ",createTime=" + createTime + ",modifyTime=" + modifyTime + ",propertyId=" + propertyId + - ",skuId=" + skuId + ",categoryId=" + categoryId + ",propertyName=" + propertyName + ",categoryName=" + categoryName + ",defalutSort=" + defalutSort + + ",productId=" + productId + "}"; } } \ No newline at end of file diff --git a/api-mapper/src/main/resources/mapper/vv/VvProductDao.xml b/api-mapper/src/main/resources/mapper/vv/VvProductDao.xml index 81fe735..2f82753 100644 --- a/api-mapper/src/main/resources/mapper/vv/VvProductDao.xml +++ b/api-mapper/src/main/resources/mapper/vv/VvProductDao.xml @@ -8,17 +8,5 @@ - - is_delete = #{isDelete}, - gmt_create = #{gmtCreate}, - uid = #{uid}, - app_id = #{appId}, - order_id = #{orderId}, - register_phone = #{registerPhone}, - content = #{content} - - - - diff --git a/api-mapper/src/test/java/com/test/xxx/MysqlMain_update.java b/api-mapper/src/test/java/com/test/xxx/MysqlMain_update.java index 4b23bde..99e6e65 100644 --- a/api-mapper/src/test/java/com/test/xxx/MysqlMain_update.java +++ b/api-mapper/src/test/java/com/test/xxx/MysqlMain_update.java @@ -49,7 +49,7 @@ public class MysqlMain_update { List list = new ArrayList(); - String a = "vv_buyer"; + String a = "vv_product_property"; for (String s : a.split(",")) { list.add(new TablesBean(s)); } diff --git a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/FrontManagerIndexSortRequest.java b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/FrontManagerIndexSortRequest.java index edafb70..99c719d 100644 --- a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/FrontManagerIndexSortRequest.java +++ b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/FrontManagerIndexSortRequest.java @@ -5,8 +5,14 @@ import lombok.Data; @Data public class FrontManagerIndexSortRequest { + /*** + * 商品id + */ private Long productId; + /** + * 排序位置 -1 ,最前面 + */ private Integer defaultSort; } diff --git a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvBuyerRequest.java b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvBuyerRequest.java index 2aeeff3..c8480a8 100644 --- a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvBuyerRequest.java +++ b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvBuyerRequest.java @@ -6,10 +6,10 @@ import lombok.Data; @Data public class VvBuyerRequest { - private Integer pageNum; + private Integer pageNum = 1 ; - private Integer pageSize; + private Integer pageSize = 10 ; //创建时间撮 @@ -24,15 +24,9 @@ public class VvBuyerRequest { //买家手机号 private String buyerPhone; - - /*** - * 按创建时间排序,,传ASC 或 DESC + * 按创建时间排序,,传 ASC 或 DESC */ private String createTimestampSort; - - - - } diff --git a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvCategoryIndexSortRequest.java b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvCategoryIndexSortRequest.java index 92916a7..98b7f34 100644 --- a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvCategoryIndexSortRequest.java +++ b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvCategoryIndexSortRequest.java @@ -8,11 +8,15 @@ import lombok.Data; public class VvCategoryIndexSortRequest { + /** + * 类目id + */ private Long categoryId; - - + /** + * 排序 + */ private int defaultSort; } diff --git a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvProductRequest.java b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvProductRequest.java index 18bfe27..b1eaa64 100644 --- a/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvProductRequest.java +++ b/api-third/src/main/java/com/heyu/api/alibaba/request/mm/VvProductRequest.java @@ -8,10 +8,10 @@ import java.math.BigDecimal; @Data public class VvProductRequest { - private Integer pageNum; + private Integer pageNum = 1 ; - private Integer pageSize; + private Integer pageSize = 10 ; //商品标题 private String title; @@ -33,12 +33,13 @@ public class VvProductRequest { //创建时间撮 private Long minCreateTimestamp; + // 创建时间最小值 private Long maxCreateTimestamp; - - //修改时间撮 + //修改时间最大撮 private Long minModifyTimestamp; + // 修改时间最小值 private Long maxModifyTimestamp; diff --git a/api-web/api-interface/src/main/java/com/heyu/api/aop/LogAop.java b/api-web/api-interface/src/main/java/com/heyu/api/aop/LogAop.java index f447a9f..d5648fb 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/aop/LogAop.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/aop/LogAop.java @@ -100,6 +100,11 @@ public class LogAop { .append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE) .append("uri:").append(uri); + if(uri.startsWith("/mm/")){ + return point.proceed(); + + } + // 默认对有的接口进行拦截 Boolean intercept = faceAuthMap.get(className); Boolean classMethodConfigNotIntercept = faceAuthMap.get(classNameAndMethodName); diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminController.java index 260b4d6..9053660 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/AdminController.java @@ -11,6 +11,7 @@ import com.heyu.api.data.utils.MD5Utils; import com.heyu.api.data.utils.R; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -29,9 +30,12 @@ public class AdminController { /*** * 列表 + * http://localhost:8888/mm/admin/login + * + * {"username":"admin","password":"admin123"} */ @RequestMapping("/login") - public R list(VVAdminRequest vvAdminRequest) { + public R list(@RequestBody VVAdminRequest vvAdminRequest) { VVAdminDTO vvAdminDTO = new VVAdminDTO(); VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername()); if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) { diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/BuyerController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/BuyerController.java index 861495d..d706615 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/BuyerController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/BuyerController.java @@ -7,16 +7,19 @@ import com.heyu.api.alibaba.request.mm.order.VvBuyerDTO; import com.heyu.api.data.dao.vv.VvBuyerAddressDao; import com.heyu.api.data.dao.vv.VvBuyerDao; import com.heyu.api.data.entity.vv.VvBuyerAddressEntity; +import com.heyu.api.data.entity.vv.VvBuyerEntity; import com.heyu.api.data.utils.R; import com.heyu.api.utils.ISelect; import com.heyu.api.utils.PPageUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -34,10 +37,15 @@ public class BuyerController { /*** * 列表 + * http://localhost:8888/mm/buyer/list + * + * + * + * + * */ @RequestMapping("/list") - public R list(VvBuyerRequest vvProductRequest) { - + public R list(@RequestBody VvBuyerRequest vvProductRequest) { PPageUtils pageUtils = PPageUtils.startPage(vvProductRequest.getPageNum(), vvProductRequest.getPageSize()) .doSelect(new ISelect() { @Override @@ -52,23 +60,43 @@ public class BuyerController { ); } }); - List vvBuyerAddressEntities = pageUtils.getRows(); + + List vvBuyerEntities = pageUtils.getRows(); List buyerIds = new ArrayList<>(); - for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) { - buyerIds.add(vvBuyerAddressEntity.getBuyerId()); + for (VvBuyerEntity buyerEntity : vvBuyerEntities) { + buyerIds.add(buyerEntity.getId()); } - Map> listMap = vvBuyerAddressDao.selectMapByBuyerIds(buyerIds); + List vvBuyerAddressEntities = vvBuyerAddressDao.selectMapByBuyerIds(buyerIds); + + + Map> listMap = new HashMap<>(); + + for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) { + List vvBuyerAddressEntityList = listMap.get(vvBuyerAddressEntity.getBuyerId()); + + if (vvBuyerAddressEntityList == null) { + vvBuyerAddressEntityList = new ArrayList<>(); + } + + vvBuyerAddressEntityList.add(vvBuyerAddressEntity); + + + listMap.put(vvBuyerAddressEntity.getBuyerId(), vvBuyerAddressEntityList); + + + } + List buyerDTOs = new ArrayList<>(); - for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) { + for (VvBuyerEntity vvBuyerAddressEntity : vvBuyerEntities) { VvBuyerDTO vvBuyerDTO = new VvBuyerDTO(); BeanUtils.copyProperties(vvBuyerAddressEntity, vvBuyerDTO); - vvBuyerDTO.setVvBuyerAddressEntityList(listMap.get(vvBuyerAddressEntity.getBuyerId())); + vvBuyerDTO.setVvBuyerAddressEntityList(listMap.get(vvBuyerDTO.getId())); buyerDTOs.add(vvBuyerDTO); diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/CategoryController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/CategoryController.java index a3bb3e2..fb71d71 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/CategoryController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/CategoryController.java @@ -11,6 +11,7 @@ import com.heyu.api.data.utils.R; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -27,9 +28,14 @@ public class CategoryController { /*** * 列表 + * + * + * http://localhost:8888/mm/category/list + * + * */ @RequestMapping("/list") - public R list(VvCategoryRequest vvCategoryRequest) { + public R list(@RequestBody VvCategoryRequest vvCategoryRequest) { List vvCategoryEntities = vvCategoryDao.selectVvCategoryAll(); List list = vvCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId()); List vvCategoryDTOS = new ArrayList<>(); @@ -52,7 +58,7 @@ public class CategoryController { * @return */ @RequestMapping("/insertOrUpdate") - public R insert(VvCategoryEntity vvCategoryEntity) { + public R insert(@RequestBody VvCategoryEntity vvCategoryEntity) { vvCategoryDao.insertOrUpdateVvCategory(vvCategoryEntity); return R.ok().setData("保存成功"); } @@ -61,12 +67,12 @@ public class CategoryController { * 排序 */ @RequestMapping("/sort") - public R sort(VvCategorySortRequest vvCategorySortRequest) { + public R sort(@RequestBody VvCategorySortRequest vvCategorySortRequest) { List list = vvCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getCategoryIds()); List categoryIds = vvCategorySortRequest.getCategoryIds(); for (VvCategoryEntity vvCategoryEntity : list) { int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1; - vvCategoryEntity.setLevel(index); + vvCategoryEntity.setDefaultSort(index); vvCategoryDao.updateVvCategoryById(vvCategoryEntity); } return R.ok().setData("保存成功"); @@ -77,7 +83,7 @@ public class CategoryController { * 排序 */ @RequestMapping("/update/sort/index") - public R updateSortIndex(VvCategoryIndexSortRequest vvCategorySortRequest) { + public R updateSortIndex(@RequestBody VvCategoryIndexSortRequest vvCategorySortRequest) { VvCategoryEntity vvCategory = vvCategoryDao.selectVvCategoryById(vvCategorySortRequest.getCategoryId()); vvCategory.setDefaultSort(vvCategorySortRequest.getDefaultSort()); diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/FrontManagerController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/FrontManagerController.java index ebd65e1..4a73cd3 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/FrontManagerController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/FrontManagerController.java @@ -9,6 +9,7 @@ import com.heyu.api.data.entity.vv.VvProductEntity; import com.heyu.api.data.utils.R; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -26,10 +27,11 @@ public class FrontManagerController { /*** * 列表 + * http://localhost:8888/mm/front/manager/list */ @RequestMapping("/list") - public R list(FrontManagerRequest vvCategoryRequest) { + public R list(@RequestBody FrontManagerRequest vvCategoryRequest) { List vvProductEntityList = vvProductDao.selectVvProductByFrontPage(1); return R.ok().setData(vvProductEntityList); } @@ -38,7 +40,7 @@ public class FrontManagerController { * 排序 */ @RequestMapping("/sort") - public R sort(FrontManagerSortRequest sortRequest) { + public R sort(@RequestBody FrontManagerSortRequest sortRequest) { List list = vvProductDao.selectVvProductByIds(sortRequest.getProductIds()); List categoryIds = sortRequest.getProductIds(); for (VvProductEntity vvProduct : list) { @@ -53,10 +55,14 @@ public class FrontManagerController { * 排序 */ @RequestMapping("/update/sort/index") - public R updateSortIndex(FrontManagerIndexSortRequest frontManagerIndexSortRequest) { + public R updateSortIndex(@RequestBody FrontManagerIndexSortRequest frontManagerIndexSortRequest) { VvProductEntity vvProduct = vvProductDao.selectVvProductById(frontManagerIndexSortRequest.getProductId()); vvProduct.setDefaultSort(frontManagerIndexSortRequest.getDefaultSort()); vvProductDao.updateVvProductById(vvProduct); return R.ok().setData("保存成功"); } + + + + } diff --git a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/ProductController.java b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/ProductController.java index 686e595..4ac3353 100644 --- a/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/ProductController.java +++ b/api-web/api-interface/src/main/java/com/heyu/api/controller/mm/ProductController.java @@ -10,12 +10,12 @@ import com.heyu.api.data.dto.vv.VvProductPropertyDTO; import com.heyu.api.data.dto.vv.VvSkuDTO; import com.heyu.api.data.entity.vv.*; import com.heyu.api.data.utils.R; -import com.heyu.api.data.utils.StringUtils; import com.heyu.api.utils.ISelect; import com.heyu.api.utils.PPageUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -54,15 +54,13 @@ public class ProductController { /*** * 列表 + * http://localhost:8888/mm/product/list + * + * */ @RequestMapping("/list") - public R list(VvProductRequest vvProductRequest) { + public R list(@RequestBody VvProductRequest vvProductRequest) { - if (StringUtils.isNotBlank(vvProductRequest.getRealSaleCountSort()) - && StringUtils.isBlank(vvProductRequest.getCreateTimestampSort()) - && StringUtils.isBlank(vvProductRequest.getModifyTimestampSort())) { - vvProductRequest.setCreateTimestampSort("DESC"); - } PPageUtils pageUtils = PPageUtils.startPage(vvProductRequest.getPageNum(), vvProductRequest.getPageSize()) .doSelect(new ISelect() { @@ -94,7 +92,7 @@ public class ProductController { @RequestMapping("/detail") - public R detail(VvProductDetailRequest vvProductDetailRequest) { + public R detail(@RequestBody VvProductDetailRequest vvProductDetailRequest) { VvProductDTO vvProductDTO = new VvProductDTO(); VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvProductDetailRequest.getProductId()); @@ -106,11 +104,11 @@ public class ProductController { vvProductDTO.setVvProductDetailList(productDetailEntities); List vvSkuEntities = vvSkuDao.selectVvSkuByProductId(vvProductDetailRequest.getProductId()); - List vvSkuDTOS = new ArrayList<>(); + List vvSkuDTOS = new ArrayList<>(); for (VvSkuEntity vvSkuEntity : vvSkuEntities) { VvSkuDTO vvSkuDTO = new VvSkuDTO(); BeanUtils.copyProperties(vvSkuEntity, vvSkuDTO); - List vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId()); + List vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId()); vvSkuDTO.setVvSkuPropertyValueList(vvSkuPropertyValueEntities); vvSkuDTOS.add(vvSkuDTO); } @@ -119,7 +117,7 @@ public class ProductController { List vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(vvProductDetailRequest.getProductId()); - List vvProductPropertyDTOS = new ArrayList<>(); + List vvProductPropertyDTOS = new ArrayList<>(); for (VvProductPropertyEntity vvProductPropertyEntity : vvProductPropertyEntities) { @@ -127,7 +125,7 @@ public class ProductController { BeanUtils.copyProperties(vvProductPropertyEntity, vvProductPropertyDTO); - List productPropertyValues = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(vvProductDetailRequest.getProductId(),vvProductPropertyEntity.getId()); + List productPropertyValues = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(vvProductDetailRequest.getProductId(), vvProductPropertyEntity.getId()); vvProductPropertyDTO.setVvProductPropertyValueList(productPropertyValues); @@ -140,7 +138,7 @@ public class ProductController { @RequestMapping("/insertOrUpadate") - public R insertOrUpadate(VvProductDTO vvProductDTO) { + public R insertOrUpadate(@RequestBody VvProductDTO vvProductDTO) { Long productId = vvProductDTO.getId() == null ? -1L : vvProductDTO.getId(); @@ -152,11 +150,11 @@ public class ProductController { for (VvProductDetailEntity productDetailEntity : productDetailEntities) { boolean flag = true; for (VvProductDetailEntity vvProductDetailEntity : vvProductDTO.getVvProductDetailList()) { - if(productDetailEntity.getId().equals(vvProductDetailEntity.getId())){ + if (productDetailEntity.getId().equals(vvProductDetailEntity.getId())) { flag = false; } } - if(flag){ + if (flag) { vvProductDetailDao.deleteVvProductDetailRealById(productDetailEntity.getId()); } } @@ -185,12 +183,12 @@ public class ProductController { } for (VvSkuDTO vvSkuDTO : vvSkuDTOS) { - Long skuId = vvSkuDTO.getId() ; + Long skuId = vvSkuDTO.getId(); vvSkuDao.insertOrUpdateVvSku(vvSkuDTO); /*** * 插入 */ - if(skuId != null){ + if (skuId != null) { // 更新 List vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList(); List vvSkuPropertyValueDB = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuDTO.getId()); @@ -208,21 +206,21 @@ public class ProductController { } } } - List vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList(); + List vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList(); for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) { vvSkuPropertyValueEntity.setSkuId(vvSkuDTO.getId()); vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity); } } - List vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList(); + List vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList(); List vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(productId); - for (VvProductPropertyEntity vvProductPropertyDb: vvProductPropertyEntities) { + for (VvProductPropertyEntity vvProductPropertyDb : vvProductPropertyEntities) { boolean flag = true; for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) { - if(vvProductPropertyDb.getId().equals(vvProductPropertyDTO.getId())){ - flag = false; + if (vvProductPropertyDb.getId().equals(vvProductPropertyDTO.getId())) { + flag = false; } } if (flag) { @@ -234,9 +232,9 @@ public class ProductController { for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) { Long productPropertyId = vvProductPropertyDTO.getId(); vvProductPropertyDao.insertOrUpdateVvProductProperty(vvProductPropertyDTO); - List vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList(); - if(productPropertyId != null){ - List productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productId,productPropertyId); + List vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList(); + if (productPropertyId != null) { + List productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productId, productPropertyId); for (VvProductPropertyValueEntity vvProductPropertyValueEntity : productPropertyValueDb) { boolean flag = true; for (VvProductPropertyValueEntity productPropertyValueEntity : vvProductPropertyValueEntities) {