Commit 445e3b22 authored by 梁光意's avatar 梁光意

判断不能创建顶级分组

parent 3c8ad24f
package com.syc.slm.slmbi.controller;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.dto.CreateInstrumentPanelGroupDTO;
import com.syc.slm.slmbi.dto.InstrumentPanelGroupDTO;
import com.syc.slm.slmbi.exception.SysException;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo;
import io.swagger.annotations.Api;
......@@ -44,7 +46,13 @@ public class InstrumentPanelGroupController extends BaseRestController{
@ApiOperation("保存仪表板分组")
@ApiImplicitParam(name = "appId", value = "租户id", required = true,dataTypeClass = String.class)
public R<String> saveGroup(@PathVariable String appId, @RequestBody CreateInstrumentPanelGroupDTO group) {
return call(()->instrumentPanelGroupService.saveGroup(group,appId));
return call(() -> {
// 不能在service层判断,因为那个方式需要初始化
if (StringUtils.isBlank(group.getParentId())) {
throw new SysException("不能创建顶级分组");
}
return instrumentPanelGroupService.saveGroup(group, appId);
});
}
@PutMapping
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment