工具发布流程和使用申请流程细节优化

This commit is contained in:
liukang 2024-08-28 14:50:05 +08:00
parent 0e18f96534
commit a230a1c2d8
16 changed files with 222 additions and 132 deletions

View File

@ -4,24 +4,26 @@ import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.IdUtil;
import com.blueland.bpmclient.model.ProcessInstanceModel;
import com.rzdata.common.annotation.Log;
import com.rzdata.common.constant.Constants;
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.BizExceptionCodeEnum;
import com.rzdata.common.enums.BusinessType;
import com.rzdata.common.enums.RecordStatusEnum;
import com.rzdata.common.exception.RestException;
import com.rzdata.common.utils.SecurityUtils;
import com.rzdata.common.utils.StringUtils;
import com.rzdata.common.utils.poi.ExcelUtil;
import com.rzdata.system.service.ISysDeptService;
import com.rzdata.web.domain.Tool;
import com.rzdata.web.service.IToolService;
import com.rzdata.web.service.IUseApplyService;
import com.rzdata.web.service.WorkflowService;
import io.swagger.annotations.ApiOperation;
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.ArrayList;
import java.util.List;
/**
@ -40,6 +42,12 @@ public class ToolController extends BaseController
@Autowired
private WorkflowService workflowService;
@Autowired
private IUseApplyService iUseApplyService;
@Autowired
private ISysDeptService iSysDeptService;
/**
* 查询工具信息列表
*/
@ -48,6 +56,17 @@ public class ToolController extends BaseController
{
startPage();
List<Tool> list = toolService.selectToolList(tool);
//前端传传参开启下载权限验证
if (BooleanUtil.isTrue(tool.getDownloadCheck())) {
String userId = SecurityUtils.getUserId().toString();
for (Tool vo:list) {
//已发布的工具 是创建人 或者 配置了下载权限 或者 通过了使用申请的
vo.setDownloadStatus(RecordStatusEnum.DONE.getCode().equals(vo.getRecordStatus())&&
(userId.equals(vo.getCreateBy())||
SecurityUtils.hasPermi(Constants.DOWNLOAD_TOOL_PERMISSION)||
iUseApplyService.checkUseApply(vo.getToolId(),userId)));
}
}
return getDataTable(list);
}
@ -60,7 +79,7 @@ public class ToolController extends BaseController
{
List<Tool> list = toolService.selectToolList(tTool);
ExcelUtil<Tool> util = new ExcelUtil<Tool>(Tool.class);
util.exportExcel(response, list, "工具信息数据");
util.exportExcel(response, list, "工具信息数据",tTool.getExcludeFields());
}
/**
@ -78,7 +97,9 @@ public class ToolController extends BaseController
@GetMapping(value = "/bpmc/{bpmcId}")
public AjaxResult getInfoByBpmcId(@PathVariable("bpmcId") String bpmcId)
{
return success(toolService.getInfoByBpmcId(bpmcId));
Tool tool= toolService.getInfoByBpmcId(bpmcId);
tool.setToolRespDeptName(iSysDeptService.getDeptName(tool.getToolRespDept()));
return success(tool);
}
@ApiOperation("判断文件名称是否存在 true 存在 false 不存在")

View File

@ -129,8 +129,8 @@ public class UseApplyController extends BaseController
useApplyItemService.updateItemList(useApply.getItemList(),useApply.getId());
}else {
UseApply updateStatus = new UseApply();
useApply.setId(useApply.getId());
useApply.setRecordStatus(useApply.getRecordStatus());
updateStatus.setId(useApply.getId());
updateStatus.setRecordStatus(useApply.getRecordStatus());
useApplyService.updateUseApply(updateStatus);
}
return AjaxResult.success("操作成功",processInstanceModel);

View File

@ -9,6 +9,8 @@ import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.List;
/**
* 工具信息对象 t_tool
*
@ -24,70 +26,64 @@ public class Tool extends BaseEntity
private String toolId;
/** 工具编号 */
@Excel(name = "工具编号")
private String toolCode;
/** 工具名称 */
@Excel(name = "工具名称")
@Excel(name = "工具名称",sort=1)
private String toolName;
/** 工具类别 */
@Excel(name = "工具类别")
@Excel(name = "工具类别",dictType="tool_type",sort=2)
private String toolType;
/** 来源 */
@Excel(name = "来源")
@Excel(name = "工具来源",sort=3)
private String toolSource;
/** 用途 */
@Excel(name = "用途")
@Excel(name = "工具用途",sort=7)
private String toolUse;
/** 测试情况 */
@Excel(name = "试情况")
@Excel(name = "评情况",sort=8)
private String testSituation;
/** 功能描述 */
@Excel(name = "功能描述")
@Excel(name = "功能描述",sort=9)
private String functionDesc;
/** 适用条件 */
@Excel(name = "适用条件")
@Excel(name = "适用条件",sort=10)
private String applyCondition;
/** 操作说明 */
@Excel(name = "操作说明")
@Excel(name = "操作说明",sort=11)
private String operateExplain;
/** 负责人 */
@Excel(name = "负责人")
private String toolPrincipals;
/** 负责人名称 */
@Excel(name = "负责人")
@Excel(name = "负责人",sort=4)
private String toolPrincipalsName;
/** 归属单位 */
@Excel(name = "归属单位")
private String toolRespDept;
@Excel(name = "归属单位",sort=5)
private String toolRespDeptName;
/** 状态 */
@Excel(name = "状态")
@Excel(name = "状态",dictType="sys_normal_disable",sort=6)
private String status;
/** 备注 */
@Excel(name = "备注",sort=12)
private String remark;
/** 发布时间 */
private String releaseTime;
/** 部门对象 */
@Excels({
@Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
@Excel(name = "部门负责人", targetAttr = "leader", type = Excel.Type.EXPORT)
})
private SysDept dept;
private BpmClientInputModelBo bpmClientInputModel;
private String recordStatus;
@ -95,4 +91,14 @@ public class Tool extends BaseEntity
private Boolean editStatus;
private String procInstId;
private Boolean permissionCheck;
private Boolean permission;
private Boolean downloadCheck;
private Boolean downloadStatus;
private List<String> excludeFields;
}

View File

@ -3,6 +3,7 @@ package com.rzdata.web.mapper;
import java.util.List;
import com.rzdata.web.domain.UseApply;
import com.rzdata.web.domain.Tool;
import org.apache.ibatis.annotations.Param;
/**
* 使用申请Mapper接口
@ -61,4 +62,6 @@ public interface UseApplyMapper
* @return 结果
*/
public int deleteUseApplyByIds(String[] ids);
int checkUseApply(@Param("toolId") String toolId, @Param("userId") String userId);
}

View File

@ -61,4 +61,6 @@ public interface IUseApplyService
* @return 结果
*/
public int deleteUseApplyById(String id);
boolean checkUseApply(String toolId, String userId);
}

View File

@ -1,6 +1,8 @@
package com.rzdata.web.service.impl;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.IdUtil;
import com.rzdata.common.constant.Constants;
import com.rzdata.common.utils.DateUtils;
import com.rzdata.common.utils.SecurityUtils;
import com.rzdata.web.domain.Tool;
@ -49,6 +51,9 @@ public class ToolServiceImpl implements IToolService
@Override
public List<Tool> selectToolList(Tool tool)
{
if (BooleanUtil.isTrue(tool.getPermissionCheck())) {
tool.setPermission(SecurityUtils.hasPermi(Constants.VIEW_TOOL_PERMISSION));
}
return toolMapper.selectToolList(tool);
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.rzdata.common.utils.DateUtils;
import com.rzdata.common.utils.SecurityUtils;
import com.rzdata.web.domain.Tool;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.rzdata.web.mapper.UseApplyMapper;
@ -101,4 +102,8 @@ public class UseApplyServiceImpl implements IUseApplyService
{
return useApplyMapper.deleteUseApplyById(id);
}
public boolean checkUseApply(String toolId, String userId){
return useApplyMapper.checkUseApply(toolId, userId)>0;
}
}

View File

@ -130,5 +130,5 @@ xss:
bpmc:
tenantId: TLTC_SYS
serviceUrl: http://192.168.2.20:8081/ebpm-process-rest/
serviceUrl: http://192.168.2.18:8081/ebpm-process-rest/
uniteWorkUrl: http://localhost/tool-tech/workflowRouter

