继续迁移用户收件地址的代码
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
<!-- <module>user-service-api</module>-->
|
||||
<!-- <module>user-service-impl</module>-->
|
||||
<module>user-rest</module>
|
||||
<module>user-rpc</module>
|
||||
<module>user-rpc-api</module>
|
||||
<module>user-biz</module>
|
||||
</modules>
|
||||
|
||||
|
||||
@@ -1,89 +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</artifactId>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-biz-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring 核心 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>mall-spring-boot-starter-mybatis</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 短信平台 阿里云、云片 -->
|
||||
<dependency>
|
||||
<groupId>com.yunpian.sdk</groupId>
|
||||
<artifactId>yunpian-java-sdk</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 文件服务商 -->
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId> <!-- use mapstruct-jdk8 for Java 8 or higher -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-jdk8</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.bo.user;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:28
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAddressBO implements Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 收件区域编号
|
||||
*/
|
||||
private String areaNo;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 收件手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 是否默认
|
||||
*/
|
||||
private Integer hasDefault;
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.convert.user;
|
||||
|
||||
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.user.UsersUserAddressDO;
|
||||
import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址 convert
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:38
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserAddressConvert {
|
||||
|
||||
UserAddressConvert INSTANCE = Mappers.getMapper(UserAddressConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
UsersUserAddressDO convert(UserAddressAddDTO userAddressAddDTO);
|
||||
|
||||
@Mappings({})
|
||||
UsersUserAddressDO convert(UserAddressUpdateDTO userAddressUpdateDTO);
|
||||
|
||||
@Mappings({})
|
||||
UserAddressBO convert(UsersUserAddressDO userAddressDO);
|
||||
|
||||
@Mappings({})
|
||||
List<UserAddressBO> convertUserAddressBOList(List<UsersUserAddressDO> userAddressDOList);
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dao.user;
|
||||
|
||||
import cn.iocoder.mall.user.biz.dataobject.user.UsersUserAddressDO;
|
||||
import cn.iocoder.mall.user.biz.enums.user.UserAddressHasDefaultEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:29
|
||||
*/
|
||||
@Repository
|
||||
// TODO done FROM 芋艿 to 小范:替换成 Mybatis Plus
|
||||
public interface UserAddressMapper extends BaseMapper<UsersUserAddressDO> {
|
||||
|
||||
default List<UsersUserAddressDO> selectByUserId(Integer userId) {
|
||||
LambdaQueryWrapper<UsersUserAddressDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UsersUserAddressDO::getUserId, userId);
|
||||
return selectList(wrapper);
|
||||
}
|
||||
|
||||
default UsersUserAddressDO selectHasDefault(Integer userId) {
|
||||
LambdaQueryWrapper<UsersUserAddressDO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(UsersUserAddressDO::getUserId, userId);
|
||||
wrapper.eq(UsersUserAddressDO::getHasDefault, UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
|
||||
return selectOne(wrapper);
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dataobject.user;
|
||||
|
||||
import cn.iocoder.mall.mybatis.core.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 用户地址信息
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:22
|
||||
*/
|
||||
@Data
|
||||
// TODO FROM 芋艿 to 小范:如果继承了,需要添加 @EqualsAndHashCode(callSuper = true) 注解
|
||||
@Accessors(chain = true)
|
||||
public class UsersUserAddressDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 收件区域编号
|
||||
*/
|
||||
private String areaNo;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 收件手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 是否为默认
|
||||
*/
|
||||
private Integer hasDefault;
|
||||
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dto.user;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户地址 add
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:25
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAddressAddDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 收件区域编号
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 收件区域编号
|
||||
*/
|
||||
private String areaNo;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 收件手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 是否默认
|
||||
*
|
||||
* - 1 不是
|
||||
* - 2 是
|
||||
*/
|
||||
private Integer hasDefault;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dto.user;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户地址 更新
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:28
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
// TODO FROM 芋艿 to 小范:service 要做 validation 哈。其它同理
|
||||
public class UserAddressUpdateDTO implements Serializable {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 收件区域编号
|
||||
*/
|
||||
private String areaNo;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 收件手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 是否默认地址
|
||||
*/
|
||||
private Integer hasDefault;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.enums;
|
||||
|
||||
import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
|
||||
|
||||
/**
|
||||
* 错误码枚举类
|
||||
*
|
||||
* 用户系统,使用 1-001-000-000 段
|
||||
*/
|
||||
public enum UserErrorCodeEnum implements ServiceExceptionUtil.Enumerable {
|
||||
|
||||
// ========== 用户地址 ==========
|
||||
USER_ADDRESS_NOT_EXISTENT(1001004000, "用户地址不存在!"),
|
||||
USER_ADDRESS_IS_DELETED(1001004001, "用户地址已被删除!"),
|
||||
USER_GET_ADDRESS_NOT_EXISTS(1001004002, "获取的地址不存在!"),
|
||||
|
||||
// ========== 用户 ==========
|
||||
// TODO DONE FROM 芋艿 to linhj:是不是提示不对呀
|
||||
USER_NOT_EXISTS(1001004003, "用户不存在!"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String message;
|
||||
|
||||
UserErrorCodeEnum(int code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGroup() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.enums.user;
|
||||
|
||||
/**
|
||||
* 用户地址 - 用户默认地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-10 22:02
|
||||
*/
|
||||
public enum UserAddressHasDefaultEnum {
|
||||
|
||||
DEFAULT_ADDRESS_NO (1, "不是默认地址"),
|
||||
DEFAULT_ADDRESS_YES (2, "是默认地址")
|
||||
;
|
||||
|
||||
private final int value;
|
||||
private final String name;
|
||||
|
||||
UserAddressHasDefaultEnum(int value, String name) {
|
||||
this.value = value;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:27 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:30 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.biz.service;
|
||||
@@ -1,62 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.service.user;
|
||||
|
||||
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
|
||||
import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:24
|
||||
*/
|
||||
public interface UserAddressService {
|
||||
|
||||
/**
|
||||
* 添加地址
|
||||
*
|
||||
* @param userAddressAddDTO
|
||||
*/
|
||||
void addAddress(UserAddressAddDTO userAddressAddDTO);
|
||||
|
||||
/**
|
||||
* 更新 - 根据id 更新
|
||||
*
|
||||
* @param userAddressAddDTO
|
||||
*/
|
||||
void updateAddress(UserAddressUpdateDTO userAddressAddDTO);
|
||||
|
||||
/**
|
||||
* 删除 - 更新id 删除
|
||||
*
|
||||
* @param userId
|
||||
* @param addressId
|
||||
*/
|
||||
void removeAddress(Integer userId, Integer addressId);
|
||||
|
||||
/**
|
||||
* 获取 - 用户所有地址
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<UserAddressBO> listAddress(Integer userId);
|
||||
|
||||
/**
|
||||
* 获取 - 根据id 获取地址
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
UserAddressBO getAddress(Integer id);
|
||||
|
||||
/**
|
||||
* 获取 - 获取用户 default 地址
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
UserAddressBO getDefaultAddress(Integer userId);
|
||||
}
|
||||
@@ -1,121 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.service.user;
|
||||
|
||||
import cn.iocoder.common.framework.exception.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.mall.mybatis.core.enums.DeletedStatusEnum;
|
||||
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
|
||||
import cn.iocoder.mall.user.biz.convert.user.UserAddressConvert;
|
||||
import cn.iocoder.mall.user.biz.dao.user.UserAddressMapper;
|
||||
import cn.iocoder.mall.user.biz.dataobject.user.UsersUserAddressDO;
|
||||
import cn.iocoder.mall.user.biz.dto.user.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.biz.dto.user.UserAddressUpdateDTO;
|
||||
import cn.iocoder.mall.user.biz.enums.UserErrorCodeEnum;
|
||||
import cn.iocoder.mall.user.biz.enums.user.UserAddressHasDefaultEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:26
|
||||
*/
|
||||
@Service
|
||||
public class UserAddressServiceImpl implements UserAddressService {
|
||||
|
||||
@Autowired
|
||||
private UserAddressMapper userAddressMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void addAddress(UserAddressAddDTO userAddressAddDTO) {
|
||||
// 转换do,设置默认数据
|
||||
UsersUserAddressDO userAddressDO = UserAddressConvert.INSTANCE.convert(userAddressAddDTO);
|
||||
userAddressDO.setCreateTime(new Date());
|
||||
userAddressDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
||||
// 检查是否设置为默认地址
|
||||
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
|
||||
UsersUserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userAddressAddDTO.getUserId());
|
||||
if (defaultUserAddress != null) {
|
||||
userAddressMapper.updateById(
|
||||
new UsersUserAddressDO()
|
||||
.setId(defaultUserAddress.getId())
|
||||
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
|
||||
);
|
||||
}
|
||||
}
|
||||
// 保存地址
|
||||
userAddressMapper.insert(userAddressDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void updateAddress(UserAddressUpdateDTO userAddressAddDTO) {
|
||||
// 检查地址
|
||||
UsersUserAddressDO userAddress = userAddressMapper.selectById(userAddressAddDTO.getId());
|
||||
if (userAddress == null) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_ADDRESS_NOT_EXISTENT.getCode());
|
||||
}
|
||||
// 删除的地址不能更新
|
||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());
|
||||
}
|
||||
// 检查是否设置为默认地址
|
||||
// 是:将数据库 default address 设置为 no
|
||||
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
|
||||
UsersUserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userAddressAddDTO.getUserId());
|
||||
if (defaultUserAddress != null && !userAddressAddDTO.getId().equals(defaultUserAddress.getId())) {
|
||||
userAddressMapper.updateById(
|
||||
new UsersUserAddressDO()
|
||||
.setId(defaultUserAddress.getId())
|
||||
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
|
||||
);
|
||||
}
|
||||
}
|
||||
// 转换 vo, 并保存数据
|
||||
UsersUserAddressDO userAddressDO = UserAddressConvert.INSTANCE.convert(userAddressAddDTO);
|
||||
userAddressDO.setUpdateTime(new Date());
|
||||
userAddressMapper.updateById(userAddressDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAddress(Integer userId, Integer addressId) {
|
||||
// checked address is exists.
|
||||
UsersUserAddressDO userAddress = userAddressMapper.selectById(addressId);
|
||||
if (userAddress == null) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_ADDRESS_NOT_EXISTENT.getCode());
|
||||
}
|
||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||
// skip
|
||||
return;
|
||||
}
|
||||
// 更新状态为 remove
|
||||
userAddressMapper.updateById(
|
||||
(UsersUserAddressDO) new UsersUserAddressDO()
|
||||
.setId(addressId)
|
||||
.setDeleted(DeletedStatusEnum.DELETED_YES.getValue())
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserAddressBO> listAddress(Integer userId) {
|
||||
List<UsersUserAddressDO> userAddressDOList = userAddressMapper.selectByUserId(userId);
|
||||
List<UserAddressBO> userAddressBOList = UserAddressConvert.INSTANCE.convertUserAddressBOList(userAddressDOList);
|
||||
return userAddressBOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAddressBO getAddress(Integer id) {
|
||||
UsersUserAddressDO userAddress = userAddressMapper.selectById(id);
|
||||
return UserAddressConvert.INSTANCE.convert(userAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAddressBO getDefaultAddress(Integer userId) {
|
||||
UsersUserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(userId);
|
||||
return UserAddressConvert.INSTANCE.convert(defaultUserAddress);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
# 服务器的配置项
|
||||
server:
|
||||
port: 18082
|
||||
servlet:
|
||||
context-path: /user-api/
|
||||
|
||||
# Swagger 配置项
|
||||
swagger:
|
||||
title: 用户子系统
|
||||
description: 用户子系统
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.mall.user.rest.controller
|
||||
@@ -1,34 +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-rpc-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>system-biz-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>javax.validation</groupId>
|
||||
<artifactId>validation-api</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,29 +0,0 @@
|
||||
package cn.iocoder.mall.user.rpc.api;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
|
||||
|
||||
/**
|
||||
* 用户地址 RPC
|
||||
*
|
||||
* author: sin
|
||||
* time: 2020/5/1 10:26 上午
|
||||
*/
|
||||
public interface UserAddressRPC {
|
||||
|
||||
/**
|
||||
* 获取 - 根据id获取用户地址
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
CommonResult<UserAddressResponse> getAddress(Integer id);
|
||||
|
||||
/**
|
||||
* 获取 - 获取用户默认地址
|
||||
*
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
CommonResult<UserAddressResponse> getDefaultAddress(Integer userId);
|
||||
}
|
||||
@@ -1,40 +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-rpc</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-rpc-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-biz</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 和 Config 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:43 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.rpc.convert;
|
||||
@@ -1,21 +0,0 @@
|
||||
package cn.iocoder.mall.user.rpc.convert.user;
|
||||
|
||||
import cn.iocoder.mall.user.biz.bo.user.UserAddressBO;
|
||||
import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* user address convert
|
||||
*
|
||||
* author: sin
|
||||
* time: 2020/5/1 10:30 上午
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserAddressRPCConvert {
|
||||
|
||||
UserAddressRPCConvert INSTANCE = Mappers.getMapper(UserAddressRPCConvert.class);
|
||||
|
||||
UserAddressResponse convert(UserAddressBO userAddressBO);
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:36 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.rpc;
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* author: sin
|
||||
* time: 2020/5/3 8:37 下午
|
||||
*/
|
||||
package cn.iocoder.mall.user.rpc.rpc;
|
||||
@@ -1,32 +0,0 @@
|
||||
package cn.iocoder.mall.user.rpc.rpc.user;
|
||||
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.biz.service.user.UserAddressService;
|
||||
import cn.iocoder.mall.user.rpc.api.UserAddressRPC;
|
||||
import cn.iocoder.mall.user.rpc.convert.user.UserAddressRPCConvert;
|
||||
import cn.iocoder.mall.user.rpc.response.user.UserAddressResponse;
|
||||
import org.apache.dubbo.config.annotation.Service;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
/**
|
||||
* 用户地址 RPC
|
||||
*
|
||||
* author: sin
|
||||
* time: 2020/5/1 10:26 上午
|
||||
*/
|
||||
@Service(version = "${dubbo.provider.UserAddressRPC.version}", validation = "true")
|
||||
public class UserAddressRPCImpl implements UserAddressRPC {
|
||||
|
||||
@Autowired
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
@Override
|
||||
public CommonResult<UserAddressResponse> getAddress(Integer id) {
|
||||
return CommonResult.success(UserAddressRPCConvert.INSTANCE.convert(userAddressService.getAddress(id)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<UserAddressResponse> getDefaultAddress(Integer userId) {
|
||||
return CommonResult.success(UserAddressRPCConvert.INSTANCE.convert(userAddressService.getDefaultAddress(userId)));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
spring:
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
nacos:
|
||||
# Spring Cloud Nacos Discovery 配置项
|
||||
discovery:
|
||||
server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址
|
||||
namespace: local # Nacos 命名空间
|
||||
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Dubbo 注册中心
|
||||
registry:
|
||||
address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
|
||||
@@ -1,14 +0,0 @@
|
||||
spring:
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
nacos:
|
||||
# Spring Cloud Nacos Discovery 配置项
|
||||
discovery:
|
||||
server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址
|
||||
namespace: test # Nacos 命名空间
|
||||
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Dubbo 注册中心
|
||||
registry:
|
||||
address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
|
||||
@@ -1,19 +0,0 @@
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Spring Cloud Alibaba Dubbo 专属配置
|
||||
cloud:
|
||||
subscribed-services: system-application # 设置订阅的应用列表,默认为 * 订阅所有应用
|
||||
# Dubbo 提供者的协议
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
# Dubbo 提供服务的扫描基础包
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.user.rpc.rpc
|
||||
# Dubbo 服务提供者的配置
|
||||
provider:
|
||||
filter: -exception
|
||||
SystemLogRPC:
|
||||
version: 1.0.0
|
||||
UserAddressRPC:
|
||||
version: 1.0.0
|
||||
@@ -1,80 +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-service-impl</artifactId>
|
||||
<dependencies>
|
||||
<!-- Mall 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.mall</groupId>
|
||||
<artifactId>user-service-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- RPC 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-dubbo</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Registry 和 Config 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MQ 相关 -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-stream-rocketmq</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 提供给 mapstruct 使用 -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -1,35 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.user.api.bo.UserAddressBO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserAddressDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mappings;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址 convert
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:38
|
||||
*/
|
||||
@Mapper
|
||||
public interface UserAddressConvert {
|
||||
|
||||
UserAddressConvert INSTANCE = Mappers.getMapper(UserAddressConvert.class);
|
||||
|
||||
@Mappings({})
|
||||
UserAddressDO convert(UserAddressAddDTO userAddressAddDTO);
|
||||
|
||||
@Mappings({})
|
||||
UserAddressDO convert(UserAddressUpdateDTO userAddressUpdateDTO);
|
||||
|
||||
@Mappings({})
|
||||
UserAddressBO convert(UserAddressDO userAddressDO);
|
||||
|
||||
@Mappings({})
|
||||
List<UserAddressBO> convertUserAddressBOList(List<UserAddressDO> userAddressDOList);
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dao;
|
||||
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserAddressDO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户 地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:29
|
||||
*/
|
||||
@Repository
|
||||
public interface UserAddressMapper {
|
||||
|
||||
int insert(UserAddressDO userAddressDO);
|
||||
|
||||
int updateById(
|
||||
@Param("id") Integer id,
|
||||
@Param("userAddressDO") UserAddressDO userAddressDO
|
||||
);
|
||||
|
||||
List<UserAddressDO> selectByUserIdAndDeleted(
|
||||
Integer deleted,
|
||||
Integer userId
|
||||
);
|
||||
|
||||
UserAddressDO selectByUserIdAndId(
|
||||
Integer userId,
|
||||
Integer id
|
||||
);
|
||||
|
||||
UserAddressDO selectHasDefault(
|
||||
Integer deleted,
|
||||
Integer userId,
|
||||
Integer hasDefault
|
||||
);
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dataobject;
|
||||
|
||||
import cn.iocoder.common.framework.dataobject.DeletableDO;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 用户地址信息
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:22
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserAddressDO extends DeletableDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer userId;
|
||||
// TODO FROM 芋艿 to 小范:需要增加下省市区;
|
||||
// TODO FROM 芋艿 to 小范:想了一个增强,可以靠 API ,实现自动识别,哈哈哈;https://open.kuaidihelp.com/apitool/1019
|
||||
/**
|
||||
* 收件区域编号
|
||||
*/
|
||||
private String areaNo;
|
||||
/**
|
||||
* 收件人名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 收件手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 是否为默认
|
||||
*/
|
||||
// TODO FROM 芋艿 to 小范:是不是一起在捉摸个单词,总觉得 hasDefault 怪怪的。。
|
||||
private Integer hasDefault;
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dataobject;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户注册信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Deprecated
|
||||
public class UserRegisterDO {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Integer id;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
// TODO 芋艿 ip
|
||||
// TODO 芋艿 ua
|
||||
// TODO 芋艿 方式,手机注册、qq 等等
|
||||
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.dataobject;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 用户三方开放平台授权,例如:QQ / 微博 / 微信等等。
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class UserThirdAuthDO {
|
||||
|
||||
/**
|
||||
* 用户编号
|
||||
*
|
||||
* 外键 {@link UserDO#uid}
|
||||
*/
|
||||
private Long uid;
|
||||
|
||||
// ========== 授权相关字段
|
||||
|
||||
/**
|
||||
* 用户的唯一标识
|
||||
*/
|
||||
private String openid;
|
||||
/**
|
||||
* 开放平台
|
||||
*
|
||||
* @see cn.iocoder.mall.user.api.constant.ThirdPlatformConstant
|
||||
*/
|
||||
private Integer platform;
|
||||
/**
|
||||
* 访问令牌
|
||||
*/
|
||||
private Date accessToken;
|
||||
/**
|
||||
* 过期时间
|
||||
*/
|
||||
private Date expireTime;
|
||||
/**
|
||||
* 刷新令牌
|
||||
*/
|
||||
private Date refreshToken;
|
||||
/**
|
||||
* 授权范围。一般情况下,使用逗号分隔
|
||||
*/
|
||||
private String scopes;
|
||||
|
||||
// ========== 基础信息
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickname;
|
||||
/**
|
||||
* 性别
|
||||
*
|
||||
* TODO 芋艿,找地方统一枚举。0-未知,1-男,2-女
|
||||
*/
|
||||
private Integer gender;
|
||||
// TODO https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842
|
||||
// TODO 芋艿,其他字段,国家/省份/城市/地区等
|
||||
// TODO 芋艿,头像
|
||||
// TODO 芋艿,微信独有 unionid
|
||||
/**
|
||||
* 统一存储基础信息,使用 JSON 格式化,避免未有效解析的情况。
|
||||
*/
|
||||
private String extras;
|
||||
|
||||
}
|
||||
@@ -1,165 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.vo.CommonResult;
|
||||
import cn.iocoder.mall.user.api.constant.UserAddressHasDefaultEnum;
|
||||
import cn.iocoder.mall.user.api.constant.UserErrorCodeEnum;
|
||||
import cn.iocoder.mall.user.biz.convert.UserAddressConvert;
|
||||
import cn.iocoder.mall.user.biz.dao.UserAddressMapper;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserAddressDO;
|
||||
import cn.iocoder.mall.user.api.UserAddressService;
|
||||
import cn.iocoder.mall.user.api.bo.UserAddressBO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户地址
|
||||
*
|
||||
* @author Sin
|
||||
* @time 2019-04-06 13:26
|
||||
*/
|
||||
@Service
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.UserAddressService.version}")
|
||||
public class UserAddressServiceImpl implements UserAddressService {
|
||||
|
||||
@Autowired
|
||||
private UserAddressMapper userAddressMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CommonResult addAddress(UserAddressAddDTO userAddressAddDTO) {
|
||||
UserAddressDO userAddressDO = UserAddressConvert.INSTANCE.convert(userAddressAddDTO);
|
||||
userAddressDO.setCreateTime(new Date());
|
||||
userAddressDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
||||
|
||||
// TODO FROM 芋艿 to 小范:建议先更新,然后在创建 UserAddressDO
|
||||
// 检查是否设置为默认地址
|
||||
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
|
||||
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
|
||||
DeletedStatusEnum.DELETED_NO.getValue(),
|
||||
userAddressAddDTO.getUserId(), UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
|
||||
|
||||
if (defaultUserAddress != null) {
|
||||
userAddressMapper.updateById(defaultUserAddress.getId(),
|
||||
new UserAddressDO()
|
||||
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
int result = userAddressMapper.insert(userAddressDO);
|
||||
return CommonResult.success(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public CommonResult updateAddress(UserAddressUpdateDTO userAddressAddDTO) {
|
||||
UserAddressDO userAddress = userAddressMapper
|
||||
.selectByUserIdAndId(userAddressAddDTO.getUserId(), userAddressAddDTO.getId());
|
||||
|
||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());
|
||||
}
|
||||
|
||||
if (userAddress == null) {
|
||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_NOT_EXISTENT.getCode());
|
||||
}
|
||||
|
||||
// 检查是否设置为默认地址
|
||||
if (UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue() == userAddressAddDTO.getHasDefault()) {
|
||||
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
|
||||
DeletedStatusEnum.DELETED_NO.getValue(),
|
||||
userAddressAddDTO.getUserId(), UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
|
||||
|
||||
if (defaultUserAddress != null && !userAddressAddDTO.getId().equals(defaultUserAddress.getId())) {
|
||||
userAddressMapper.updateById(defaultUserAddress.getId(),
|
||||
new UserAddressDO()
|
||||
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
|
||||
DeletedStatusEnum.DELETED_NO.getValue(),
|
||||
userAddressAddDTO.getUserId(), UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
|
||||
|
||||
if (defaultUserAddress != null && !userAddressAddDTO.getId().equals(defaultUserAddress.getId())) {
|
||||
userAddressMapper.updateById(defaultUserAddress.getId(),
|
||||
new UserAddressDO()
|
||||
.setHasDefault(UserAddressHasDefaultEnum.DEFAULT_ADDRESS_NO.getValue())
|
||||
);
|
||||
}
|
||||
|
||||
UserAddressDO userAddressDO = UserAddressConvert.INSTANCE.convert(userAddressAddDTO);
|
||||
userAddressDO.setUpdateTime(new Date());
|
||||
userAddressMapper.updateById(userAddressDO.getId(), userAddressDO);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult removeAddress(Integer userId, Integer addressId) {
|
||||
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, addressId);
|
||||
|
||||
// TODO FROM 芋艿 to 小范:这个应该不会触发哈
|
||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||
// skip
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
if (userAddress == null) {
|
||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_NOT_EXISTENT.getCode());
|
||||
}
|
||||
|
||||
userAddressMapper.updateById(
|
||||
addressId,
|
||||
(UserAddressDO) new UserAddressDO()
|
||||
.setDeleted(DeletedStatusEnum.DELETED_YES.getValue())
|
||||
);
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<List<UserAddressBO>> addressList(Integer userId) {
|
||||
|
||||
List<UserAddressDO> userAddressDOList = userAddressMapper
|
||||
.selectByUserIdAndDeleted(DeletedStatusEnum.DELETED_NO.getValue(), userId);
|
||||
|
||||
List<UserAddressBO> userAddressBOList = UserAddressConvert
|
||||
.INSTANCE.convertUserAddressBOList(userAddressDOList);
|
||||
|
||||
return CommonResult.success(userAddressBOList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<UserAddressBO> getAddress(Integer userId, Integer id) {
|
||||
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, id);
|
||||
if (userAddress == null) {
|
||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_GET_ADDRESS_NOT_EXISTS.getCode());
|
||||
}
|
||||
|
||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());
|
||||
}
|
||||
|
||||
UserAddressBO userAddressBO = UserAddressConvert.INSTANCE.convert(userAddress);
|
||||
return CommonResult.success(userAddressBO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommonResult<UserAddressBO> getDefaultAddress(Integer userId) {
|
||||
|
||||
UserAddressDO defaultUserAddress = userAddressMapper.selectHasDefault(
|
||||
DeletedStatusEnum.DELETED_NO.getValue(),
|
||||
userId,
|
||||
UserAddressHasDefaultEnum.DEFAULT_ADDRESS_YES.getValue());
|
||||
|
||||
return CommonResult.success(UserAddressConvert.INSTANCE.convert(defaultUserAddress));
|
||||
}
|
||||
}
|
||||
@@ -1,154 +0,0 @@
|
||||
package cn.iocoder.mall.user.biz.service;
|
||||
|
||||
import cn.iocoder.common.framework.constant.CommonStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.DeletedStatusEnum;
|
||||
import cn.iocoder.common.framework.constant.SysErrorCodeEnum;
|
||||
import cn.iocoder.common.framework.constant.UserTypeEnum;
|
||||
import cn.iocoder.common.framework.util.ServiceExceptionUtil;
|
||||
import cn.iocoder.common.framework.util.ValidationUtil;
|
||||
import cn.iocoder.mall.system.api.OAuth2Service;
|
||||
import cn.iocoder.mall.system.api.bo.oauth2.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.system.api.dto.oauth2.OAuth2CreateTokenDTO;
|
||||
import cn.iocoder.mall.system.api.dto.oauth2.OAuth2RemoveTokenByUserDTO;
|
||||
import cn.iocoder.mall.user.api.UserService;
|
||||
import cn.iocoder.mall.user.api.bo.user.UserAuthenticationBO;
|
||||
import cn.iocoder.mall.user.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.api.bo.UserPageBO;
|
||||
import cn.iocoder.mall.user.api.constant.UserConstants;
|
||||
import cn.iocoder.mall.user.api.constant.UserErrorCodeEnum;
|
||||
import cn.iocoder.mall.user.api.dto.UserPageDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserUpdateDTO;
|
||||
import cn.iocoder.mall.user.api.dto.user.UserAuthenticationByMobileCodeDTO;
|
||||
import cn.iocoder.mall.user.biz.convert.UserConvert;
|
||||
import cn.iocoder.mall.user.biz.dao.UserMapper;
|
||||
import cn.iocoder.mall.user.biz.dao.UserRegisterMapper;
|
||||
import cn.iocoder.mall.user.biz.dataobject.MobileCodeDO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserDO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserRegisterDO;
|
||||
import org.apache.dubbo.config.annotation.Reference;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* UserService ,实现和用户信息相关的逻辑
|
||||
*/
|
||||
@Service
|
||||
@org.apache.dubbo.config.annotation.Service(validation = "true", version = "${dubbo.provider.UserService.version}")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Autowired
|
||||
private UserMapper userMapper;
|
||||
@Autowired
|
||||
private UserRegisterMapper userRegisterMapper;
|
||||
|
||||
@Reference(validation = "true", version = "${dubbo.consumer.OAuth2Service.version}")
|
||||
private OAuth2Service oAuth2Service;
|
||||
|
||||
public UserDO getUser(String mobile) {
|
||||
return userMapper.selectByMobile(mobile);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public UserDO createUser(String mobile) {
|
||||
if (!ValidationUtil.isMobile(mobile)) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "手机格式不正确"); // TODO 有点搓
|
||||
}
|
||||
// 校验用户是否已经存在
|
||||
if (getUser(mobile) != null) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_MOBILE_ALREADY_REGISTERED.getCode());
|
||||
}
|
||||
// 创建用户
|
||||
UserDO userDO = new UserDO().setMobile(mobile).setStatus(UserConstants.STATUS_ENABLE);
|
||||
userDO.setCreateTime(new Date());
|
||||
userDO.setDeleted(DeletedStatusEnum.DELETED_NO.getValue());
|
||||
userMapper.insert(userDO);
|
||||
// 插入注册信息
|
||||
createUserRegister(userDO);
|
||||
// 转换返回
|
||||
return userDO;
|
||||
}
|
||||
|
||||
private void createUserRegister(UserDO userDO) {
|
||||
UserRegisterDO userRegisterDO = new UserRegisterDO().setId(userDO.getId())
|
||||
.setCreateTime(new Date());
|
||||
userRegisterMapper.insert(userRegisterDO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserPageBO getUserPage(UserPageDTO userPageDTO) {
|
||||
UserPageBO userPageBO = new UserPageBO();
|
||||
// 查询分页数据
|
||||
int offset = (userPageDTO.getPageNo() - 1) * userPageDTO.getPageSize();
|
||||
userPageBO.setList(UserConvert.INSTANCE.convert(userMapper.selectListByNicknameLike(
|
||||
userPageDTO.getNickname(), userPageDTO.getStatus(),
|
||||
offset, userPageDTO.getPageSize())));
|
||||
// 查询分页总数
|
||||
userPageBO.setTotal(userMapper.selectCountByNicknameLike(userPageDTO.getNickname(), userPageDTO.getStatus()));
|
||||
return userPageBO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserBO getUser(Integer userId) {
|
||||
return UserConvert.INSTANCE.convert(userMapper.selectById(userId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateUser(UserUpdateDTO userUpdateDTO) {
|
||||
// 校验用户存在
|
||||
if (userMapper.selectById(userUpdateDTO.getId()) == null) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 更新用户
|
||||
UserDO updateUser = UserConvert.INSTANCE.convert(userUpdateDTO);
|
||||
userMapper.update(updateUser);
|
||||
// 返回成功
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateUserStatus(Integer userId, Integer status) {
|
||||
// 校验用户存在
|
||||
UserDO user = userMapper.selectById(userId);
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 如果状态相同,则返回错误
|
||||
if (status.equals(user.getStatus())) {
|
||||
throw ServiceExceptionUtil.exception((UserErrorCodeEnum.USER_STATUS_EQUALS.getCode()));
|
||||
}
|
||||
// 更新管理员状态
|
||||
UserDO updateUser = new UserDO().setId(userId).setStatus(status);
|
||||
userMapper.update(updateUser);
|
||||
// 如果是关闭管理员,则标记 token 失效。否则,管理员还可以继续蹦跶
|
||||
if (CommonStatusEnum.DISABLE.getValue().equals(status)) {
|
||||
oAuth2Service.removeToken(new OAuth2RemoveTokenByUserDTO().setUserId(userId).setUserType(UserTypeEnum.USER.getValue()));
|
||||
}
|
||||
// 返回成功
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateUserMobile(Integer userId, String mobile) {
|
||||
if (!ValidationUtil.isMobile(mobile)) {
|
||||
throw ServiceExceptionUtil.exception(SysErrorCodeEnum.VALIDATION_REQUEST_PARAM_ERROR.getCode(), "手机格式不正确"); // TODO 有点搓
|
||||
}
|
||||
// 校验用户存在
|
||||
UserDO user = userMapper.selectById(userId);
|
||||
if (user == null) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_NOT_EXISTS.getCode());
|
||||
}
|
||||
// 如果状态相同,则返回错误
|
||||
if (mobile.equals(user.getMobile())) {
|
||||
throw ServiceExceptionUtil.exception(UserErrorCodeEnum.USER_MOBILE_EQUALS.getCode());
|
||||
}
|
||||
// 更新管理员状态
|
||||
UserDO updateUser = new UserDO().setId(userId).setMobile(mobile);
|
||||
userMapper.update(updateUser);
|
||||
// 返回成功
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
##################### 业务模块 #####################
|
||||
@@ -1,62 +0,0 @@
|
||||
spring:
|
||||
# datasource
|
||||
datasource:
|
||||
url: jdbc:mysql://s1.iocoder.cn:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: 3WLiVUBEwTbvAfsh
|
||||
|
||||
# Spring Cloud 配置项
|
||||
cloud:
|
||||
nacos:
|
||||
# Spring Cloud Nacos Discovery 配置项
|
||||
discovery:
|
||||
server-addr: s1.iocoder.cn:8848 # Nacos 服务器地址
|
||||
|
||||
# mybatis-plus
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。
|
||||
global-config:
|
||||
db-config:
|
||||
id-type: auto
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
mapperLocations: classpath*:mapper/*.xml
|
||||
typeAliasesPackage: cn.iocoder.mall.user.biz.dataobject
|
||||
|
||||
# Dubbo 配置项
|
||||
dubbo:
|
||||
# Dubbo 注册中心
|
||||
registry:
|
||||
address: spring-cloud://s1.iocoder.cn:8848 # 指定 Dubbo 服务注册中心的地址
|
||||
# Spring Cloud Alibaba Dubbo 专属配置
|
||||
cloud:
|
||||
subscribed-services: admin-application # 设置订阅的应用列表,默认为 * 订阅所有应用
|
||||
# Dubbo 提供者的协议
|
||||
protocol:
|
||||
name: dubbo
|
||||
port: -1
|
||||
# Dubbo 提供服务的扫描基础包
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.user.biz.service
|
||||
# Dubbo 服务提供者的配置
|
||||
provider:
|
||||
filter: -exception
|
||||
MobileCodeService:
|
||||
version: 1.0.0
|
||||
UserAccessLogService:
|
||||
version: 1.0.0
|
||||
UserAddressService:
|
||||
version: 1.0.0
|
||||
UserService:
|
||||
version: 1.0.0
|
||||
consumer:
|
||||
OAuth2Service:
|
||||
version: 1.0.0
|
||||
|
||||
# rocketmq
|
||||
rocketmq:
|
||||
name-server: 127.0.0.1:9876
|
||||
producer:
|
||||
group: user-producer-spu-collection-group
|
||||
@@ -1,72 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.user.biz.dao.UserAddressMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, user_id, area_no, `name`, mobile, address,
|
||||
create_time, update_time, has_default, deleted
|
||||
</sql>
|
||||
|
||||
<insert id="insert" parameterType="UserAddressDO" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO user_address (
|
||||
user_id, area_no, `name`, mobile, address,
|
||||
create_time, update_time, has_default, deleted
|
||||
) VALUES (
|
||||
#{userId}, #{areaNo}, #{name}, #{mobile}, #{address},
|
||||
#{createTime}, #{updateTime}, #{hasDefault}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="updateById">
|
||||
UPDATE user_address
|
||||
<set>
|
||||
<if test="userAddressDO.areaNo != null">
|
||||
, area_no = #{userAddressDO.areaNo}
|
||||
</if>
|
||||
<if test="userAddressDO.name != null">
|
||||
, `name` = #{userAddressDO.name}
|
||||
</if>
|
||||
<if test="userAddressDO.mobile != null">
|
||||
, mobile = #{userAddressDO.mobile}
|
||||
</if>
|
||||
<if test="userAddressDO.address != null">
|
||||
, address = #{userAddressDO.address}
|
||||
</if>
|
||||
<if test="userAddressDO.updateTime != null">
|
||||
, update_time = #{userAddressDO.updateTime}
|
||||
</if>
|
||||
<if test="userAddressDO.hasDefault != null">
|
||||
, has_default = #{userAddressDO.hasDefault}
|
||||
</if>
|
||||
<if test="userAddressDO.deleted != null">
|
||||
, deleted = #{userAddressDO.deleted}
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectByUserIdAndId" resultType="cn.iocoder.mall.user.biz.dataobject.UserAddressDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM user_address
|
||||
WHERE user_id = #{userId}
|
||||
AND id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectByUserIdAndDeleted" resultType="cn.iocoder.mall.user.biz.dataobject.UserAddressDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM user_address
|
||||
WHERE deleted = #{deleted}
|
||||
AND `user_id` = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="selectHasDefault" resultType="cn.iocoder.mall.user.biz.dataobject.UserAddressDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM user_address
|
||||
WHERE deleted = #{deleted}
|
||||
AND `user_id` = #{userId}
|
||||
AND `has_default` = #{hasDefault}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -1,88 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.user.biz.dao.UserMapper">
|
||||
|
||||
<sql id="FIELDS">
|
||||
id, mobile, nickname, avatar, status,
|
||||
create_time, deleted
|
||||
</sql>
|
||||
|
||||
<insert id="insert" parameterType="UserDO" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO users (
|
||||
id, mobile, status, create_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{mobile}, #{status}, #{createTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="UserDO">
|
||||
UPDATE users
|
||||
<set>
|
||||
<if test="mobile != null">
|
||||
, mobile = #{mobile}
|
||||
</if>
|
||||
<if test="nickname != null">
|
||||
, nickname = #{nickname}
|
||||
</if>
|
||||
<if test="avatar != null">
|
||||
, avatar = #{avatar}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
, status = #{status}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
, deleted = #{deleted}
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="selectById" parameterType="Integer" resultType="UserDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM users
|
||||
WHERE id = #{id}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectByMobile" parameterType="String" resultType="UserDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM users
|
||||
WHERE mobile = #{mobile}
|
||||
AND deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="selectListByNicknameLike" resultType="UserDO">
|
||||
SELECT
|
||||
<include refid="FIELDS" />
|
||||
FROM users
|
||||
<where>
|
||||
<if test="nickname != null">
|
||||
nickname LIKE "%"#{nickname}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="selectCountByNicknameLike" resultType="Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM users
|
||||
<where>
|
||||
<if test="nickname != null">
|
||||
nickname LIKE "%"#{nickname}"%"
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status}
|
||||
</if>
|
||||
AND deleted = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.mall.user.biz.dao.UserRegisterMapper">
|
||||
|
||||
<insert id="insert" parameterType="UserRegisterDO">
|
||||
INSERT INTO user_register (
|
||||
id, create_time
|
||||
) VALUES (
|
||||
#{id}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user