新增节点管理相关接口
parent
738999100b
commit
a23c32aab5
|
@ -6,13 +6,15 @@ import lombok.*;
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 节点对象 node_source
|
* 节点管理对象 node_source
|
||||||
*
|
*
|
||||||
* @author 2112A
|
* @author 2112A
|
||||||
* @date 2024-08-22
|
* @date 2024-08-23
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
@ -21,10 +23,12 @@ import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
@SuperBuilder
|
@SuperBuilder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@TableName("node_source")
|
||||||
public class Node extends BaseEntity{
|
public class Node extends BaseEntity{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 自增主键 */
|
/** 自增主键 */
|
||||||
|
@TableId( type = IdType.AUTO)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 节点编码 */
|
/** 节点编码 */
|
||||||
|
@ -55,78 +59,7 @@ public class Node extends BaseEntity{
|
||||||
@Excel(name = "启用状态")
|
@Excel(name = "启用状态")
|
||||||
private String state;
|
private String state;
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
public void setNodeCode(String nodeCode)
|
|
||||||
{
|
|
||||||
this.nodeCode = nodeCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeCode()
|
|
||||||
{
|
|
||||||
return nodeCode;
|
|
||||||
}
|
|
||||||
public void setNodeName(String nodeName)
|
|
||||||
{
|
|
||||||
this.nodeName = nodeName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeName()
|
|
||||||
{
|
|
||||||
return nodeName;
|
|
||||||
}
|
|
||||||
public void setNodeReq(String nodeReq)
|
|
||||||
{
|
|
||||||
this.nodeReq = nodeReq;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeReq()
|
|
||||||
{
|
|
||||||
return nodeReq;
|
|
||||||
}
|
|
||||||
public void setNodeResp(String nodeResp)
|
|
||||||
{
|
|
||||||
this.nodeResp = nodeResp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeResp()
|
|
||||||
{
|
|
||||||
return nodeResp;
|
|
||||||
}
|
|
||||||
public void setNodePreCode(String nodePreCode)
|
|
||||||
{
|
|
||||||
this.nodePreCode = nodePreCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodePreCode()
|
|
||||||
{
|
|
||||||
return nodePreCode;
|
|
||||||
}
|
|
||||||
public void setNodeNextCode(String nodeNextCode)
|
|
||||||
{
|
|
||||||
this.nodeNextCode = nodeNextCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getNodeNextCode()
|
|
||||||
{
|
|
||||||
return nodeNextCode;
|
|
||||||
}
|
|
||||||
public void setState(String state)
|
|
||||||
{
|
|
||||||
this.state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getState()
|
|
||||||
{
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.muyu.quest.controller;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.quest.domain.Node;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.muyu.quest.service.INodeService;
|
||||||
|
import com.muyu.common.core.web.controller.BaseController;
|
||||||
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.muyu.common.security.utils.SecurityUtils;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点管理Controller
|
||||||
|
*
|
||||||
|
* @author 2112A
|
||||||
|
* @date 2024-08-23
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/Node")
|
||||||
|
public class NodeController extends BaseController
|
||||||
|
{
|
||||||
|
@Resource
|
||||||
|
private INodeService nodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点管理列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("Node:Node:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public Result<TableDataInfo<Node>> list(Node node)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Node> list = nodeService.selectNodeList(node);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出节点管理列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("Node:Node:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, Node node)
|
||||||
|
{
|
||||||
|
List<Node> list = nodeService.selectNodeList(node);
|
||||||
|
ExcelUtil<Node> util = new ExcelUtil<Node>(Node.class);
|
||||||
|
util.exportExcel(response, list, "节点管理数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取节点管理详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("Node:Node:query")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public Result<List<Node>> getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(nodeService.selectNodeById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增节点管理
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("Node:Node:add")
|
||||||
|
@PostMapping
|
||||||
|
public Result<Integer> add(
|
||||||
|
@Validated @RequestBody Node node)
|
||||||
|
{
|
||||||
|
if (nodeService.checkIdUnique(node)) {
|
||||||
|
return error("新增 节点管理 '" + node + "'失败,节点管理已存在");
|
||||||
|
}
|
||||||
|
node.setCreateBy(SecurityUtils.getUsername());
|
||||||
|
return toAjax(nodeService.save(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改节点管理
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("Node:Node:edit")
|
||||||
|
@PutMapping
|
||||||
|
public Result<Integer> edit(
|
||||||
|
@Validated @RequestBody Node node)
|
||||||
|
{
|
||||||
|
if (!nodeService.checkIdUnique(node)) {
|
||||||
|
return error("修改 节点管理 '" + node + "'失败,节点管理不存在");
|
||||||
|
}
|
||||||
|
node.setUpdateBy(SecurityUtils.getUsername());
|
||||||
|
return toAjax(nodeService.updateById(node));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除节点管理
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("Node:Node:remove")
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||||
|
{
|
||||||
|
nodeService.removeBatchByIds(Arrays.asList(ids));
|
||||||
|
return success();
|
||||||
|
}
|
||||||
|
}
|
|
@ -53,7 +53,7 @@ public class TaskController extends BaseController
|
||||||
* 获取任务详细信息
|
* 获取任务详细信息
|
||||||
*/
|
*/
|
||||||
// @RequiresPermissions("quest:quest:query")
|
// @RequiresPermissions("quest:quest:query")
|
||||||
@GetMapping(value = "selectTaskByTaskCode/{taskCode}")
|
@GetMapping(value = "/selectTaskByTaskCode/{taskCode}")
|
||||||
public Result<List<Task>> getInfo(@PathVariable("taskCode") String taskCode) {
|
public Result<List<Task>> getInfo(@PathVariable("taskCode") String taskCode) {
|
||||||
return success(taskService.selectTaskByTaskCode(taskCode));
|
return success(taskService.selectTaskByTaskCode(taskCode));
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ public class TaskController extends BaseController
|
||||||
* 获取任务详细信息
|
* 获取任务详细信息
|
||||||
*/
|
*/
|
||||||
// @RequiresPermissions("quest:quest:query")
|
// @RequiresPermissions("quest:quest:query")
|
||||||
@GetMapping(value = "selectTaskById/{id}")
|
@GetMapping(value = "/selectTaskById/{id}")
|
||||||
public Result<List<Task>> getInfo(@PathVariable("id") Long id) {
|
public Result<List<Task>> getInfo(@PathVariable("id") Long id) {
|
||||||
return success(taskService.selectTaskById(id));
|
return success(taskService.selectTaskById(id));
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.muyu.quest.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.muyu.quest.domain.Node;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点管理Mapper接口
|
||||||
|
*
|
||||||
|
* @author 2112A
|
||||||
|
* @date 2024-08-23
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface NodeMapper extends BaseMapper<Node>{
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
package com.muyu.quest.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.muyu.quest.domain.Node;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点管理Service接口
|
||||||
|
*
|
||||||
|
* @author 2112A
|
||||||
|
* @date 2024-08-23
|
||||||
|
*/
|
||||||
|
public interface INodeService extends IService<Node> {
|
||||||
|
/**
|
||||||
|
* 精确查询节点管理
|
||||||
|
*
|
||||||
|
* @param id 节点管理主键
|
||||||
|
* @return 节点管理
|
||||||
|
*/
|
||||||
|
public Node selectNodeById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点管理列表
|
||||||
|
*
|
||||||
|
* @param node 节点管理
|
||||||
|
* @return 节点管理集合
|
||||||
|
*/
|
||||||
|
public List<Node> selectNodeList(Node node);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断 节点管理 id是否唯一
|
||||||
|
* @param node 节点管理
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
Boolean checkIdUnique(Node node);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.muyu.quest.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.muyu.quest.domain.Node;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.muyu.quest.mapper.NodeMapper;
|
||||||
|
import com.muyu.quest.service.INodeService;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.muyu.common.core.utils.StringUtils;
|
||||||
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 节点管理Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 2112A
|
||||||
|
* @date 2024-08-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class NodeServiceImpl
|
||||||
|
extends ServiceImpl<NodeMapper, Node>
|
||||||
|
implements INodeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 精确查询节点管理
|
||||||
|
*
|
||||||
|
* @param id 节点管理主键
|
||||||
|
* @return 节点管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Node selectNodeById(Long id)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<Node> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
Assert.notNull(id, "id不可为空");
|
||||||
|
queryWrapper.eq(Node::getId, id);
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询节点管理列表
|
||||||
|
*
|
||||||
|
* @param node 节点管理
|
||||||
|
* @return 节点管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Node> selectNodeList(Node node)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<Node> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
if (StringUtils.isNotEmpty(node.getNodeName())){
|
||||||
|
queryWrapper.like(Node::getNodeName, node.getNodeName());
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotEmpty(node.getState())){
|
||||||
|
queryWrapper.eq(Node::getState, node.getState());
|
||||||
|
}
|
||||||
|
return this.list(queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 唯一 判断
|
||||||
|
* @param node 节点管理
|
||||||
|
* @return 节点管理
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean checkIdUnique(Node node) {
|
||||||
|
LambdaQueryWrapper<Node> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(Node::getId, node.getId());
|
||||||
|
return this.count(queryWrapper) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue