更新商品信息时,删除分享图

This commit is contained in:
LIONCITYS\lioncity
2020-09-10 15:11:03 +08:00
parent 5c4448eb7c
commit 0a38192b27
3 changed files with 256 additions and 245 deletions

View File

@ -143,4 +143,9 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
*/ */
void insertAndEditYxStoreProduct(StoreProductDto storeProductDto); void insertAndEditYxStoreProduct(StoreProductDto storeProductDto);
/**+
* 删除商品转发海报
* @param id
*/
void deleteForwardImg(Long id);
} }

View File

@ -76,11 +76,10 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* @author hupeng * @author hupeng
* @date 2020-05-12 * @date 2020-05-12
*/ */
@Service @Service
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMapper, YxStoreProduct> implements YxStoreProductService { public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMapper, YxStoreProduct> implements YxStoreProductService {
@ -107,56 +106,57 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
private YxShippingTemplatesService shippingTemplatesService; private YxShippingTemplatesService shippingTemplatesService;
/** /**
* 增加库存 减少销量 * 增加库存 减少销量
* @param num 数量 *
* @param num 数量
* @param productId 商品id * @param productId 商品id
* @param unique sku唯一值 * @param unique sku唯一值
*/ */
@Override @Override
public void incProductStock(Integer num, Long productId, String unique,Long activityId, String type) { public void incProductStock(Integer num, Long productId, String unique, Long activityId, String type) {
//处理属性sku //处理属性sku
if(StrUtil.isNotEmpty(unique)){ if (StrUtil.isNotEmpty(unique)) {
yxStoreProductAttrService.incProductAttrStock(num,productId,unique,type); yxStoreProductAttrService.incProductAttrStock(num, productId, unique, type);
} }
//先处理商品库存,活动商品也要处理,因为共享库存 //先处理商品库存,活动商品也要处理,因为共享库存
storeProductMapper.incStockDecSales(num, productId); storeProductMapper.incStockDecSales(num, productId);
//处理商品外层显示的库存 //处理商品外层显示的库存
if("combination".equals(type)){ if ("combination".equals(type)) {
storeProductMapper.incCombinationStockIncSales(num,productId,activityId); storeProductMapper.incCombinationStockIncSales(num, productId, activityId);
}else if("seckill".equals(type)){ } else if ("seckill".equals(type)) {
storeProductMapper.incSeckillStockIncSales(num,productId,activityId); storeProductMapper.incSeckillStockIncSales(num, productId, activityId);
} }
//todo 处理砍价商品库存 //todo 处理砍价商品库存
} }
/** /**
* 减少库存与增加销量 * 减少库存与增加销量
* @param num 数量 *
* @param num 数量
* @param productId 商品id * @param productId 商品id
* @param unique sku * @param unique sku
*/ */
@Override @Override
public void decProductStock(int num, Long productId, String unique,Long activityId,String type) { public void decProductStock(int num, Long productId, String unique, Long activityId, String type) {
//处理属性sku //处理属性sku
if(StrUtil.isNotEmpty(unique)){ if (StrUtil.isNotEmpty(unique)) {
yxStoreProductAttrService.decProductAttrStock(num,productId,unique, type); yxStoreProductAttrService.decProductAttrStock(num, productId, unique, type);
} }
//先处理商品库存,活动商品也要处理,因为共享库存 //先处理商品库存,活动商品也要处理,因为共享库存
int product = storeProductMapper.decStockIncSales(num,productId); int product = storeProductMapper.decStockIncSales(num, productId);
if(product == 0) { if (product == 0) {
throw new YshopException("共享商品库存不足"); throw new YshopException("共享商品库存不足");
} }
//处理商品外层显示的库存 //处理商品外层显示的库存
if("combination".equals(type)){ if ("combination".equals(type)) {
int combinationRes = storeProductMapper.decCombinationStockIncSales(num,productId,activityId); int combinationRes = storeProductMapper.decCombinationStockIncSales(num, productId, activityId);
if(combinationRes == 0) { if (combinationRes == 0) {
throw new YshopException("拼团商品库存不足"); throw new YshopException("拼团商品库存不足");
} }
}else if("seckill".equals(type)){ } else if ("seckill".equals(type)) {
int seckillRes = storeProductMapper.decSeckillStockIncSales(num,productId,activityId); int seckillRes = storeProductMapper.decSeckillStockIncSales(num, productId, activityId);
if(seckillRes == 0) { if (seckillRes == 0) {
throw new YshopException("秒杀商品库存不足"); throw new YshopException("秒杀商品库存不足");
} }
} }
@ -165,13 +165,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
} }
@Override @Override
public YxStoreProduct getProductInfo(int id) { public YxStoreProduct getProductInfo(int id) {
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>(); QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
wrapper.eq("is_del",0).eq("is_show",1).eq("id",id); wrapper.eq("is_del", 0).eq("is_show", 1).eq("id", id);
YxStoreProduct storeProduct = this.baseMapper.selectOne(wrapper); YxStoreProduct storeProduct = this.baseMapper.selectOne(wrapper);
if(ObjectUtil.isNull(storeProduct)){ if (ObjectUtil.isNull(storeProduct)) {
throw new ErrorRequestException("商品不存在或已下架"); throw new ErrorRequestException("商品不存在或已下架");
} }
@ -181,19 +180,21 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/** /**
* 获取单个商品 * 获取单个商品
*
* @param id 商品id * @param id 商品id
* @return YxStoreProductQueryVo * @return YxStoreProductQueryVo
*/ */
@Override @Override
public YxStoreProductQueryVo getStoreProductById(Long id) { public YxStoreProductQueryVo getStoreProductById(Long id) {
return generator.convert(this.baseMapper.selectById(id),YxStoreProductQueryVo.class); return generator.convert(this.baseMapper.selectById(id), YxStoreProductQueryVo.class);
} }
/** /**
* 返回普通商品库存 * 返回普通商品库存
*
* @param productId 商品id * @param productId 商品id
* @param unique sku唯一值 * @param unique sku唯一值
* @return int * @return int
*/ */
@Override @Override
@ -206,9 +207,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
if (storeProductAttrValue == null) { if (storeProductAttrValue == null) {
return 0; return 0;
} }
if("pink".equals(type)){ if ("pink".equals(type)) {
return storeProductAttrValue.getPinkStock(); return storeProductAttrValue.getPinkStock();
}else if ("seckill".equals(type)){ } else if ("seckill".equals(type)) {
return storeProductAttrValue.getSeckillStock(); return storeProductAttrValue.getSeckillStock();
} }
return storeProductAttrValue.getStock(); return storeProductAttrValue.getStock();
@ -218,6 +219,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/** /**
* 商品列表 * 商品列表
*
* @param productQueryParam YxStoreProductQueryParam * @param productQueryParam YxStoreProductQueryParam
* @return list * @return list
*/ */
@ -225,35 +227,35 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
public List<YxStoreProductQueryVo> getGoodsList(YxStoreProductQueryParam productQueryParam) { public List<YxStoreProductQueryVo> getGoodsList(YxStoreProductQueryParam productQueryParam) {
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>(); QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(YxStoreProduct::getIsShow,CommonEnum.SHOW_STATUS_1.getValue()); wrapper.lambda().eq(YxStoreProduct::getIsShow, CommonEnum.SHOW_STATUS_1.getValue());
//分类搜索 //分类搜索
if(StrUtil.isNotBlank(productQueryParam.getSid()) && if (StrUtil.isNotBlank(productQueryParam.getSid()) &&
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())){ !ShopConstants.YSHOP_ZERO.equals(productQueryParam.getSid())) {
wrapper.lambda().eq(YxStoreProduct::getCateId,productQueryParam.getSid()); wrapper.lambda().eq(YxStoreProduct::getCateId, productQueryParam.getSid());
} }
//关键字搜索 //关键字搜索
if(StrUtil.isNotEmpty(productQueryParam.getKeyword())){ if (StrUtil.isNotEmpty(productQueryParam.getKeyword())) {
wrapper.lambda().like(YxStoreProduct::getStoreName,productQueryParam.getKeyword()); wrapper.lambda().like(YxStoreProduct::getStoreName, productQueryParam.getKeyword());
} }
//新品搜索 //新品搜索
if(StrUtil.isNotBlank(productQueryParam.getNews()) && if (StrUtil.isNotBlank(productQueryParam.getNews()) &&
!ShopConstants.YSHOP_ZERO.equals(productQueryParam.getNews())){ !ShopConstants.YSHOP_ZERO.equals(productQueryParam.getNews())) {
wrapper.lambda().eq(YxStoreProduct::getIsNew,ShopCommonEnum.IS_NEW_1.getValue()); wrapper.lambda().eq(YxStoreProduct::getIsNew, ShopCommonEnum.IS_NEW_1.getValue());
} }
//销量排序 //销量排序
if(SortEnum.DESC.getValue().equals(productQueryParam.getSalesOrder())){ if (SortEnum.DESC.getValue().equals(productQueryParam.getSalesOrder())) {
wrapper.lambda().orderByDesc(YxStoreProduct::getSales); wrapper.lambda().orderByDesc(YxStoreProduct::getSales);
}else if(SortEnum.ASC.getValue().equals(productQueryParam.getSalesOrder())) { } else if (SortEnum.ASC.getValue().equals(productQueryParam.getSalesOrder())) {
wrapper.lambda().orderByAsc(YxStoreProduct::getSales); wrapper.lambda().orderByAsc(YxStoreProduct::getSales);
} }
//价格排序 //价格排序
if(SortEnum.DESC.getValue().equals(productQueryParam.getPriceOrder())){ if (SortEnum.DESC.getValue().equals(productQueryParam.getPriceOrder())) {
wrapper.lambda().orderByDesc(YxStoreProduct::getPrice); wrapper.lambda().orderByDesc(YxStoreProduct::getPrice);
}else if(SortEnum.ASC.getValue().equals(productQueryParam.getPriceOrder())){ } else if (SortEnum.ASC.getValue().equals(productQueryParam.getPriceOrder())) {
wrapper.lambda().orderByAsc(YxStoreProduct::getPrice); wrapper.lambda().orderByAsc(YxStoreProduct::getPrice);
} }
@ -262,46 +264,47 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
Page<YxStoreProduct> pageModel = new Page<>(productQueryParam.getPage(), Page<YxStoreProduct> pageModel = new Page<>(productQueryParam.getPage(),
productQueryParam.getLimit()); productQueryParam.getLimit());
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel,wrapper); IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel, wrapper);
List<YxStoreProductQueryVo> list = generator.convert(pageList.getRecords(),YxStoreProductQueryVo.class); List<YxStoreProductQueryVo> list = generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class);
return list; return list;
} }
/** /**
* 商品详情 * 商品详情
* @param id 商品id *
* @param uid 用户id * @param id 商品id
* @param latitude 纬度 * @param uid 用户id
* @param latitude 纬度
* @param longitude 经度 * @param longitude 经度
* @return ProductVo * @return ProductVo
*/ */
@Override @Override
public ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude) { public ProductVo goodsDetail(Long id, Long uid, String latitude, String longitude) {
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>(); QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(YxStoreProduct::getIsShow,ShopCommonEnum.SHOW_1.getValue()) wrapper.lambda().eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.eq(YxStoreProduct::getId,id); .eq(YxStoreProduct::getId, id);
YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper); YxStoreProduct storeProduct = storeProductMapper.selectOne(wrapper);
if(ObjectUtil.isNull(storeProduct)){ if (ObjectUtil.isNull(storeProduct)) {
throw new ErrorRequestException("商品不存在或已下架"); throw new ErrorRequestException("商品不存在或已下架");
} }
//获取商品sku //获取商品sku
Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(id); Map<String, Object> returnMap = yxStoreProductAttrService.getProductAttrDetail(id);
ProductVo productVo = new ProductVo(); ProductVo productVo = new ProductVo();
YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct,YxStoreProductQueryVo.class); YxStoreProductQueryVo storeProductQueryVo = generator.convert(storeProduct, YxStoreProductQueryVo.class);
//设置销量 //设置销量
storeProductQueryVo.setSales(storeProductQueryVo.getSales()+storeProductQueryVo.getFicti()); storeProductQueryVo.setSales(storeProductQueryVo.getSales() + storeProductQueryVo.getFicti());
//设置VIP价格 //设置VIP价格
double vipPrice = userService.setLevelPrice( double vipPrice = userService.setLevelPrice(
storeProductQueryVo.getPrice().doubleValue(),uid); storeProductQueryVo.getPrice().doubleValue(), uid);
storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice)); storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice));
//收藏 //收藏
boolean isCollect = relationService.isProductRelation(id,uid); boolean isCollect = relationService.isProductRelation(id, uid);
storeProductQueryVo.setUserCollect(isCollect); storeProductQueryVo.setUserCollect(isCollect);
//总条数 //总条数
@ -319,15 +322,15 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
//获取运费模板名称 //获取运费模板名称
String storeFreePostage = RedisUtil.get("store_free_postage"); String storeFreePostage = RedisUtil.get("store_free_postage");
String tempName = ""; String tempName = "";
if(StrUtil.isBlank(storeFreePostage) if (StrUtil.isBlank(storeFreePostage)
|| !NumberUtil.isNumber(storeFreePostage) || !NumberUtil.isNumber(storeFreePostage)
|| Integer.valueOf(storeFreePostage) == 0){ || Integer.valueOf(storeFreePostage) == 0) {
tempName = "全国包邮"; tempName = "全国包邮";
}else{ } else {
YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeProduct.getTempId()); YxShippingTemplates shippingTemplates = shippingTemplatesService.getById(storeProduct.getTempId());
if(ObjectUtil.isNotNull(shippingTemplates)){ if (ObjectUtil.isNotNull(shippingTemplates)) {
tempName = shippingTemplates.getName(); tempName = shippingTemplates.getName();
}else { } else {
throw new BadRequestException("请配置运费模板"); throw new BadRequestException("请配置运费模板");
} }
@ -336,22 +339,22 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
//设置商品相关信息 //设置商品相关信息
productVo.setStoreInfo(storeProductQueryVo); productVo.setStoreInfo(storeProductQueryVo);
productVo.setProductAttr((List<YxStoreProductAttrQueryVo>)returnMap.get("productAttr")); productVo.setProductAttr((List<YxStoreProductAttrQueryVo>) returnMap.get("productAttr"));
productVo.setProductValue((Map<String, YxStoreProductAttrValue>)returnMap.get("productValue")); productVo.setProductValue((Map<String, YxStoreProductAttrValue>) returnMap.get("productValue"));
//门店 //门店
productVo.setSystemStore(systemStoreService.getStoreInfo(latitude,longitude)); productVo.setSystemStore(systemStoreService.getStoreInfo(latitude, longitude));
productVo.setMapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey())); productVo.setMapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey()));
//添加足迹 //添加足迹
YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper<YxStoreProductRelation>() YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper<YxStoreProductRelation>()
.eq(YxStoreProductRelation::getUid, uid) .eq(YxStoreProductRelation::getUid, uid)
.eq(YxStoreProductRelation::getProductId, storeProductQueryVo.getId()) .eq(YxStoreProductRelation::getProductId, storeProductQueryVo.getId())
.eq(YxStoreProductRelation::getType, "foot")); .eq(YxStoreProductRelation::getType, "foot"));
if(ObjectUtil.isNotNull(foot)){ if (ObjectUtil.isNotNull(foot)) {
foot.setCreateTime(new Date()); foot.setCreateTime(new Date());
relationService.saveOrUpdate(foot); relationService.saveOrUpdate(foot);
}else { } else {
YxStoreProductRelation storeProductRelation = new YxStoreProductRelation(); YxStoreProductRelation storeProductRelation = new YxStoreProductRelation();
storeProductRelation.setProductId(storeProductQueryVo.getId()); storeProductRelation.setProductId(storeProductQueryVo.getId());
storeProductRelation.setUid(uid); storeProductRelation.setUid(uid);
@ -376,7 +379,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/** /**
* 商品列表 * 商品列表
* @param page 页码 *
* @param page 页码
* @param limit 条数 * @param limit 条数
* @param order ProductEnum * @param order ProductEnum
* @return List * @return List
@ -385,11 +389,11 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
public List<YxStoreProductQueryVo> getList(int page, int limit, int order) { public List<YxStoreProductQueryVo> getList(int page, int limit, int order) {
QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>(); QueryWrapper<YxStoreProduct> wrapper = new QueryWrapper<>();
wrapper.lambda().eq(YxStoreProduct::getIsShow,ShopCommonEnum.SHOW_1.getValue()) wrapper.lambda().eq(YxStoreProduct::getIsShow, ShopCommonEnum.SHOW_1.getValue())
.orderByDesc(YxStoreProduct::getSort); .orderByDesc(YxStoreProduct::getSort);
// order // order
switch (ProductEnum.toType(order)){ switch (ProductEnum.toType(order)) {
case TYPE_1: case TYPE_1:
wrapper.lambda().eq(YxStoreProduct::getIsBest, wrapper.lambda().eq(YxStoreProduct::getIsBest,
ShopCommonEnum.IS_STATUS_1.getValue()); //精品推荐 ShopCommonEnum.IS_STATUS_1.getValue()); //精品推荐
@ -409,17 +413,13 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
} }
Page<YxStoreProduct> pageModel = new Page<>(page, limit); Page<YxStoreProduct> pageModel = new Page<>(page, limit);
IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel,wrapper); IPage<YxStoreProduct> pageList = storeProductMapper.selectPage(pageModel, wrapper);
return generator.convert(pageList.getRecords(),YxStoreProductQueryVo.class); return generator.convert(pageList.getRecords(), YxStoreProductQueryVo.class);
} }
//============ 分割线================// //============ 分割线================//
@ -435,9 +435,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
@Override @Override
public List<YxStoreProduct> queryAll(YxStoreProductQueryCriteria criteria){ public List<YxStoreProduct> queryAll(YxStoreProductQueryCriteria criteria) {
List<YxStoreProduct> yxStoreProductList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProduct.class, criteria)); List<YxStoreProduct> yxStoreProductList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProduct.class, criteria));
yxStoreProductList.forEach(yxStoreProduct ->{ yxStoreProductList.forEach(yxStoreProduct -> {
yxStoreProduct.setStoreCategory(yxStoreCategoryService.getById(yxStoreProduct.getCateId())); yxStoreProduct.setStoreCategory(yxStoreCategoryService.getById(yxStoreProduct.getCateId()));
}); });
return yxStoreProductList; return yxStoreProductList;
@ -448,7 +448,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
public void download(List<YxStoreProductDto> all, HttpServletResponse response) throws IOException { public void download(List<YxStoreProductDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>(); List<Map<String, Object>> list = new ArrayList<>();
for (YxStoreProductDto yxStoreProduct : all) { for (YxStoreProductDto yxStoreProduct : all) {
Map<String,Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
map.put("商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", yxStoreProduct.getMerId()); map.put("商户Id(0为总后台管理员创建,不为0的时候是商户后台创建)", yxStoreProduct.getMerId());
map.put("商品图片", yxStoreProduct.getImage()); map.put("商品图片", yxStoreProduct.getImage());
map.put("轮播图", yxStoreProduct.getSliderImage()); map.put("轮播图", yxStoreProduct.getSliderImage());
@ -490,39 +490,37 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
} }
/** /**
* 商品上架下架 * 商品上架下架
* @param id 商品id *
* @param status ShopCommonEnum * @param id 商品id
* @param status ShopCommonEnum
*/ */
@Override @Override
public void onSale(Long id,Integer status) { public void onSale(Long id, Integer status) {
if(ShopCommonEnum.SHOW_1.getValue().equals(status)){ if (ShopCommonEnum.SHOW_1.getValue().equals(status)) {
status = ShopCommonEnum.SHOW_0.getValue(); status = ShopCommonEnum.SHOW_0.getValue();
}else{ } else {
status = ShopCommonEnum.SHOW_1.getValue(); status = ShopCommonEnum.SHOW_1.getValue();
} }
storeProductMapper.updateOnsale(status,id); storeProductMapper.updateOnsale(status, id);
} }
/** /**
* 新增/保存商品 * 新增/保存商品
*
* @param storeProductDto 商品 * @param storeProductDto 商品
*/ */
@Override @Override
public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto) public void insertAndEditYxStoreProduct(StoreProductDto storeProductDto) {
{
ProductResultDto resultDTO = this.computedProduct(storeProductDto.getAttrs()); ProductResultDto resultDTO = this.computedProduct(storeProductDto.getAttrs());
//添加商品 //添加商品
YxStoreProduct yxStoreProduct = new YxStoreProduct(); YxStoreProduct yxStoreProduct = new YxStoreProduct();
BeanUtil.copyProperties(storeProductDto,yxStoreProduct,"sliderImage"); BeanUtil.copyProperties(storeProductDto, yxStoreProduct, "sliderImage");
if(storeProductDto.getSliderImage().isEmpty()) { if (storeProductDto.getSliderImage().isEmpty()) {
throw new YshopException("请上传轮播图"); throw new YshopException("请上传轮播图");
} }
@ -532,13 +530,16 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
yxStoreProduct.setStock(resultDTO.getStock()); yxStoreProduct.setStock(resultDTO.getStock());
yxStoreProduct.setSliderImage(String.join(",", storeProductDto.getSliderImage())); yxStoreProduct.setSliderImage(String.join(",", storeProductDto.getSliderImage()));
if (storeProductDto.getId() != null) {
//清空商品转发图
deleteForwardImg(storeProductDto.getId());
}
this.saveOrUpdate(yxStoreProduct); this.saveOrUpdate(yxStoreProduct);
//属性处理 //属性处理
//处理单sKu //处理单sKu
if(SpecTypeEnum.TYPE_0.getValue().equals(storeProductDto.getSpecType())){ if (SpecTypeEnum.TYPE_0.getValue().equals(storeProductDto.getSpecType())) {
FromatDetailDto fromatDetailDto = FromatDetailDto.builder() FromatDetailDto fromatDetailDto = FromatDetailDto.builder()
.value("规格") .value("规格")
.detailValue("") .detailValue("")
@ -548,62 +549,58 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
List<ProductFormatDto> attrs = storeProductDto.getAttrs(); List<ProductFormatDto> attrs = storeProductDto.getAttrs();
ProductFormatDto productFormatDto = attrs.get(0); ProductFormatDto productFormatDto = attrs.get(0);
productFormatDto.setValue1("规格"); productFormatDto.setValue1("规格");
Map<String,String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
map.put("规格","默认"); map.put("规格", "默认");
productFormatDto.setDetail(map); productFormatDto.setDetail(map);
yxStoreProductAttrService.insertYxStoreProductAttr(ListUtil.toList(fromatDetailDto), yxStoreProductAttrService.insertYxStoreProductAttr(ListUtil.toList(fromatDetailDto),
ListUtil.toList(productFormatDto),storeProductDto.getId()); ListUtil.toList(productFormatDto), storeProductDto.getId());
}else{ } else {
yxStoreProductAttrService.insertYxStoreProductAttr(storeProductDto.getItems(), yxStoreProductAttrService.insertYxStoreProductAttr(storeProductDto.getItems(),
storeProductDto.getAttrs(),storeProductDto.getId()); storeProductDto.getAttrs(), storeProductDto.getId());
} }
} }
/** /**
* 获取生成的属性 * 获取生成的属性
* @param id 商品id *
* @param id 商品id
* @param jsonStr jsonStr * @param jsonStr jsonStr
* @return map * @return map
*/ */
@Override @Override
public Map<String,Object> getFormatAttr(Long id, String jsonStr,boolean isActivity) { public Map<String, Object> getFormatAttr(Long id, String jsonStr, boolean isActivity) {
JSONObject jsonObject = JSON.parseObject(jsonStr); JSONObject jsonObject = JSON.parseObject(jsonStr);
Map<String,Object> resultMap = new LinkedHashMap<>(3); Map<String, Object> resultMap = new LinkedHashMap<>(3);
if(jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()){ if (jsonObject == null || jsonObject.get("attrs") == null || jsonObject.getJSONArray("attrs").isEmpty()) {
resultMap.put("attr",new ArrayList<>()); resultMap.put("attr", new ArrayList<>());
resultMap.put("value",new ArrayList<>()); resultMap.put("value", new ArrayList<>());
resultMap.put("header",new ArrayList<>()); resultMap.put("header", new ArrayList<>());
return resultMap; return resultMap;
} }
List<FromatDetailDto> fromatDetailDTOList = JSON.parseArray(jsonObject.get("attrs").toString(), List<FromatDetailDto> fromatDetailDTOList = JSON.parseArray(jsonObject.get("attrs").toString(),
FromatDetailDto.class); FromatDetailDto.class);
//fromatDetailDTOList //fromatDetailDTOList
DetailDto detailDto = this.attrFormat(fromatDetailDTOList); DetailDto detailDto = this.attrFormat(fromatDetailDTOList);
List<Map<String,Object>> headerMapList = null; List<Map<String, Object>> headerMapList = null;
List<Map<String,Object>> valueMapList = new ArrayList<>(); List<Map<String, Object>> valueMapList = new ArrayList<>();
String align = "center"; String align = "center";
Map<String,Object> headerMap = new LinkedHashMap<>(); Map<String, Object> headerMap = new LinkedHashMap<>();
for (Map<String, Map<String,String>> map : detailDto.getRes()) { for (Map<String, Map<String, String>> map : detailDto.getRes()) {
Map<String,String> detail = map.get("detail"); Map<String, String> detail = map.get("detail");
String[] detailArr = detail.values().toArray(new String[]{}); String[] detailArr = detail.values().toArray(new String[]{});
Arrays.sort(detailArr); Arrays.sort(detailArr);
String sku = String.join(",",detailArr); String sku = String.join(",", detailArr);
Map<String,Object> valueMap = new LinkedHashMap<>(); Map<String, Object> valueMap = new LinkedHashMap<>();
List<String> detailKeys = List<String> detailKeys =
detail.entrySet() detail.entrySet()
@ -613,12 +610,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
int i = 0; int i = 0;
headerMapList = new ArrayList<>(); headerMapList = new ArrayList<>();
for (String title : detailKeys){ for (String title : detailKeys) {
headerMap.put("title",title); headerMap.put("title", title);
headerMap.put("minWidth","130"); headerMap.put("minWidth", "130");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("key", "value" + (i+1)); headerMap.put("key", "value" + (i + 1));
headerMap.put("slot", "value" + (i+1)); headerMap.put("slot", "value" + (i + 1));
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
i++; i++;
} }
@ -626,7 +623,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
String[] detailValues = detail.values().toArray(new String[]{}); String[] detailValues = detail.values().toArray(new String[]{});
for (int j = 0; j < detailValues.length; j++) { for (int j = 0; j < detailValues.length; j++) {
String key = "value" + (j + 1); String key = "value" + (j + 1);
valueMap.put(key,detailValues[j]); valueMap.put(key, detailValues[j]);
} }
// /** 拼团属性对应的金额 */ // /** 拼团属性对应的金额 */
// private BigDecimal pinkPrice; // private BigDecimal pinkPrice;
@ -637,41 +634,41 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
// private Integer pinkStock; // private Integer pinkStock;
// //
// private Integer seckillStock; // private Integer seckillStock;
valueMap.put("detail",detail); valueMap.put("detail", detail);
valueMap.put("pic",""); valueMap.put("pic", "");
valueMap.put("price",0); valueMap.put("price", 0);
valueMap.put("cost",0); valueMap.put("cost", 0);
valueMap.put("ot_price",0); valueMap.put("ot_price", 0);
valueMap.put("stock",0); valueMap.put("stock", 0);
valueMap.put("bar_code",""); valueMap.put("bar_code", "");
valueMap.put("weight",0); valueMap.put("weight", 0);
valueMap.put("volume",0); valueMap.put("volume", 0);
valueMap.put("brokerage",0); valueMap.put("brokerage", 0);
valueMap.put("brokerage_two",0); valueMap.put("brokerage_two", 0);
valueMap.put("pink_price",0); valueMap.put("pink_price", 0);
valueMap.put("seckill_price",0); valueMap.put("seckill_price", 0);
valueMap.put("pink_stock",0); valueMap.put("pink_stock", 0);
valueMap.put("seckill_stock",0); valueMap.put("seckill_stock", 0);
if(id > 0){ if (id > 0) {
YxStoreProductAttrValue storeProductAttrValue = yxStoreProductAttrValueService YxStoreProductAttrValue storeProductAttrValue = yxStoreProductAttrValueService
.getOne(Wrappers.<YxStoreProductAttrValue>lambdaQuery() .getOne(Wrappers.<YxStoreProductAttrValue>lambdaQuery()
.eq(YxStoreProductAttrValue::getProductId,id) .eq(YxStoreProductAttrValue::getProductId, id)
.eq(YxStoreProductAttrValue::getSku,sku)); .eq(YxStoreProductAttrValue::getSku, sku));
if(storeProductAttrValue != null){ if (storeProductAttrValue != null) {
valueMap.put("pic",storeProductAttrValue.getImage()); valueMap.put("pic", storeProductAttrValue.getImage());
valueMap.put("price",storeProductAttrValue.getPrice()); valueMap.put("price", storeProductAttrValue.getPrice());
valueMap.put("cost",storeProductAttrValue.getCost()); valueMap.put("cost", storeProductAttrValue.getCost());
valueMap.put("ot_price",storeProductAttrValue.getOtPrice()); valueMap.put("ot_price", storeProductAttrValue.getOtPrice());
valueMap.put("stock",storeProductAttrValue.getStock()); valueMap.put("stock", storeProductAttrValue.getStock());
valueMap.put("bar_code",storeProductAttrValue.getBarCode()); valueMap.put("bar_code", storeProductAttrValue.getBarCode());
valueMap.put("weight",storeProductAttrValue.getWeight()); valueMap.put("weight", storeProductAttrValue.getWeight());
valueMap.put("volume",storeProductAttrValue.getVolume()); valueMap.put("volume", storeProductAttrValue.getVolume());
valueMap.put("brokerage",storeProductAttrValue.getBrokerage()); valueMap.put("brokerage", storeProductAttrValue.getBrokerage());
valueMap.put("brokerage_two",storeProductAttrValue.getBrokerageTwo()); valueMap.put("brokerage_two", storeProductAttrValue.getBrokerageTwo());
valueMap.put("pink_price",storeProductAttrValue.getPinkPrice()); valueMap.put("pink_price", storeProductAttrValue.getPinkPrice());
valueMap.put("seckill_price",storeProductAttrValue.getSeckillPrice()); valueMap.put("seckill_price", storeProductAttrValue.getSeckillPrice());
valueMap.put("pink_stock",storeProductAttrValue.getPinkStock()); valueMap.put("pink_stock", storeProductAttrValue.getPinkStock());
valueMap.put("seckill_stock",storeProductAttrValue.getSeckillStock()); valueMap.put("seckill_stock", storeProductAttrValue.getSeckillStock());
} }
} }
@ -679,27 +676,24 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
} }
this.addMap(headerMap,headerMapList,align,isActivity); this.addMap(headerMap, headerMapList, align, isActivity);
resultMap.put("attr",fromatDetailDTOList); resultMap.put("attr", fromatDetailDTOList);
resultMap.put("value",valueMapList); resultMap.put("value", valueMapList);
resultMap.put("header",headerMapList); resultMap.put("header", headerMapList);
return resultMap; return resultMap;
} }
/** /**
* 计算产品数据 * 计算产品数据
*
* @param attrs attrs * @param attrs attrs
* @return ProductResultDto * @return ProductResultDto
*/ */
private ProductResultDto computedProduct(List<ProductFormatDto> attrs){ private ProductResultDto computedProduct(List<ProductFormatDto> attrs) {
//取最小价格 //取最小价格
Double minPrice = attrs Double minPrice = attrs
.stream() .stream()
@ -725,7 +719,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
.reduce(Integer::sum) .reduce(Integer::sum)
.orElse(0); .orElse(0);
if(stock <= 0) { if (stock <= 0) {
throw new YshopException("库存不能低于0"); throw new YshopException("库存不能低于0");
} }
@ -739,158 +733,161 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
/** /**
* mapTobean * mapTobean
*
* @param listMap listMap * @param listMap listMap
* @return list * @return list
*/ */
private List<ProductFormatDto> ListMapToListBean(List<Map<String, Object>> listMap){ private List<ProductFormatDto> ListMapToListBean(List<Map<String, Object>> listMap) {
List<ProductFormatDto> list = new ArrayList<>(); List<ProductFormatDto> list = new ArrayList<>();
// 循环遍历出map对象 // 循环遍历出map对象
for (Map<String, Object> m : listMap) { for (Map<String, Object> m : listMap) {
list.add(BeanUtil.mapToBean(m,ProductFormatDto.class,true)); list.add(BeanUtil.mapToBean(m, ProductFormatDto.class, true));
} }
return list; return list;
} }
/** /**
* 增加表头 * 增加表头
* @param headerMap headerMap *
* @param headerMap headerMap
* @param headerMapList headerMapList * @param headerMapList headerMapList
* @param align align * @param align align
*/ */
private void addMap(Map<String,Object> headerMap,List<Map<String,Object>> headerMapList,String align,boolean isActivity){ private void addMap(Map<String, Object> headerMap, List<Map<String, Object>> headerMapList, String align, boolean isActivity) {
headerMap.put("title","图片"); headerMap.put("title", "图片");
headerMap.put("slot", "pic"); headerMap.put("slot", "pic");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",80); headerMap.put("minWidth", 80);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","售价"); headerMap.put("title", "售价");
headerMap.put("slot", "price"); headerMap.put("slot", "price");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",120); headerMap.put("minWidth", 120);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","成本价"); headerMap.put("title", "成本价");
headerMap.put("slot", "cost"); headerMap.put("slot", "cost");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","原价"); headerMap.put("title", "原价");
headerMap.put("slot", "ot_price"); headerMap.put("slot", "ot_price");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","库存"); headerMap.put("title", "库存");
headerMap.put("slot", "stock"); headerMap.put("slot", "stock");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","产品编号"); headerMap.put("title", "产品编号");
headerMap.put("slot", "bar_code"); headerMap.put("slot", "bar_code");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","重量(KG)"); headerMap.put("title", "重量(KG)");
headerMap.put("slot", "weight"); headerMap.put("slot", "weight");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","体积(m³)"); headerMap.put("title", "体积(m³)");
headerMap.put("slot", "volume"); headerMap.put("slot", "volume");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
if(isActivity){ if (isActivity) {
headerMap.put("title","拼团价"); headerMap.put("title", "拼团价");
headerMap.put("slot", "pink_price"); headerMap.put("slot", "pink_price");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","拼团活动库存"); headerMap.put("title", "拼团活动库存");
headerMap.put("slot", "pink_stock"); headerMap.put("slot", "pink_stock");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","秒杀价"); headerMap.put("title", "秒杀价");
headerMap.put("slot", "seckill_price"); headerMap.put("slot", "seckill_price");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
headerMap.put("title","秒杀活动库存"); headerMap.put("title", "秒杀活动库存");
headerMap.put("slot", "seckill_stock"); headerMap.put("slot", "seckill_stock");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",140); headerMap.put("minWidth", 140);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
} }
headerMap.put("title","操作"); headerMap.put("title", "操作");
headerMap.put("slot", "action"); headerMap.put("slot", "action");
headerMap.put("align",align); headerMap.put("align", align);
headerMap.put("minWidth",70); headerMap.put("minWidth", 70);
headerMapList.add(ObjectUtil.clone(headerMap)); headerMapList.add(ObjectUtil.clone(headerMap));
} }
/** /**
* 组合规则属性算法 * 组合规则属性算法
*
* @param fromatDetailDTOList * @param fromatDetailDTOList
* @return DetailDto * @return DetailDto
*/ */
private DetailDto attrFormat(List<FromatDetailDto> fromatDetailDTOList){ private DetailDto attrFormat(List<FromatDetailDto> fromatDetailDTOList) {
List<String> data = new ArrayList<>(); List<String> data = new ArrayList<>();
List<Map<String,Map<String,String>>> res = new ArrayList<>(); List<Map<String, Map<String, String>>> res = new ArrayList<>();
fromatDetailDTOList.stream() fromatDetailDTOList.stream()
.map(FromatDetailDto::getDetail) .map(FromatDetailDto::getDetail)
.forEach(i -> { .forEach(i -> {
if(i == null || i.isEmpty()) { if (i == null || i.isEmpty()) {
throw new YshopException("请至少添加一个规格值哦"); throw new YshopException("请至少添加一个规格值哦");
} }
String str = ArrayUtil.join(i.toArray(),","); String str = ArrayUtil.join(i.toArray(), ",");
if(str.contains("-")) { if (str.contains("-")) {
throw new YshopException("规格值里包含'-',请重新添加"); throw new YshopException("规格值里包含'-',请重新添加");
} }
}); });
if(fromatDetailDTOList.size() > 1){ if (fromatDetailDTOList.size() > 1) {
for (int i=0; i < fromatDetailDTOList.size() - 1;i++){ for (int i = 0; i < fromatDetailDTOList.size() - 1; i++) {
if(i == 0) { if (i == 0) {
data = fromatDetailDTOList.get(i).getDetail(); data = fromatDetailDTOList.get(i).getDetail();
} }
List<String> tmp = new LinkedList<>(); List<String> tmp = new LinkedList<>();
for (String v : data) { for (String v : data) {
for (String g : fromatDetailDTOList.get(i+1).getDetail()) { for (String g : fromatDetailDTOList.get(i + 1).getDetail()) {
String rep2 = ""; String rep2 = "";
if(i == 0){ if (i == 0) {
rep2 = fromatDetailDTOList.get(i).getValue() + "_" + v + "-" rep2 = fromatDetailDTOList.get(i).getValue() + "_" + v + "-"
+ fromatDetailDTOList.get(i+1).getValue() + "_" + g; + fromatDetailDTOList.get(i + 1).getValue() + "_" + g;
}else{ } else {
rep2 = v + "-" rep2 = v + "-"
+ fromatDetailDTOList.get(i+1).getValue() + "_" + g; + fromatDetailDTOList.get(i + 1).getValue() + "_" + g;
} }
tmp.add(rep2); tmp.add(rep2);
if(i == fromatDetailDTOList.size() - 2){ if (i == fromatDetailDTOList.size() - 2) {
Map<String,Map<String,String>> rep4 = new LinkedHashMap<>(); Map<String, Map<String, String>> rep4 = new LinkedHashMap<>();
Map<String,String> reptemp = new LinkedHashMap<>(); Map<String, String> reptemp = new LinkedHashMap<>();
for (String h : Arrays.asList(rep2.split("-"))) { for (String h : Arrays.asList(rep2.split("-"))) {
List<String> rep3 = Arrays.asList(h.split("_")); List<String> rep3 = Arrays.asList(h.split("_"));
if(rep3.size() > 1){ if (rep3.size() > 1) {
reptemp.put(rep3.get(0),rep3.get(1)); reptemp.put(rep3.get(0), rep3.get(1));
}else{ } else {
reptemp.put(rep3.get(0),""); reptemp.put(rep3.get(0), "");
} }
} }
rep4.put("detail",reptemp); rep4.put("detail", reptemp);
res.add(rep4); res.add(rep4);
} }
@ -898,23 +895,23 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
} }
if(!tmp.isEmpty()){ if (!tmp.isEmpty()) {
data = tmp; data = tmp;
} }
} }
}else{ } else {
List<String> dataArr = new ArrayList<>(); List<String> dataArr = new ArrayList<>();
for (FromatDetailDto fromatDetailDTO : fromatDetailDTOList) { for (FromatDetailDto fromatDetailDTO : fromatDetailDTOList) {
for (String str : fromatDetailDTO.getDetail()) { for (String str : fromatDetailDTO.getDetail()) {
Map<String,Map<String,String>> map2 = new LinkedHashMap<>(); Map<String, Map<String, String>> map2 = new LinkedHashMap<>();
dataArr.add(fromatDetailDTO.getValue()+"_"+str); dataArr.add(fromatDetailDTO.getValue() + "_" + str);
Map<String,String> map1 = new LinkedHashMap<>(); Map<String, String> map1 = new LinkedHashMap<>();
map1.put(fromatDetailDTO.getValue(),str); map1.put(fromatDetailDTO.getValue(), str);
map2.put("detail",map1); map2.put("detail", map1);
res.add(map2); res.add(map2);
} }
} }
String s = StrUtil.join("-",dataArr); String s = StrUtil.join("-", dataArr);
data.add(s); data.add(s);
} }
@ -925,4 +922,9 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
return detailDto; return detailDto;
} }
@Override
public void deleteForwardImg(Long id) {
baseMapper.deleteForwardImg(id, "_product_detail_wap");
}
} }

View File

@ -10,6 +10,7 @@ package co.yixiang.modules.product.service.mapper;
import co.yixiang.common.mapper.CoreMapper; import co.yixiang.common.mapper.CoreMapper;
import co.yixiang.modules.product.domain.YxStoreProduct; import co.yixiang.modules.product.domain.YxStoreProduct;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -96,4 +97,7 @@ public interface StoreProductMapper extends CoreMapper<YxStoreProduct> {
@Update("update yx_store_product set browse=browse+1 " + @Update("update yx_store_product set browse=browse+1 " +
"where id=#{productId}") "where id=#{productId}")
int incBrowseNum(@Param("productId") Long productId); int incBrowseNum(@Param("productId") Long productId);
@Delete("DELETE from yx_system_attachment where name like CONCAT(#{id},'_%',#{name}, '%')")
void deleteForwardImg(@Param("id") Long id,@Param("name") String name);
} }