View File

@ -18,6 +18,7 @@
<result property="toolPrincipals" column="tool_principals" />
<result property="toolPrincipalsName" column="tool_principals_name" />
<result property="toolRespDept" column="tool_resp_dept" />
<result property="toolRespDeptName" column="tool_resp_dept_name" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
@ -26,7 +27,6 @@
<result property="updateTime" column="update_time" />
<result property="procInstId" column="proc_inst_id" />
<result property="recordStatus" column="record_status" />
<association property="dept" javaType="SysDept" resultMap="deptResult" />
</resultMap>
<resultMap id="deptResult" type="SysDept">
@ -142,7 +142,7 @@
<select id="selectToolList" parameterType="Tool" resultMap="ToolResult">
select u.tool_id, u.tool_code, u.tool_name, u.tool_type, u.tool_source, u.tool_use, u.test_situation, u.function_desc, u.apply_condition, u.operate_explain,u.record_status,u.proc_inst_id,
u.tool_principals, u.tool_principals_name, u.tool_resp_dept, u.status, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from t_tool u
u.tool_principals, u.tool_principals_name, u.tool_resp_dept, u.status, u.create_by, u.create_time, u.remark, d.dept_name as tool_resp_dept_name from t_tool u
left join sys_dept d on u.tool_resp_dept = d.dept_id
where 1=1
and u.record_status != 'cancel'
@ -167,7 +167,7 @@
<if test="toolRespDept != null and toolRespDept != ''">
AND u.tool_resp_dept = #{toolRespDept}
</if>
<if test="createBy != null and createBy != ''">
<if test="createBy != null and createBy != '' and permission != true">
AND (u.create_by = #{createBy} or u.record_status = 'done')
</if>
order by create_time desc

View File

@ -101,4 +101,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<select id="checkUseApply" resultType="int">
SELECT count(*) FROM `t_use_apply_item` uai
left join `t_use_apply` ua on uai.apply_id = ua.id
WHERE ua.record_status = 'done'
and uai.tool_id = #{toolId}
and ua.user_id = #{userId}
</select>
</mapper>

View File

@ -5,7 +5,7 @@ import io.jsonwebtoken.Claims;
/**
* 通用常量信息
*
*
* @author jian
*/
public class Constants
@ -170,4 +170,16 @@ public class Constants
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.rzdata.common.utils.file", "com.rzdata.common.config", "com.rzdata.generator" };
/**
* 查看审批中的工具权限
*/
public static final String VIEW_TOOL_PERMISSION = "view:doing:tool";
/**
* 查看审批中的工具权限
*/
public static final String DOWNLOAD_TOOL_PERMISSION = "download:done:tool";
}

View File

@ -88,7 +88,7 @@ import com.rzdata.common.utils.reflect.ReflectUtils;
/**
* Excel相关处理
*
*
* @author ruoyi
*/
public class ExcelUtil<T>
@ -210,9 +210,11 @@ public class ExcelUtil<T>
* @param fields 列属性名 示例[单个"name"/多个"id","name"]
* @throws Exception
*/
public void hideColumn(String... fields)
public void hideColumn(List<String> fields)
{
this.excludeFields = fields;
if (fields!=null) {
this.excludeFields = fields.toArray(new String[0]);
}
}
public void init(List<T> list, String sheetName, String title, Type type)
@ -285,7 +287,7 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @return 转换后集合
*/
@ -310,7 +312,7 @@ public class ExcelUtil<T>
/**
* 对excel表单默认第一个索引名转换成list
*
*
* @param is 输入流
* @param titleNum 标题占用行数
* @return 转换后集合
@ -322,7 +324,7 @@ public class ExcelUtil<T>
/**
* 对excel表单指定表格索引名转换成list
*
*
* @param sheetName 表格索引名
* @param titleNum 标题占用行数
* @param is 输入流
@ -506,7 +508,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
@ -518,7 +520,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @param title 标题
@ -532,7 +534,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
@ -545,7 +547,21 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
* @return 结果
*/
public void exportExcel(HttpServletResponse response, List<T> list, String sheetName,List<String> excludeFields)
{
hideColumn(excludeFields);
exportExcel(response, list, sheetName, StringUtils.EMPTY);
}
/**
* 对list数据源将其里面的数据导入到excel表单
*
* @param response 返回数据
* @param list 导出数据集合
* @param sheetName 工作表的名称
@ -562,7 +578,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
@ -573,7 +589,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @param title 标题
* @return 结果
@ -586,7 +602,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @return 结果
*/
@ -597,7 +613,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @param sheetName 工作表的名称
* @param title 标题
* @return 结果
@ -612,7 +628,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public void exportExcel(HttpServletResponse response)
@ -634,7 +650,7 @@ public class ExcelUtil<T>
/**
* 对list数据源将其里面的数据导入到excel表单
*
*
* @return 结果
*/
public AjaxResult exportExcel()
@ -702,7 +718,7 @@ public class ExcelUtil<T>
/**
* 填充excel数据
*
*
* @param index 序号
* @param row 单元格行
*/
@ -773,7 +789,7 @@ public class ExcelUtil<T>
/**
* 创建表格样式
*
*
* @param wb 工作薄对象
* @return 样式列表
*/
@ -828,7 +844,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格头样式
*
*
* @param wb 工作薄对象
* @return 自定义样式列表
*/
@ -864,7 +880,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格列样式
*
*
* @param wb 工作薄对象
* @return 自定义样式列表
*/
@ -896,7 +912,7 @@ public class ExcelUtil<T>
/**
* 根据Excel注解创建表格列样式
*
*
* @param styles 自定义样式列表
* @param field 属性列信息
* @param excel 注解信息
@ -958,7 +974,7 @@ public class ExcelUtil<T>
/**
* 设置单元格信息
*
*
* @param value 单元格值
* @param attr 注解相关
* @param cell 单元格信息
@ -1138,7 +1154,7 @@ public class ExcelUtil<T>
/**
* 设置 POI XSSFSheet 单元格提示或选择框
*
*
* @param sheet 表单
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
@ -1175,7 +1191,7 @@ public class ExcelUtil<T>
/**
* 设置某些列的值只能输入预制的数据,显示下拉框兼容超出一定数量的下拉框.
*
*
* @param sheet 要设置的sheet.
* @param textlist 下拉框显示的内容
* @param promptContent 提示内容
@ -1227,7 +1243,7 @@ public class ExcelUtil<T>
/**
* 解析导出值 0=,1=,2=未知
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
@ -1264,7 +1280,7 @@ public class ExcelUtil<T>
/**
* 反向解析值 =0,=1,未知=2
*
*
* @param propertyValue 参数值
* @param converterExp 翻译注解
* @param separator 分隔符
@ -1301,7 +1317,7 @@ public class ExcelUtil<T>
/**
* 解析字典值
*
*
* @param dictValue 字典值
* @param dictType 字典类型
* @param separator 分隔符
@ -1314,7 +1330,7 @@ public class ExcelUtil<T>
/**
* 反向解析值字典值
*
*
* @param dictLabel 字典标签
* @param dictType 字典类型
* @param separator 分隔符
@ -1327,7 +1343,7 @@ public class ExcelUtil<T>
/**
* 数据处理器
*
*
* @param value 数据值
* @param excel 数据注解
* @return
@ -1404,7 +1420,7 @@ public class ExcelUtil<T>
/**
* 获取下载路径
*
*
* @param filename 文件名称
*/
public String getAbsoluteFile(String filename)
@ -1420,7 +1436,7 @@ public class ExcelUtil<T>
/**
* 获取bean中的属性值
*
*
* @param vo 实体对象
* @param field 字段
* @param excel 注解
@ -1451,7 +1467,7 @@ public class ExcelUtil<T>
/**
* 以类的属性的get方法方法形式获取值
*
*
* @param o
* @param name
* @return value
@ -1557,7 +1573,7 @@ public class ExcelUtil<T>
/**
* 创建工作表
*
*
* @param sheetNo sheet数量
* @param index 序号
*/
@ -1574,7 +1590,7 @@ public class ExcelUtil<T>
/**
* 获取单元格值
*
*
* @param row 获取的行
* @param column 获取单元格列号
* @return 单元格值
@ -1634,7 +1650,7 @@ public class ExcelUtil<T>
/**
* 判断是否是空行
*
*
* @param row 判断的行
* @return
*/
@ -1722,7 +1738,7 @@ public class ExcelUtil<T>
/**
* 格式化不同类型的日期对象
*
*
* @param dateFormat 日期格式
* @param val 被格式化的日期对象
* @return 格式化后的日期字符
@ -1788,7 +1804,7 @@ public class ExcelUtil<T>
/**
* 获取对象的子列表方法
*
*
* @param name 名称
* @param pojoClass 类对象
* @return 子列表方法

View File

@ -6,14 +6,14 @@ import com.rzdata.common.core.domain.entity.SysDept;
/**
* 部门管理 数据层
*
*
* @author jian
*/
public interface SysDeptMapper
{
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@ -21,7 +21,7 @@ public interface SysDeptMapper
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @param deptCheckStrictly 部门树选择项是否关联显示
* @return 选中部门列表
@ -30,7 +30,7 @@ public interface SysDeptMapper
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@ -38,7 +38,7 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门
*
*
* @param deptId 部门ID
* @return 部门列表
*/
@ -46,7 +46,7 @@ public interface SysDeptMapper
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@ -54,7 +54,7 @@ public interface SysDeptMapper
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -62,7 +62,7 @@ public interface SysDeptMapper
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -70,7 +70,7 @@ public interface SysDeptMapper
/**
* 校验部门名称是否唯一
*
*
* @param deptName 部门名称
* @param parentId 父部门ID
* @return 结果
@ -79,7 +79,7 @@ public interface SysDeptMapper
/**
* 新增部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -87,7 +87,7 @@ public interface SysDeptMapper
/**
* 修改部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -95,14 +95,14 @@ public interface SysDeptMapper
/**
* 修改所在部门正常状态
*
*
* @param deptIds 部门ID组
*/
public void updateDeptStatusNormal(Long[] deptIds);
/**
* 修改子元素关系
*
*
* @param depts 子元素
* @return 结果
*/
@ -110,9 +110,11 @@ public interface SysDeptMapper
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
String getDeptNameByDeptId(String deptId);
}

View File

@ -6,14 +6,14 @@ import com.rzdata.common.core.domain.entity.SysDept;
/**
* 部门管理 服务层
*
*
* @author jian
*/
public interface ISysDeptService
{
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@ -21,7 +21,7 @@ public interface ISysDeptService
/**
* 查询部门树结构信息
*
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@ -29,7 +29,7 @@ public interface ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
@ -37,7 +37,7 @@ public interface ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@ -45,7 +45,7 @@ public interface ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
@ -53,7 +53,7 @@ public interface ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@ -61,7 +61,7 @@ public interface ISysDeptService
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@ -69,7 +69,7 @@ public interface ISysDeptService
/**
* 是否存在部门子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -77,7 +77,7 @@ public interface ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@ -85,7 +85,7 @@ public interface ISysDeptService
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
@ -93,14 +93,14 @@ public interface ISysDeptService
/**
* 校验部门是否有数据权限
*
*
* @param deptId 部门id
*/
public void checkDeptDataScope(Long deptId);
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -108,7 +108,7 @@ public interface ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -116,9 +116,11 @@ public interface ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
public int deleteDeptById(Long deptId);
String getDeptName(String deptId);
}

View File

@ -23,7 +23,7 @@ import com.rzdata.system.service.ISysDeptService;
/**
* 部门管理 服务实现
*
*
* @author ruoyi
*/
@Service
@ -37,7 +37,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门管理数据
*
*
* @param dept 部门信息
* @return 部门信息集合
*/
@ -50,7 +50,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门树结构信息
*
*
* @param dept 部门信息
* @return 部门树信息集合
*/
@ -63,7 +63,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要树结构
*
*
* @param depts 部门列表
* @return 树结构列表
*/
@ -90,7 +90,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 构建前端所需要下拉树结构
*
*
* @param depts 部门列表
* @return 下拉树结构列表
*/
@ -103,7 +103,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据角色ID查询部门树信息
*
*
* @param roleId 角色ID
* @return 选中部门列表
*/
@ -116,7 +116,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据部门ID查询信息
*
*
* @param deptId 部门ID
* @return 部门信息
*/
@ -128,7 +128,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 根据ID查询所有子部门正常状态
*
*
* @param deptId 部门ID
* @return 子部门数
*/
@ -140,7 +140,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 是否存在子节点
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -153,7 +153,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 查询部门是否存在用户
*
*
* @param deptId 部门ID
* @return 结果 true 存在 false 不存在
*/
@ -166,7 +166,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 校验部门名称是否唯一
*
*
* @param dept 部门信息
* @return 结果
*/
@ -184,7 +184,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 校验部门是否有数据权限
*
*
* @param deptId 部门id
*/
@Override
@ -204,7 +204,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 新增保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -223,7 +223,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改保存部门信息
*
*
* @param dept 部门信息
* @return 结果
*/
@ -251,7 +251,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改该部门的父级部门状态
*
*
* @param dept 当前部门
*/
private void updateParentDeptStatusNormal(SysDept dept)
@ -263,7 +263,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 修改子元素关系
*
*
* @param deptId 被修改的部门ID
* @param newAncestors 新的父ID集合
* @param oldAncestors 旧的父ID集合
@ -283,7 +283,7 @@ public class SysDeptServiceImpl implements ISysDeptService
/**
* 删除部门管理信息
*
*
* @param deptId 部门ID
* @return 结果
*/
@ -335,4 +335,9 @@ public class SysDeptServiceImpl implements ISysDeptService
{
return getChildList(list, t).size() > 0;
}
@Override
public String getDeptName(String deptId){
return deptMapper.getDeptNameByDeptId(deptId);
}
}

View File

@ -21,12 +21,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDeptVo">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status, d.del_flag, d.create_by, d.create_time
from sys_dept d
</sql>
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where d.del_flag = '0'
@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.dataScope}
order by d.parent_id, d.order_num
</select>
<select id="selectDeptListByRoleId" resultType="Long">
select d.dept_id
from sys_dept d
@ -57,36 +57,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by d.parent_id, d.order_num
</select>
<select id="selectDeptById" parameterType="Long" resultMap="SysDeptResult">
select d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.phone, d.email, d.status,
(select dept_name from sys_dept where dept_id = d.parent_id) parent_name
from sys_dept d
where d.dept_id = #{deptId}
</select>
<select id="checkDeptExistUser" parameterType="Long" resultType="int">
select count(1) from sys_user where dept_id = #{deptId} and del_flag = '0'
</select>
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
select count(1) from sys_dept
where del_flag = '0' and parent_id = #{deptId} limit 1
</select>
<select id="selectChildrenDeptById" parameterType="Long" resultMap="SysDeptResult">
select * from sys_dept where find_in_set(#{deptId}, ancestors)
</select>
<select id="selectNormalChildrenDeptById" parameterType="Long" resultType="int">
select count(*) from sys_dept where status = 0 and del_flag = '0' and find_in_set(#{deptId}, ancestors)
</select>
<select id="checkDeptNameUnique" resultMap="SysDeptResult">
<include refid="selectDeptVo"/>
where dept_name=#{deptName} and parent_id = #{parentId} and del_flag = '0' limit 1
</select>
<insert id="insertDept" parameterType="SysDept">
insert into sys_dept(
<if test="deptId != null and deptId != 0">dept_id,</if>
@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
sysdate()
)
</insert>
<update id="updateDept" parameterType="SysDept">
update sys_dept
<set>
@ -131,7 +131,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where dept_id = #{deptId}
</update>
<update id="updateDeptChildren" parameterType="java.util.List">
update sys_dept set ancestors =
<foreach collection="depts" item="item" index="index"
@ -144,16 +144,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item.deptId}
</foreach>
</update>
<update id="updateDeptStatusNormal" parameterType="Long">
update sys_dept set status = '0' where dept_id in
update sys_dept set status = '0' where dept_id in
<foreach collection="array" item="deptId" open="(" separator="," close=")">
#{deptId}
</foreach>
</update>
<delete id="deleteDeptById" parameterType="Long">
update sys_dept set del_flag = '2' where dept_id = #{deptId}
</delete>
</mapper>
<select id="getDeptNameByDeptId" resultType="string" >
select dept_name from sys_dept where dept_id = #{deptId}
</select>
</mapper>