卖家端bug
This commit is contained in:
@@ -3,10 +3,15 @@ package com.aida.seller.module.listing.mapper;
|
||||
import com.aida.seller.module.listing.entity.ListingEntity;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
|
||||
/**
|
||||
* 商城首页商品 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface ListingMallMapper extends BaseMapper<ListingEntity> {
|
||||
|
||||
@Update("UPDATE seller_listing SET view_count = view_count + 1 WHERE id = #{id}")
|
||||
int incrementViewCount(@Param("id") Long id);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.aida.seller.module.listing.vo.ListingDetailVO;
|
||||
import com.aida.seller.module.listing.vo.ListingMallVO;
|
||||
import com.aida.seller.util.MinioUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -61,13 +60,23 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(dto.getCategories())) {
|
||||
for (String cat : dto.getCategories()) {
|
||||
queryWrapper.apply(
|
||||
queryWrapper.and(wrapper -> {
|
||||
for (int i = 0; i < dto.getCategories().size(); i++) {
|
||||
String cat = dto.getCategories().get(i);
|
||||
if (i == 0) {
|
||||
wrapper.apply(
|
||||
"JSON_CONTAINS(product_category, {0}, '$')",
|
||||
"\"" + cat + "\""
|
||||
);
|
||||
} else {
|
||||
wrapper.or().apply(
|
||||
"JSON_CONTAINS(product_category, {0}, '$')",
|
||||
"\"" + cat + "\""
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
applySorting(queryWrapper, dto.getSortField(), dto.getSortOrder());
|
||||
|
||||
@@ -148,10 +157,7 @@ public class ListingMallServiceImpl extends ServiceImpl<ListingMallMapper, Listi
|
||||
throw new BusinessException("商品不存在");
|
||||
}
|
||||
|
||||
this.getBaseMapper().update(null,
|
||||
new LambdaUpdateWrapper<ListingEntity>()
|
||||
.eq(ListingEntity::getId, id)
|
||||
.setSql("view_count = view_count + 1"));
|
||||
this.baseMapper.incrementViewCount(id);
|
||||
|
||||
List<ListingImageEntity> images = listingImageMapper.selectList(
|
||||
new LambdaQueryWrapper<ListingImageEntity>()
|
||||
|
||||
Reference in New Issue
Block a user