抽奖修改
This commit is contained in:
parent
21f3c45111
commit
d0c200a2e0
@ -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()) {
|
||||
|
||||
}
|
||||
|
||||
@ -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<VvBuyerAddressEntity> {
|
||||
@ -43,8 +41,10 @@ public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
|
||||
List<VvBuyerAddressEntity> selectAppByCondition(IPage page, Long buyerId);
|
||||
|
||||
|
||||
@Bean2Map(key = VvBuyerAddressEntity.buyer_id)
|
||||
Map<Long, List<VvBuyerAddressEntity>> selectMapByBuyerIds(List<Long> buyerIds);
|
||||
|
||||
|
||||
|
||||
List<VvBuyerAddressEntity> selectMapByBuyerIds(List<Long> buyerId);
|
||||
|
||||
|
||||
}
|
||||
@ -46,5 +46,5 @@ public interface VvBuyerDao extends BaseMapper<VvBuyerEntity> {
|
||||
@IF @LIKE String buyerWeixin,
|
||||
@IF @GE Long minCreateTimestamp,
|
||||
@IF @LE Long maxCreateTimestamp,
|
||||
@IF String createTimestampSort);
|
||||
@OrderBy @IF @Column(VvBuyerEntity.create_timestamp) String createTimestampSort);
|
||||
}
|
||||
@ -73,6 +73,6 @@ public interface VvProductDao extends BaseMapper<VvProductEntity> {
|
||||
@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);
|
||||
}
|
||||
@ -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 +
|
||||
|
||||
@ -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 +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -8,17 +8,5 @@
|
||||
|
||||
|
||||
|
||||
<trim prefix="set" suffixOverrides="," prefixOverrides="," >
|
||||
<if test="isDelete != null">is_delete = #{isDelete},</if>
|
||||
<if test="gmtCreate != null">gmt_create = #{gmtCreate},</if>
|
||||
<if test="uid != null">uid = #{uid},</if>
|
||||
<if test="appId != null">app_id = #{appId},</if>
|
||||
<if test="orderId != null">order_id = #{orderId},</if>
|
||||
<if test="registerPhone != null">register_phone = #{registerPhone},</if>
|
||||
<if test="content != null">content = #{content}</if>
|
||||
</trim>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ public class MysqlMain_update {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
String a = "vv_buyer";
|
||||
String a = "vv_product_property";
|
||||
for (String s : a.split(",")) {
|
||||
list.add(new TablesBean(s));
|
||||
}
|
||||
|
||||
@ -5,8 +5,14 @@ import lombok.Data;
|
||||
@Data
|
||||
public class FrontManagerIndexSortRequest {
|
||||
|
||||
/***
|
||||
* 商品id
|
||||
*/
|
||||
private Long productId;
|
||||
|
||||
|
||||
/**
|
||||
* 排序位置 -1 ,最前面
|
||||
*/
|
||||
private Integer defaultSort;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -8,11 +8,15 @@ import lombok.Data;
|
||||
public class VvCategoryIndexSortRequest {
|
||||
|
||||
|
||||
/**
|
||||
* 类目id
|
||||
*/
|
||||
private Long categoryId;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private int defaultSort;
|
||||
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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())) {
|
||||
|
||||
@ -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<VvBuyerAddressEntity> vvBuyerAddressEntities = pageUtils.getRows();
|
||||
|
||||
List<VvBuyerEntity> vvBuyerEntities = pageUtils.getRows();
|
||||
|
||||
List<Long> buyerIds = new ArrayList<>();
|
||||
|
||||
for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) {
|
||||
buyerIds.add(vvBuyerAddressEntity.getBuyerId());
|
||||
for (VvBuyerEntity buyerEntity : vvBuyerEntities) {
|
||||
buyerIds.add(buyerEntity.getId());
|
||||
}
|
||||
|
||||
|
||||
Map<Long, List<VvBuyerAddressEntity>> listMap = vvBuyerAddressDao.selectMapByBuyerIds(buyerIds);
|
||||
List<VvBuyerAddressEntity> vvBuyerAddressEntities = vvBuyerAddressDao.selectMapByBuyerIds(buyerIds);
|
||||
|
||||
|
||||
Map<Long, List<VvBuyerAddressEntity>> listMap = new HashMap<>();
|
||||
|
||||
for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) {
|
||||
List<VvBuyerAddressEntity> vvBuyerAddressEntityList = listMap.get(vvBuyerAddressEntity.getBuyerId());
|
||||
|
||||
if (vvBuyerAddressEntityList == null) {
|
||||
vvBuyerAddressEntityList = new ArrayList<>();
|
||||
}
|
||||
|
||||
vvBuyerAddressEntityList.add(vvBuyerAddressEntity);
|
||||
|
||||
|
||||
listMap.put(vvBuyerAddressEntity.getBuyerId(), vvBuyerAddressEntityList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
List<VvBuyerDTO> 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);
|
||||
|
||||
@ -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<VvCategoryEntity> vvCategoryEntities = vvCategoryDao.selectVvCategoryAll();
|
||||
List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId());
|
||||
List<VvCategoryDTO> 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<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getCategoryIds());
|
||||
List<Long> 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());
|
||||
|
||||
@ -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<VvProductEntity> 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<VvProductEntity> list = vvProductDao.selectVvProductByIds(sortRequest.getProductIds());
|
||||
List<Long> 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("保存成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -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<VvSkuEntity> vvSkuEntities = vvSkuDao.selectVvSkuByProductId(vvProductDetailRequest.getProductId());
|
||||
List<VvSkuDTO> vvSkuDTOS = new ArrayList<>();
|
||||
List<VvSkuDTO> vvSkuDTOS = new ArrayList<>();
|
||||
for (VvSkuEntity vvSkuEntity : vvSkuEntities) {
|
||||
VvSkuDTO vvSkuDTO = new VvSkuDTO();
|
||||
BeanUtils.copyProperties(vvSkuEntity, vvSkuDTO);
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId());
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId());
|
||||
vvSkuDTO.setVvSkuPropertyValueList(vvSkuPropertyValueEntities);
|
||||
vvSkuDTOS.add(vvSkuDTO);
|
||||
}
|
||||
@ -119,7 +117,7 @@ public class ProductController {
|
||||
|
||||
List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(vvProductDetailRequest.getProductId());
|
||||
|
||||
List<VvProductPropertyDTO> vvProductPropertyDTOS = new ArrayList<>();
|
||||
List<VvProductPropertyDTO> vvProductPropertyDTOS = new ArrayList<>();
|
||||
|
||||
for (VvProductPropertyEntity vvProductPropertyEntity : vvProductPropertyEntities) {
|
||||
|
||||
@ -127,7 +125,7 @@ public class ProductController {
|
||||
|
||||
BeanUtils.copyProperties(vvProductPropertyEntity, vvProductPropertyDTO);
|
||||
|
||||
List<VvProductPropertyValueEntity> productPropertyValues = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(vvProductDetailRequest.getProductId(),vvProductPropertyEntity.getId());
|
||||
List<VvProductPropertyValueEntity> 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<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueDB = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuDTO.getId());
|
||||
@ -208,21 +206,21 @@ public class ProductController {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
|
||||
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
|
||||
for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
|
||||
vvSkuPropertyValueEntity.setSkuId(vvSkuDTO.getId());
|
||||
vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity);
|
||||
}
|
||||
}
|
||||
|
||||
List<VvProductPropertyDTO> vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList();
|
||||
List<VvProductPropertyDTO> vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList();
|
||||
List<VvProductPropertyEntity> 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<VvProductPropertyValueEntity> vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList();
|
||||
if(productPropertyId != null){
|
||||
List<VvProductPropertyValueEntity> productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productId,productPropertyId);
|
||||
List<VvProductPropertyValueEntity> vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList();
|
||||
if (productPropertyId != null) {
|
||||
List<VvProductPropertyValueEntity> productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productId, productPropertyId);
|
||||
for (VvProductPropertyValueEntity vvProductPropertyValueEntity : productPropertyValueDb) {
|
||||
boolean flag = true;
|
||||
for (VvProductPropertyValueEntity productPropertyValueEntity : vvProductPropertyValueEntities) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user