| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.BaoJiGroup; |
| | | import com.whyc.pojo.BaoJiGroupUser; |
| | | import com.whyc.pojo.UserInf; |
| | | import com.whyc.service.BaoJiGroupUserService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | 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 javax.annotation.Resource; |
| | | import javax.swing.*; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * 包机组-用户 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("baoJiGroupUser") |
| | | @Api(tags = "包机组-用户") |
| | | @Api(tags = "用户管理-包机组-用户") |
| | | public class BaoJiGroupUserController { |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @GetMapping("groupAndUser") |
| | | @ApiOperation(value = "查询所有的包机组和对应用户") |
| | | public Response getGroupAndUserList(){ |
| | | return new Response().set(1,service.getGroupAndUserList()); |
| | | public Response<List<BaoJiGroup>> getGroupAndUserList(){ |
| | | return new Response<List<BaoJiGroup>>().set(1,service.getGroupAndUserList()); |
| | | } |
| | | |
| | | @GetMapping("groupAndUserListOfCurrentUser") |
| | | @ApiOperation(value = "查询当前用户的所有包机组和对应用户") |
| | | public Response<List<BaoJiGroup>> getGroupAndUserListOfCurrentUser(){ |
| | | Long userId = ActionUtil.getUser().getUId(); |
| | | return new Response<List<BaoJiGroup>>().set(1,service.getGroupAndUserListOfCurrentUser(userId)); |
| | | } |
| | | |
| | | @GetMapping("userList") |
| | | @ApiOperation(value = "包机组已添加用户和未添加用户列表") |
| | | public Response<Map<String,List<UserInf>>> getUserList(@RequestParam int baoJiGroupId ){ |
| | | Map<String,List<UserInf>> resultMap = service.getUserList(baoJiGroupId); |
| | | return new Response<Map<String, List<UserInf>>>().set(1,resultMap); |
| | | } |
| | | |
| | | @PutMapping("userList") |
| | | @ApiOperation(value = "包机组添加用户|移除用户",notes = "operationFlag为1,添加;-1,移除") |
| | | public Response updateUserList(@RequestBody List<BaoJiGroupUser> baoJiGroupUserList,@RequestParam int operationFlag){ |
| | | service.updateUserList(baoJiGroupUserList,operationFlag); |
| | | if(operationFlag==1) { |
| | | return new Response().setII(1, "添加成功"); |
| | | }else{ |
| | | return new Response().setII(1,"移除成功"); |
| | | } |
| | | } |
| | | |
| | | } |