规则通过id查询

master
Qin Dong Ming 2024-08-27 19:02:44 +08:00
parent 96902f3114
commit ffe0d0daf6
1 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package com.muyu.service.serviceImpl;
import com.muyu.common.core.utils.StringUtils;
import com.muyu.domain.EngineType;
import com.muyu.domain.constants.Result;
import com.muyu.mapper.TypseMapper;
@ -29,6 +30,14 @@ public class TypeServiceImpl implements TypeService {
@Override
public Result add(EngineType type) {
if (StringUtils.isEmpty(type.getName())){
return Result.error("类型不能为空");
}
if (StringUtils.isNotEmpty(type.getName())){
if (list().contains(type)){
return Result.error("该类型已存在");
}
}
Integer res = typseMapper.add(type);
return Result.success(res);
}