mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 04:39:00 +08:00
♻️ Refactoring code.新增角色与菜单VO对象
This commit is contained in:
1 parent
e030653d40
commit
d7f9cb21fb
5 files changed
+104
-10
No files matched your search
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.admin.api.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author lengleng
|
||||
* @date 2020/2/10
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "前端角色展示对象")
|
||||
public class RoleMenuVO {
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
*/
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
*/
|
||||
private String menuIds;
|
||||
|
||||
}
|
||||
@@ -20,22 +20,75 @@ package com.pig4cloud.pigx.admin.api.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 角色表
|
||||
* </p>
|
||||
*
|
||||
* @author lengleng
|
||||
* @date 2020/2/10
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "前端角色展示对象")
|
||||
public class RoleVO {
|
||||
public class RoleVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色id
|
||||
* 角色ID
|
||||
*/
|
||||
@Schema(description = "角色ID")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 菜单列表
|
||||
* 角色名称
|
||||
*/
|
||||
private String menuIds;
|
||||
@Schema(description = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色标识
|
||||
*/
|
||||
@Schema(description = "角色标识")
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
*/
|
||||
@Schema(description = "角色描述")
|
||||
private String roleDesc;
|
||||
|
||||
/**
|
||||
* 数据权限类型
|
||||
*/
|
||||
@Schema(description = "数据权限类型")
|
||||
private Integer dsType;
|
||||
|
||||
/**
|
||||
* 数据权限作用范围
|
||||
*/
|
||||
@Schema(description = "数据权限作用范围")
|
||||
private String dsScope;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@Schema(description = "修改时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@Schema(description = "用户所属租户id")
|
||||
private Long tenantId;
|
||||
|
||||
}
|
||||
+2
-2
@@ -25,7 +25,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRole;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleExcelVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleMenuVO;
|
||||
import com.pig4cloud.pigx.admin.service.SysRoleService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
@@ -146,7 +146,7 @@ public class SysRoleController {
|
||||
@SysLog("更新角色菜单")
|
||||
@PutMapping("/menu")
|
||||
@PreAuthorize("@pms.hasPermission('sys_role_perm')")
|
||||
public R saveRoleMenus(@RequestBody RoleVO roleVo) {
|
||||
public R saveRoleMenus(@RequestBody RoleMenuVO roleVo) {
|
||||
return R.ok(sysRoleService.updateRoleMenus(roleVo));
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ package com.pig4cloud.pigx.admin.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRole;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleExcelVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleMenuVO;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import org.springframework.validation.BindingResult;
|
||||
|
||||
@@ -65,7 +65,7 @@ public interface SysRoleService extends IService<SysRole> {
|
||||
* @param roleVo 角色&菜单列表
|
||||
* @return
|
||||
*/
|
||||
Boolean updateRoleMenus(RoleVO roleVo);
|
||||
Boolean updateRoleMenus(RoleMenuVO roleVo);
|
||||
|
||||
/**
|
||||
* 导入角色
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRole;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysRoleMenu;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleExcelVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleVO;
|
||||
import com.pig4cloud.pigx.admin.api.vo.RoleMenuVO;
|
||||
import com.pig4cloud.pigx.admin.mapper.SysRoleMapper;
|
||||
import com.pig4cloud.pigx.admin.service.SysRoleMenuService;
|
||||
import com.pig4cloud.pigx.admin.service.SysRoleService;
|
||||
@@ -102,7 +102,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateRoleMenus(RoleVO roleVo) {
|
||||
public Boolean updateRoleMenus(RoleMenuVO roleVo) {
|
||||
return roleMenuService.saveRoleMenus(roleVo.getRoleId(), roleVo.getMenuIds());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user