| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.PermitGroupDto; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.service.CategoryService; |
| | | import com.whyc.service.GroupService; |
| | | import com.whyc.service.PermitGroupService; |
| | | import com.whyc.service.PermitService; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.pojo.PermitGroup; |
| | | import com.whyc.pojo.UserGroup; |
| | | import com.whyc.service.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.bouncycastle.asn1.ocsp.ResponderID; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Api(tags = "权限管理") |
| | | @RequestMapping("permitGroup") |
| | |
| | | |
| | | @Autowired |
| | | private PermitService permitService; |
| | | |
| | | @Autowired |
| | | private DocUserService docUserService; |
| | | |
| | | |
| | | @Autowired |
| | | private CategoryService categoryService; |
| | |
| | | public Response getAllGroup(){ |
| | | return groupService.getAllGroup(); |
| | | } |
| | | |
| | | @ApiOperation(value = "登录后根据用户名查询该用户的权限") |
| | | @GetMapping("getPermitsByUname") |
| | | public Response getPermitsByUname(){ |
| | | List list = permitService.getPermitsByUname(); |
| | | return new Response().setII(1,list.size()>0,list,"返回"); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加权限组") |
| | | @GetMapping("addGroup") |
| | | public Response addGroup(@RequestParam String groupName){ |
| | | return groupService.addGroup(groupName); |
| | | } |
| | | |
| | | @ApiOperation(value = "删除权限组") |
| | | @GetMapping("delGroup") |
| | | public Response delGroup(@RequestParam String groupId){ |
| | | return groupService.delGroup(groupId); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑权限组名") |
| | | @GetMapping("updateGroup") |
| | | public Response updateGroup(@RequestParam String groupId,@RequestParam String groupName){ |
| | | return groupService.updateGroup(groupId,groupName); |
| | | } |
| | | @ApiOperation(value = "查询所有用户") |
| | | @GetMapping("getAllDocUser") |
| | | public Response getAllDocUser(){ |
| | | return docUserService.getAllDocUser(); |
| | | } |
| | | |
| | | @ApiOperation(value = "权限组下加用户") |
| | | @PostMapping("addUserToGroup") |
| | | public Response addUserToGroup(@RequestBody List<UserGroup> users){ |
| | | return groupService.addUserToGroup(users); |
| | | } |
| | | |
| | | @ApiOperation(value = "权限组下移除用户") |
| | | @PostMapping("delUserToGroup") |
| | | public Response delUserToGroup(@RequestBody List<UserGroup> users){ |
| | | return groupService.delUserToGroup(users); |
| | | } |
| | | |
| | | @ApiOperation(value = "(组合操作)权限组下加用户和移除用户") |
| | | @PostMapping("opreateUserToGroup") |
| | | public Response opreateUserToGroup(@RequestBody PermitGroupDto permitGroupDto){ |
| | | return groupService.opreateUserToGroup(permitGroupDto); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "权限组下加权限") |
| | | @PostMapping("addPermitToGroup") |
| | | public Response addPermitToGroup(@RequestBody List<PermitGroup> permits){ |
| | | return groupService.addPermitToGroup(permits); |
| | | } |
| | | @ApiOperation(value = "权限组下移除权限") |
| | | @PostMapping("delPermitToGroup") |
| | | public Response delPermitToGroup(@RequestBody List<PermitGroup> permits){ |
| | | return groupService.delPermitToGroup(permits); |
| | | } |
| | | |
| | | @ApiOperation(value = "(组合操作)权限组下加权限和移除权限") |
| | | @PostMapping("opreatePermitToGroup") |
| | | public Response opreatePermitToGroup(@RequestBody PermitGroupDto permitGroupDto){ |
| | | return groupService.opreatePermitToGroup(permitGroupDto); |
| | | } |
| | | } |