完成用户管理的功能开发

This commit is contained in:
YunaiV 2020-07-23 07:27:52 +08:00
parent ef1354478e
commit 25047e081c
10 changed files with 57 additions and 8 deletions

View File

@ -0,0 +1,31 @@
### /user/page 成功
GET {{baseUrl}}/user/page?pageNo=1&pageSize=10
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
dubbo-tag: {{dubboTag}}
### /user/update 成功
POST {{baseUrl}}/user/update
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
dubbo-tag: {{dubboTag}}
id=31&username=user02&password=buzhidao&name=测试管理员&departmentId=1
### /user/update-status 成功
POST {{baseUrl}}/user/update-status
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
dubbo-tag: {{dubboTag}}
userId=243&status=2
### /user/update-status 失败,参数缺失
POST {{baseUrl}}/user/update-status
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer {{accessToken}}
dubbo-tag: {{dubboTag}}
userId=31
###

View File

@ -14,7 +14,7 @@ public class UserUpdateStatusReqVO {
@ApiModelProperty(value = "用户编号", required = true)
@NotNull(message = "用户编号不能为空")
private Integer id;
private Integer userId;
@ApiModelProperty(value = "状态", required = true, example = "1", notes = "见 CommonStatusEnum 枚举")
@NotNull(message = "状态不能为空")
@InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")

View File

@ -9,6 +9,7 @@ import cn.iocoder.mall.userservice.rpc.user.dto.UserPageReqDTO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserRespDTO;
import cn.iocoder.mall.userservice.rpc.user.dto.UserUpdateReqDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@ -28,6 +29,7 @@ public interface UserConvert {
PageResult<UserRespVO> convertPage(PageResult<UserRespDTO> bean);
@Mapping(source = "userId", target = "id")
UserUpdateReqDTO convert(UserUpdateStatusReqVO bean);
}

View File

@ -21,7 +21,7 @@ import java.util.List;
@Service
public class UserManager {
@Reference(version = "$ {dubbo.consumer.UserRpc.version}", validation = "false")
@Reference(version = "${dubbo.consumer.UserRpc.version}", validation = "false")
private UserRpc userRpc;
/**

View File

@ -6,6 +6,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* OAuth2.0 移除用户令牌 Request DTO
@ -14,7 +15,7 @@ import javax.validation.constraints.NotNull;
*/
@Data
@Accessors(chain = true)
public class OAuth2RemoveTokenByUserReqDTO {
public class OAuth2RemoveTokenByUserReqDTO implements Serializable {
/**
* 用户编号

View File

@ -5,6 +5,7 @@ import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* 用户信息 Response DTO
@ -35,5 +36,9 @@ public class UserRespDTO implements Serializable {
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 注册时间
*/
private Date createTime;
}

View File

@ -13,8 +13,8 @@
<dependencies>
<!-- RPC 相关 -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-dubbo</artifactId>
<groupId>cn.iocoder.mall</groupId>
<artifactId>mall-spring-boot-starter-dubbo</artifactId>
</dependency>
<dependency>

View File

@ -4,6 +4,8 @@ import cn.iocoder.common.framework.enums.CommonStatusEnum;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 用户信息
*/
@ -41,5 +43,9 @@ public class UserBO {
* {@link #password} 的盐
*/
private String passwordSalt;
/**
* 注册时间
*/
private Date createTime;
}

View File

@ -11,10 +11,14 @@ spring:
# Spring Cloud Nacos Discovery 配置项
discovery:
server-addr: 400-infra.server.iocoder.cn:8848 # Nacos 服务器地址
namespace: local # Nacos 命名空间
namespace: dev # Nacos 命名空间
# Dubbo 配置项
dubbo:
# Dubbo 注册中心
registry:
address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
# address: spring-cloud://400-infra.server.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
address: nacos://400-infra.server.iocoder.cn:8848?namespace=dev # 指定 Dubbo 服务注册中心的地址
# Dubbo 服务提供者的配置
provider:
tag: ${DUBBO_TAG} # Dubbo 路由分组

View File

@ -41,4 +41,4 @@ dubbo:
# Dubbo 服务消费者的配置
consumer:
OAuth2Rpc:
versoin: 1.0.0
version: 1.0.0