master:浏览历史,我的收藏 已删除商品后端优化处理;

pull/1121/head
liujiang 2025-12-04 18:44:48 +08:00
parent 9a326ca34e
commit 2ab3fede64
4 changed files with 14 additions and 0 deletions

View File

@ -33,6 +33,8 @@ public class StoreProdAppResDTO {
private String prodArtNum;
@ApiModelProperty(value = "商品标题")
private String prodTitle;
@ApiModelProperty(value = "商品状态")
private Integer prodStatus;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date createTime;

View File

@ -25,6 +25,8 @@ public class StoreProdPCResDTO {
private String storeName;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "商品状态")
private Integer prodStatus;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "商品标题")

View File

@ -842,6 +842,10 @@ public class StoreProductServiceImpl implements IStoreProductService {
public StoreProdAppResDTO getAppInfo(Long storeProdId) {
// 档口商品的基础信息
StoreProdAppResDTO appResDTO = this.storeProdMapper.getAppInfo(storeProdId, SecurityUtils.getUserIdSafe());
// 如果商品已删除,则报错
if (ObjectUtils.isEmpty(appResDTO) || Objects.equals(appResDTO.getProdStatus(), EProductStatus.REMOVED.getValue())) {
throw new ServiceException("商品已删除或不存在!请您浏览其它商品", HttpStatus.ERROR);
}
StoreProductCategoryAttribute cateAttr = this.storeProdCateAttrMapper.selectOne(new LambdaQueryWrapper<StoreProductCategoryAttribute>()
.eq(StoreProductCategoryAttribute::getStoreProdId, storeProdId).eq(StoreProductCategoryAttribute::getDelFlag, Constants.UNDELETED));
List<StoreProductColor> colorList = this.storeProdColorMapper.selectList(new LambdaQueryWrapper<StoreProductColor>()
@ -957,6 +961,10 @@ public class StoreProductServiceImpl implements IStoreProductService {
public StoreProdPCResDTO getPCInfo(Long storeProdId) {
// 商品基础信息
StoreProdPCResDTO prodInfoDTO = ObjectUtils.defaultIfNull(this.storeProdMapper.selectPCProdInfo(storeProdId, SecurityUtils.getUserIdSafe()), new StoreProdPCResDTO());
// 如果商品已删除,则报错
if (ObjectUtils.isEmpty(prodInfoDTO) || Objects.equals(prodInfoDTO.getProdStatus(), EProductStatus.REMOVED.getValue())) {
throw new ServiceException("商品已删除或不存在!请您浏览其它商品", HttpStatus.ERROR);
}
// 获取商品的属性
StoreProductCategoryAttribute cateAttr = this.storeProdCateAttrMapper.selectOne(new LambdaQueryWrapper<StoreProductCategoryAttribute>()
.eq(StoreProductCategoryAttribute::getStoreProdId, storeProdId).eq(StoreProductCategoryAttribute::getDelFlag, Constants.UNDELETED));

View File

@ -220,6 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sp.id AS storeProdId,
sp.prod_art_num,
sp.prod_title,
sp.prod_status,
sp.create_time,
spd.detail,
<if test="userId != null">
@ -285,6 +286,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.store_name,
sp.prod_art_num,
sp.prod_title,
sp.prod_status,
sp.create_time,
MIN( DISTINCT spcs.price ) AS minPrice,
GROUP_CONCAT( DISTINCT dpt.tag ORDER BY dpt.type ASC ) AS tagStr,