Commit 6e51992b authored by 梁彬's avatar 梁彬

refactor: 重构仪表板分组API

parent adb0e9ba
package com.syc.slm.slmbi.controller; package com.syc.slm.slmbi.controller;
import com.syc.slm.common.core.util.R; 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.dto.InstrumentPanelGroupDTO;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService; import com.syc.slm.slmbi.service.InstrumentPanelGroupService;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo;
import com.syc.slm.slmbi.vo.PanelGroupVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* slm-bi * slm-bi
* 仪表板分组 * 仪表板分组
...@@ -29,32 +24,9 @@ public class InstrumentPanelGroupController { ...@@ -29,32 +24,9 @@ public class InstrumentPanelGroupController {
@Autowired @Autowired
private InstrumentPanelGroupService instrumentPanelGroupService; private InstrumentPanelGroupService instrumentPanelGroupService;
@GetMapping
@ApiOperation("第一次进入页面,或者点击查询,获取全部分组下的仪表板数据,以及分组数据")
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称")
public R<List<PanelGroupVo>> loadTrees(
@RequestParam(value = "name", required = false) String name) {
return R.ok(instrumentPanelGroupService.loadTrees(name));
}
@GetMapping("/children")
@ApiOperation("点击节点获取,该分组下的仪表板信息,以及分组数据")
@ApiImplicitParams({@ApiImplicitParam(name = "groupId", value = "分组id", required = true),
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称")})
public R<List<PanelGroupVo>> children(@RequestParam("groupId") String groupId,
@RequestParam(value = "name", required = false) String name) {
return R.ok(instrumentPanelGroupService.children(groupId, name));
}
@GetMapping("/selectInstrumentPanelGroups")
@ApiOperation("获取所有的仪表板分组以及分组下的仪表板以及仪表板下的组件")
public R<List<InstrumentPanelGroupVo>> selectInstrumentPanelGroups() {
return R.ok(instrumentPanelGroupService.selectGroupList());
}
@PostMapping @PostMapping
@ApiOperation("保存仪表板分组") @ApiOperation("保存仪表板分组")
public R<String> saveGroup(@RequestBody InstrumentPanelGroupDTO group) { public R<String> saveGroup(@RequestBody CreateInstrumentPanelGroupDTO group) {
return R.ok(instrumentPanelGroupService.saveGroup(group)); return R.ok(instrumentPanelGroupService.saveGroup(group));
} }
......
package com.syc.slm.slmbi.controller;
import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo;
import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author liangbin
* @date 2021/3/31
*/
@RestController
@RequestMapping("/panel-tree")
@Api(value = "仪表板树接口")
public class InstrumentPanelTreeController {
@GetMapping
@ApiOperation("第一次进入页面,或者点击查询,获取全部分组下的仪表板数据,以及分组数据")
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称")
public R<List<PanelTreeNodeVo>> loadTrees(@RequestParam(value = "name", required = false) String name) {
return R.ok();
}
@GetMapping("/children")
@ApiOperation("点击节点获取,该分组下的仪表板信息,以及分组数据")
@ApiImplicitParams({@ApiImplicitParam(name = "groupId", value = "分组id", required = true),
@ApiImplicitParam(name = "name", value = "分组名称或者仪表板名称")})
public R<List<PanelTreeNodeVo>> children(@RequestParam("groupId") String groupId,
@RequestParam(value = "name", required = false) String name) {
return R.ok();
}
// FIXME 使用场景?
@GetMapping("/selectInstrumentPanelGroups")
@ApiOperation("获取所有的仪表板分组以及分组下的仪表板以及仪表板下的组件")
public R<List<InstrumentPanelGroupVo>> selectInstrumentPanelGroups() {
return R.ok();
}
// TODO 树搜索
}
package com.syc.slm.slmbi.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author liangbin
* @date 2021/3/31
*/
@ApiModel("新增仪表板分组DTO")
@Data
@EqualsAndHashCode(callSuper = true)
public class CreateInstrumentPanelGroupDTO extends InstrumentPanelGroupDTO {
@ApiModelProperty(value = "仪表板分组主键", hidden = true)
private String id;
}
...@@ -16,9 +16,9 @@ import lombok.EqualsAndHashCode; ...@@ -16,9 +16,9 @@ import lombok.EqualsAndHashCode;
@Data @Data
@EqualsAndHashCode(callSuper = false) @EqualsAndHashCode(callSuper = false)
public class InstrumentPanelGroupDTO { public class InstrumentPanelGroupDTO {
@ApiModelProperty(value = "仪表板分组主键(保存非必填)", required = true) @ApiModelProperty(value = "仪表板分组主键", required = true)
private String id; private String id;
@ApiModelProperty(value = "仪表板分组父级主键", required = true) @ApiModelProperty(value = "仪表板分组父级主键,非顶级分组时必填")
private String parentId; private String parentId;
@ApiModelProperty(value = "仪表板分组名称", required = true) @ApiModelProperty(value = "仪表板分组名称", required = true)
private String name; private String name;
......
...@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; ...@@ -4,7 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.syc.slm.slmbi.dto.InstrumentPanelGroupDTO; import com.syc.slm.slmbi.dto.InstrumentPanelGroupDTO;
import com.syc.slm.slmbi.entity.InstrumentPanelGroup; import com.syc.slm.slmbi.entity.InstrumentPanelGroup;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo; import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo;
import com.syc.slm.slmbi.vo.PanelGroupVo; import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import lombok.NonNull; import lombok.NonNull;
import java.util.List; import java.util.List;
...@@ -50,7 +50,7 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro ...@@ -50,7 +50,7 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro
* @param name * @param name
* @return * @return
*/ */
List<PanelGroupVo> loadTrees(String name); List<PanelTreeNodeVo> loadTrees(String name);
/** /**
* 查询下一节点分组 * 查询下一节点分组
...@@ -58,5 +58,5 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro ...@@ -58,5 +58,5 @@ public interface InstrumentPanelGroupService extends IService<InstrumentPanelGro
* @param name * @param name
* @return * @return
*/ */
List<PanelGroupVo> children(String groupId, String name); List<PanelTreeNodeVo> children(String groupId, String name);
} }
package com.syc.slm.slmbi.service.impl; package com.syc.slm.slmbi.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.syc.slm.common.core.util.R;
import com.syc.slm.slmbi.dao.InstrumentPanelGroupMapper; import com.syc.slm.slmbi.dao.InstrumentPanelGroupMapper;
import com.syc.slm.slmbi.dto.InstrumentPanelGroupDTO; import com.syc.slm.slmbi.dto.InstrumentPanelGroupDTO;
import com.syc.slm.slmbi.entity.InstrumentPanelGroup; import com.syc.slm.slmbi.entity.InstrumentPanelGroup;
import com.syc.slm.slmbi.service.InstrumentPanelGroupService; import com.syc.slm.slmbi.service.InstrumentPanelGroupService;
import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo; import com.syc.slm.slmbi.vo.InstrumentPanelGroupVo;
import com.syc.slm.slmbi.vo.PanelGroupVo; import com.syc.slm.slmbi.vo.PanelTreeNodeVo;
import lombok.NonNull; import lombok.NonNull;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
...@@ -44,12 +42,12 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel ...@@ -44,12 +42,12 @@ public class InstrumentPanelGroupServiceImpl extends ServiceImpl<InstrumentPanel
} }
@Override @Override
public List<PanelGroupVo> loadTrees(String name) { public List<PanelTreeNodeVo> loadTrees(String name) {
return null; return null;
} }
@Override @Override
public List<PanelGroupVo> children(String groupId, String name) { public List<PanelTreeNodeVo> children(String groupId, String name) {
return null; return null;
} }
} }
package com.syc.slm.slmbi.vo;
/**
* 仪表板树节点类型
*
* @author liangbin
* @date 2021/3/31
*/
public enum PanelTreeNodeType {
// 分组
GROUP,
// 仪表板
PANEL;
}
...@@ -15,16 +15,14 @@ import lombok.EqualsAndHashCode; ...@@ -15,16 +15,14 @@ import lombok.EqualsAndHashCode;
@Data @Data
@ApiModel(value = "仪表板分组tree vo") @ApiModel(value = "仪表板分组tree vo")
@EqualsAndHashCode(callSuper=false) @EqualsAndHashCode(callSuper = false)
public class PanelGroupVo { public class PanelTreeNodeVo {
@ApiModelProperty(value = "分组或者仪表板主键") @ApiModelProperty(value = "分组或者仪表板主键")
private Integer id; private String id;
@ApiModelProperty(value = "父级id") @ApiModelProperty(value = "父级id")
private String parentId; private String parentId;
@ApiModelProperty(value = "分组名称") @ApiModelProperty(value = "节点名称")
private String groupName; private String name;
@ApiModelProperty(value = "仪表板名称") @ApiModelProperty(value = "节点类型")
private String panelName; private PanelTreeNodeType type;
@ApiModelProperty(value = "1 分组,2 仪表板")
private Integer type;
} }
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