金属元素新增BUG

This commit is contained in:
liss
2025-11-17 18:33:33 +08:00
parent 10bfece481
commit cfdeb40a23
2 changed files with 4 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ public interface ErrorCodeConstants {
// ========== 示例模块 1-001-000-000 ==========
ErrorCode MATERIAL_OTHER_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料不存在");
ErrorCode ELEMENT_NOT_EXISTS = new ErrorCode(1_001_000_001, "金属元素不存在");
ErrorCode ELEMENT_EXISTS = new ErrorCode(1_001_000_002, "金属元素已经存在");
ErrorCode CONTACT_NOT_EXISTS = new ErrorCode(1_001_000_001, "联系人不存在");
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1_001_000_001, "账户条款不存在");
ErrorCode MATERIAL_DESTROY_NOT_EXISTS = new ErrorCode(1_001_000_001, "物料回收率不存在");

View File

@@ -17,6 +17,7 @@ import org.springframework.validation.annotation.Validated;
import java.util.List;
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.ELEMENT_EXISTS;
import static com.zt.plat.module.base.enums.ErrorCodeConstants.ELEMENT_NOT_EXISTS;
/**
@@ -95,8 +96,8 @@ public class ElementServiceImpl implements ElementService {
private void validateElementCodeExists(String code) {
ElementDO elementDO = elementMapper.getElementName(code);
if (elementDO == null) {
throw exception(ELEMENT_NOT_EXISTS);
if (elementDO != null) {
throw exception(ELEMENT_EXISTS);
}
}