This commit is contained in:
pan 2024-09-08 20:34:39 +08:00
parent b69682c2d0
commit 1523a4db4f
12 changed files with 816 additions and 3 deletions

View File

@ -171,12 +171,16 @@ public class ToolController extends BaseController
if (add) {
tTool.setProcInstId(processInstanceModel.getProcInstId());
toolService.insertTool(tTool);
/** 保存工具关联关系 **/
toolService.saveToolRelation(tTool, false);
//保存附件
toolService.addFileList(tTool);
//记录申请数据
toolService.recordToolApply(tTool);
} else if (BooleanUtil.isTrue(tTool.getEditStatus())){
toolService.updateTool(tTool);
/** 保存工具关联关系 **/
toolService.saveToolRelation(tTool, true);
//删除附件
toolService.delFile(tTool);
//保存附件
@ -193,7 +197,6 @@ public class ToolController extends BaseController
}
toolService.updateTool(tool);
}
//办结
if(RecordStatusEnum.DONE.getCode().equals(tTool.getRecordStatus())){
//给消息中心发送消息

View File

@ -0,0 +1,107 @@
package com.rzdata.web.controller.tool;
import com.rzdata.common.annotation.Log;
import com.rzdata.common.core.controller.BaseController;
import com.rzdata.common.core.domain.AjaxResult;
import com.rzdata.common.core.page.TableDataInfo;
import com.rzdata.common.enums.BusinessType;
import com.rzdata.common.utils.poi.ExcelUtil;
import com.rzdata.web.domain.ToolRelation;
import com.rzdata.web.service.IToolRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* tool_relationController
*
* @author ja
* @date 2024-09-08
*/
@RestController
@RequestMapping("/system/relation")
public class ToolRelationController extends BaseController
{
@Autowired
private IToolRelationService toolRelationService;
/**
* 查询tool_relation列表
*/
@PreAuthorize("@ss.hasPermi('system:relation:list')")
@GetMapping("/list")
public TableDataInfo list(ToolRelation toolRelation)
{
startPage();
List<ToolRelation> list = toolRelationService.selectToolRelationList(toolRelation);
return getDataTable(list);
}
/**
* 导出tool_relation列表
*/
@PreAuthorize("@ss.hasPermi('system:relation:export')")
@Log(title = "tool_relation", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ToolRelation toolRelation)
{
List<ToolRelation> list = toolRelationService.selectToolRelationList(toolRelation);
ExcelUtil<ToolRelation> util = new ExcelUtil<ToolRelation>(ToolRelation.class);
util.exportExcel(response, list, "tool_relation数据");
}
/**
* 获取tool_relation详细信息
*/
@PreAuthorize("@ss.hasPermi('system:relation:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id)
{
return success(toolRelationService.selectToolRelationById(id));
}
/**
* 新增tool_relation
*/
@PreAuthorize("@ss.hasPermi('system:relation:add')")
@Log(title = "tool_relation", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ToolRelation toolRelation)
{
return toAjax(toolRelationService.insertToolRelation(toolRelation));
}
/**
* 修改tool_relation
*/
@PreAuthorize("@ss.hasPermi('system:relation:edit')")
@Log(title = "tool_relation", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ToolRelation toolRelation)
{
return toAjax(toolRelationService.updateToolRelation(toolRelation));
}
/**
* 删除tool_relation
*/
@PreAuthorize("@ss.hasPermi('system:relation:remove')")
@Log(title = "tool_relation", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(toolRelationService.deleteToolRelationByIds(ids));
}
/**
* three,show展示
*/
@PostMapping("/get/three")
public AjaxResult getDataThree(@RequestBody ToolRelation toolRelation)
{
return success(toolRelationService.getDataThree(toolRelation));
}
}

View File

@ -113,4 +113,6 @@ public class Tool extends BaseEntity
private String statusName;
/** 主键 **/
private List<String> toolIdList;
/** 需要过滤的主键 **/
private List<String> filterToolIds;
}

View File

@ -0,0 +1,38 @@
package com.rzdata.web.domain;
import com.rzdata.common.annotation.Excel;
import com.rzdata.common.core.domain.BaseEntity;
import lombok.Data;
import java.util.List;
/**
* tool_relation对象 t_tool_relation
*
* @author ja
* @date 2024-09-08
*/
@Data
public class ToolRelation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private String id;
/** 源id */
@Excel(name = "源id")
private String resourceId;
/** 目标id */
@Excel(name = "目标id")
private String targetId;
/** 文件编号 */
private String toolCode;
/** 文件名称 */
private String toolName;
/** 资源名称 */
private List<String> resourceIds;
}

View File

@ -0,0 +1,80 @@
package com.rzdata.web.mapper;
import com.rzdata.web.domain.ToolRelation;
import com.rzdata.web.domain.TzMessage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* tool_relationMapper接口
*
* @author ja
* @date 2024-09-08
*/
public interface ToolRelationMapper
{
/**
* 查询tool_relation
*
* @param id tool_relation主键
* @return tool_relation
*/
public ToolRelation selectToolRelationById(String id);
/**
* 查询tool_relation列表
*
* @param toolRelation tool_relation
* @return tool_relation集合
*/
public List<ToolRelation> selectToolRelationList(ToolRelation toolRelation);
public List<ToolRelation> selectRelationToolList(ToolRelation toolRelation);
/**
* 新增tool_relation
*
* @param toolRelation tool_relation
* @return 结果
*/
public int insertToolRelation(ToolRelation toolRelation);
/**
* 修改tool_relation
*
* @param toolRelation tool_relation
* @return 结果
*/
public int updateToolRelation(ToolRelation toolRelation);
/**
* 删除tool_relation
*
* @param id tool_relation主键
* @return 结果
*/
public int deleteToolRelationById(String id);
/** 根据资源id和目标id去删除 **/
public int deleteResourceAndTarget(ToolRelation toolRelation);
/** 根据目标id和源id去删除 **/
public int deleteTargetAndResource(ToolRelation toolRelation);
/**
* 批量删除tool_relation
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteToolRelationByIds(String[] ids);
/**
* 批量插入
* @param toolRelationList
* @return
*/
public int batchInsert(@Param("toolRelationList") List<ToolRelation> toolRelationList);
}

View File

@ -0,0 +1,78 @@
package com.rzdata.web.service;
import com.rzdata.common.core.domain.ToolTreeSelect;
import com.rzdata.web.domain.ToolRelation;
import java.util.List;
/**
* tool_relationService接口
*
* @author ja
* @date 2024-09-08
*/
public interface IToolRelationService
{
/**
* 查询tool_relation
*
* @param id tool_relation主键
* @return tool_relation
*/
public ToolRelation selectToolRelationById(String id);
/**
* 查询tool_relation列表
*
* @param toolRelation tool_relation
* @return tool_relation集合
*/
public List<ToolRelation> selectToolRelationList(ToolRelation toolRelation);
public List<ToolRelation> selectRelationToolList(ToolRelation toolRelation);
/**
* 新增tool_relation
*
* @param toolRelation tool_relation
* @return 结果
*/
public int insertToolRelation(ToolRelation toolRelation);
/**
* 修改tool_relation
*
* @param toolRelation tool_relation
* @return 结果
*/
public int updateToolRelation(ToolRelation toolRelation);
/**
* 批量删除tool_relation
*
* @param ids 需要删除的tool_relation主键集合
* @return 结果
*/
public int deleteToolRelationByIds(String[] ids);
/**
* 删除tool_relation信息
*
* @param id tool_relation主键
* @return 结果
*/
public int deleteToolRelationById(String id);
/**
* 获取数据树
* @param toolRelation
* @return
*/
List<ToolTreeSelect> getDataThree(ToolRelation toolRelation);
public int batchInsert(List<ToolRelation> toolRelationList);
/**根据资源id和目标id去删除 **/
public int deleteResourceAndTarget(ToolRelation toolRelation);
/** 根据目标id和源id去删除 **/
public int deleteTargetAndResource(ToolRelation toolRelation);
}

View File

@ -31,6 +31,10 @@ public interface IToolService
*/
public List<Tool> selectToolList(Tool tool);
/** 查询所有数据 **/
public List<Tool> selectAllNotAuthList(Tool tool);
/**
* 新增工具信息
*
@ -39,6 +43,14 @@ public interface IToolService
*/
public int insertTool(Tool tool);
/**
* 新增工具关联关系信息
*
* @param tool 工具信息
* @return 结果
*/
public void saveToolRelation(Tool tool, Boolean isDel);
public boolean checkToolExist(Tool tTool);
/**

View File

@ -0,0 +1,302 @@
package com.rzdata.web.service.impl;
import java.sql.Struct;
import java.util.*;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.rzdata.common.core.domain.ToolTreeSelect;
import com.rzdata.common.core.domain.TreeSelect;
import com.rzdata.common.core.domain.entity.SysDept;
import com.rzdata.common.utils.StringUtils;
import com.rzdata.web.domain.Tool;
import com.rzdata.web.domain.ToolRelation;
import com.rzdata.web.mapper.ToolRelationMapper;
import com.rzdata.web.service.IToolRelationService;
import com.rzdata.web.service.IToolService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* tool_relationService业务层处理
*
* @author ja
* @date 2024-09-08
*/
@Service
public class ToolRelationServiceImpl implements IToolRelationService
{
@Autowired
private ToolRelationMapper toolRelationMapper;
@Autowired
private IToolService toolService;
/**
* 查询tool_relation
*
* @param id tool_relation主键
* @return tool_relation
*/
@Override
public ToolRelation selectToolRelationById(String id)
{
return toolRelationMapper.selectToolRelationById(id);
}
/**
* 查询tool_relation列表
*
* @param toolRelation tool_relation
* @return tool_relation
*/
@Override
public List<ToolRelation> selectToolRelationList(ToolRelation toolRelation)
{
return toolRelationMapper.selectToolRelationList(toolRelation);
}
@Override
public List<ToolRelation> selectRelationToolList(ToolRelation toolRelation)
{
return toolRelationMapper.selectRelationToolList(toolRelation);
}
/**
* 新增tool_relation
*
* @param toolRelation tool_relation
* @return 结果
*/
@Override
public int insertToolRelation(ToolRelation toolRelation)
{
return toolRelationMapper.insertToolRelation(toolRelation);
}
/**
* 修改tool_relation
*
* @param toolRelation tool_relation
* @return 结果
*/
@Override
public int updateToolRelation(ToolRelation toolRelation)
{
return toolRelationMapper.updateToolRelation(toolRelation);
}
/**
* 批量删除tool_relation
*
* @param ids 需要删除的tool_relation主键
* @return 结果
*/
@Override
public int deleteToolRelationByIds(String[] ids)
{
return toolRelationMapper.deleteToolRelationByIds(ids);
}
/**
* 批量删除
*/
@Override
public int batchInsert(List<ToolRelation> toolRelationList)
{
return toolRelationMapper.batchInsert(toolRelationList);
}
/**
* 删除tool_relation信息
*
* @param id tool_relation主键
* @return 结果
*/
@Override
public int deleteToolRelationById(String id)
{
return toolRelationMapper.deleteToolRelationById(id);
}
/**
* 获取数据树权限
* @param toolRelation
* @return
*/
@Override
public List<ToolTreeSelect> getDataThree(ToolRelation toolRelation) {
if(CollUtil.isEmpty(toolRelation.getResourceIds())){
return null;
}
List<ToolRelation> toolRelations = this.selectRelationToolList(toolRelation);
//拿到C的数据
ToolRelation toolRelation1 = toolRelations.get(0);
// 查询数据库中的所有工具关系
List<ToolRelation> allToolRelations = this.selectRelationToolList(null);
return getDataThree(toolRelation1.getResourceId());
/*//查询所有关联的数据最后在组装起来
List<ToolRelation> toolRelations = this.selectRelationToolList(toolRelation);
//查询所有数据
List<ToolRelation> allToolRelation = this.selectRelationToolList(null);*/
// 查询所有与 C 相关的工具关系
//List<ToolRelation> relatedToolRelations = this.selectRelationToolList(toolRelation);
/*
// C 开始构建树形结构
List<ToolTreeSelect> treeSelects = relatedToolRelations.stream()
.map(tr -> buildChildren(tr, allToolRelations, new HashSet<>()))
.filter(Objects::nonNull)
.collect(Collectors.toList());
*/
// 构建树形结构 C 向上递归查找父节点
/* ToolTreeSelect treeSelect = buildParentTree(toolRelation, allToolRelations, new HashSet<>());
return treeSelect != null ? Collections.singletonList(treeSelect) : new ArrayList<>();*/
}
public List<ToolTreeSelect> getDataThree(String toolResourceId) {
// 创建链条列表用于存储递归结果
List<ToolTreeSelect> toolChain = new ArrayList<>();
// 从工具 resourceId 开始递归查找
buildToolChain(toolResourceId, toolChain);
return toolChain;
}
// 递归构建工具链
private void buildToolChain(String resourceId, List<ToolTreeSelect> toolChain) {
// 根据 resourceId 查找当前工具关联关系
ToolRelation currentToolRelation = this.findToolRelationByResourceId(resourceId);
if (currentToolRelation != null) {
// 将当前工具加入链条
ToolTreeSelect currentTool = new ToolTreeSelect();
currentTool.setId(currentToolRelation.getId());
currentTool.setLabel(currentToolRelation.getToolName()); // 假设有工具名称字段
toolChain.add(currentTool);
// 如果当前工具的 target_id 不为空则继续向上递归
if (currentToolRelation.getTargetId() != null) {
buildToolChain(currentToolRelation.getTargetId(), toolChain);
}
}
}
// 根据 resourceId 查找 ToolRelation
private ToolRelation findToolRelationByResourceId(String resourceId) {
// 在数据库中查询 toolRelation 记录
ToolRelation queryToolRelation = new ToolRelation();
queryToolRelation.setResourceId(resourceId);
List<ToolRelation> toolRelations = this.selectRelationToolList(queryToolRelation);
return toolRelations.isEmpty() ? null : toolRelations.get(0);
}
// 递归向上构建父节点
private ToolTreeSelect buildParentTree(ToolRelation currentToolRelation, List<ToolRelation> allToolRelation, Set<String> visited) {
// 检查是否已经访问过该节点避免死循环
if (visited.contains(currentToolRelation.getId())) {
return null; // 如果已访问直接返回 null
}
visited.add(currentToolRelation.getId()); // 记录已访问的节点
// 构建当前节点的 TreeSelect
ToolTreeSelect node = new ToolTreeSelect();
node.setId(currentToolRelation.getResourceId()); // 设置节点 ID resourceId
node.setLabel(currentToolRelation.getToolName()); // 假设 ToolRelation 中有工具名称
// 查找父节点向上递归查找与当前节点的 resource_id 对应的 target_id
List<ToolTreeSelect> parents = allToolRelation.stream()
.filter(t -> currentToolRelation.getResourceId().equals(t.getTargetId())) // 找到父节点
.map(t -> buildParentTree(t, allToolRelation, visited)) // 递归处理父节点
.filter(Objects::nonNull) // 过滤掉 null 的父节点
.collect(Collectors.toList());
// 如果有父节点则将父节点设置为 children
node.setChildren(parents);
return node;
}
private List<ToolTreeSelect> buildTwoTreeSelect(List<Tool> tools) {
List<ToolTreeSelect> treeSelectList = new ArrayList<>();
for (Tool tool : tools) {
// 构建当前节点的 TreeSelect
ToolTreeSelect node = new ToolTreeSelect();
node.setId(tool.getToolId());
node.setLabel(tool.getToolName()); // 你可能有其他字段例如 types可在此处设置
node.setChildren(new ArrayList<>()); // 你可能有其他字段例如 types可在此处设置
treeSelectList.add(node);
}
return treeSelectList;
}
// 递归构建树形结构
private List<ToolTreeSelect> buildToolTreeSelect(List<ToolRelation> tools, List<ToolRelation> allToolRelation) {
// 找到根节点没有父节点的工具关系
List<ToolTreeSelect> treeSelectList = tools.stream()
.filter(t -> allToolRelation.stream().noneMatch(r -> r.getTargetId().equals(t.getResourceId()))) // 根节点判定targetId 没有匹配 resourceId
.map(t -> buildChildren(t, allToolRelation, new HashSet<>()))
.filter(Objects::nonNull) // 过滤掉空的节点
.collect(Collectors.toList());
return treeSelectList;
}
// 构建子节点
private ToolTreeSelect buildChildren(ToolRelation toolRelation, List<ToolRelation> allToolRelation, Set<String> visited) {
// 检查是否已经访问过该节点避免死循环
if (visited.contains(toolRelation.getId())) {
return null; // 如果已访问直接返回 null
}
visited.add(toolRelation.getId()); // 记录已访问的节点
// 构建当前节点的 TreeSelect
ToolTreeSelect node = new ToolTreeSelect();
node.setId(toolRelation.getResourceId()); // 设置节点 ID resourceId
node.setLabel(toolRelation.getToolName()); // 假设 toolName 是工具名称
// 查找子节点递归构建
List<ToolTreeSelect> children = allToolRelation.stream()
.filter(t -> toolRelation.getTargetId().equals(t.getResourceId())) // 找到当前节点的子节点
.map(t -> buildChildren(t, allToolRelation, visited)) // 递归处理子节点
.filter(Objects::nonNull) // 过滤掉 null 的子节点
.collect(Collectors.toList());
node.setChildren(children); // 设置子节点
return node;
}
/**
* 根据资源id和目标id去删除
* @param toolRelation
* @return
*/
@Override
public int deleteResourceAndTarget(ToolRelation toolRelation)
{
return toolRelationMapper.deleteResourceAndTarget(toolRelation);
}
/**
* 根据目标id和源id去删除
* @param toolRelation
* @return
*/
@Override
public int deleteTargetAndResource(ToolRelation toolRelation)
{
return toolRelationMapper.deleteTargetAndResource(toolRelation);
}
}

View File

@ -5,6 +5,7 @@ import cn.hutool.core.lang.Snowflake;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.blueland.bpmclient.model.BpmClientInputModel;
import com.rzdata.common.annotation.DataScope;
import com.rzdata.common.constant.Constants;
@ -54,11 +55,9 @@ public class ToolServiceImpl implements IToolService
@Autowired
private Snowflake snowflake;
@Autowired
private ITzMessageService tzMessageService;
@Autowired
private ISysDictTypeService sysDictTypeService;
@ -69,6 +68,10 @@ public class ToolServiceImpl implements IToolService
@Autowired
private ISysDeptService sysDeptService;
/** 工具管理表 **/
@Autowired
private IToolRelationService iToolRelationService;
/**
* 查询工具信息
*
@ -104,6 +107,15 @@ public class ToolServiceImpl implements IToolService
return toolMapper.selectToolList(tool);
}
/**
* 查询所有数据不走任何
* @return
*/
@Override
public List<Tool> selectAllNotAuthList(Tool tool){
return toolMapper.selectToolList(tool);
}
/**
* 新增工具信息
*
@ -118,6 +130,39 @@ public class ToolServiceImpl implements IToolService
return toolMapper.insertTool(tool);
}
/**
* 保存关联关系
* @param tool
*/
@Override
public void saveToolRelation(Tool tool, Boolean isDel) {
if(StrUtil.isNotBlank(tool.getAssociation())){
List<Tool> tools = JSONUtil.toList(tool.getAssociation(), Tool.class);
//关联
List<ToolRelation> associationToolList = new ArrayList<>();
//被关联的数据
for (Tool toolItem : tools) {
ToolRelation toolRelation = new ToolRelation();
toolRelation.setId(String.valueOf(snowflake.nextId()));
toolRelation.setResourceId(tool.getToolId());
toolRelation.setTargetId(toolItem.getToolId());
associationToolList.add(toolRelation);
if(isDel){
iToolRelationService.deleteResourceAndTarget(toolRelation);
}
}
// 使用AtomicInteger来跟踪索引
AtomicInteger counter = new AtomicInteger(0);
// 使用Stream API进行分组
Map<Integer, List<ToolRelation>> grouped = associationToolList.stream()
.collect(Collectors.groupingBy(
e -> counter.getAndIncrement() / 500
));
// 对每个子列表进行批量插入
grouped.values().forEach(batch -> iToolRelationService.batchInsert(batch));
}
}
@Override
public boolean checkToolExist(Tool tTool)
{

View File

@ -184,6 +184,12 @@
#{id}
</foreach>
</if>
<if test="filterToolIds != null and filterToolIds.size() > 0">
and u.tool_id not in
<foreach item="id" index="index" collection="filterToolIds" open="(" separator="," close=")">
#{id}
</foreach>
</if>
${params.dataScope}
order by create_time desc
</select>

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.rzdata.web.mapper.ToolRelationMapper">
<resultMap type="ToolRelation" id="ToolRelationResult">
<result property="id" column="id" />
<result property="resourceId" column="resource_id" />
<result property="targetId" column="target_id" />
<result property="toolCode" column="tool_code" />
<result property="toolName" column="tool_name" />
</resultMap>
<sql id="selectToolRelationVo">
select id, resource_id, target_id from t_tool_relation
</sql>
<select id="selectToolRelationList" parameterType="ToolRelation" resultMap="ToolRelationResult">
<include refid="selectToolRelationVo"/>
<where>
<if test="resourceId != null and resourceId != ''"> and resource_id = #{resourceId}</if>
<if test="targetId != null and targetId != ''"> and target_id = #{targetId}</if>
</where>
</select>
<select id="selectRelationToolList" parameterType="ToolRelation" resultMap="ToolRelationResult">
select
tr.id, tr.resource_id, tr.target_id,tl.tool_code,tl.tool_name
from t_tool_relation tr
left join t_tool tl on tr.target_id = tl.tool_id
<where>
<if test="resourceId != null and resourceId != ''"> and tr.resource_id = #{resourceId}</if>
<if test="targetId != null and targetId != ''"> and tr.target_id = #{targetId}</if>
<if test="resourceIds != null and resourceIds.size() > 0">
and tr.resource_id in
<foreach item="id" index="index" collection="resourceIds" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</where>
</select>
<select id="selectToolRelationById" parameterType="String" resultMap="ToolRelationResult">
<include refid="selectToolRelationVo"/>
where id = #{id}
</select>
<insert id="insertToolRelation" parameterType="ToolRelation">
insert into t_tool_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="resourceId != null">resource_id,</if>
<if test="targetId != null">target_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="resourceId != null">#{resourceId},</if>
<if test="targetId != null">#{targetId},</if>
</trim>
</insert>
<update id="updateToolRelation" parameterType="ToolRelation">
update t_tool_relation
<trim prefix="SET" suffixOverrides=",">
<if test="resourceId != null">resource_id = #{resourceId},</if>
<if test="targetId != null">target_id = #{targetId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteToolRelationById" parameterType="String">
delete from t_tool_relation where id = #{id}
</delete>
<delete id="deleteResourceAndTarget" parameterType="String">
delete from t_tool_relation where resource_id = #{resourceId} and target_id = #{targetId}
</delete>
<delete id="deleteTargetAndResource" parameterType="String">
delete from t_tool_relation where target_id = #{targetId} and resource_id = #{resourceId}
</delete>
<delete id="deleteToolRelationByIds" parameterType="String">
delete from t_tool_relation where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<!-- 批量插入 -->
<insert id="batchInsert" parameterType="java.util.List">
insert into t_tool_relation (id, resource_id, target_id)
values
<foreach item="item" index="index" collection="toolRelationList" open="(" separator="),(" close=")">
#{item.id}, #{item.resourceId}, #{item.targetId}
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,39 @@
package com.rzdata.common.core.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.rzdata.common.core.domain.entity.SysDept;
import com.rzdata.common.core.domain.entity.SysMenu;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* Treeselect树结构实体类
*
* @author ruoyi
*/
@Data
public class ToolTreeSelect implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private String id;
/** 节点名称 */
private String label;
/** 类型 */
private String types;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<ToolTreeSelect> children;
public ToolTreeSelect()
{
}
}