提交修改
This commit is contained in:
parent
22c79d1e65
commit
15914f5f30
@ -1,46 +1,64 @@
|
||||
package com.heyu.api.data.dao.vv;
|
||||
/**
|
||||
* <p>
|
||||
* 商品表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
* <p>
|
||||
* 商品表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author quyixiao
|
||||
* @since 2025-08-20
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.data.entity.vv.VvProductEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.lz.mybatis.plugin.annotations.IN;
|
||||
import com.lz.mybatis.plugin.annotations.OrderBy;
|
||||
import com.lz.mybatis.plugin.annotations.*;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface VvProductDao extends BaseMapper<VvProductEntity> {
|
||||
|
||||
|
||||
VvProductEntity selectVvProductById(@Param("id")Long id);
|
||||
VvProductEntity selectVvProductById(@Param("id") Long id);
|
||||
|
||||
|
||||
Long insertVvProduct(VvProductEntity vvProduct);
|
||||
Long insertVvProduct(VvProductEntity vvProduct);
|
||||
|
||||
|
||||
Long insertOrUpdateVvProduct(VvProductEntity vvProduct);
|
||||
Long insertOrUpdateVvProduct(VvProductEntity vvProduct);
|
||||
|
||||
|
||||
int updateVvProductById(VvProductEntity vvProduct);
|
||||
int updateVvProductById(VvProductEntity vvProduct);
|
||||
|
||||
|
||||
int updateCoverVvProductById(VvProductEntity vvProduct);
|
||||
int updateCoverVvProductById(VvProductEntity vvProduct);
|
||||
|
||||
|
||||
int deleteVvProductById(@Param("id")Long id);
|
||||
int deleteVvProductById(@Param("id") Long id);
|
||||
|
||||
@OrderBy(VvProductEntity.default_sort)
|
||||
List<VvProductEntity> selectVvProductByFrontPage(Integer frontPage);
|
||||
@OrderBy(VvProductEntity.default_sort)
|
||||
List<VvProductEntity> selectVvProductByFrontPage(Integer frontPage);
|
||||
|
||||
|
||||
List<VvProductEntity> selectVvProductByIds(@IN List<Long> id);
|
||||
|
||||
List<VvProductEntity> selectVvProductByIds(@IN List<Long> id);
|
||||
List<VvProductEntity> selectVvProductByCondition(IPage page,
|
||||
@IF @LIKE String title,
|
||||
@IF @Column(VvProductEntity.show_sale_price) @GE BigDecimal minShowSalePrice,
|
||||
@IF @Column(VvProductEntity.show_sale_price) @LE BigDecimal maxShowSalePrice,
|
||||
@IF @Column(VvProductEntity.real_sale_count) @GE Integer minRealSaleCount,
|
||||
@IF @Column(VvProductEntity.real_sale_count) @LE Integer maxRealSaleCount,
|
||||
@IF @Column(VvProductEntity.create_timestamp) @GE Long minCreateTimestamp,
|
||||
@IF @Column(VvProductEntity.create_timestamp) @LE Long maxCreateTimestamp,
|
||||
@IF @Column(VvProductEntity.modify_timestamp) @GE Long minModifyTimestamp,
|
||||
@IF @Column(VvProductEntity.modify_timestamp) @LE Long maxModifyTimestamp,
|
||||
@IF Integer frontPage,
|
||||
@IF String status,
|
||||
@IF @OrderBy(VvProductEntity.real_sale_count) String saleCount,
|
||||
@IF @OrderBy(VvProductEntity.create_timestamp) String createTimestamp,
|
||||
@IF @OrderBy(VvProductEntity.modify_timestamp) String modifyTimestamp
|
||||
);
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.heyu.api.data.dto.vv;
|
||||
|
||||
import com.heyu.api.data.entity.vv.VvPropertyEntity;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class VvProductDTO extends VvPropertyEntity {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -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-20
|
||||
* @since 2025-08-21
|
||||
*/
|
||||
|
||||
@Data
|
||||
@ -37,6 +37,8 @@ private static final long serialVersionUID = 1L;
|
||||
public final static String category_id_two = CLASS_NAME + "category_id_two"; // 二级类目
|
||||
public final static String category_id_three = CLASS_NAME + "category_id_three"; // 三级类目
|
||||
public final static String front_page = CLASS_NAME + "front_page"; // 是否是首页
|
||||
public final static String status_ = CLASS_NAME + "status"; // delete 删除,down 下架,online 在线,draft 草稿
|
||||
public final static String real_sale_count = CLASS_NAME + "real_sale_count"; // 真实销售量
|
||||
//
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
@ -59,9 +61,9 @@ private static final long serialVersionUID = 1L;
|
||||
//默认排序
|
||||
private Integer defaultSort;
|
||||
//创建时间撮
|
||||
private Integer createTimestamp;
|
||||
private Long createTimestamp;
|
||||
//修改时间撮
|
||||
private Integer modifyTimestamp;
|
||||
private Long modifyTimestamp;
|
||||
//一级类目id
|
||||
private Integer categoryIdOne;
|
||||
//二级类目
|
||||
@ -70,6 +72,10 @@ private static final long serialVersionUID = 1L;
|
||||
private Integer categoryIdThree;
|
||||
//是否是首页
|
||||
private Integer frontPage;
|
||||
//delete 删除,down 下架,online 在线,draft 草稿
|
||||
private String status;
|
||||
//真实销售量
|
||||
private Integer realSaleCount;
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
@ -224,14 +230,14 @@ private static final long serialVersionUID = 1L;
|
||||
* 创建时间撮
|
||||
* @return
|
||||
*/
|
||||
public Integer getCreateTimestamp() {
|
||||
public Long getCreateTimestamp() {
|
||||
return createTimestamp;
|
||||
}
|
||||
/**
|
||||
* 创建时间撮
|
||||
* @param createTimestamp
|
||||
*/
|
||||
public void setCreateTimestamp(Integer createTimestamp) {
|
||||
public void setCreateTimestamp(Long createTimestamp) {
|
||||
this.createTimestamp = createTimestamp;
|
||||
}
|
||||
|
||||
@ -239,14 +245,14 @@ private static final long serialVersionUID = 1L;
|
||||
* 修改时间撮
|
||||
* @return
|
||||
*/
|
||||
public Integer getModifyTimestamp() {
|
||||
public Long getModifyTimestamp() {
|
||||
return modifyTimestamp;
|
||||
}
|
||||
/**
|
||||
* 修改时间撮
|
||||
* @param modifyTimestamp
|
||||
*/
|
||||
public void setModifyTimestamp(Integer modifyTimestamp) {
|
||||
public void setModifyTimestamp(Long modifyTimestamp) {
|
||||
this.modifyTimestamp = modifyTimestamp;
|
||||
}
|
||||
|
||||
@ -310,6 +316,36 @@ private static final long serialVersionUID = 1L;
|
||||
this.frontPage = frontPage;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete 删除,down 下架,online 在线,draft 草稿
|
||||
* @return
|
||||
*/
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
/**
|
||||
* delete 删除,down 下架,online 在线,draft 草稿
|
||||
* @param status
|
||||
*/
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
/**
|
||||
* 真实销售量
|
||||
* @return
|
||||
*/
|
||||
public Integer getRealSaleCount() {
|
||||
return realSaleCount;
|
||||
}
|
||||
/**
|
||||
* 真实销售量
|
||||
* @param realSaleCount
|
||||
*/
|
||||
public void setRealSaleCount(Integer realSaleCount) {
|
||||
this.realSaleCount = realSaleCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VvProductEntity{" +
|
||||
@ -329,6 +365,8 @@ private static final long serialVersionUID = 1L;
|
||||
",categoryIdTwo=" + categoryIdTwo +
|
||||
",categoryIdThree=" + categoryIdThree +
|
||||
",frontPage=" + frontPage +
|
||||
",status=" + status +
|
||||
",realSaleCount=" + realSaleCount +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@ -49,7 +49,7 @@ public class MysqlMain_update {
|
||||
List<TablesBean> list = new ArrayList<TablesBean>();
|
||||
|
||||
|
||||
String a = "vv_property,vv_property_value";
|
||||
String a = "vv_product";
|
||||
for (String s : a.split(",")) {
|
||||
list.add(new TablesBean(s));
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.test.xxx.mysql;
|
||||
|
||||
import com.heyu.api.data.dao.api.ApiPostCodeDao;
|
||||
import com.heyu.api.data.dao.vv.VvProductDao;
|
||||
import com.lz.mybatis.plugin.utils.TestParseUtils;
|
||||
import com.lz.mybatis.plugin.utils.t.Tuple2;
|
||||
import org.junit.Test;
|
||||
@ -12,7 +12,7 @@ SqlParseUtilsTest {
|
||||
public void test1() {
|
||||
|
||||
|
||||
Tuple2<Boolean, String> tuple = TestParseUtils.testSql(ApiPostCodeDao::insertApiPostCode).getData();
|
||||
Tuple2<Boolean, String> tuple = TestParseUtils.testSql(VvProductDao::selectVvProductByCondition).getData();
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,64 @@
|
||||
package com.heyu.api.alibaba.request.mm;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class VvProductRequest {
|
||||
|
||||
private Integer pageNum;
|
||||
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
//商品标题
|
||||
private String title;
|
||||
|
||||
|
||||
//销售价格
|
||||
private BigDecimal minShowSalePrice;
|
||||
|
||||
|
||||
//销售价格
|
||||
private BigDecimal maxShowSalePrice;
|
||||
|
||||
|
||||
// 真实销售数量
|
||||
private Integer minRealSaleCount;
|
||||
//真实销售数量
|
||||
private Integer maxRealSaleCount;
|
||||
|
||||
|
||||
//创建时间撮
|
||||
private Long minCreateTimestamp;
|
||||
private Long maxCreateTimestamp;
|
||||
|
||||
|
||||
//修改时间撮
|
||||
private Long minModifyTimestamp;
|
||||
|
||||
private Long maxModifyTimestamp;
|
||||
|
||||
|
||||
//是否是首页
|
||||
private Integer frontPage;
|
||||
|
||||
|
||||
//delete 删除,down 下架,online 在线,draft 草稿
|
||||
private String status;
|
||||
|
||||
// 按真实销量排序,传ASC 或 DESC
|
||||
private String realSaleCountSort;
|
||||
/***
|
||||
* 按创建时间排序,,传ASC 或 DESC
|
||||
*/
|
||||
private String createTimestampSort;
|
||||
|
||||
/***
|
||||
* 按修改时间排序,传ASC 或 DESC
|
||||
*/
|
||||
private String modifyTimestampSort;
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.heyu.api.controller.mm;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.heyu.api.alibaba.request.mm.VvProductRequest;
|
||||
import com.heyu.api.data.dao.vv.VvProductDao;
|
||||
import com.heyu.api.data.entity.vv.VvPropertyEntity;
|
||||
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.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mm/product")
|
||||
public class ProductController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private VvProductDao vvProductDao;
|
||||
|
||||
|
||||
/***
|
||||
* 列表
|
||||
*/
|
||||
@RequestMapping("/list")
|
||||
public R list(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() {
|
||||
@Override
|
||||
public List doSelect(IPage page) {
|
||||
return vvProductDao.selectVvProductByCondition(page,
|
||||
vvProductRequest.getTitle(),
|
||||
vvProductRequest.getMinShowSalePrice(),
|
||||
vvProductRequest.getMaxShowSalePrice(),
|
||||
vvProductRequest.getMinRealSaleCount(),
|
||||
vvProductRequest.getMaxRealSaleCount(),
|
||||
vvProductRequest.getMinCreateTimestamp(),
|
||||
vvProductRequest.getMaxCreateTimestamp(),
|
||||
vvProductRequest.getMinModifyTimestamp(),
|
||||
vvProductRequest.getMaxModifyTimestamp(),
|
||||
vvProductRequest.getFrontPage(),
|
||||
vvProductRequest.getStatus(),
|
||||
vvProductRequest.getRealSaleCountSort(),
|
||||
vvProductRequest.getCreateTimestampSort(),
|
||||
vvProductRequest.getModifyTimestampSort()
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
List<VvPropertyEntity> vvPropertyEntities = pageUtils.getRows();
|
||||
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user