| | |
| | | if (Objects.isNull(dictType.getName())) { |
| | | throw new CoolException("字典名称不能为空!!"); |
| | | } |
| | | if (Objects.isNull(dictType.getDescription())) { |
| | | throw new CoolException("字典描述不能为空!!"); |
| | | } |
| | | if (Objects.isNull(dictType.getCode())) { |
| | | throw new CoolException("字典编码不能为空!!"); |
| | | } |
| | | |
| | | if (!dictTypeService.list(new LambdaQueryWrapper<DictType>().eq(DictType::getCode, dictType.getCode())).isEmpty()) { |
| | | throw new CoolException("编码不能重复!!"); |
| | | } |
| | | if (!dictTypeService.list(new LambdaQueryWrapper<DictType>().eq(DictType::getName, dictType.getName())).isEmpty()) { |
| | | throw new CoolException("名称不能重复!!"); |
| | | } |
| | | if (!dictTypeService.save(dictType)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | |
| | | @OperationLog("Update 数据字典") |
| | | @PostMapping("/dictType/update") |
| | | public R update(@RequestBody DictType dictType) { |
| | | if (Objects.isNull(dictType)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | dictType.setUpdateBy(getLoginUserId()); |
| | | dictType.setUpdateTime(new Date()); |
| | | if (!dictTypeService.updateById(dictType)) { |
| | | return R.error("Update Fail"); |
| | | } |