fix: 增加接口校验

This commit is contained in:
junjun 2022-03-28 15:51:18 +08:00
parent 2213a565f8
commit 9cc43d1095
2 changed files with 6 additions and 3 deletions

View File

@ -42,7 +42,7 @@ public class DataSetGroupController {
}, logical = Logical.AND)
@ApiOperation("保存")
@PostMapping("/save")
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) throws Exception {
return dataSetGroupService.save(datasetGroup);
}

View File

@ -44,7 +44,10 @@ public class DataSetGroupService {
private SysAuthService sysAuthService;
@DeCleaner(DePermissionType.DATASET)
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
public DataSetGroupDTO save(DatasetGroup datasetGroup) throws Exception {
if (StringUtils.isEmpty(datasetGroup.getType())) {
throw new Exception("type can not be empty");
}
checkName(datasetGroup);
if (StringUtils.isEmpty(datasetGroup.getId())) {
datasetGroup.setId(UUID.randomUUID().toString());
@ -65,7 +68,7 @@ public class DataSetGroupService {
public void delete(String id) throws Exception {
Assert.notNull(id, "id cannot be null");
sysAuthService.checkTreeNoManageCount("dataset",id);
sysAuthService.checkTreeNoManageCount("dataset", id);
DatasetGroup dg = datasetGroupMapper.selectByPrimaryKey(id);
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();