| | |
| | | package com.yuanchu.mom.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.dto.UserPageDto; |
| | | import com.yuanchu.mom.pojo.CustomEnum; |
| | | import com.yuanchu.mom.annotation.ValueAuth; |
| | | import com.yuanchu.mom.annotation.ValueClassify; |
| | | import com.yuanchu.mom.dto.RolePowerDto; |
| | | import com.yuanchu.mom.pojo.Role; |
| | | import com.yuanchu.mom.pojo.User; |
| | | import com.yuanchu.mom.service.PowerService; |
| | | import com.yuanchu.mom.service.RoleService; |
| | | import com.yuanchu.mom.service.UserService; |
| | | import com.yuanchu.mom.utils.JackSonUtil; |
| | | import com.yuanchu.mom.utils.Jwt; |
| | | import com.yuanchu.mom.utils.RedisUtil; |
| | | import com.yuanchu.mom.vo.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RequestMapping("/role") |
| | |
| | | |
| | | private RoleService roleService; |
| | | |
| | | private PowerService powerService; |
| | | @ValueAuth |
| | | @ApiOperation(value = "获取角色列表枚举") |
| | | @GetMapping("/selectRoleList") |
| | | public Result selectUserList(){ |
| | | public Result selectRoleList(){ |
| | | return Result.success(roleService.selectList()); |
| | | } |
| | | |
| | | |
| | | @ValueAuth |
| | | @ApiOperation(value = "获取角色列表") |
| | | @PostMapping("/selectRoleLists") |
| | | public Result selectRoleList(@RequestBody Map<String, Object> data) throws Exception { |
| | | public Result selectRoleLists(@RequestBody Map<String, Object> data) throws Exception { |
| | | Page page = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("page")), Page.class); |
| | | Role role = JackSonUtil.unmarshal(JackSonUtil.marshal(data.get("entity")), Role.class); |
| | | return Result.success(roleService.selectUserList(page, role)); |
| | | } |
| | | |
| | | @ValueClassify("角色管理") |
| | | @ApiOperation(value = "删除角色列表") |
| | | @PostMapping("/delRole") |
| | | public Result delRole(Integer id){ |
| | | return Result.success(roleService.delRole(id)); |
| | | } |
| | | @ValueAuth |
| | | @ApiOperation(value = "通过角色id查询权限列表") |
| | | @PostMapping("/selectPowerByRoleId") |
| | | public Result<?> selectPowerByRoleId(Integer id) { |
| | | return Result.success(powerService.selectPowerByRoleId(id)); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加角色信息") |
| | | @ApiOperation(value = "获取菜单") |
| | | @GetMapping("/selectMenuList") |
| | | @ValueAuth |
| | | public Result<?> selectMenuList() { |
| | | return Result.success(roleService.selectMenuList()); |
| | | } |
| | | @ValueClassify("角色管理") |
| | | @ApiOperation(value = "添加角色") |
| | | @PostMapping("/addRole") |
| | | public Result<?> addRole(@RequestBody Role role) { |
| | | return Result.success(roleService.addRole(role)); |
| | | public Result<?> addRole(String str) { |
| | | RolePowerDto powers = JSON.parseObject(str, RolePowerDto.class); |
| | | return Result.success(roleService.addRole(powers)); |
| | | } |
| | | @ValueClassify("角色管理") |
| | | @ApiOperation(value = "修改角色信息") |
| | | @PostMapping("/upRole") |
| | | public Result<?> upRole(String str) { |
| | | RolePowerDto powers = JSON.parseObject(str, RolePowerDto.class); |
| | | return Result.success(roleService.upRole(powers)); |
| | | } |
| | | } |