master
parent
a3a35394b4
commit
c9929d953b
|
@ -1,57 +0,0 @@
|
|||
package com.muyu.quest.domain;
|
||||
|
||||
import com.muyu.common.core.annotation.Excel;
|
||||
import com.muyu.common.core.web.domain.BaseEntity;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 任务结点中间表对象 task_node_middle
|
||||
*
|
||||
* @author 2112A
|
||||
* @date 2024-08-23
|
||||
*/
|
||||
|
||||
@Data
|
||||
@Setter
|
||||
@Getter
|
||||
@SuperBuilder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@TableName("task_node_middle")
|
||||
public class TaskNodeMiddle extends BaseEntity{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 自增主键 */
|
||||
@TableId( type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** 任务编码 */
|
||||
@Excel(name = "任务编码")
|
||||
private String taskCode;
|
||||
|
||||
/** 节点编码 */
|
||||
@Excel(name = "节点编码")
|
||||
private String nodeCode;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("taskCode", getTaskCode())
|
||||
.append("nodeCode", getNodeCode())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -3,11 +3,8 @@ package com.muyu.quest.controller;
|
|||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.muyu.common.core.enums.SysDBType;
|
||||
import com.muyu.quest.domain.TaskNodeMiddle;
|
||||
import com.muyu.quest.req.NodeReq;
|
||||
import com.muyu.quest.resp.NodeResp;
|
||||
import com.muyu.quest.service.ITaskNodeMiddleService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
@ -20,7 +17,6 @@ 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.domain.Node;
|
||||
import com.muyu.quest.service.INodeService;
|
||||
import com.muyu.common.core.web.controller.BaseController;
|
||||
|
|
|
@ -1,112 +0,0 @@
|
|||
package com.muyu.quest.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
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.domain.TaskNodeMiddle;
|
||||
import com.muyu.quest.service.ITaskNodeMiddleService;
|
||||
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("/middle")
|
||||
public class TaskNodeMiddleController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private ITaskNodeMiddleService taskNodeMiddleService;
|
||||
|
||||
/**
|
||||
* 查询任务结点中间表列表
|
||||
*/
|
||||
// @RequiresPermissions("quest:middle:list")
|
||||
@GetMapping("/list")
|
||||
public Result<TableDataInfo<TaskNodeMiddle>> list(TaskNodeMiddle taskNodeMiddle)
|
||||
{
|
||||
startPage();
|
||||
List<TaskNodeMiddle> list = taskNodeMiddleService.selectTaskNodeMiddleList(taskNodeMiddle);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出任务结点中间表列表
|
||||
*/
|
||||
// @RequiresPermissions("quest:middle:export")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, TaskNodeMiddle taskNodeMiddle)
|
||||
{
|
||||
List<TaskNodeMiddle> list = taskNodeMiddleService.selectTaskNodeMiddleList(taskNodeMiddle);
|
||||
ExcelUtil<TaskNodeMiddle> util = new ExcelUtil<TaskNodeMiddle>(TaskNodeMiddle.class);
|
||||
util.exportExcel(response, list, "任务结点中间表数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务结点中间表详细信息
|
||||
*/
|
||||
// @RequiresPermissions("quest:middle:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public Result<List<TaskNodeMiddle>> getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(taskNodeMiddleService.selectTaskNodeMiddleById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增任务结点中间表
|
||||
*/
|
||||
// @RequiresPermissions("quest:middle:add")
|
||||
@PostMapping
|
||||
public Result<Integer> add(
|
||||
@Validated @RequestBody TaskNodeMiddle taskNodeMiddle)
|
||||
{
|
||||
if (taskNodeMiddleService.checkIdUnique(taskNodeMiddle)) {
|
||||
return error("新增 任务结点中间表 '" + taskNodeMiddle + "'失败,任务结点中间表已存在");
|
||||
}
|
||||
taskNodeMiddle.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(taskNodeMiddleService.save(taskNodeMiddle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务结点中间表
|
||||
*/
|
||||
// @RequiresPermissions("quest:middle:edit")
|
||||
@PutMapping
|
||||
public Result<Integer> edit(
|
||||
@Validated @RequestBody TaskNodeMiddle taskNodeMiddle)
|
||||
{
|
||||
if (!taskNodeMiddleService.checkIdUnique(taskNodeMiddle)) {
|
||||
return error("修改 任务结点中间表 '" + taskNodeMiddle + "'失败,任务结点中间表不存在");
|
||||
}
|
||||
taskNodeMiddle.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(taskNodeMiddleService.updateById(taskNodeMiddle));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务结点中间表
|
||||
*/
|
||||
// @RequiresPermissions("quest:middle:remove")
|
||||
@DeleteMapping("/{ids}")
|
||||
public Result<Integer> remove(@PathVariable("ids") Long[] ids)
|
||||
{
|
||||
taskNodeMiddleService.removeBatchByIds(Arrays.asList(ids));
|
||||
return success();
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.muyu.quest.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.quest.domain.TaskNodeMiddle;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 任务结点中间表Mapper接口
|
||||
*
|
||||
* @author 2112A
|
||||
* @date 2024-08-23
|
||||
*/
|
||||
@Mapper
|
||||
public interface TaskNodeMiddleMapper extends BaseMapper<TaskNodeMiddle>{
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
package com.muyu.quest.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.quest.domain.TaskNodeMiddle;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 任务结点中间表Service接口
|
||||
*
|
||||
* @author 2112A
|
||||
* @date 2024-08-23
|
||||
*/
|
||||
public interface ITaskNodeMiddleService extends IService<TaskNodeMiddle> {
|
||||
/**
|
||||
* 精确查询任务结点中间表
|
||||
*
|
||||
* @param id 任务结点中间表主键
|
||||
* @return 任务结点中间表
|
||||
*/
|
||||
public TaskNodeMiddle selectTaskNodeMiddleById(Long id);
|
||||
|
||||
/**
|
||||
* 查询任务结点中间表列表
|
||||
*
|
||||
* @param taskNodeMiddle 任务结点中间表
|
||||
* @return 任务结点中间表集合
|
||||
*/
|
||||
public List<TaskNodeMiddle> selectTaskNodeMiddleList(TaskNodeMiddle taskNodeMiddle);
|
||||
|
||||
/**
|
||||
* 判断 任务结点中间表 id是否唯一
|
||||
* @param taskNodeMiddle 任务结点中间表
|
||||
* @return 结果
|
||||
*/
|
||||
Boolean checkIdUnique(TaskNodeMiddle taskNodeMiddle);
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.muyu.quest.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.muyu.quest.req.NodeReq;
|
||||
|
@ -76,13 +77,13 @@ public class NodeServiceImpl
|
|||
public Boolean checkIdUnique(Node node) {
|
||||
LambdaQueryWrapper<Node> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Node::getId, node.getId());
|
||||
return this.count(queryWrapper) > 0;
|
||||
return this.exists(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Node> selectNodeByIds(Long[] ids) {
|
||||
LambdaQueryWrapper<Node> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(Node::getId, ids);
|
||||
queryWrapper.in(Node::getId, Arrays.asList(ids));
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
package com.muyu.quest.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.muyu.common.core.utils.DateUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.muyu.quest.mapper.TaskNodeMiddleMapper;
|
||||
import com.muyu.quest.domain.TaskNodeMiddle;
|
||||
import com.muyu.quest.service.ITaskNodeMiddleService;
|
||||
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 TaskNodeMiddleServiceImpl
|
||||
extends ServiceImpl<TaskNodeMiddleMapper, TaskNodeMiddle>
|
||||
implements ITaskNodeMiddleService {
|
||||
|
||||
/**
|
||||
* 精确查询任务结点中间表
|
||||
*
|
||||
* @param id 任务结点中间表主键
|
||||
* @return 任务结点中间表
|
||||
*/
|
||||
@Override
|
||||
public TaskNodeMiddle selectTaskNodeMiddleById(Long id)
|
||||
{
|
||||
LambdaQueryWrapper<TaskNodeMiddle> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Assert.notNull(id, "id不可为空");
|
||||
queryWrapper.eq(TaskNodeMiddle::getId, id);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询任务结点中间表列表
|
||||
*
|
||||
* @param taskNodeMiddle 任务结点中间表
|
||||
* @return 任务结点中间表
|
||||
*/
|
||||
@Override
|
||||
public List<TaskNodeMiddle> selectTaskNodeMiddleList(TaskNodeMiddle taskNodeMiddle)
|
||||
{
|
||||
LambdaQueryWrapper<TaskNodeMiddle> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotEmpty(taskNodeMiddle.getTaskCode())){
|
||||
queryWrapper.eq(TaskNodeMiddle::getTaskCode, taskNodeMiddle.getTaskCode());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(taskNodeMiddle.getNodeCode())){
|
||||
queryWrapper.eq(TaskNodeMiddle::getNodeCode, taskNodeMiddle.getNodeCode());
|
||||
}
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 唯一 判断
|
||||
* @param taskNodeMiddle 任务结点中间表
|
||||
* @return 任务结点中间表
|
||||
*/
|
||||
@Override
|
||||
public Boolean checkIdUnique(TaskNodeMiddle taskNodeMiddle) {
|
||||
LambdaQueryWrapper<TaskNodeMiddle> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(TaskNodeMiddle::getId, taskNodeMiddle.getId());
|
||||
return this.count(queryWrapper) > 0;
|
||||
}
|
||||
|
||||
}
|
|
@ -62,14 +62,14 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task>
|
|||
public Boolean checkTaskCodeUnique(Task task) {
|
||||
LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Task::getTaskCode, task.getTaskCode());
|
||||
return this.count(queryWrapper) > 0;
|
||||
return this.exists(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean checkIdUnique(Task task) {
|
||||
LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(Task::getId, task.getId());
|
||||
return this.count(queryWrapper) > 0;
|
||||
return this.exists(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue