完成 Role 模块的迁移

This commit is contained in:
YunaiV 2021-01-09 23:08:32 +08:00
parent 04feb57ed8
commit 1bfaa2c967
26 changed files with 151 additions and 361 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.common.core.domain.entity.SysMenu;
@ -9,22 +10,7 @@ import com.ruoyi.common.core.domain.entity.SysMenu;
*
* @author ruoyi
*/
public interface SysMenuMapper
{
/**
* 查询系统菜单列表
*
* @param menu 菜单信息
* @return 菜单列表
*/
public List<SysMenu> selectMenuList(SysMenu menu);
/**
* 根据用户所有权限
*
* @return 权限列表
*/
public List<String> selectMenuPerms();
public interface SysMenuMapper {
/**
* 根据用户查询系统菜单列表
@ -60,7 +46,7 @@ public interface SysMenuMapper
/**
* 根据角色ID查询菜单树信息
*
* @param roleId 角色ID
* @param roleId 角色ID
* @param menuCheckStrictly 菜单树选择项是否关联显示
* @return 选中菜单列表
*/

View File

@ -1,18 +1,19 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.common.core.domain.entity.SysRole;
/**
* 角色表 数据层
*
*
* @author ruoyi
*/
public interface SysRoleMapper
{
public interface SysRoleMapper {
/**
* 根据条件分页查询角色数据
*
*
* @param role 角色信息
* @return 角色数据集合信息
*/
@ -20,88 +21,26 @@ public interface SysRoleMapper
/**
* 根据用户ID查询角色
*
*
* @param userId 用户ID
* @return 角色列表
*/
public List<SysRole> selectRolePermissionByUserId(Long userId);
/**
* 查询所有角色
*
* @return 角色列表
*/
public List<SysRole> selectRoleAll();
/**
* 根据用户ID获取角色选择框列表
*
*
* @param userId 用户ID
* @return 选中角色ID列表
*/
public List<Integer> selectRoleListByUserId(Long userId);
/**
* 通过角色ID查询角色
*
* @param roleId 角色ID
* @return 角色对象信息
*/
public SysRole selectRoleById(Long roleId);
/**
* 根据用户ID查询角色
*
*
* @param userName 用户名
* @return 角色列表
*/
public List<SysRole> selectRolesByUserName(String userName);
/**
* 校验角色名称是否唯一
*
* @param roleName 角色名称
* @return 角色信息
*/
public SysRole checkRoleNameUnique(String roleName);
/**
* 校验角色权限是否唯一
*
* @param roleKey 角色权限
* @return 角色信息
*/
public SysRole checkRoleKeyUnique(String roleKey);
/**
* 修改角色信息
*
* @param role 角色信息
* @return 结果
*/
public int updateRole(SysRole role);
/**
* 新增角色信息
*
* @param role 角色信息
* @return 结果
*/
public int insertRole(SysRole role);
/**
* 通过角色ID删除角色
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleById(Long roleId);
/**
* 批量删除角色信息
*
* @param roleIds 需要删除的角色ID
* @return 结果
*/
public int deleteRoleByIds(Long[] roleIds);
}

View File

@ -1,44 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import com.ruoyi.system.domain.SysRoleMenu;
/**
* 角色与菜单关联表 数据层
*
* @author ruoyi
*/
public interface SysRoleMenuMapper
{
/**
* 查询菜单使用数量
*
* @param menuId 菜单ID
* @return 结果
*/
public int checkMenuExistRole(Long menuId);
/**
* 通过角色ID删除角色和菜单关联
*
* @param roleId 角色ID
* @return 结果
*/
public int deleteRoleMenuByRoleId(Long roleId);
/**
* 批量删除角色菜单关联信息
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteRoleMenu(Long[] ids);
/**
* 批量新增角色菜单信息
*
* @param roleMenuList 角色菜单列表
* @return 结果
*/
public int batchRoleMenu(List<SysRoleMenu> roleMenuList);
}

View File

@ -1,62 +0,0 @@
package com.ruoyi.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysUserRole;
/**
* 用户与角色关联表 数据层
*
* @author ruoyi
*/
public interface SysUserRoleMapper
{
/**
* 通过用户ID删除用户和角色关联
*
* @param userId 用户ID
* @return 结果
*/
public int deleteUserRoleByUserId(Long userId);
/**
* 批量删除用户和角色关联
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteUserRole(Long[] ids);
/**
* 通过角色ID查询角色使用数量
*
* @param roleId 角色ID
* @return 结果
*/
public int countUserRoleByRoleId(Long roleId);
/**
* 批量新增用户角色信息
*
* @param userRoleList 用户角色列表
* @return 结果
*/
public int batchUserRole(List<SysUserRole> userRoleList);
/**
* 删除用户和角色关联信息
*
* @param userRole 用户和角色关联信息
* @return 结果
*/
public int deleteUserRoleInfo(SysUserRole userRole);
/**
* 批量取消授权用户角色
*
* @param roleId 角色ID
* @param userIds 需要删除的用户数据ID
* @return 结果
*/
public int deleteUserRoleInfos(@Param("roleId") Long roleId, @Param("userIds") Long[] userIds);
}

View File

@ -4,22 +4,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.SysMenuMapper">
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
<where>
<if test="menuName != null and menuName != ''">
AND menu_name like concat('%', #{menuName}, '%')
</if>
<if test="visible != null and visible != ''">
AND visible = #{visible}
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
</where>
order by parent_id, order_num
</select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
@ -67,13 +51,6 @@
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
</select>
<select id="selectMenuPermsByUserId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
@ -83,13 +60,4 @@
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from sys_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
</mapper>

View File

@ -1,34 +0,0 @@
<?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.SysRoleMenuMapper">
<resultMap type="SysRoleMenu" id="SysRoleMenuResult">
<result property="roleId" column="role_id" />
<result property="menuId" column="menu_id" />
</resultMap>
<select id="checkMenuExistRole" resultType="Integer">
select count(1) from sys_role_menu where menu_id = #{menuId}
</select>
<delete id="deleteRoleMenuByRoleId" parameterType="Long">
delete from sys_role_menu where role_id=#{roleId}
</delete>
<delete id="deleteRoleMenu" parameterType="Long">
delete from sys_role_menu where role_id in
<foreach collection="array" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</delete>
<insert id="batchRoleMenu">
insert into sys_role_menu(role_id, menu_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.roleId},#{item.menuId})
</foreach>
</insert>
</mapper>

View File

@ -1,44 +0,0 @@
<?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.SysUserRoleMapper">
<resultMap type="SysUserRole" id="SysUserRoleResult">
<result property="userId" column="user_id" />
<result property="roleId" column="role_id" />
</resultMap>
<delete id="deleteUserRoleByUserId" parameterType="Long">
delete from sys_user_role where user_id=#{userId}
</delete>
<select id="countUserRoleByRoleId" resultType="Integer">
select count(1) from sys_user_role where role_id=#{roleId}
</select>
<delete id="deleteUserRole" parameterType="Long">
delete from sys_user_role where user_id in
<foreach collection="array" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
<insert id="batchUserRole">
insert into sys_user_role(user_id, role_id) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.userId},#{item.roleId})
</foreach>
</insert>
<delete id="deleteUserRoleInfo" parameterType="SysUserRole">
delete from sys_user_role where user_id=#{userId} and role_id=#{roleId}
</delete>
<delete id="deleteUserRoleInfos">
delete from sys_user_role where role_id=#{roleId} and user_id in
<foreach collection="userIds" item="userId" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>

View File

@ -25,24 +25,6 @@ export function getDept(deptId) {
})
}
// 查询部门下拉树结构
// TODO 准备删除
export function treeselect() {
return request({
url: '/system/dept/treeselect',
method: 'get'
})
}
// 根据角色ID查询部门树结构
// TODO 准备删除
export function roleDeptTreeselect(roleId) {
return request({
url: '/system/dept/roleDeptTreeselect/' + roleId,
method: 'get'
})
}
// 获取部门精简信息列表
export function listSimpleDepts() {
return request({
@ -76,3 +58,6 @@ export function delDept(deptId) {
method: 'delete'
})
}
export class treeselect {
}

View File

@ -16,3 +16,12 @@ export function assignRoleMenu(data) {
data: data
})
}
// 赋予角色数据权限
export function assignRoleDataScope(data) {
return request({
url: '/system/permission/assign-role-data-scope',
method: 'post',
data: data
})
}

View File

@ -35,15 +35,6 @@ export function updateRole(data) {
})
}
// 角色数据权限
export function dataScope(data) {
return request({
url: '/system/role/dataScope',
method: 'put',
data: data
})
}
// 角色状态修改
export function changeRoleStatus(id, status) {
const data = {

View File

@ -30,7 +30,7 @@ export const SysRoleTypeEnum = {
}
/**
* 数据权限的泛微枚举
* 数据权限的范围枚举
*/
export const SysDataScopeEnum = {
ALL: 1, // 全部数据权限

View File

@ -55,15 +55,15 @@ export function resetForm(refName) {
// 添加日期范围
export function addDateRange(params, dateRange, propName) {
var search = params;
search.params = {};
if (null != dateRange && '' != dateRange) {
const search = params;
search.params = {};
if (null != dateRange && '' !== dateRange) {
if (typeof(propName) === "undefined") {
search.params["beginTime"] = dateRange[0];
search.params["endTime"] = dateRange[1];
search["beginTime"] = dateRange[0];
search["endTime"] = dateRange[1];
} else {
search.params["begin" + propName] = dateRange[0];
search.params["end" + propName] = dateRange[1];
search["begin" + propName] = dateRange[0];
search["end" + propName] = dateRange[1];
}
}
return search;

View File

@ -248,8 +248,8 @@ import {
updateRole
} from "@/api/system/role";
import {listSimpleMenus} from "@/api/system/menu";
import {assignRoleMenu, listRoleMenus} from "@/api/system/permission";
import {listSimpleDepts, treeselect as deptTreeselect} from "@/api/system/dept";
import {assignRoleMenu, listRoleMenus, assignRoleDataScope} from "@/api/system/permission";
import {listSimpleDepts} from "@/api/system/dept";
import {SysCommonStatusEnum, SysDataScopeEnum} from "@/utils/constants";
import {DICT_TYPE, getDictDataLabel, getDictDatas} from "@/utils/dict";
@ -326,7 +326,10 @@ export default {
/** 查询角色列表 */
getList() {
this.loading = true;
listRole(this.addDateRange(this.queryParams, this.dateRange)).then(
listRole(this.addDateRange(this.queryParams, [
this.dateRange[0] ? this.dateRange[0] + ' 00:00:00' : undefined,
this.dateRange[1] ? this.dateRange[1] + ' 23:59:59' : undefined,
])).then(
response => {
this.roleList = response.data.list;
this.total = response.data.total;
@ -387,6 +390,7 @@ export default {
sort: 0,
deptIds: [],
menuIds: [],
dataScope: undefined,
deptCheckStrictly: false,
remark: undefined
};
@ -485,11 +489,11 @@ export default {
// menuOptions
this.deptOptions = [];
this.deptOptions.push(...this.handleTree(response.data, "id"));
});
//
getRole(row.id).then(response => {
// TODO
// this.$refs.dept.setCheckedKeys(res.checkedKeys);
//
getRole(row.id).then(response => {
this.form.dataScope = response.data.dataScope;
this.$refs.dept.setCheckedKeys(response.data.dataScopeDeptIds, false);
});
});
},
/** 提交按钮 */
@ -515,11 +519,10 @@ export default {
/** 提交按钮(数据权限) */
submitDataScope: function() {
if (this.form.id !== undefined) {
// this.form.deptIds = this.getDeptAllCheckedKeys();
debugger
dataScope({
assignRoleDataScope({
roleId: this.form.id,
deptIds: this.form.dataScope !== SysDataScopeEnum.DEPT_CUSTOM ? [] :
dataScope: this.form.dataScope,
dataScopeDeptIds: this.form.dataScope !== SysDataScopeEnum.DEPT_CUSTOM ? [] :
this.$refs.dept.getCheckedKeys(false)
}).then(response => {
this.msgSuccess("修改成功");

View File

@ -1,6 +1,7 @@
package cn.iocoder.dashboard.modules.system.controller.permission;
import cn.iocoder.dashboard.common.pojo.CommonResult;
import cn.iocoder.dashboard.modules.system.controller.permission.vo.permission.SysPermissionAssignRoleDataScopeReqVO;
import cn.iocoder.dashboard.modules.system.controller.permission.vo.permission.SysPermissionAssignRoleMenuReqVO;
import cn.iocoder.dashboard.modules.system.service.permission.SysPermissionService;
import io.swagger.annotations.Api;
@ -43,6 +44,15 @@ public class SysPermissionController {
return success(true);
}
@PostMapping("/assign-role-data-scope")
@ApiOperation("赋予角色数据权限")
// @RequiresPermissions("system:permission:assign-role-data-scope")
public CommonResult<Boolean> assignRoleDataScope(
@Validated @RequestBody SysPermissionAssignRoleDataScopeReqVO reqVO) {
permissionService.assignRoleDataScope(reqVO.getRoleId(), reqVO.getDataScope(), reqVO.getDataScopeDeptIds());
return success(true);
}
// @GetMapping("/list-admin-roles")
// @ApiOperation("获得管理员拥有的角色编号列表")
//// @RequiresPermissions("system:permission:assign-admin-role")

View File

@ -0,0 +1,27 @@
package cn.iocoder.dashboard.modules.system.controller.permission.vo.permission;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.util.Collections;
import java.util.Set;
@ApiModel("赋予角色数据权限 Request VO")
@Data
public class SysPermissionAssignRoleDataScopeReqVO {
@ApiModelProperty(value = "角色编号", required = true, example = "1")
@NotNull(message = "角色编号不能为空")
private Long roleId;
@ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 SysDataScopeEnum 枚举类")
@NotNull(message = "数据范围不能为空")
// TODO 这里要多一个枚举校验
private Integer dataScope;
@ApiModelProperty(value = "部门编号列表", example = "1,3,5", notes = "只有范围类型为 DEPT_CUSTOM 时,该字段才需要")
private Set<Long> dataScopeDeptIds = Collections.emptySet(); // 兜底
}

View File

@ -12,7 +12,7 @@ import java.util.Set;
@Data
public class SysPermissionAssignRoleMenuReqVO {
@ApiModelProperty(value = "角色", required = true, example = "1")
@ApiModelProperty(value = "角色编号", required = true, example = "1")
@NotNull(message = "角色编号不能为空")
private Long roleId;

View File

@ -5,6 +5,11 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("角色分页 Request VO")
@Data
@ -14,7 +19,18 @@ public class SysRolePageReqVO extends PageParam {
@ApiModelProperty(value = "角色名称", example = "芋道", notes = "模糊匹配")
private String name;
@ApiModelProperty(value = "角色标识", example = "yudao", notes = "模糊匹配")
private String code;
@ApiModelProperty(value = "展示状态", example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
private Integer status;
@ApiModelProperty(value = "开始时间", example = "2020-10-24")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date beginTime;
@ApiModelProperty(value = "结束时间", example = "2020-10-24")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endTime;
}

View File

@ -8,6 +8,7 @@ import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.Set;
@ApiModel("角色信息 Response VO")
@Data
@ -22,6 +23,9 @@ public class SysRoleRespVO extends SysRoleBaseVO {
@ApiModelProperty(value = "数据范围", required = true, example = "1", notes = "参见 DataScopeEnum 枚举类")
private Integer dataScope;
@ApiModelProperty(value = "数据范围(指定部门数组)", example = "1")
private Set<Long> dataScopeDeptIds;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "参见 SysCommonStatusEnum 枚举类")
private Integer status;

View File

@ -14,7 +14,9 @@ public interface SysRoleMapper extends BaseMapper<SysRoleDO> {
default IPage<SysRoleDO> selectPage(SysRolePageReqVO reqVO) {
return selectPage(MyBatisUtils.buildPage(reqVO),
new QueryWrapperX<SysRoleDO>().likeIfPresent("name", reqVO.getName())
.eqIfPresent("status", reqVO.getStatus()));
.likeIfPresent("code", reqVO.getCode())
.eqIfPresent("status", reqVO.getStatus())
.betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime()));
}
default SysRoleDO selectByName(String name) {

View File

@ -12,7 +12,7 @@ import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
import java.util.Set;
/**
* 角色 DO
@ -72,6 +72,6 @@ public class SysRoleDO extends BaseDO {
* 适用于 {@link #dataScope} 的值为 {@link DataScopeEnum#DEPT_CUSTOM}
*/
@TableField(typeHandler = FastjsonTypeHandler.class)
private List<Long> dataScopeDeptIds;
private Set<Long> dataScopeDeptIds;
}

View File

@ -30,7 +30,6 @@ public interface SysErrorCodeConstants {
ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1002003000, "角色不存在");
ErrorCode ROLE_NAME_DUPLICATE = new ErrorCode(1002003001, "已经存在名为【{}}】的角色");
ErrorCode ROLE_CODE_DUPLICATE = new ErrorCode(1002003002, "已经存在编码为【{}}】的角色");
ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1002003004, "不能修改类型为系统内置的角色");
ErrorCode ROLE_CAN_NOT_DELETE_SYSTEM_TYPE_ROLE = new ErrorCode(1002003005, "不能删除类型为系统内置的角色");
ErrorCode ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE = new ErrorCode(1002003004, "不能操作类型为系统内置的角色");
}

View File

@ -52,13 +52,22 @@ public interface SysPermissionService {
Set<Long> listRoleMenuIds(Long roleId);
/**
* 赋予赋予角色菜单
* 设置角色菜单
*
* @param roleId 角色编号
* @param menuIds 菜单编号集合
*/
void assignRoleMenu(Long roleId, Set<Long> menuIds);
/**
* 设置角色的数据权限
*
* @param roleId 角色编号
* @param dataScope 数据范围
* @param dataScopeDeptIds 部门编号数组
*/
void assignRoleDataScope(Long roleId, Integer dataScope, Set<Long> dataScopeDeptIds);
/**
* 处理角色删除时删除关联授权角色
*

View File

@ -8,6 +8,7 @@ import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.permission.SysRo
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* 角色 Service 接口
@ -91,4 +92,13 @@ public interface SysRoleService {
*/
void updateRoleStatus(Long id, Integer status);
/**
* 设置角色的数据权限
*
* @param id 角色编号
* @param dataScope 数据范围
* @param dataScopeDeptIds 部门编号数组
*/
void updateRoleDataScope(Long id, Integer dataScope, Set<Long> dataScopeDeptIds);
}

View File

@ -142,6 +142,11 @@ public class SysPermissionServiceImpl implements SysPermissionService {
}
}
@Override
public void assignRoleDataScope(Long roleId, Integer dataScope, Set<Long> dataScopeDeptIds) {
roleService.updateRoleDataScope(roleId, dataScope, dataScopeDeptIds);
}
@Override
public void processRoleDeleted(Long roleId) {
// TODO 实现我

View File

@ -23,10 +23,7 @@ import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*;
@ -148,6 +145,18 @@ public class SysRoleServiceImpl implements SysRoleService {
roleMapper.updateById(updateObject);
}
@Override
public void updateRoleDataScope(Long id, Integer dataScope, Set<Long> dataScopeDeptIds) {
// 校验是否可以更新
checkUpdateRole(id);
// 更新数据范围
SysRoleDO updateObject = new SysRoleDO();
updateObject.setId(id);
updateObject.setDataScope(dataScope);
updateObject.setDataScopeDeptIds(dataScopeDeptIds);
roleMapper.updateById(updateObject);
}
/**
* 校验角色的唯一字段是否重复
*
@ -187,7 +196,7 @@ public class SysRoleServiceImpl implements SysRoleService {
}
// 内置角色不允许删除
if (RoleTypeEnum.SYSTEM.getType().equals(roleDO.getType())) {
throw ServiceExceptionUtil.exception(ROLE_CAN_NOT_DELETE_SYSTEM_TYPE_ROLE);
throw ServiceExceptionUtil.exception(ROLE_CAN_NOT_UPDATE_SYSTEM_TYPE_ROLE);
}
}

View File

@ -8,6 +8,8 @@ import java.util.Date;
*/
public class DateUtils {
public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss";
public static Date addTime(Duration duration) {
return new Date(System.currentTimeMillis() + duration.toMillis());
}