商品查询参数新增 是否付费会员
This commit is contained in:
parent
88ac93c477
commit
95ae012aab
@ -51,8 +51,12 @@ public class ProductSpuPageReqVO extends PageParam {
|
||||
@Schema(description = "商品分类编号", example = "1")
|
||||
private Long categoryId;
|
||||
|
||||
@Schema(description = "是否是付费会员", example = "1")
|
||||
private Integer isPaidMember;
|
||||
|
||||
@Schema(description = "创建时间", example = "[2022-07-01 00:00:00, 2022-07-01 23:59:59]")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,9 @@ public class AppProductSpuPageReqVO extends PageParam {
|
||||
@Schema(description = "排序方式", example = "true")
|
||||
private Boolean sortAsc;
|
||||
|
||||
@Schema(description = "是否是付费会员", example = "1")
|
||||
private Integer isPaidMember;
|
||||
|
||||
@AssertTrue(message = "排序字段不合法")
|
||||
@JsonIgnore
|
||||
public boolean isSortFieldValid() {
|
||||
|
@ -23,4 +23,6 @@ public class AppProductSpuRecommendPageReqVo extends PageParam {
|
||||
private Integer recommendNew;
|
||||
@Schema(description = "优品推荐", example = "1")
|
||||
private Integer recommendGood;
|
||||
@Schema(description = "是否是付费会员", example = "1")
|
||||
private Integer isPaidMember;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
|
||||
.eqIfPresent(ProductSpuDO::getCategoryId, reqVO.getCategoryId())
|
||||
.betweenIfPresent(ProductSpuDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(ProductSpuDO::getSort)
|
||||
.eqIfPresent(ProductSpuDO::getOnlyPaidMemberView, reqVO.getIsPaidMember())
|
||||
.orderByDesc(ProductSpuDO::getId);
|
||||
appendTabQuery(tabType, queryWrapper);
|
||||
return selectPage(reqVO, queryWrapper);
|
||||
@ -61,7 +62,9 @@ public interface ProductSpuMapper extends BaseMapperX<ProductSpuDO> {
|
||||
.inIfPresent(ProductSpuDO::getCategoryId, categoryIds);
|
||||
// 上架状态 且有库存
|
||||
query.eq(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus());
|
||||
|
||||
if (pageReqVO.getIsPaidMember() == null || pageReqVO.getIsPaidMember() == 0) {
|
||||
query.eq(ProductSpuDO::getOnlyPaidMemberView, 0);
|
||||
}
|
||||
// 排序逻辑
|
||||
if (Objects.equals(pageReqVO.getSortField(), AppProductSpuPageReqVO.SORT_FIELD_SALES_COUNT)) {
|
||||
query.last(String.format(" ORDER BY (sales_count + virtual_sales_count) %s, sort DESC, id DESC",
|
||||
|
@ -186,6 +186,9 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||
if (recommendGood != null && recommendGood != 0){
|
||||
wrapperX.eq(ProductSpuDO::getRecommendGood, recommendGood);
|
||||
}
|
||||
if (pageVo.getIsPaidMember() == null || pageVo.getIsPaidMember() == 0){
|
||||
wrapperX.eq(ProductSpuDO::getOnlyPaidMemberView, 0);
|
||||
}
|
||||
wrapperX.eq(ProductSpuDO::getStatus, 1);
|
||||
wrapperX.last(" ORDER BY (sales_count + virtual_sales_count) DESC, sort DESC, id DESC");
|
||||
return productSpuMapper.selectList(wrapperX);
|
||||
|
Loading…
Reference in New Issue
Block a user