规则通过id查询

master
Qin Dong Ming 2024-08-27 19:05:24 +08:00
parent ffe0d0daf6
commit e17c2d0b4a
1 changed files with 6 additions and 8 deletions

View File

@ -30,14 +30,12 @@ public class TypeServiceImpl implements TypeService {
@Override @Override
public Result add(EngineType type) { public Result add(EngineType type) {
if (StringUtils.isEmpty(type.getName())){ if (StringUtils.isEmpty(type.getName())){
return Result.error("类型不能为空"); return Result.error("类型名称不能为空");
} }
if (StringUtils.isNotEmpty(type.getName())){ if (type.getName().equals(type.getName())){
if (list().contains(type)){ return Result.error("类型名称不能重复");
return Result.error("该类型已存在"); }
}
}
Integer res = typseMapper.add(type); Integer res = typseMapper.add(type);
return Result.success(res); return Result.success(res);
} }