抽奖修改

This commit is contained in:
quyixiao 2025-08-24 10:03:35 +08:00
parent 21f3c45111
commit d0c200a2e0
18 changed files with 152 additions and 112 deletions

View File

@ -56,11 +56,11 @@ public class MyBatisBaomidouServiceImpl implements MyBatisBaomidouService {
@Override @Override
public void info(String info) { 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()) { if (log.isDebugEnabled()) {
} }

View File

@ -8,15 +8,13 @@ package com.heyu.api.data.dao.vv;
* @since 2025-08-23 * @since 2025-08-23
*/ */
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.heyu.api.data.entity.vv.VvBuyerAddressEntity; 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.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> { public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
@ -43,8 +41,10 @@ public interface VvBuyerAddressDao extends BaseMapper<VvBuyerAddressEntity> {
List<VvBuyerAddressEntity> selectAppByCondition(IPage page, Long buyerId); 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);
} }

View File

@ -46,5 +46,5 @@ public interface VvBuyerDao extends BaseMapper<VvBuyerEntity> {
@IF @LIKE String buyerWeixin, @IF @LIKE String buyerWeixin,
@IF @GE Long minCreateTimestamp, @IF @GE Long minCreateTimestamp,
@IF @LE Long maxCreateTimestamp, @IF @LE Long maxCreateTimestamp,
@IF String createTimestampSort); @OrderBy @IF @Column(VvBuyerEntity.create_timestamp) String createTimestampSort);
} }

View File

@ -73,6 +73,6 @@ public interface VvProductDao extends BaseMapper<VvProductEntity> {
@IF Integer categoryIdTwo, @IF Integer categoryIdTwo,
@IF Integer categoryIdThree, @IF Integer categoryIdThree,
@IF @OrderBy(VvProductEntity.show_sale_price) String salePriceSort, @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); @IF @OrderBy(VvProductEntity.create_timestamp) String createTimestampSort);
} }

View File

@ -1,16 +1,16 @@
package com.heyu.api.data.entity.vv; package com.heyu.api.data.entity.vv;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import com.lz.mybatis.plugin.annotations.AS;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;import java.util.Date;
/** /**
*商品表 *商品表
* @author quyixiao * @author quyixiao
* @since 2025-08-21 * @since 2025-08-23
*/ */
@Data @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 video_url = CLASS_NAME + "video_url"; // 视频url
public final static String title_ = CLASS_NAME + "title"; // 商品标题 public final static String title_ = CLASS_NAME + "title"; // 商品标题
public final static String show_sale_price = CLASS_NAME + "show_sale_price"; // 销售价格 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 default_sort = CLASS_NAME + "default_sort"; // 默认排序
public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间撮 public final static String create_timestamp = CLASS_NAME + "create_timestamp"; // 创建时间撮
public final static String modify_timestamp = CLASS_NAME + "modify_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 String title;
//销售价格 //销售价格
private BigDecimal showSalePrice; private BigDecimal showSalePrice;
//销售数量,用于展示用 //销售数量
private Integer saleCount; private Integer showSaleCount;
//默认排序 //默认排序
private Integer defaultSort; private Integer defaultSort;
//创建时间撮 //创建时间撮
@ -200,15 +200,15 @@ private static final long serialVersionUID = 1L;
* 销售数量 * 销售数量
* @return * @return
*/ */
public Integer getSaleCount() { public Integer getShowSaleCount() {
return saleCount; return showSaleCount;
} }
/** /**
* 销售数量 * 销售数量
* @param saleCount * @param showSaleCount
*/ */
public void setSaleCount(Integer saleCount) { public void setShowSaleCount(Integer showSaleCount) {
this.saleCount = saleCount; this.showSaleCount = showSaleCount;
} }
/** /**
@ -357,7 +357,7 @@ private static final long serialVersionUID = 1L;
",videoUrl=" + videoUrl + ",videoUrl=" + videoUrl +
",title=" + title + ",title=" + title +
",showSalePrice=" + showSalePrice + ",showSalePrice=" + showSalePrice +
",saleCount=" + saleCount + ",showSaleCount=" + showSaleCount +
",defaultSort=" + defaultSort + ",defaultSort=" + defaultSort +
",createTimestamp=" + createTimestamp + ",createTimestamp=" + createTimestamp +
",modifyTimestamp=" + modifyTimestamp + ",modifyTimestamp=" + modifyTimestamp +

View File

@ -10,7 +10,7 @@ import java.util.Date;import java.util.Date;
/** /**
*sku 与属性的对应关系 *sku 与属性的对应关系
* @author quyixiao * @author quyixiao
* @since 2025-08-22 * @since 2025-08-23
*/ */
@Data @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 create_time = CLASS_NAME + "create_time"; // 创建时间
public final static String modify_time = CLASS_NAME + "modify_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 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 category_id = CLASS_NAME + "category_id"; // 类目id
public final static String property_name = CLASS_NAME + "property_name"; // 属性名称 public final static String property_name = CLASS_NAME + "property_name"; // 属性名称
public final static String category_name = CLASS_NAME + "category_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 defalut_sort = CLASS_NAME + "defalut_sort"; // 默认排序
public final static String product_id = CLASS_NAME + "product_id"; // 商品id
// //
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Long id; private Long id;
@ -42,8 +42,6 @@ private static final long serialVersionUID = 1L;
private Date modifyTime; private Date modifyTime;
//属性id //属性id
private Long propertyId; private Long propertyId;
//skuid
private Long skuId;
//类目id //类目id
private Long categoryId; private Long categoryId;
//属性名称 //属性名称
@ -52,6 +50,8 @@ private static final long serialVersionUID = 1L;
private String categoryName; private String categoryName;
//默认排序 //默认排序
private Integer defalutSort; private Integer defalutSort;
//商品id
private Long productId;
/** /**
* *
* @return * @return
@ -127,21 +127,6 @@ private static final long serialVersionUID = 1L;
this.propertyId = propertyId; this.propertyId = propertyId;
} }
/**
* skuid
* @return
*/
public Long getSkuId() {
return skuId;
}
/**
* skuid
* @param skuId
*/
public void setSkuId(Long skuId) {
this.skuId = skuId;
}
/** /**
* 类目id * 类目id
* @return * @return
@ -202,6 +187,21 @@ private static final long serialVersionUID = 1L;
this.defalutSort = defalutSort; this.defalutSort = defalutSort;
} }
/**
* 商品id
* @return
*/
public Long getProductId() {
return productId;
}
/**
* 商品id
* @param productId
*/
public void setProductId(Long productId) {
this.productId = productId;
}
@Override @Override
public String toString() { public String toString() {
return "VvProductPropertyEntity{" + return "VvProductPropertyEntity{" +
@ -210,11 +210,11 @@ private static final long serialVersionUID = 1L;
",createTime=" + createTime + ",createTime=" + createTime +
",modifyTime=" + modifyTime + ",modifyTime=" + modifyTime +
",propertyId=" + propertyId + ",propertyId=" + propertyId +
",skuId=" + skuId +
",categoryId=" + categoryId + ",categoryId=" + categoryId +
",propertyName=" + propertyName + ",propertyName=" + propertyName +
",categoryName=" + categoryName + ",categoryName=" + categoryName +
",defalutSort=" + defalutSort + ",defalutSort=" + defalutSort +
",productId=" + productId +
"}"; "}";
} }
} }

View File

@ -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> </mapper>

View File

@ -49,7 +49,7 @@ public class MysqlMain_update {
List<TablesBean> list = new ArrayList<TablesBean>(); List<TablesBean> list = new ArrayList<TablesBean>();
String a = "vv_buyer"; String a = "vv_product_property";
for (String s : a.split(",")) { for (String s : a.split(",")) {
list.add(new TablesBean(s)); list.add(new TablesBean(s));
} }

View File

@ -5,8 +5,14 @@ import lombok.Data;
@Data @Data
public class FrontManagerIndexSortRequest { public class FrontManagerIndexSortRequest {
/***
* 商品id
*/
private Long productId; private Long productId;
/**
* 排序位置 -1 ,最前面
*/
private Integer defaultSort; private Integer defaultSort;
} }

View File

@ -6,10 +6,10 @@ import lombok.Data;
@Data @Data
public class VvBuyerRequest { 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; private String buyerPhone;
/*** /***
* 按创建时间排序,ASC DESC * 按创建时间排序, ASC DESC
*/ */
private String createTimestampSort; private String createTimestampSort;
} }

View File

@ -8,11 +8,15 @@ import lombok.Data;
public class VvCategoryIndexSortRequest { public class VvCategoryIndexSortRequest {
/**
* 类目id
*/
private Long categoryId; private Long categoryId;
/**
* 排序
*/
private int defaultSort; private int defaultSort;
} }

View File

@ -8,10 +8,10 @@ import java.math.BigDecimal;
@Data @Data
public class VvProductRequest { public class VvProductRequest {
private Integer pageNum; private Integer pageNum = 1 ;
private Integer pageSize; private Integer pageSize = 10 ;
//商品标题 //商品标题
private String title; private String title;
@ -33,12 +33,13 @@ public class VvProductRequest {
//创建时间撮 //创建时间撮
private Long minCreateTimestamp; private Long minCreateTimestamp;
// 创建时间最小值
private Long maxCreateTimestamp; private Long maxCreateTimestamp;
//修改时间最大撮
//修改时间撮
private Long minModifyTimestamp; private Long minModifyTimestamp;
// 修改时间最小值
private Long maxModifyTimestamp; private Long maxModifyTimestamp;

View File

@ -100,6 +100,11 @@ public class LogAop {
.append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE) .append("class:").append(className).append("#").append(methodName).append(BLANK_SPACE)
.append("uri:").append(uri); .append("uri:").append(uri);
if(uri.startsWith("/mm/")){
return point.proceed();
}
// 默认对有的接口进行拦截 // 默认对有的接口进行拦截
Boolean intercept = faceAuthMap.get(className); Boolean intercept = faceAuthMap.get(className);
Boolean classMethodConfigNotIntercept = faceAuthMap.get(classNameAndMethodName); Boolean classMethodConfigNotIntercept = faceAuthMap.get(classNameAndMethodName);

View File

@ -11,6 +11,7 @@ import com.heyu.api.data.utils.MD5Utils;
import com.heyu.api.data.utils.R; import com.heyu.api.data.utils.R;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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") @RequestMapping("/login")
public R list(VVAdminRequest vvAdminRequest) { public R list(@RequestBody VVAdminRequest vvAdminRequest) {
VVAdminDTO vvAdminDTO = new VVAdminDTO(); VVAdminDTO vvAdminDTO = new VVAdminDTO();
VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername()); VvAdminEntity vvAdminEntity = vvAdminDao.selectVvAdminByUserName(vvAdminRequest.getUsername());
if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) { if (vvAdminEntity.getPassword().equals(vvAdminRequest.getPassword())) {

View File

@ -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.VvBuyerAddressDao;
import com.heyu.api.data.dao.vv.VvBuyerDao; import com.heyu.api.data.dao.vv.VvBuyerDao;
import com.heyu.api.data.entity.vv.VvBuyerAddressEntity; 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.data.utils.R;
import com.heyu.api.utils.ISelect; import com.heyu.api.utils.ISelect;
import com.heyu.api.utils.PPageUtils; import com.heyu.api.utils.PPageUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -34,10 +37,15 @@ public class BuyerController {
/*** /***
* 列表 * 列表
* http://localhost:8888/mm/buyer/list
*
*
*
*
*
*/ */
@RequestMapping("/list") @RequestMapping("/list")
public R list(VvBuyerRequest vvProductRequest) { public R list(@RequestBody VvBuyerRequest vvProductRequest) {
PPageUtils pageUtils = PPageUtils.startPage(vvProductRequest.getPageNum(), vvProductRequest.getPageSize()) PPageUtils pageUtils = PPageUtils.startPage(vvProductRequest.getPageNum(), vvProductRequest.getPageSize())
.doSelect(new ISelect() { .doSelect(new ISelect() {
@Override @Override
@ -52,23 +60,43 @@ public class BuyerController {
); );
} }
}); });
List<VvBuyerAddressEntity> vvBuyerAddressEntities = pageUtils.getRows();
List<VvBuyerEntity> vvBuyerEntities = pageUtils.getRows();
List<Long> buyerIds = new ArrayList<>(); List<Long> buyerIds = new ArrayList<>();
for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) { for (VvBuyerEntity buyerEntity : vvBuyerEntities) {
buyerIds.add(vvBuyerAddressEntity.getBuyerId()); 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<>(); List<VvBuyerDTO> buyerDTOs = new ArrayList<>();
for (VvBuyerAddressEntity vvBuyerAddressEntity : vvBuyerAddressEntities) { for (VvBuyerEntity vvBuyerAddressEntity : vvBuyerEntities) {
VvBuyerDTO vvBuyerDTO = new VvBuyerDTO(); VvBuyerDTO vvBuyerDTO = new VvBuyerDTO();
BeanUtils.copyProperties(vvBuyerAddressEntity, vvBuyerDTO); BeanUtils.copyProperties(vvBuyerAddressEntity, vvBuyerDTO);
vvBuyerDTO.setVvBuyerAddressEntityList(listMap.get(vvBuyerAddressEntity.getBuyerId())); vvBuyerDTO.setVvBuyerAddressEntityList(listMap.get(vvBuyerDTO.getId()));
buyerDTOs.add(vvBuyerDTO); buyerDTOs.add(vvBuyerDTO);

View File

@ -11,6 +11,7 @@ import com.heyu.api.data.utils.R;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -27,9 +28,14 @@ public class CategoryController {
/*** /***
* 列表 * 列表
*
*
* http://localhost:8888/mm/category/list
*
*
*/ */
@RequestMapping("/list") @RequestMapping("/list")
public R list(VvCategoryRequest vvCategoryRequest) { public R list(@RequestBody VvCategoryRequest vvCategoryRequest) {
List<VvCategoryEntity> vvCategoryEntities = vvCategoryDao.selectVvCategoryAll(); List<VvCategoryEntity> vvCategoryEntities = vvCategoryDao.selectVvCategoryAll();
List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId()); List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByParentId(vvCategoryRequest.getParentId());
List<VvCategoryDTO> vvCategoryDTOS = new ArrayList<>(); List<VvCategoryDTO> vvCategoryDTOS = new ArrayList<>();
@ -52,7 +58,7 @@ public class CategoryController {
* @return * @return
*/ */
@RequestMapping("/insertOrUpdate") @RequestMapping("/insertOrUpdate")
public R insert(VvCategoryEntity vvCategoryEntity) { public R insert(@RequestBody VvCategoryEntity vvCategoryEntity) {
vvCategoryDao.insertOrUpdateVvCategory(vvCategoryEntity); vvCategoryDao.insertOrUpdateVvCategory(vvCategoryEntity);
return R.ok().setData("保存成功"); return R.ok().setData("保存成功");
} }
@ -61,12 +67,12 @@ public class CategoryController {
* 排序 * 排序
*/ */
@RequestMapping("/sort") @RequestMapping("/sort")
public R sort(VvCategorySortRequest vvCategorySortRequest) { public R sort(@RequestBody VvCategorySortRequest vvCategorySortRequest) {
List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getCategoryIds()); List<VvCategoryEntity> list = vvCategoryDao.selectVvCategoryByIds(vvCategorySortRequest.getCategoryIds());
List<Long> categoryIds = vvCategorySortRequest.getCategoryIds(); List<Long> categoryIds = vvCategorySortRequest.getCategoryIds();
for (VvCategoryEntity vvCategoryEntity : list) { for (VvCategoryEntity vvCategoryEntity : list) {
int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1; int index = categoryIds.indexOf(vvCategoryEntity.getId()) + 1;
vvCategoryEntity.setLevel(index); vvCategoryEntity.setDefaultSort(index);
vvCategoryDao.updateVvCategoryById(vvCategoryEntity); vvCategoryDao.updateVvCategoryById(vvCategoryEntity);
} }
return R.ok().setData("保存成功"); return R.ok().setData("保存成功");
@ -77,7 +83,7 @@ public class CategoryController {
* 排序 * 排序
*/ */
@RequestMapping("/update/sort/index") @RequestMapping("/update/sort/index")
public R updateSortIndex(VvCategoryIndexSortRequest vvCategorySortRequest) { public R updateSortIndex(@RequestBody VvCategoryIndexSortRequest vvCategorySortRequest) {
VvCategoryEntity vvCategory = vvCategoryDao.selectVvCategoryById(vvCategorySortRequest.getCategoryId()); VvCategoryEntity vvCategory = vvCategoryDao.selectVvCategoryById(vvCategorySortRequest.getCategoryId());
vvCategory.setDefaultSort(vvCategorySortRequest.getDefaultSort()); vvCategory.setDefaultSort(vvCategorySortRequest.getDefaultSort());

View File

@ -9,6 +9,7 @@ import com.heyu.api.data.entity.vv.VvProductEntity;
import com.heyu.api.data.utils.R; import com.heyu.api.data.utils.R;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -26,10 +27,11 @@ public class FrontManagerController {
/*** /***
* 列表 * 列表
* http://localhost:8888/mm/front/manager/list
*/ */
@RequestMapping("/list") @RequestMapping("/list")
public R list(FrontManagerRequest vvCategoryRequest) { public R list(@RequestBody FrontManagerRequest vvCategoryRequest) {
List<VvProductEntity> vvProductEntityList = vvProductDao.selectVvProductByFrontPage(1); List<VvProductEntity> vvProductEntityList = vvProductDao.selectVvProductByFrontPage(1);
return R.ok().setData(vvProductEntityList); return R.ok().setData(vvProductEntityList);
} }
@ -38,7 +40,7 @@ public class FrontManagerController {
* 排序 * 排序
*/ */
@RequestMapping("/sort") @RequestMapping("/sort")
public R sort(FrontManagerSortRequest sortRequest) { public R sort(@RequestBody FrontManagerSortRequest sortRequest) {
List<VvProductEntity> list = vvProductDao.selectVvProductByIds(sortRequest.getProductIds()); List<VvProductEntity> list = vvProductDao.selectVvProductByIds(sortRequest.getProductIds());
List<Long> categoryIds = sortRequest.getProductIds(); List<Long> categoryIds = sortRequest.getProductIds();
for (VvProductEntity vvProduct : list) { for (VvProductEntity vvProduct : list) {
@ -53,10 +55,14 @@ public class FrontManagerController {
* 排序 * 排序
*/ */
@RequestMapping("/update/sort/index") @RequestMapping("/update/sort/index")
public R updateSortIndex(FrontManagerIndexSortRequest frontManagerIndexSortRequest) { public R updateSortIndex(@RequestBody FrontManagerIndexSortRequest frontManagerIndexSortRequest) {
VvProductEntity vvProduct = vvProductDao.selectVvProductById(frontManagerIndexSortRequest.getProductId()); VvProductEntity vvProduct = vvProductDao.selectVvProductById(frontManagerIndexSortRequest.getProductId());
vvProduct.setDefaultSort(frontManagerIndexSortRequest.getDefaultSort()); vvProduct.setDefaultSort(frontManagerIndexSortRequest.getDefaultSort());
vvProductDao.updateVvProductById(vvProduct); vvProductDao.updateVvProductById(vvProduct);
return R.ok().setData("保存成功"); return R.ok().setData("保存成功");
} }
} }

View File

@ -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.dto.vv.VvSkuDTO;
import com.heyu.api.data.entity.vv.*; import com.heyu.api.data.entity.vv.*;
import com.heyu.api.data.utils.R; 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.ISelect;
import com.heyu.api.utils.PPageUtils; import com.heyu.api.utils.PPageUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -54,15 +54,13 @@ public class ProductController {
/*** /***
* 列表 * 列表
* http://localhost:8888/mm/product/list
*
*
*/ */
@RequestMapping("/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()) PPageUtils pageUtils = PPageUtils.startPage(vvProductRequest.getPageNum(), vvProductRequest.getPageSize())
.doSelect(new ISelect() { .doSelect(new ISelect() {
@ -94,7 +92,7 @@ public class ProductController {
@RequestMapping("/detail") @RequestMapping("/detail")
public R detail(VvProductDetailRequest vvProductDetailRequest) { public R detail(@RequestBody VvProductDetailRequest vvProductDetailRequest) {
VvProductDTO vvProductDTO = new VvProductDTO(); VvProductDTO vvProductDTO = new VvProductDTO();
VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvProductDetailRequest.getProductId()); VvProductEntity vvProduct = vvProductDao.selectVvProductById(vvProductDetailRequest.getProductId());
@ -106,11 +104,11 @@ public class ProductController {
vvProductDTO.setVvProductDetailList(productDetailEntities); vvProductDTO.setVvProductDetailList(productDetailEntities);
List<VvSkuEntity> vvSkuEntities = vvSkuDao.selectVvSkuByProductId(vvProductDetailRequest.getProductId()); List<VvSkuEntity> vvSkuEntities = vvSkuDao.selectVvSkuByProductId(vvProductDetailRequest.getProductId());
List<VvSkuDTO> vvSkuDTOS = new ArrayList<>(); List<VvSkuDTO> vvSkuDTOS = new ArrayList<>();
for (VvSkuEntity vvSkuEntity : vvSkuEntities) { for (VvSkuEntity vvSkuEntity : vvSkuEntities) {
VvSkuDTO vvSkuDTO = new VvSkuDTO(); VvSkuDTO vvSkuDTO = new VvSkuDTO();
BeanUtils.copyProperties(vvSkuEntity, vvSkuDTO); BeanUtils.copyProperties(vvSkuEntity, vvSkuDTO);
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId()); List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuEntity.getId());
vvSkuDTO.setVvSkuPropertyValueList(vvSkuPropertyValueEntities); vvSkuDTO.setVvSkuPropertyValueList(vvSkuPropertyValueEntities);
vvSkuDTOS.add(vvSkuDTO); vvSkuDTOS.add(vvSkuDTO);
} }
@ -119,7 +117,7 @@ public class ProductController {
List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(vvProductDetailRequest.getProductId()); List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(vvProductDetailRequest.getProductId());
List<VvProductPropertyDTO> vvProductPropertyDTOS = new ArrayList<>(); List<VvProductPropertyDTO> vvProductPropertyDTOS = new ArrayList<>();
for (VvProductPropertyEntity vvProductPropertyEntity : vvProductPropertyEntities) { for (VvProductPropertyEntity vvProductPropertyEntity : vvProductPropertyEntities) {
@ -127,7 +125,7 @@ public class ProductController {
BeanUtils.copyProperties(vvProductPropertyEntity, vvProductPropertyDTO); 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); vvProductPropertyDTO.setVvProductPropertyValueList(productPropertyValues);
@ -140,7 +138,7 @@ public class ProductController {
@RequestMapping("/insertOrUpadate") @RequestMapping("/insertOrUpadate")
public R insertOrUpadate(VvProductDTO vvProductDTO) { public R insertOrUpadate(@RequestBody VvProductDTO vvProductDTO) {
Long productId = vvProductDTO.getId() == null ? -1L : vvProductDTO.getId(); Long productId = vvProductDTO.getId() == null ? -1L : vvProductDTO.getId();
@ -152,11 +150,11 @@ public class ProductController {
for (VvProductDetailEntity productDetailEntity : productDetailEntities) { for (VvProductDetailEntity productDetailEntity : productDetailEntities) {
boolean flag = true; boolean flag = true;
for (VvProductDetailEntity vvProductDetailEntity : vvProductDTO.getVvProductDetailList()) { for (VvProductDetailEntity vvProductDetailEntity : vvProductDTO.getVvProductDetailList()) {
if(productDetailEntity.getId().equals(vvProductDetailEntity.getId())){ if (productDetailEntity.getId().equals(vvProductDetailEntity.getId())) {
flag = false; flag = false;
} }
} }
if(flag){ if (flag) {
vvProductDetailDao.deleteVvProductDetailRealById(productDetailEntity.getId()); vvProductDetailDao.deleteVvProductDetailRealById(productDetailEntity.getId());
} }
} }
@ -185,12 +183,12 @@ public class ProductController {
} }
for (VvSkuDTO vvSkuDTO : vvSkuDTOS) { for (VvSkuDTO vvSkuDTO : vvSkuDTOS) {
Long skuId = vvSkuDTO.getId() ; Long skuId = vvSkuDTO.getId();
vvSkuDao.insertOrUpdateVvSku(vvSkuDTO); vvSkuDao.insertOrUpdateVvSku(vvSkuDTO);
/*** /***
* 插入 * 插入
*/ */
if(skuId != null){ if (skuId != null) {
// 更新 // 更新
List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList(); List<VvSkuPropertyValueEntity> vvSkuPropertyValueEntities = vvSkuDTO.getVvSkuPropertyValueList();
List<VvSkuPropertyValueEntity> vvSkuPropertyValueDB = vvSkuPropertyValueDao.selectVvSkuPropertyValueBySkuId(vvSkuDTO.getId()); 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) { for (VvSkuPropertyValueEntity vvSkuPropertyValueEntity : vvSkuPropertyValueEntities) {
vvSkuPropertyValueEntity.setSkuId(vvSkuDTO.getId()); vvSkuPropertyValueEntity.setSkuId(vvSkuDTO.getId());
vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity); vvSkuPropertyValueDao.insertOrUpdateVvSkuPropertyValue(vvSkuPropertyValueEntity);
} }
} }
List<VvProductPropertyDTO> vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList(); List<VvProductPropertyDTO> vvProductPropertyDTOS = vvProductDTO.getVvProductPropertyList();
List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(productId); List<VvProductPropertyEntity> vvProductPropertyEntities = vvProductPropertyDao.selectVvProductPropertyByProductId(productId);
for (VvProductPropertyEntity vvProductPropertyDb: vvProductPropertyEntities) { for (VvProductPropertyEntity vvProductPropertyDb : vvProductPropertyEntities) {
boolean flag = true; boolean flag = true;
for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) { for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) {
if(vvProductPropertyDb.getId().equals(vvProductPropertyDTO.getId())){ if (vvProductPropertyDb.getId().equals(vvProductPropertyDTO.getId())) {
flag = false; flag = false;
} }
} }
if (flag) { if (flag) {
@ -234,9 +232,9 @@ public class ProductController {
for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) { for (VvProductPropertyDTO vvProductPropertyDTO : vvProductPropertyDTOS) {
Long productPropertyId = vvProductPropertyDTO.getId(); Long productPropertyId = vvProductPropertyDTO.getId();
vvProductPropertyDao.insertOrUpdateVvProductProperty(vvProductPropertyDTO); vvProductPropertyDao.insertOrUpdateVvProductProperty(vvProductPropertyDTO);
List<VvProductPropertyValueEntity> vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList(); List<VvProductPropertyValueEntity> vvProductPropertyValueEntities = vvProductPropertyDTO.getVvProductPropertyValueList();
if(productPropertyId != null){ if (productPropertyId != null) {
List<VvProductPropertyValueEntity> productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productId,productPropertyId); List<VvProductPropertyValueEntity> productPropertyValueDb = vvProductPropertyValueDao.selectVvProductPropertyValueByProductIdPropertyId(productId, productPropertyId);
for (VvProductPropertyValueEntity vvProductPropertyValueEntity : productPropertyValueDb) { for (VvProductPropertyValueEntity vvProductPropertyValueEntity : productPropertyValueDb) {
boolean flag = true; boolean flag = true;
for (VvProductPropertyValueEntity productPropertyValueEntity : vvProductPropertyValueEntities) { for (VvProductPropertyValueEntity productPropertyValueEntity : vvProductPropertyValueEntities) {