新增角色菜单临时接口
This commit is contained in:
@@ -23,4 +23,9 @@ public class SysMenuDAO {
|
||||
return sysMenuMapper.selectMenuAll(parentIds, platformType);
|
||||
}
|
||||
|
||||
public Long addMenu(SysMenuDO param){
|
||||
sysMenuMapper.insertSelective(param);
|
||||
return param.getId();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.cool.store.dao;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.enums.DataSourceEnum;
|
||||
import com.cool.store.mapper.SysRoleMapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Repository;
|
||||
@@ -50,4 +52,16 @@ public class SysRoleDAO {
|
||||
}
|
||||
return sysRoleMapper.getRoleByName(roleName, dataSource.getCode());
|
||||
}
|
||||
|
||||
public Page<SysRoleDO> getRolePage(Integer pageNum, Integer pageSize){
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
return sysRoleMapper.getRolePage();
|
||||
}
|
||||
|
||||
public SysRoleDO getRoleDetail(String roleId){
|
||||
if(StringUtils.isBlank(roleId)){
|
||||
return null;
|
||||
}
|
||||
return sysRoleMapper.getRoleDetail(roleId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@ package com.cool.store.dao;
|
||||
|
||||
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import com.cool.store.enums.PlatFormTypeEnum;
|
||||
import com.cool.store.mapper.SysRoleMenuMapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -33,4 +35,17 @@ public class SysRoleMenuDAO {
|
||||
return sysRoleMenuMapper.getRoleMenuByRoleId(roleId, platform);
|
||||
}
|
||||
|
||||
public Integer updateRoleAuth(String roleId, List<Long> menuIds){
|
||||
//先删后增
|
||||
sysRoleMenuMapper.deleteRoleAuth(roleId, PlatFormTypeEnum.PC.getCode());
|
||||
List<SysRoleMenuDO> insertList = new ArrayList<>();
|
||||
for (Long menuId : menuIds) {
|
||||
SysRoleMenuDO insert = new SysRoleMenuDO();
|
||||
insert.setMenuId(menuId);
|
||||
insert.setRoleId(roleId);
|
||||
insertList.add(insert);
|
||||
}
|
||||
return sysRoleMenuMapper.batchInsert(insertList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.cool.store.mapper;
|
||||
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.github.pagehelper.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
@@ -40,4 +41,17 @@ public interface SysRoleMapper {
|
||||
* @return
|
||||
*/
|
||||
SysRoleDO getRoleByName(@Param("roleName") String roleName, @Param("roleType")Integer roleType);
|
||||
|
||||
/**
|
||||
* 角色分页
|
||||
* @return
|
||||
*/
|
||||
Page<SysRoleDO> getRolePage();
|
||||
|
||||
/**
|
||||
* 获取角色详情
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
SysRoleDO getRoleDetail(@Param("roleId") String roleId);
|
||||
}
|
||||
@@ -16,7 +16,7 @@ public interface SysRoleMenuMapper {
|
||||
* 会对传进来的字段做判空处理,如果字段为空,则使用数据库默认字段或者null
|
||||
* dateTime:2023-05-19 03:01
|
||||
*/
|
||||
int insertSelective(@Param("record") SysRoleMenuDO record);
|
||||
int batchInsert(@Param("recordList") List<SysRoleMenuDO> recordList);
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -32,4 +32,11 @@ public interface SysRoleMenuMapper {
|
||||
* @return
|
||||
*/
|
||||
List<SysRoleMenuDO> getRoleMenuByRoleId(@Param("roleId")String roleId, @Param("platform")String platform);
|
||||
|
||||
/**
|
||||
* 删除角色权限
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
Integer deleteRoleAuth(@Param("roleId")String roleId, @Param("platform")String platform);
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
id, parent_id, code, name, alias, path, perms, source, sort, category, action, remark,
|
||||
platform, is_deleted, type, target, component, icon, menu_type, env, common_functions_icon
|
||||
</sql>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into sys_menu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="parentId != null">
|
||||
|
||||
@@ -138,4 +138,20 @@
|
||||
where
|
||||
role_name = #{roleName} and role_type = #{roleType} and deleted = 0 limit 1
|
||||
</select>
|
||||
|
||||
<select id="getRolePage" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from
|
||||
sys_role
|
||||
</select>
|
||||
|
||||
<select id="getRoleDetail" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from
|
||||
sys_role
|
||||
where
|
||||
role_id = #{roleId} deleted = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -10,30 +10,32 @@
|
||||
<sql id="Base_Column_List">
|
||||
id, menu_id, role_id, platform
|
||||
</sql>
|
||||
<insert id="insertSelective" keyColumn="id" keyProperty="record.id" useGeneratedKeys="true">
|
||||
insert into sys_role_menu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.menuId != null">
|
||||
menu_id,
|
||||
</if>
|
||||
<if test="record.roleId != null">
|
||||
role_id,
|
||||
</if>
|
||||
<if test="record.platform != null">
|
||||
platform,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="record.menuId != null">
|
||||
#{record.menuId},
|
||||
</if>
|
||||
<if test="record.roleId != null">
|
||||
#{record.roleId},
|
||||
</if>
|
||||
<if test="record.platform != null">
|
||||
#{record.platform},
|
||||
</if>
|
||||
</trim>
|
||||
<insert id="batchInsert">
|
||||
<foreach collection="recordList" item="record" separator=";">
|
||||
insert into sys_role_menu
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="record.menuId != null">
|
||||
menu_id,
|
||||
</if>
|
||||
<if test="record.roleId != null">
|
||||
role_id,
|
||||
</if>
|
||||
<if test="record.platform != null">
|
||||
platform,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="record.menuId != null">
|
||||
#{record.menuId},
|
||||
</if>
|
||||
<if test="record.roleId != null">
|
||||
#{record.roleId},
|
||||
</if>
|
||||
<if test="record.platform != null">
|
||||
#{record.platform},
|
||||
</if>
|
||||
</trim>
|
||||
</foreach>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective">
|
||||
update sys_role_menu
|
||||
@@ -59,4 +61,8 @@
|
||||
where
|
||||
role_id=#{roleId} and platform=#{platform}
|
||||
</select>
|
||||
|
||||
<delete id="deleteRoleAuth">
|
||||
delete from sys_role_menu where role_id=#{roleId} and platform=#{platform}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.cool.store.dto.menu;
|
||||
|
||||
|
||||
import com.cool.store.entity.SysMenuDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
import com.cool.store.enums.MenuTypeEnum;
|
||||
import com.cool.store.exception.ServiceException;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
@Data
|
||||
public class AddMenuDTO {
|
||||
|
||||
@NotBlank(message = "名称不能为空")
|
||||
private String name;
|
||||
|
||||
@JsonProperty("parent_id")
|
||||
@NotNull(message = "父Id不能为空")
|
||||
private Long parentId;
|
||||
|
||||
@NotBlank(message = "地址不能为空")
|
||||
private String path;
|
||||
|
||||
private String component;
|
||||
|
||||
private String target;
|
||||
|
||||
private String icon;
|
||||
|
||||
private String env;
|
||||
|
||||
public static SysMenuDO convertDO(AddMenuDTO param, MenuTypeEnum menuTypeEnum){
|
||||
SysMenuDO menu = new SysMenuDO();
|
||||
SysMenuDO sysMenuDO = new SysMenuDO();
|
||||
sysMenuDO.setParentId(param.getParentId());
|
||||
sysMenuDO.setName(param.getName());
|
||||
sysMenuDO.setCode(param.getName());
|
||||
sysMenuDO.setPath(param.getPath());
|
||||
sysMenuDO.setType(null);
|
||||
sysMenuDO.setSource("menu");
|
||||
sysMenuDO.setAction(1);
|
||||
sysMenuDO.setPlatform("PC");
|
||||
sysMenuDO.setComponent(param.getComponent());
|
||||
sysMenuDO.setTarget(param.getTarget());
|
||||
sysMenuDO.setIcon(param.getIcon());
|
||||
sysMenuDO.setMenuType(menuTypeEnum.getCode());
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.cool.store.dto.role;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: RoleUpdateDTO
|
||||
* @Description:
|
||||
* @date 2023-07-25 15:03
|
||||
*/
|
||||
@Data
|
||||
public class RoleUpdateDTO {
|
||||
|
||||
@ApiModelProperty("角色id")
|
||||
private String roleId;
|
||||
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
@ApiModelProperty("菜单ids")
|
||||
private List<Long> menuIds;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.cool.store.vo.role;
|
||||
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: RoleAuthInfoVO
|
||||
* @Description:
|
||||
* @date 2023-07-25 15:11
|
||||
*/
|
||||
@Data
|
||||
public class RoleAuthInfoVO {
|
||||
|
||||
@ApiModelProperty("角色id")
|
||||
private String roleId;
|
||||
|
||||
@ApiModelProperty("角色名称")
|
||||
private String roleName;
|
||||
|
||||
@ApiModelProperty("菜单ids")
|
||||
private List<Long> menuIds;
|
||||
|
||||
public static RoleAuthInfoVO convertVO(SysRoleDO role, List<SysRoleMenuDO> roleMenuList){
|
||||
if(Objects.isNull(role)){
|
||||
return null;
|
||||
}
|
||||
RoleAuthInfoVO result = new RoleAuthInfoVO();
|
||||
result.setRoleId(role.getRoleId());
|
||||
result.setRoleName(role.getRoleName());
|
||||
result.setMenuIds(ListUtils.emptyIfNull(roleMenuList).stream().map(SysRoleMenuDO::getMenuId).distinct().collect(Collectors.toList()));
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.cool.store.vo.role;
|
||||
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: RolePageVO
|
||||
* @Description:
|
||||
* @date 2023-07-25 15:10
|
||||
*/
|
||||
@Data
|
||||
public class RolePageVO {
|
||||
|
||||
private String roleId;
|
||||
|
||||
private String roleName;
|
||||
|
||||
public static List<RolePageVO> convertList(List<SysRoleDO> roleList){
|
||||
if(CollectionUtils.isEmpty(roleList)){
|
||||
return Lists.newArrayList();
|
||||
}
|
||||
List<RolePageVO> resultList = new ArrayList<>();
|
||||
for (SysRoleDO sysRole : roleList) {
|
||||
RolePageVO role = new RolePageVO();
|
||||
role.setRoleId(sysRole.getRoleId());
|
||||
role.setRoleName(role.getRoleName());
|
||||
resultList.add(role);
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.menu.AddMenuDTO;
|
||||
import com.cool.store.enums.MenuTypeEnum;
|
||||
import com.cool.store.vo.menu.MenuTreeVO;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,4 +21,18 @@ public interface MenuService {
|
||||
* @return
|
||||
*/
|
||||
List<MenuTreeVO> getUserMenus(String userId, String roleId);
|
||||
|
||||
/**
|
||||
* 获取所有的菜单
|
||||
* @return
|
||||
*/
|
||||
List<MenuTreeVO> getAllMenus();
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
* @param param
|
||||
* @param menuType
|
||||
* @return
|
||||
*/
|
||||
Long addMenu(AddMenuDTO param, MenuTypeEnum menuType);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.cool.store.service;
|
||||
|
||||
import com.cool.store.dto.role.RoleUpdateDTO;
|
||||
import com.cool.store.vo.role.RoleAuthInfoVO;
|
||||
import com.cool.store.vo.role.RolePageVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: RoleService
|
||||
* @Description:角色service
|
||||
* @date 2023-07-25 15:05
|
||||
*/
|
||||
public interface RoleService {
|
||||
|
||||
/**
|
||||
* 获取角色分页
|
||||
* @param pageNum
|
||||
* @param pageSize
|
||||
* @return
|
||||
*/
|
||||
PageInfo<RolePageVO> getRolePage(Integer pageNum, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取角色权限详情
|
||||
* @param roleId
|
||||
* @return
|
||||
*/
|
||||
RoleAuthInfoVO getRoleAuthDetail(String roleId);
|
||||
|
||||
/**
|
||||
* 更新角色权限
|
||||
* @param userId
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
Integer updateRoleAuth(String userId, RoleUpdateDTO param);
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.cool.store.service.impl;
|
||||
import com.cool.store.constants.CommonConstants;
|
||||
import com.cool.store.dao.SysMenuDAO;
|
||||
import com.cool.store.dao.SysRoleMenuDAO;
|
||||
import com.cool.store.dto.menu.AddMenuDTO;
|
||||
import com.cool.store.entity.SysMenuDO;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import com.cool.store.enums.MenuTypeEnum;
|
||||
@@ -10,7 +11,6 @@ import com.cool.store.enums.PlatFormTypeEnum;
|
||||
import com.cool.store.service.MenuService;
|
||||
import com.cool.store.vo.menu.MenuTreeVO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -52,6 +52,17 @@ public class MenuServiceImpl implements MenuService {
|
||||
return MenuTreeVO.dealMenuTree(CommonConstants.ZERO_LONG, menuList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuTreeVO> getAllMenus() {
|
||||
List<SysMenuDO> menuList= sysMenuDAO.selectMenuAll(null, PlatFormTypeEnum.PC.getCode());
|
||||
return MenuTreeVO.dealMenuTree(CommonConstants.ZERO_LONG, menuList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long addMenu(AddMenuDTO param, MenuTypeEnum menuType) {
|
||||
return sysMenuDAO.addMenu(AddMenuDTO.convertDO(param, menuType));
|
||||
}
|
||||
|
||||
private void getParentNode(Long menuId, Map<Long, Long> idMap, Set<Long> authMenuList) {
|
||||
Long parentId = idMap.get(menuId);
|
||||
authMenuList.add(parentId);
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.cool.store.service.impl;
|
||||
|
||||
import com.cool.store.dao.SysMenuDAO;
|
||||
import com.cool.store.dao.SysRoleDAO;
|
||||
import com.cool.store.dao.SysRoleMenuDAO;
|
||||
import com.cool.store.dto.role.RoleUpdateDTO;
|
||||
import com.cool.store.entity.SysRoleDO;
|
||||
import com.cool.store.entity.SysRoleMenuDO;
|
||||
import com.cool.store.enums.PlatFormTypeEnum;
|
||||
import com.cool.store.service.RoleService;
|
||||
import com.cool.store.vo.role.RoleAuthInfoVO;
|
||||
import com.cool.store.vo.role.RolePageVO;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: RoleServiceImpl
|
||||
* @Description:
|
||||
* @date 2023-07-25 15:06
|
||||
*/
|
||||
@Service
|
||||
public class RoleServiceImpl implements RoleService {
|
||||
|
||||
@Resource
|
||||
private SysRoleDAO sysRoleDAO;
|
||||
@Resource
|
||||
private SysMenuDAO sysMenuDAO;
|
||||
@Resource
|
||||
private SysRoleMenuDAO sysRoleMenuDAO;
|
||||
|
||||
@Override
|
||||
public PageInfo<RolePageVO> getRolePage(Integer pageNum, Integer pageSize) {
|
||||
Page<SysRoleDO> page = sysRoleDAO.getRolePage(pageNum, pageSize);
|
||||
PageInfo resultPage = new PageInfo(page);
|
||||
List<RolePageVO> resultList = RolePageVO.convertList(page);
|
||||
resultPage.setList(resultList);
|
||||
return resultPage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RoleAuthInfoVO getRoleAuthDetail(String roleId) {
|
||||
SysRoleDO roleDetail = sysRoleDAO.getRoleDetail(roleId);
|
||||
if(Objects.isNull(roleDetail)){
|
||||
return null;
|
||||
}
|
||||
List<SysRoleMenuDO> roleMenuAuths = sysRoleMenuDAO.getRoleMenuByRoleId(roleId, PlatFormTypeEnum.PC.getCode());
|
||||
return RoleAuthInfoVO.convertVO(roleDetail, roleMenuAuths);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateRoleAuth(String userId, RoleUpdateDTO param) {
|
||||
return sysRoleMenuDAO.updateRoleAuth(param.getRoleId(), param.getMenuIds());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dto.menu.AddMenuDTO;
|
||||
import com.cool.store.enums.MenuTypeEnum;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.MenuService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -25,4 +29,19 @@ public class MenuController {
|
||||
return ResponseResult.success(menuService.getUserMenus(CurrentUserHolder.getUserId(), CurrentUserHolder.getRoleId()));
|
||||
}
|
||||
|
||||
@GetMapping("/menu/getAllMenus")
|
||||
public ResponseResult getAllMenus(){
|
||||
return ResponseResult.success(menuService.getAllMenus());
|
||||
}
|
||||
|
||||
@PostMapping(path = "/menu/add")
|
||||
public ResponseResult addMenu(@RequestBody AddMenuDTO param){
|
||||
return ResponseResult.success(menuService.addMenu(param, MenuTypeEnum.MENU));
|
||||
}
|
||||
|
||||
@PostMapping(path = "/menu/auth/add")
|
||||
public ResponseResult addMenuAuth(@RequestBody AddMenuDTO param){
|
||||
return ResponseResult.success(menuService.addMenu(param, MenuTypeEnum.AUTH));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.cool.store.controller;
|
||||
|
||||
import com.cool.store.context.CurrentUserHolder;
|
||||
import com.cool.store.dto.role.RoleUpdateDTO;
|
||||
import com.cool.store.response.ResponseResult;
|
||||
import com.cool.store.service.RoleService;
|
||||
import com.cool.store.vo.role.RoleAuthInfoVO;
|
||||
import com.cool.store.vo.role.RolePageVO;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author zhangchenbiao
|
||||
* @FileName: RoleController
|
||||
* @Description:
|
||||
* @date 2023-07-25 14:58
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "角色")
|
||||
public class RoleController {
|
||||
|
||||
@Resource
|
||||
private RoleService roleService;
|
||||
|
||||
@ApiOperation("角色列表")
|
||||
@GetMapping("/role/page")
|
||||
public ResponseResult<PageInfo<RolePageVO>> getRolePage(@RequestParam("pageNum")Integer pageNum, @RequestParam("pageSize")Integer pageSize){
|
||||
return ResponseResult.success(roleService.getRolePage(pageNum, pageSize));
|
||||
}
|
||||
|
||||
@ApiOperation("角色权限详情")
|
||||
@GetMapping("/role/auth/detail")
|
||||
public ResponseResult<RoleAuthInfoVO> getRoleAuthDetail(@RequestParam("roleId")String roleId){
|
||||
return ResponseResult.success(roleService.getRoleAuthDetail(roleId));
|
||||
}
|
||||
|
||||
@ApiOperation("角色更新")
|
||||
@PostMapping("/role/auth/update")
|
||||
public ResponseResult updateRoleAuth(@RequestBody RoleUpdateDTO param){
|
||||
return ResponseResult.success(roleService.updateRoleAuth(CurrentUserHolder.getUserId(), param));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user