更多ruoyi-nbcio功能请看演示系统
gitee源代码地址
前后端代码: https://gitee.com/nbacheng/ruoyi-nbcio
演示地址:RuoYi-Nbcio后台管理系统
1、前端部分
流程设计里面需要增加相应的支持,主要是增加一个界面与相应的逻辑
<el-row> <h4><b>审批人设置</b></h4> <el-radio-group v-model="dataType" @change="changeDataType"> <el-radio label="USERS">指定用户</el-radio> <el-radio label="ROLES">角色</el-radio> <el-radio label="DEPTS">部门</el-radio> <el-radio label="INITIATOR">发起人</el-radio> <el-radio label="MANAGER">部门经理</el-radio> </el-radio-group> </el-row>
} else if (val === 'MANAGER') { userTaskForm.assignee = "${DepManagerHandler.getUser(execution)}"; userTaskForm.text = "部门经理"; }
2、增加一个获取部门经理的方法
/** * 根据用户账号获取部门经理 * * @param userName 用户账号 * @return 结果 */ String getDepLeaderByUserName(String userName); }
3、部门的mapper.xml主要增加一个字段与相应的方法,如下,当然表也要增加一个字段
<?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.ruoyi.system.mapper.SysDeptMapper"> <resultMap type="SysDept" id="SysDeptResult"> <id property="deptId" column="dept_id"/> <result property="parentId" column="parent_id"/> <result property="ancestors" column="ancestors"/> <result property="deptName" column="dept_name"/> <result property="orderNum" column="order_num"/> <result property="leaderId" column="leader_id"/> <result property="leader" column="leader"/> <result property="phone" column="phone"/> <result property="email" column="email"/> <result property="status" column="status"/> <result property="delFlag" column="del_flag"/> <result property="parentName" column="parent_name"/> <result property="createBy" column="create_by"/> <result property="createTime" column="create_time"/> <result property="updateBy" column="update_by"/> <result property="updateTime" column="update_time"/> </resultMap> <select id="selectDeptList" resultMap="SysDeptResult"> select * from sys_dept ${ew.getCustomSqlSegment} </select> <select id="selectDeptListByRoleId" resultType="Long"> select d.dept_id from sys_dept d left join sys_role_dept rd on d.dept_id = rd.dept_id where rd.role_id = #{roleId} <if test="deptCheckStrictly"> and d.dept_id not in (select d.parent_id from sys_dept d inner join sys_role_dept rd on d.dept_id = rd.dept_id and rd.role_id = #{roleId}) </if> order by d.parent_id, d.order_num </select> <select id="getDepLeaderByUserName" parameterType="String" resultType="String"> select b.leader from sys_user a LEFT JOIN sys_dept b on a.dept_id = b.dept_id where a.user_name = #{userName} </select> </mapper>
4、同时对下一个用户处理时增加下面代码
} else if(StringUtils.equalsAnyIgnoreCase(assignee, "${DepManagerHandler.getUser(execution)}")) {//对部门经理做特殊处理 SysUser sysUser = new SysUser(); sysUser.setUserName("${DepManagerHandler.getUser(execution)}"); list.add(sysUser); setAssigneeFlowNetDto(flowNextDto,list,userTask); }
5、效果图如下: