|
@@ -35,18 +35,20 @@ public class TemplateConfigService {
|
|
|
}
|
|
|
|
|
|
public void insert(TemplateConfig templateConfig) {
|
|
|
-// TemplateConfig existObj = templateConfigMapper.getByName(templateConfig.getName());
|
|
|
-// if (existObj != null) {
|
|
|
-// throw new RuntimeException("模板名称已存在");
|
|
|
-// }
|
|
|
+ String name = templateConfig.getName();
|
|
|
+ TemplateConfig existObj = templateConfigMapper.getByName(name, templateConfig.getGroupId());
|
|
|
+ if (existObj != null) {
|
|
|
+ throw new RuntimeException("模板名称 "+ name +" 已存在");
|
|
|
+ }
|
|
|
templateConfig.setIsDeleted(0);
|
|
|
templateConfigMapper.insert(templateConfig);
|
|
|
}
|
|
|
|
|
|
public void update(TemplateConfig templateConfig) {
|
|
|
- TemplateConfig existObj = templateConfigMapper.getByName(templateConfig.getName());
|
|
|
+ String name = templateConfig.getName();
|
|
|
+ TemplateConfig existObj = templateConfigMapper.getByName(name, templateConfig.getGroupId());
|
|
|
if (existObj != null && !Objects.equals(templateConfig.getId(), existObj.getId())) {
|
|
|
- throw new RuntimeException("模板名称已存在");
|
|
|
+ throw new RuntimeException("模板名称 "+ name +" 已存在");
|
|
|
}
|
|
|
templateConfigMapper.updateIgnoreNull(templateConfig);
|
|
|
}
|