设备类型可修改相同名称bug解决
This commit is contained in:
parent
1581d47cc9
commit
849c4bddf6
|
|
@ -268,6 +268,12 @@ public class MaTypeController extends BaseController {
|
|||
@Log(title = "机具类型管理ma_type", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody MaType maType) {
|
||||
Long parentId = maType.getParentId();
|
||||
List<MaType> subMas = maTypeMapper.getListByParentId(parentId, null);
|
||||
boolean containsSameBrother = subMas.stream().anyMatch(o -> o.getTypeName().equals(maType.getTypeName()));
|
||||
if (containsSameBrother) {
|
||||
return AjaxResult.error("修改失败,同级存在相同名称");
|
||||
}
|
||||
return toAjax(iTypeService.updateMaType(maType));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ public class MaTypeServiceImpl implements ITypeService {
|
|||
public int insertMaType(MaType maType) {
|
||||
Long parentId = maType.getParentId();
|
||||
List<MaType> subMas = maTypeMapper.getListByParentId(parentId, null);
|
||||
boolean containsSameBrother = subMas.stream().anyMatch(o -> o.getTypeName().contains(maType.getTypeName()));
|
||||
boolean containsSameBrother = subMas.stream().anyMatch(o -> o.getTypeName().equals(maType.getTypeName()));
|
||||
if (containsSameBrother) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue