mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-07 12:59:01 +00:00
Merge branch 'master' of https://gitee.com/y_project/RuoYi-Cloud
This commit is contained in:
@@ -74,7 +74,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int pauseJob(SysJob job) throws SchedulerException
|
||||
{
|
||||
Long jobId = job.getJobId();
|
||||
@@ -94,7 +94,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int resumeJob(SysJob job) throws SchedulerException
|
||||
{
|
||||
Long jobId = job.getJobId();
|
||||
@@ -114,7 +114,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteJob(SysJob job) throws SchedulerException
|
||||
{
|
||||
Long jobId = job.getJobId();
|
||||
@@ -134,7 +134,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteJobByIds(Long[] jobIds) throws SchedulerException
|
||||
{
|
||||
for (Long jobId : jobIds)
|
||||
@@ -150,7 +150,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int changeStatus(SysJob job) throws SchedulerException
|
||||
{
|
||||
int rows = 0;
|
||||
@@ -172,7 +172,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void run(SysJob job) throws SchedulerException
|
||||
{
|
||||
Long jobId = job.getJobId();
|
||||
@@ -190,7 +190,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int insertJob(SysJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
job.setStatus(ScheduleConstants.Status.PAUSE.getValue());
|
||||
@@ -208,7 +208,7 @@ public class SysJobServiceImpl implements ISysJobService
|
||||
* @param job 调度信息
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateJob(SysJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
SysJob properties = selectJobById(job.getJobId());
|
||||
|
@@ -75,6 +75,7 @@ public class SysDeptController extends BaseController
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
deptService.checkDeptDataScope(deptId);
|
||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
|
@@ -69,6 +69,7 @@ public class SysRoleController extends BaseController
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return AjaxResult.success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
|
@@ -172,6 +172,7 @@ public class SysUserController extends BaseController
|
||||
@GetMapping(value = { "/", "/{userId}" })
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
userService.checkUserDataScope(userId);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
|
@@ -84,6 +84,13 @@ public interface ISysDeptService
|
||||
*/
|
||||
public String checkDeptNameUnique(SysDept dept);
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
public void checkDeptDataScope(Long deptId);
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
|
@@ -82,6 +82,13 @@ public interface ISysRoleService
|
||||
*/
|
||||
public void checkRoleAllowed(SysRole role);
|
||||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
public void checkRoleDataScope(Long roleId);
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
|
@@ -97,6 +97,13 @@ public interface ISysUserService
|
||||
*/
|
||||
public void checkUserAllowed(SysUser user);
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
public void checkUserDataScope(Long userId);
|
||||
|
||||
/**
|
||||
* 新增用户信息
|
||||
*
|
||||
|
@@ -9,10 +9,13 @@ import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.core.utils.SecurityUtils;
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||
import com.ruoyi.system.api.domain.SysDept;
|
||||
import com.ruoyi.system.api.domain.SysRole;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
import com.ruoyi.system.domain.vo.TreeSelect;
|
||||
import com.ruoyi.system.mapper.SysDeptMapper;
|
||||
import com.ruoyi.system.mapper.SysRoleMapper;
|
||||
@@ -171,6 +174,26 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验部门是否有数据权限
|
||||
*
|
||||
* @param deptId 部门id
|
||||
*/
|
||||
@Override
|
||||
public void checkDeptDataScope(Long deptId)
|
||||
{
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
||||
{
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(deptId);
|
||||
List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
||||
if (StringUtils.isEmpty(depts))
|
||||
{
|
||||
throw new ServiceException("没有权限访问部门数据!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存部门信息
|
||||
*
|
||||
|
@@ -10,10 +10,12 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.SecurityUtils;
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||
import com.ruoyi.system.api.domain.SysRole;
|
||||
import com.ruoyi.system.api.domain.SysUser;
|
||||
import com.ruoyi.system.domain.SysRoleDept;
|
||||
import com.ruoyi.system.domain.SysRoleMenu;
|
||||
import com.ruoyi.system.domain.SysUserRole;
|
||||
@@ -187,6 +189,26 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验角色是否有数据权限
|
||||
*
|
||||
* @param roleId 角色id
|
||||
*/
|
||||
@Override
|
||||
public void checkRoleDataScope(Long roleId)
|
||||
{
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
||||
{
|
||||
SysRole role = new SysRole();
|
||||
role.setRoleId(roleId);
|
||||
List<SysRole> roles = SpringUtils.getAopProxy(this).selectRoleList(role);
|
||||
if (StringUtils.isEmpty(roles))
|
||||
{
|
||||
throw new ServiceException("没有权限访问角色数据!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色ID查询角色使用数量
|
||||
*
|
||||
|
@@ -10,6 +10,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import com.ruoyi.common.core.constant.UserConstants;
|
||||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.core.utils.SecurityUtils;
|
||||
import com.ruoyi.common.core.utils.SpringUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.datascope.annotation.DataScope;
|
||||
import com.ruoyi.system.api.domain.SysRole;
|
||||
@@ -227,6 +228,26 @@ public class SysUserServiceImpl implements ISysUserService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
public void checkUserDataScope(Long userId)
|
||||
{
|
||||
if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
||||
{
|
||||
SysUser user = new SysUser();
|
||||
user.setUserId(userId);
|
||||
List<SysUser> users = SpringUtils.getAopProxy(this).selectUserList(user);
|
||||
if (StringUtils.isEmpty(users))
|
||||
{
|
||||
throw new ServiceException("没有权限访问用户数据!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存用户信息
|
||||
*
|
||||
|
@@ -30,6 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectDeptList" parameterType="SysDept" resultMap="SysDeptResult">
|
||||
<include refid="selectDeptVo"/>
|
||||
where d.del_flag = '0'
|
||||
<if test="deptId != null and deptId != 0">
|
||||
AND dept_id = #{deptId}
|
||||
</if>
|
||||
<if test="parentId != null and parentId != 0">
|
||||
AND parent_id = #{parentId}
|
||||
</if>
|
||||
@@ -66,14 +69,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="hasChildByDeptId" parameterType="Long" resultType="int">
|
||||
select count(1) from sys_dept
|
||||
where del_flag = '0' and parent_id = #{deptId}
|
||||
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="java.lang.Integer">
|
||||
<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>
|
||||
|
||||
|
@@ -33,6 +33,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectRoleList" parameterType="SysRole" resultMap="SysRoleResult">
|
||||
<include refid="selectRoleVo"/>
|
||||
where r.del_flag = '0'
|
||||
<if test="roleId != null and roleId != 0">
|
||||
AND r.role_id = #{roleId}
|
||||
</if>
|
||||
<if test="roleName != null and roleName != ''">
|
||||
AND r.role_name like concat('%', #{roleName}, '%')
|
||||
</if>
|
||||
|
@@ -59,6 +59,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select u.user_id, u.dept_id, u.nick_name, u.user_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
|
||||
left join sys_dept d on u.dept_id = d.dept_id
|
||||
where u.del_flag = '0'
|
||||
<if test="userId != null and userId != 0">
|
||||
AND u.user_id = #{userId}
|
||||
</if>
|
||||
<if test="userName != null and userName != ''">
|
||||
AND u.user_name like concat('%', #{userName}, '%')
|
||||
</if>
|
||||
|
34
ruoyi-ui/src/directive/dialog/dragHeight.js
Normal file
34
ruoyi-ui/src/directive/dialog/dragHeight.js
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* v-dialogDragWidth 可拖动弹窗高度(右下角)
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
export default {
|
||||
bind(el) {
|
||||
const dragDom = el.querySelector('.el-dialog');
|
||||
const lineEl = document.createElement('div');
|
||||
lineEl.style = 'width: 6px; background: inherit; height: 10px; position: absolute; right: 0; bottom: 0; margin: auto; z-index: 1; cursor: nwse-resize;';
|
||||
lineEl.addEventListener('mousedown',
|
||||
function(e) {
|
||||
// 鼠标按下,计算当前元素距离可视区的距离
|
||||
const disX = e.clientX - el.offsetLeft;
|
||||
const disY = e.clientY - el.offsetTop;
|
||||
// 当前宽度 高度
|
||||
const curWidth = dragDom.offsetWidth;
|
||||
const curHeight = dragDom.offsetHeight;
|
||||
document.onmousemove = function(e) {
|
||||
e.preventDefault(); // 移动时禁用默认事件
|
||||
// 通过事件委托,计算移动的距离
|
||||
const xl = e.clientX - disX;
|
||||
const yl = e.clientY - disY
|
||||
dragDom.style.width = `${curWidth + xl}px`;
|
||||
dragDom.style.height = `${curHeight + yl}px`;
|
||||
};
|
||||
document.onmouseup = function(e) {
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
}, false);
|
||||
dragDom.appendChild(lineEl);
|
||||
}
|
||||
}
|
30
ruoyi-ui/src/directive/dialog/dragWidth.js
Normal file
30
ruoyi-ui/src/directive/dialog/dragWidth.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* v-dialogDragWidth 可拖动弹窗宽度(右侧边)
|
||||
* Copyright (c) 2019 ruoyi
|
||||
*/
|
||||
|
||||
export default {
|
||||
bind(el) {
|
||||
const dragDom = el.querySelector('.el-dialog');
|
||||
const lineEl = document.createElement('div');
|
||||
lineEl.style = 'width: 5px; background: inherit; height: 80%; position: absolute; right: 0; top: 0; bottom: 0; margin: auto; z-index: 1; cursor: w-resize;';
|
||||
lineEl.addEventListener('mousedown',
|
||||
function (e) {
|
||||
// 鼠标按下,计算当前元素距离可视区的距离
|
||||
const disX = e.clientX - el.offsetLeft;
|
||||
// 当前宽度
|
||||
const curWidth = dragDom.offsetWidth;
|
||||
document.onmousemove = function (e) {
|
||||
e.preventDefault(); // 移动时禁用默认事件
|
||||
// 通过事件委托,计算移动的距离
|
||||
const l = e.clientX - disX;
|
||||
dragDom.style.width = `${curWidth + l}px`;
|
||||
};
|
||||
document.onmouseup = function (e) {
|
||||
document.onmousemove = null;
|
||||
document.onmouseup = null;
|
||||
};
|
||||
}, false);
|
||||
dragDom.appendChild(lineEl);
|
||||
}
|
||||
}
|
@@ -1,17 +1,20 @@
|
||||
import hasRole from './permission/hasRole'
|
||||
import hasPermi from './permission/hasPermi'
|
||||
import dialogDrag from './dialog/drag'
|
||||
import dialogDragWidth from './dialog/dragWidth'
|
||||
import dialogDragHeight from './dialog/dragHeight'
|
||||
|
||||
const install = function(Vue) {
|
||||
Vue.directive('hasRole', hasRole)
|
||||
Vue.directive('hasPermi', hasPermi)
|
||||
Vue.directive('dialogDrag', dialogDrag)
|
||||
Vue.directive('dialogDragWidth', dialogDragWidth)
|
||||
Vue.directive('dialogDragHeight', dialogDragHeight)
|
||||
}
|
||||
|
||||
if (window.Vue) {
|
||||
window['hasRole'] = hasRole
|
||||
window['hasPermi'] = hasPermi
|
||||
window['dialogDrag'] = dialogDrag
|
||||
Vue.use(install); // eslint-disable-line
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,7 @@ create table QRTZ_TRIGGERS (
|
||||
-- ----------------------------
|
||||
create table QRTZ_SIMPLE_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_ name的外键',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
repeat_count bigint(7) not null comment '重复的次数统计',
|
||||
repeat_interval bigint(12) not null comment '重复的间隔时间',
|
||||
@@ -134,7 +134,7 @@ create table QRTZ_FIRED_TRIGGERS (
|
||||
-- ----------------------------
|
||||
create table QRTZ_SCHEDULER_STATE (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
instance_name varchar(200) not null comment '之前配置文件中org.quartz.scheduler.instanceId配置的名字,就会写入该字段',
|
||||
instance_name varchar(200) not null comment '实例名称',
|
||||
last_checkin_time bigint(13) not null comment '上次检查时间',
|
||||
checkin_interval bigint(13) not null comment '检查间隔时间',
|
||||
primary key (sched_name, instance_name)
|
||||
@@ -154,7 +154,7 @@ create table QRTZ_LOCKS (
|
||||
-- ----------------------------
|
||||
create table QRTZ_SIMPROP_TRIGGERS (
|
||||
sched_name varchar(120) not null comment '调度名称',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_ name的外键',
|
||||
trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键',
|
||||
trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键',
|
||||
str_prop_1 varchar(512) null comment 'String类型的trigger的第一个参数',
|
||||
str_prop_2 varchar(512) null comment 'String类型的trigger的第二个参数',
|
||||
|
Reference in New Issue
Block a user