用户的功能迁移
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
<module>user-rest</module>
|
||||
<module>user-rpc</module>
|
||||
<module>user-rpc-api</module>
|
||||
<module>user-biz-api</module>
|
||||
<module>user-biz</module>
|
||||
</modules>
|
||||
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>user</artifactId>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>user-biz-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>common-framework</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:31 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz.bo;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:31 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz.convert;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:28 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz.dao;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:27 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz.dataobject;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:29 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz.dto;
|
||||
@@ -1,22 +0,0 @@
|
||||
package cn.iocoder.mall.user.api.bo.user;
|
||||
|
||||
import cn.iocoder.mall.system.api.bo.oauth2.OAuth2AccessTokenBO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@ApiModel("用户认证 BO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAuthenticationBO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "昵称", required = true, example = "小王")
|
||||
private String nickname;
|
||||
|
||||
private OAuth2AccessTokenBO token;
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cn.iocoder.mall.user.api.dto.user;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
@ApiModel("用户认证 DTO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAuthenticationByMobileCodeDTO {
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
@Length(min = 11, max = 11, message = "账号长度为 11 位")
|
||||
@Pattern(regexp = "^[0-9]+$", message = "手机号必须都是数字")
|
||||
private String mobile;
|
||||
|
||||
@ApiModelProperty(value = "手机验证码", required = true, example = "1024")
|
||||
@NotEmpty(message = "手机验证码不能为空")
|
||||
@Length(min = 4, max = 6, message = "手机验证码长度为 4-6 位")
|
||||
@Pattern(regexp = "^[0-9]+$", message = "手机验证码必须都是数字")
|
||||
private String code;
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.user.api.bo.user.UserAuthenticationBO;
|
||||
import cn.iocoder.mall.user.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserConvert {
|
||||
|
||||
UserConvert INSTANCE = Mappers.getMapper(UserConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
UserBO convert(UserDO userDO);
|
||||
|
||||
@Mappings({})
|
||||
UserAuthenticationBO convert2(UserDO userDO);
|
||||
|
||||
@Mappings({})
|
||||
UserDO convert(UserUpdateDTO userUpdateDTO);
|
||||
|
||||
@Mappings({})
|
||||
List<UserBO> convert(List<UserDO> userDOs);
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dao;
|
||||
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface UserMapper {
|
||||
|
||||
void insert(UserDO entity);
|
||||
|
||||
int update(UserDO entity);
|
||||
|
||||
UserDO selectByMobile(@Param("mobile") String mobile);
|
||||
|
||||
UserDO selectById(@Param("id") Integer id);
|
||||
|
||||
List<UserDO> selectListByNicknameLike(@Param("nickname") String nickname,
|
||||
@Param("status") Integer status,
|
||||
@Param("offset") Integer offset,
|
||||
@Param("limit") Integer limit);
|
||||
|
||||
Integer selectCountByNicknameLike(@Param("nickname") String nickname,
|
||||
@Param("status") Integer status);
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dao;
|
||||
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserRegisterDO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface UserRegisterMapper {
|
||||
|
||||
void insert(UserRegisterDO entity);
|
||||
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
package cn.iocoder.mall.user.application.controller.admins;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.api.UserService;
|
||||
import cn.iocoder.mall.user.api.bo.UserPageBO;
|
||||
import cn.iocoder.mall.user.api.dto.UserPageDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.application.convert.UserConvert;
|
||||
import cn.iocoder.mall.user.application.vo.admins.AdminsUserPageVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.iocoder.common.framework.vo.CommonResult.success;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admins/user")
|
||||
@Api("用户模块")
|
||||
public class AdminsUserController {
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.provider.UserService.version}")
|
||||
private UserService userService;
|
||||
|
||||
// 分页
|
||||
@GetMapping("/page")
|
||||
@ApiOperation(value = "用户分页")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nickname", value = "昵称,模糊匹配", example = "小王"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码,从 1 开始", example = "1"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", required = true, example = "10"),
|
||||
})
|
||||
public CommonResult<AdminsUserPageVO> page(@RequestParam(value = "nickname", required = false) String nickname,
|
||||
@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
UserPageDTO userPageDTO = new UserPageDTO().setNickname(nickname).setStatus(status)
|
||||
.setPageNo(pageNo).setPageSize(pageSize);
|
||||
// 查询分页
|
||||
UserPageBO result = userService.getUserPage(userPageDTO);
|
||||
// 转换结果
|
||||
return success(UserConvert.INSTANCE.convert(result));
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation(value = "更新用户基本信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "用户编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "nickname", value = "昵称", required = true, example = "小王"),
|
||||
@ApiImplicitParam(name = "avatar", value = "头像", required = true, example = "http://www.iocoder.cn/xxx.jpg"),
|
||||
})
|
||||
public CommonResult<Boolean> update(@RequestParam("id") Integer id,
|
||||
@RequestParam("nickname") String nickname,
|
||||
@RequestParam("avatar") String avatar) {
|
||||
UserUpdateDTO userUpdateDTO = new UserUpdateDTO().setId(id).setNickname(nickname).setNickname(nickname).setAvatar(avatar);
|
||||
// 更新
|
||||
return success(userService.updateUser(userUpdateDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/update_status")
|
||||
@ApiOperation(value = "更新用户状态")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "用户编号", required = true, example = "1"),
|
||||
@ApiImplicitParam(name = "status", value = "状态。1 - 开启;2 - 禁用", required = true, example = "1"),
|
||||
})
|
||||
public CommonResult<Boolean> updateStatus(@RequestParam("id") Integer id,
|
||||
@RequestParam("status") Integer status) {
|
||||
return success(userService.updateUserStatus(id, status));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package cn.iocoder.mall.user.application.convert;
|
||||
|
||||
import cn.iocoder.mall.user.application.po.UserAddressAddPO;
|
||||
import cn.iocoder.mall.user.application.po.UserAddressUpdatePO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* @author Sin
|
||||
* @time 2019-04-06 14:19
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserAddressConvert {
|
||||
|
||||
UserAddressConvert INSTANCE = Mappers.getMapper(UserAddressConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
UserAddressAddDTO convert(UserAddressAddPO userAddressAddPO);
|
||||
|
||||
@Mappings({})
|
||||
UserAddressUpdateDTO convert(UserAddressUpdatePO userAddressUpdatePO);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package cn.iocoder.mall.user.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel("用户分页 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsUserPageVO {
|
||||
|
||||
@ApiModelProperty(value = "用户数组")
|
||||
private List<AdminsUserVO> list;
|
||||
@ApiModelProperty(value = "用户总数")
|
||||
private Integer total;
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package cn.iocoder.mall.user.application.vo.admins;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ApiModel("用户 VO")
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AdminsUserVO {
|
||||
|
||||
@ApiModelProperty(value = "用户编号", required = true, example = "1")
|
||||
private Integer id;
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "15601691300")
|
||||
private String mobile;
|
||||
@ApiModelProperty(value = "昵称", required = true, example = "小王")
|
||||
private String nickname;
|
||||
@ApiModelProperty(value = "头像", required = true, example = "http://www.iocoder.cn/xxx.jpg")
|
||||
private String avatar;
|
||||
@ApiModelProperty(value = "账号状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
@ApiModelProperty(value = "创建时间", required = true, example = "时间戳格式")
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user