update - 调整产品删除实现逻辑
This commit is contained in:
parent
66c173ccbc
commit
f2ebf603bc
@ -0,0 +1,29 @@
|
||||
package cn.axzo.tyr.server.config.exception;
|
||||
|
||||
|
||||
import cn.axzo.basics.common.exception.ServiceException;
|
||||
import cn.axzo.framework.autoconfigure.web.exception.RespErrorCodeMappingProperties;
|
||||
import cn.axzo.framework.autoconfigure.web.exception.handler.AbstractExceptionApiResultHandler;
|
||||
import cn.axzo.framework.domain.web.code.IRespCode;
|
||||
import cn.axzo.framework.domain.web.code.RespCode;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 目前整体框架中 ServiceException 有多种,而常用的 {@link cn.axzo.basics.common.util.AssertUtil} 抛出的是 {@link cn.axzo.basics.common.exception.ServiceException}
|
||||
* 与框架默认的异常处理器不兼容,所以新增加一个处理该异常的处理器
|
||||
*
|
||||
* @author wangli
|
||||
* @since 2023/9/11 11:39
|
||||
*/
|
||||
@Component
|
||||
public class ServiceExceptionResultHandler extends AbstractExceptionApiResultHandler<ServiceException> {
|
||||
public ServiceExceptionResultHandler(RespErrorCodeMappingProperties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IRespCode decode(ServiceException error, IRespCode fallbackCode) {
|
||||
return new RespCode(String.valueOf(error.getErrorCode()), error.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
@ -81,8 +81,8 @@ public class ProductServiceImpl implements ProductService {
|
||||
ProductModule productModule = productModuleDao.getById(id);
|
||||
AssertUtil.isTrue(Objects.nonNull(productModule), "产品不存在");
|
||||
productModuleDao.lambdaUpdate()
|
||||
.eq(ProductModule::getId, productModule.getId())
|
||||
.set(ProductModule::getIsDelete, productModule.getId())
|
||||
.eq(ProductModule::getId, id)
|
||||
.set(ProductModule::getIsDelete, id)
|
||||
.update();
|
||||
return ApiResult.ok(BeanMapper.copyBean(productModule, ProductVO.class));
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user