| | |
| | | package com.whyc.controller; |
| | | |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.pojo.DocUser; |
| | | import com.whyc.service.DocUserService; |
| | | import com.whyc.util.ActionUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | 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 org.springframework.web.multipart.MultipartFile; |
| | | |
| | | |
| | | @RestController |
| | | @Api(tags = "用户管理") |
| | |
| | | private DocUserService service; |
| | | |
| | | @ApiOperation(value = "查询所有用户信息",notes = "默认排除指定用户:sys_admin") |
| | | @GetMapping("getAllUser") |
| | | private Response getAllUser(){ |
| | | return service.getAllUser(); |
| | | @PostMapping("getAllUser") |
| | | public Response getAllUser(@RequestBody(required = false) DocUser docUser,@RequestParam int pageCurr,@RequestParam int pageSize){ |
| | | return service.getAllUser(docUser,pageCurr,pageSize); |
| | | } |
| | | |
| | | @ApiOperation(value = "编辑所有用户信息") |
| | | @PostMapping("updateUser") |
| | | @ApiImplicitParam(name = "file", value = "上传的文件", dataTypeClass = MultipartFile.class, required = false,paramType = "form") |
| | | public Response updateUser(@RequestPart(value = "file",required = false) MultipartFile file, @RequestParam String json){ |
| | | DocUser docUser= ActionUtil.getGson().fromJson(json,DocUser.class); |
| | | return service.updateUser(file,docUser); |
| | | } |
| | | @ApiOperation(value = "新添加用户信息") |
| | | @PostMapping("addUser") |
| | | @ApiImplicitParam(name = "file", value = "上传的文件", dataTypeClass = MultipartFile.class, required = false,paramType = "form") |
| | | public Response addUser(@RequestPart(value = "file",required = false) MultipartFile file,@RequestParam String json){ |
| | | DocUser docUser= ActionUtil.getGson().fromJson(json,DocUser.class); |
| | | return service.addUser(file,docUser); |
| | | } |
| | | @ApiOperation(value = "删除用户信息") |
| | | @GetMapping("deleteUser") |
| | | public Response deleteUser(@RequestParam int id){ |
| | | return service.delUser(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改密码") |
| | | @GetMapping("changeSnId") |
| | | public Response changeSnId(@RequestParam String oldSnId,@RequestParam String newSnId){ |
| | | DocUser docUser=ActionUtil.getUser(); |
| | | return service.changeSnId(docUser.getName(),oldSnId,newSnId); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据角色id查询对应的用户") |
| | | @GetMapping("getUserByRoleId") |
| | | public Response readUserByRoleId(int roleId){ |
| | | return service.getUserByRoleId(roleId); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据角色id集合查询对应的用户") |
| | | @GetMapping("getUserByRoleIds") |
| | | public Response readUserByRoleIds(Integer[] roleIds){ |
| | | return service.readUserByRoleIds(roleIds); |
| | | } |
| | | |
| | | } |