用户的功能迁移
This commit is contained in:
@@ -46,12 +46,14 @@ public class PassportController {
|
||||
return success(passportManager.getAdmin(AdminSecurityContextHolder.getAdminId()));
|
||||
}
|
||||
|
||||
// TODO 优化点:迁移到 PermissionController
|
||||
@GetMapping("/tree-admin-menu")
|
||||
@ApiOperation("获得当前管理员的菜单树")
|
||||
public CommonResult<List<PassportAdminMenuTreeNodeVO>> treeAdminMenu() {
|
||||
return success(passportManager.treeAdminMenu(AdminSecurityContextHolder.getAdminId()));
|
||||
}
|
||||
|
||||
// TODO 优化点:迁移到 PermissionController
|
||||
@GetMapping("/list-admin-permission")
|
||||
@ApiOperation("获得当前管理员的权限列表")
|
||||
public CommonResult<Set<String>> listAdminPermission() {
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.common.framework.vo.PageResult;
|
||||
import cn.iocoder.mall.managementweb.controller.user.vo.UserPageReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.user.vo.UserRespVO;
|
||||
import cn.iocoder.mall.managementweb.controller.user.vo.UserUpdateInfoReqVO;
|
||||
import cn.iocoder.mall.managementweb.controller.user.vo.UserUpdateStatusReqVO;
|
||||
import cn.iocoder.mall.managementweb.manager.user.UserManager;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 用户 Controller
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user")
|
||||
@Api(tags = "用户")
|
||||
@Validated
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserManager userManager;
|
||||
|
||||
@PostMapping("/update-info")
|
||||
@ApiOperation("更新用户信息")
|
||||
public CommonResult<Boolean> updateUserInfo(@Valid UserUpdateInfoReqVO updateInfoReqVO) {
|
||||
userManager.updateUserInfo(updateInfoReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PostMapping("/update-status")
|
||||
@ApiOperation("更新用户信息")
|
||||
public CommonResult<Boolean> updateUserStatus(@Valid UserUpdateStatusReqVO updateStatusReqVO) {
|
||||
userManager.updateUserStatus(updateStatusReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@ApiOperation("获得用户")
|
||||
@ApiImplicitParam(name = "userId", value = "用户编号", required = true)
|
||||
public CommonResult<UserRespVO> getUser(@RequestParam("userId") Integer userId) {
|
||||
return success(userManager.getUser(userId));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@ApiOperation("获得用户列表")
|
||||
@ApiImplicitParam(name = "userIds", value = "用户编号列表", required = true)
|
||||
public CommonResult<List<UserRespVO>> listUsers(@RequestParam("userIds") List<Integer> userIds) {
|
||||
return success(userManager.listUsers(userIds));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@ApiOperation("获得用户分页")
|
||||
public CommonResult<PageResult<UserRespVO>> pageUser(UserPageReqVO pageVO) {
|
||||
return success(userManager.pageUser(pageVO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/12
|
||||
* @Description: 管理员 - 用户信息 - 用户分页列表
|
||||
*/
|
||||
@ApiModel("用户分页列表Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsUserPageRequest {
|
||||
|
||||
@ApiModelProperty(name = "nickname", value = "昵称,模糊匹配", example = "小王")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(name = "status", value = "状态。1 - 开启;2 - 禁用", example = "0")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(name = "pageNo", value = "页码,从 1 开始", example = "1")
|
||||
private Integer pageNo = 1;
|
||||
|
||||
@ApiModelProperty(name = "pageSize", value = "每页条数", required = true, example = "10")
|
||||
private Integer pageSize = 10;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author: jiangweifan
|
||||
* @Date: 2020/5/12
|
||||
* @Description: 管理员 - 用户信息 - 更新用户状态
|
||||
*/
|
||||
@ApiModel("更新用户状态Request")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsUserUpdateStatusRequest {
|
||||
|
||||
@ApiModelProperty(name = "id", value = "用户编号", required = true, example = "1")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(name = "status", value = "用户状态。1 - 开启;2 - 禁用", required = true, example = "1")
|
||||
@NotNull(message = "用户状态不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user.vo;
|
||||
|
||||
import cn.iocoder.common.framework.vo.PageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@ApiModel("用户分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserPageReqVO extends PageParam {
|
||||
|
||||
@ApiModelProperty(value = "昵称", example = "丑艿艿", notes = "模糊匹配")
|
||||
private String nickname;
|
||||
@ApiModelProperty(value = "状态", example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user.vo;
|
||||
|
||||
import lombok.*;
|
||||
import io.swagger.annotations.*;
|
||||
import java.util.*;
|
||||
|
||||
@ApiModel("用户 Response VO")
|
||||
@Data
|
||||
public class UserRespVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "昵称", example = "丑艿艿")
|
||||
private String nickname;
|
||||
@ApiModelProperty(value = "头像", example = "http://www.iocoder.cn/xxx.jpg")
|
||||
private String avatar;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691399")
|
||||
private String mobile;
|
||||
@ApiModelProperty(value = "注册 IP", required = true, example = "127.0.0.1")
|
||||
private String createIp;
|
||||
@ApiModelProperty(value = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("用户更新信息 Request VO")
|
||||
@Data
|
||||
public class UserUpdateInfoReqVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "昵称", example = "臭艿艿")
|
||||
private String nickname;
|
||||
@ApiModelProperty(value = "头像", example = "http://www.iocoder.cn/nainainai.jpg")
|
||||
private String avatar;
|
||||
@ApiModelProperty(value = "手机号", example = "15601691300")
|
||||
private String mobile;
|
||||
@ApiModelProperty(value = "密码", example = "123456")
|
||||
private String password;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.iocoder.mall.managementweb.controller.user.vo;
|
||||
|
||||
import cn.iocoder.common.framework.enums.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.validator.InEnum;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("用户更新状态 Request VO")
|
||||
@Data
|
||||
public class UserUpdateStatusReqVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true)
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
|
||||
@NotNull(message = "状态不能为空")
|
||||
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user