| | |
| | | public Integer create(SystemDictData systemDictData) { |
| | | SystemDictData queryDto = new SystemDictData(); |
| | | queryDto.setDictId(systemDictData.getDictId()); |
| | | queryDto.setCode(systemDictData.getCode()); |
| | | queryDto.setLabel(systemDictData.getLabel()); |
| | | queryDto.setDeleted(Boolean.FALSE); |
| | | SystemDictData dictData = systemDictDataService.findOne(queryDto); |
| | | if (dictData != null) { |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "数据值已存在"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "数据标签已存在"); |
| | | } |
| | | return systemDictDataService.create(systemDictData); |
| | | } |
| | |
| | | public void updateById(SystemDictData systemDictData) { |
| | | SystemDictData queryDto = new SystemDictData(); |
| | | queryDto.setDictId(systemDictData.getDictId()); |
| | | queryDto.setCode(systemDictData.getLabel()); |
| | | queryDto.setLabel(systemDictData.getLabel()); |
| | | queryDto.setDeleted(Boolean.FALSE); |
| | | SystemDictData dictData = systemDictDataService.findOne(queryDto); |
| | | if (dictData != null && !dictData.getId().equals(systemDictData.getId())) { |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "数据值已存在"); |
| | | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "数据标签已存在"); |
| | | } |
| | | systemDictDataService.updateById(systemDictData); |
| | | } |