123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- package com.hssx.pcbms.controller;
- import com.hssx.pcbms.entity.User;
- import com.hssx.pcbms.entity.vo.UserVO;
- import com.hssx.pcbms.service.UserService;
- import com.hssx.pcbms.util.HttpRespMsg;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.multipart.MultipartFile;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-10-24
- */
- @Controller
- @RequestMapping("/user")
- public class UserController {
- @Autowired
- private UserService userService;
- /**
- * 注册
- * 参数:phone 账号 password 密码 name 姓名
- * code 验证码
- *
- * @return
- */
- @ApiOperation(value = "注册", notes = "注册方法")
- @RequestMapping("/regist")
- @ResponseBody
- public HttpRespMsg regist(User user, @RequestParam(required = false) String code) {
- HttpRespMsg msg = userService.regist(user, code);
- return msg;
- }
- /**
- * 登录
- * 参数:phone 账号 password 密码
- *
- * @return
- */
- @ApiOperation(value = "登录", notes = "登录方法")
- @RequestMapping("/login")
- @ResponseBody
- public HttpRespMsg sysLogin(User user, HttpServletRequest request,
- HttpServletResponse response) {
- HttpRespMsg msg = userService.login(user, request);
- return msg;
- }
- /**
- * 用户列表
- * 参数:deptId 部门id ,roleName 备注(角色)名称,isPass 审核是否通过 0-未通过 1-通过(以上参数查什么传什么)
- *
- * @return
- */
- @ApiOperation(value = "用户列表", notes = "用户列表方法")
- @RequestMapping("/list")
- @ResponseBody
- public HttpRespMsg list(UserVO userVO) {
- HttpRespMsg msg = userService.getList(userVO);
- return msg;
- }
- /**
- * 用户修改/审核接口
- * 参数:id:用户id(必传)
- * 要修改的参数:isPass 审核 0-不通过 1-通过,roleName 备注(角色)名称,deptId 部门id ,phone 修改手机号,file 头像文件
- *
- * @return
- */
- @ApiOperation(value = "用户修改", notes = "用户修改方法")
- @RequestMapping("/update")
- @ResponseBody
- public HttpRespMsg update(User user, @RequestParam(required = false) MultipartFile file) {
- HttpRespMsg msg = userService.updateUser(user,file);
- return msg;
- }
- /**
- * 忘记密码/修改密码接口
- * 参数:id:用户id(必传)password:密码,type :0-修改密码 1-忘记密码
- * type = 1 需要传手机号 phone:手机号,code:验证码
- *
- * @return
- */
- @ApiOperation(value = "忘记密码/修改密码接口", notes = "忘记密码/修改密码接口方法")
- @RequestMapping("/updateAndForgetPwd")
- @ResponseBody
- public HttpRespMsg updateAndForgetPwd(User user, Integer type, @RequestParam(required = false) String code) {
- HttpRespMsg msg = userService.updateAndForgetPwd(user, type, code);
- return msg;
- }
- /**
- * 用户分配权限
- * id:用户id permissionIds:权限对应的ids集合字符串("1,2,3")
- * @return
- */
- @ApiOperation(value = "用户分配权限", notes = "角色分配权限方法")
- @RequestMapping("/handOutpermissions")
- @ResponseBody
- public HttpRespMsg handOutpermissions(User user, String permissionIds) {
- HttpRespMsg msg = new HttpRespMsg();
- msg = userService.handOutpermissions(user,permissionIds);
- return msg;
- }
- }
|