功能:支持后台编辑作品点赞收藏数
This commit is contained in:
@@ -44,6 +44,16 @@ public class ProductDTO {
|
||||
*/
|
||||
private String tags;
|
||||
|
||||
/**
|
||||
* 鍟嗗搧鐐硅禐鏁?
|
||||
*/
|
||||
private Integer likeCount;
|
||||
|
||||
/**
|
||||
* 鍟嗗搧鏀惰棌鏁?
|
||||
*/
|
||||
private Integer collectCount;
|
||||
|
||||
/**
|
||||
* 商品对应的服务大约耗时(如"30分钟")
|
||||
*/
|
||||
|
||||
+15
@@ -62,6 +62,8 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im
|
||||
productDO.setImageFileIds(productDTO.getImageFileIds());
|
||||
productDO.setPrice(productDTO.getPrice());
|
||||
productDO.setTags(productDTO.getTags());
|
||||
productDO.setLikeCount(normalizeInteractionCount(productDTO.getLikeCount()));
|
||||
productDO.setCollectCount(normalizeInteractionCount(productDTO.getCollectCount()));
|
||||
productDO.setApproximateDuration(productDTO.getApproximateDuration());
|
||||
productDO.setBookableArtists(bookableArtistSupport.filterValidBookableArtists(productDTO.getShopId(), productDTO.getBookableArtists()));
|
||||
productDO.setAvailableCoupons(productDTO.getAvailableCoupons());
|
||||
@@ -84,6 +86,12 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im
|
||||
productDO.setImageFileIds(productDTO.getImageFileIds());
|
||||
productDO.setPrice(productDTO.getPrice());
|
||||
productDO.setTags(productDTO.getTags());
|
||||
if (productDTO.getLikeCount() != null) {
|
||||
productDO.setLikeCount(normalizeInteractionCount(productDTO.getLikeCount()));
|
||||
}
|
||||
if (productDTO.getCollectCount() != null) {
|
||||
productDO.setCollectCount(normalizeInteractionCount(productDTO.getCollectCount()));
|
||||
}
|
||||
productDO.setApproximateDuration(productDTO.getApproximateDuration());
|
||||
productDO.setBookableArtists(bookableArtistSupport.filterValidBookableArtists(productDTO.getShopId(), productDTO.getBookableArtists()));
|
||||
productDO.setAvailableCoupons(productDTO.getAvailableCoupons());
|
||||
@@ -348,6 +356,13 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, ProductDO> im
|
||||
.count();
|
||||
}
|
||||
|
||||
private Integer normalizeInteractionCount(Integer count) {
|
||||
if (count == null || count < 0) {
|
||||
return 0;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private boolean containsAnyTagId(String tags, Set<String> targetTagIds) {
|
||||
if (!StringUtils.hasText(tags) || targetTagIds == null || targetTagIds.isEmpty()) {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user