| | |
| | | package com.mes.role.controller; |
| | | |
| | | |
| | | import com.mes.entity.request.GeneralRequest; |
| | | import com.mes.role.entity.SysRole; |
| | | import com.mes.role.entity.vo.SysRoleVO; |
| | | import com.mes.role.service.SysRoleService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | | * 角色表 前端控制器 |
| | | * </p> |
| | | * |
| | | * @author zhoush |
| | | * @since 2024-04-11 |
| | | */ |
| | | @Api(description = "角色管理") |
| | | @RestController |
| | | @RequestMapping("/role/sys-role") |
| | | @RequestMapping("/sys/role") |
| | | public class SysRoleController { |
| | | |
| | | @Autowired |
| | | private SysRoleService sysRoleService; |
| | | |
| | | @ApiOperation("新增角色及角色下的权限信息") |
| | | @PostMapping("/saveRole") |
| | | // @PreAuthorize("hasAuthority('sys:role:save')") |
| | | public Result<SysRole> saveRole(@Validated @RequestBody SysRoleVO sysRoleVO) { |
| | | return Result.success(sysRoleService.saveRole(sysRoleVO)); |
| | | } |
| | | |
| | | @ApiOperation("编辑角色及角色下的权限信息") |
| | | @PostMapping("/updateRole") |
| | | // @PreAuthorize("hasAuthority('sys:role:save')") |
| | | public Result<String> updateRole(@Validated @RequestBody SysRoleVO sysRoleVO) { |
| | | return Result.success(sysRoleService.updateRole(sysRoleVO)); |
| | | } |
| | | |
| | | @ApiOperation("查询角色及角色下的权限信息") |
| | | @PostMapping("/queryRole") |
| | | // @PreAuthorize("hasAuthority('sys:role:save')") |
| | | public Result<List<SysRoleVO>> queryRole(@Validated @RequestBody GeneralRequest request) { |
| | | return Result.success(sysRoleService.queryRole(request)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation("删除角色及角色下的权限信息") |
| | | @PostMapping("/delete") |
| | | // @PreAuthorize("hasAuthority('sys:role:delete')") |
| | | @Transactional |
| | | public Result<String> deleteRole(@RequestBody List<Long> ids) { |
| | | return Result.success(sysRoleService.deleteRole(ids)); |
| | | } |
| | | |
| | | } |