商品分类添加修改无效
This commit is contained in:
@ -7,6 +7,7 @@
|
|||||||
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
* 一经发现盗用、分享等行为,将追究法律责任,后果自负
|
||||||
*/
|
*/
|
||||||
package co.yixiang.modules.shop.domain;
|
package co.yixiang.modules.shop.domain;
|
||||||
|
import co.yixiang.annotation.Query;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
@ -167,6 +168,9 @@ public class YxStoreProduct implements Serializable {
|
|||||||
/** 淘宝京东1688类型 */
|
/** 淘宝京东1688类型 */
|
||||||
private String soureLink;
|
private String soureLink;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private YxStoreCategory storeCategory;
|
||||||
|
|
||||||
|
|
||||||
public void copy(YxStoreProduct source){
|
public void copy(YxStoreProduct source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
|
@ -63,7 +63,7 @@ public class StoreProductController {
|
|||||||
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
resources.setAddTime(OrderUtil.getSecondTimestampTwo());
|
||||||
if(ObjectUtil.isEmpty(resources.getGiveIntegral())) resources.setGiveIntegral(BigDecimal.ZERO);
|
if(ObjectUtil.isEmpty(resources.getGiveIntegral())) resources.setGiveIntegral(BigDecimal.ZERO);
|
||||||
if(ObjectUtil.isEmpty(resources.getCost())) resources.setCost(BigDecimal.ZERO);
|
if(ObjectUtil.isEmpty(resources.getCost())) resources.setCost(BigDecimal.ZERO);
|
||||||
return new ResponseEntity(yxStoreProductService.save(resources),HttpStatus.CREATED);
|
return new ResponseEntity(yxStoreProductService.saveProduct(resources),HttpStatus.CREATED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Log("修改商品")
|
@Log("修改商品")
|
||||||
@ -73,7 +73,7 @@ public class StoreProductController {
|
|||||||
@PreAuthorize("@el.check('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT')")
|
@PreAuthorize("@el.check('admin','YXSTOREPRODUCT_ALL','YXSTOREPRODUCT_EDIT')")
|
||||||
public ResponseEntity update(@Validated @RequestBody YxStoreProduct resources){
|
public ResponseEntity update(@Validated @RequestBody YxStoreProduct resources){
|
||||||
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
//if(StrUtil.isNotEmpty("22")) throw new BadRequestException("演示环境禁止操作");
|
||||||
yxStoreProductService.saveOrUpdate(resources);
|
yxStoreProductService.updateProduct(resources);
|
||||||
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
return new ResponseEntity(HttpStatus.NO_CONTENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
|
|||||||
*/
|
*/
|
||||||
void download(List<YxStoreProductDto> all, HttpServletResponse response) throws IOException;
|
void download(List<YxStoreProductDto> all, HttpServletResponse response) throws IOException;
|
||||||
|
|
||||||
|
YxStoreProduct saveProduct(YxStoreProduct storeProduct);
|
||||||
|
|
||||||
void recovery(Integer id);
|
void recovery(Integer id);
|
||||||
|
|
||||||
void onSale(Integer id, int status);
|
void onSale(Integer id, int status);
|
||||||
@ -60,4 +62,6 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
|
|||||||
void setResult(Map<String, Object> map,Integer id);
|
void setResult(Map<String, Object> map,Integer id);
|
||||||
|
|
||||||
String getStoreProductAttrResult(Integer id);
|
String getStoreProductAttrResult(Integer id);
|
||||||
|
|
||||||
|
void updateProduct(YxStoreProduct resources);
|
||||||
}
|
}
|
||||||
|
@ -126,4 +126,6 @@ public class YxStoreProductDto implements Serializable {
|
|||||||
|
|
||||||
/** 淘宝京东1688类型 */
|
/** 淘宝京东1688类型 */
|
||||||
private String soureLink;
|
private String soureLink;
|
||||||
|
|
||||||
|
private YxStoreCategorySmallDto storeCategory;
|
||||||
}
|
}
|
||||||
|
@ -17,9 +17,7 @@ import co.yixiang.common.service.impl.BaseServiceImpl;
|
|||||||
import co.yixiang.modules.shop.domain.YxStoreProductAttr;
|
import co.yixiang.modules.shop.domain.YxStoreProductAttr;
|
||||||
import co.yixiang.modules.shop.domain.YxStoreProductAttrResult;
|
import co.yixiang.modules.shop.domain.YxStoreProductAttrResult;
|
||||||
import co.yixiang.modules.shop.domain.YxStoreProductAttrValue;
|
import co.yixiang.modules.shop.domain.YxStoreProductAttrValue;
|
||||||
import co.yixiang.modules.shop.service.YxStoreProductAttrResultService;
|
import co.yixiang.modules.shop.service.*;
|
||||||
import co.yixiang.modules.shop.service.YxStoreProductAttrService;
|
|
||||||
import co.yixiang.modules.shop.service.YxStoreProductAttrValueService;
|
|
||||||
import co.yixiang.modules.shop.service.dto.*;
|
import co.yixiang.modules.shop.service.dto.*;
|
||||||
import co.yixiang.utils.*;
|
import co.yixiang.utils.*;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
@ -29,8 +27,8 @@ import lombok.AllArgsConstructor;
|
|||||||
import co.yixiang.dozer.service.IGenerator;
|
import co.yixiang.dozer.service.IGenerator;
|
||||||
import com.github.pagehelper.PageInfo;
|
import com.github.pagehelper.PageInfo;
|
||||||
import co.yixiang.common.utils.QueryHelpPlus;
|
import co.yixiang.common.utils.QueryHelpPlus;
|
||||||
import co.yixiang.modules.shop.service.YxStoreProductService;
|
|
||||||
import co.yixiang.modules.shop.service.mapper.StoreProductMapper;
|
import co.yixiang.modules.shop.service.mapper.StoreProductMapper;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
@ -60,6 +58,8 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
|
|
||||||
private final StoreProductMapper storeProductMapper;
|
private final StoreProductMapper storeProductMapper;
|
||||||
|
|
||||||
|
private final YxStoreCategoryService yxStoreCategoryService;
|
||||||
|
|
||||||
private final YxStoreProductAttrService yxStoreProductAttrService;
|
private final YxStoreProductAttrService yxStoreProductAttrService;
|
||||||
|
|
||||||
private final YxStoreProductAttrValueService yxStoreProductAttrValueService;
|
private final YxStoreProductAttrValueService yxStoreProductAttrValueService;
|
||||||
@ -80,7 +80,14 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
@Override
|
@Override
|
||||||
//@Cacheable
|
//@Cacheable
|
||||||
public List<YxStoreProduct> queryAll(YxStoreProductQueryCriteria criteria){
|
public List<YxStoreProduct> queryAll(YxStoreProductQueryCriteria criteria){
|
||||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProduct.class, criteria));
|
List<YxStoreProduct> yxStoreProductList = baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreProduct.class, criteria));
|
||||||
|
List<YxStoreProduct> storeProductList = yxStoreProductList.stream().map(i ->{
|
||||||
|
YxStoreProduct yxStoreProduct = new YxStoreProduct();
|
||||||
|
BeanUtils.copyProperties(i,yxStoreProduct);
|
||||||
|
yxStoreProduct.setStoreCategory(yxStoreCategoryService.getById(i.getCateId()));
|
||||||
|
return yxStoreProduct;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
return storeProductList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,6 +136,13 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
FileUtil.downloadExcel(list, response);
|
FileUtil.downloadExcel(list, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public YxStoreProduct saveProduct(YxStoreProduct storeProduct) {
|
||||||
|
storeProduct.setCateId(storeProduct.getStoreCategory().getId().toString());
|
||||||
|
this.save(storeProduct);
|
||||||
|
return storeProduct;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recovery(Integer id) {
|
public void recovery(Integer id) {
|
||||||
storeProductMapper.updateDel(0,id);
|
storeProductMapper.updateDel(0,id);
|
||||||
@ -250,6 +264,12 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
|||||||
return yxStoreProductAttrResult.getResult();
|
return yxStoreProductAttrResult.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateProduct(YxStoreProduct resources) {
|
||||||
|
resources.setCateId(resources.getStoreCategory().getId().toString());
|
||||||
|
this.saveOrUpdate(resources);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void clearProductAttr(Integer id,boolean isActice) {
|
public void clearProductAttr(Integer id,boolean isActice) {
|
||||||
|
Reference in New Issue
Block a user