¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.doumee.api.system; |
| | | |
| | | import com.doumee.api.BaseController; |
| | | import com.doumee.biz.system.SystemRoleBiz; |
| | | import com.doumee.core.annotation.pr.PreventRepeat; |
| | | import com.doumee.core.constants.OperaType; |
| | | import com.doumee.core.model.ApiResponse; |
| | | import com.doumee.core.model.PageData; |
| | | import com.doumee.core.model.PageWrap; |
| | | import com.doumee.dao.system.dto.CreateRoleMenuDTO; |
| | | import com.doumee.dao.system.dto.CreateRolePermissionDTO; |
| | | import com.doumee.dao.system.dto.QuerySystemRoleDTO; |
| | | import com.doumee.dao.system.model.SystemRole; |
| | | import com.doumee.dao.system.vo.SystemRoleListVO; |
| | | import com.doumee.service.system.SystemRoleService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.shiro.authz.annotation.RequiresPermissions; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Eva.Caesar Liu |
| | | * @date 2023/03/21 14:49 |
| | | */ |
| | | @Api(tags = "ç³»ç»è§è²") |
| | | @RestController |
| | | @RequestMapping("/system/role") |
| | | public class SystemRoleController extends BaseController { |
| | | |
| | | @Autowired |
| | | private SystemRoleService systemRoleService; |
| | | |
| | | @Autowired |
| | | private SystemRoleBiz systemRoleBiz; |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("é
ç½®è§è²èå") |
| | | @PostMapping("/createRoleMenu") |
| | | @RequiresPermissions("system:role:createRoleMenu") |
| | | public ApiResponse createRoleMenu (@Validated @RequestBody CreateRoleMenuDTO dto) { |
| | | systemRoleBiz.createRoleMenu(dto); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("é
ç½®è§è²æé") |
| | | @PostMapping("/createRolePermission") |
| | | @RequiresPermissions("system:role:createRolePermission") |
| | | public ApiResponse createRolePermission (@Validated @RequestBody CreateRolePermissionDTO dto) { |
| | | systemRoleBiz.createRolePermission(dto); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @PreventRepeat |
| | | @ApiOperation("æ°å»º") |
| | | @PostMapping("/create") |
| | | @RequiresPermissions("system:role:create") |
| | | public ApiResponse create(@Validated(OperaType.Create.class) @RequestBody SystemRole systemRole) { |
| | | return ApiResponse.success(systemRoleBiz.create(systemRole)); |
| | | } |
| | | |
| | | @ApiOperation("å é¤") |
| | | @GetMapping("/delete/{id}") |
| | | @RequiresPermissions("system:role:delete") |
| | | public ApiResponse deleteById(@PathVariable Integer id) { |
| | | systemRoleBiz.deleteById(id); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("æ¹éå é¤") |
| | | @GetMapping("/delete/batch") |
| | | @RequiresPermissions("system:role:delete") |
| | | public ApiResponse deleteByIdInBatch(@RequestParam String ids) { |
| | | String [] idArray = ids.split(","); |
| | | List<Integer> idList = new ArrayList<>(); |
| | | for (String id : idArray) { |
| | | idList.add(Integer.valueOf(id)); |
| | | } |
| | | systemRoleBiz.deleteByIdInBatch(idList); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("ä¿®æ¹") |
| | | @PostMapping("/updateById") |
| | | @RequiresPermissions("system:role:update") |
| | | public ApiResponse updateById(@Validated(OperaType.Update.class) @RequestBody SystemRole systemRole) { |
| | | systemRoleBiz.updateById(systemRole); |
| | | return ApiResponse.success(null); |
| | | } |
| | | |
| | | @ApiOperation("å页æ¥è¯¢") |
| | | @PostMapping("/page") |
| | | @RequiresPermissions("system:role:query") |
| | | public ApiResponse<PageData<SystemRoleListVO>> findPage (@RequestBody PageWrap<QuerySystemRoleDTO> pageWrap) { |
| | | return ApiResponse.success(systemRoleService.findPage(pageWrap)); |
| | | } |
| | | |
| | | @ApiOperation("æ¥è¯¢ææ") |
| | | @GetMapping("/all") |
| | | @RequiresPermissions("system:role:query") |
| | | public ApiResponse<List<SystemRole>> findAll () { |
| | | SystemRole systemRole = new SystemRole(); |
| | | systemRole.setDeleted(Boolean.FALSE); |
| | | return ApiResponse.success(systemRoleService.findList(systemRole)); |
| | | } |
| | | } |