合并代码
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
swagger:
|
||||
enable: true
|
||||
title: 用户子系统
|
||||
description: 用户子系统
|
||||
version: 1.0.0
|
||||
base-package: cn.iocoder.mall.user.application.controller
|
||||
28
user/user-application/target/classes/application.yaml
Normal file
28
user/user-application/target/classes/application.yaml
Normal file
@@ -0,0 +1,28 @@
|
||||
spring:
|
||||
application:
|
||||
name: user-application
|
||||
cloud:
|
||||
sentinel:
|
||||
transport:
|
||||
port: 8719
|
||||
dashboard: localhost:12088
|
||||
metric:
|
||||
charset: UTF-8
|
||||
eager: false
|
||||
|
||||
# server
|
||||
server:
|
||||
port: 18082
|
||||
servlet:
|
||||
context-path: /user-api/
|
||||
|
||||
swagger:
|
||||
enable: false
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: health,info,env,metrics,prometheus
|
||||
metrics:
|
||||
enabled: true
|
||||
@@ -0,0 +1,50 @@
|
||||
package cn.iocoder.mall.user.application.convert;
|
||||
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressAddDTO;
|
||||
import cn.iocoder.mall.user.api.dto.UserAddressUpdateDTO;
|
||||
import cn.iocoder.mall.user.application.po.UserAddressAddPO;
|
||||
import cn.iocoder.mall.user.application.po.UserAddressUpdatePO;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-05-24T11:39:10+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class UserAddressConvertImpl implements UserAddressConvert {
|
||||
|
||||
@Override
|
||||
public UserAddressAddDTO convert(UserAddressAddPO userAddressAddPO) {
|
||||
if ( userAddressAddPO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserAddressAddDTO userAddressAddDTO = new UserAddressAddDTO();
|
||||
|
||||
userAddressAddDTO.setAreaNo( userAddressAddPO.getAreaNo() );
|
||||
userAddressAddDTO.setName( userAddressAddPO.getName() );
|
||||
userAddressAddDTO.setMobile( userAddressAddPO.getMobile() );
|
||||
userAddressAddDTO.setAddress( userAddressAddPO.getAddress() );
|
||||
userAddressAddDTO.setHasDefault( userAddressAddPO.getHasDefault() );
|
||||
|
||||
return userAddressAddDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserAddressUpdateDTO convert(UserAddressUpdatePO userAddressUpdatePO) {
|
||||
if ( userAddressUpdatePO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserAddressUpdateDTO userAddressUpdateDTO = new UserAddressUpdateDTO();
|
||||
|
||||
userAddressUpdateDTO.setId( userAddressUpdatePO.getId() );
|
||||
userAddressUpdateDTO.setAreaNo( userAddressUpdatePO.getAreaNo() );
|
||||
userAddressUpdateDTO.setName( userAddressUpdatePO.getName() );
|
||||
userAddressUpdateDTO.setMobile( userAddressUpdatePO.getMobile() );
|
||||
userAddressUpdateDTO.setAddress( userAddressUpdatePO.getAddress() );
|
||||
userAddressUpdateDTO.setHasDefault( userAddressUpdatePO.getHasDefault() );
|
||||
|
||||
return userAddressUpdateDTO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package cn.iocoder.mall.user.application.convert;
|
||||
|
||||
import cn.iocoder.mall.user.api.bo.UserBO;
|
||||
import cn.iocoder.mall.user.api.bo.UserPageBO;
|
||||
import cn.iocoder.mall.user.application.vo.admins.AdminsUserPageVO;
|
||||
import cn.iocoder.mall.user.application.vo.admins.AdminsUserVO;
|
||||
import cn.iocoder.mall.user.application.vo.users.UsersUserVO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-05-24T11:39:10+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class UserConvertImpl implements UserConvert {
|
||||
|
||||
@Override
|
||||
public AdminsUserPageVO convert(UserPageBO result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsUserPageVO adminsUserPageVO = new AdminsUserPageVO();
|
||||
|
||||
adminsUserPageVO.setList( userBOListToAdminsUserVOList( result.getList() ) );
|
||||
adminsUserPageVO.setTotal( result.getTotal() );
|
||||
|
||||
return adminsUserPageVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UsersUserVO convert2(UserBO result) {
|
||||
if ( result == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UsersUserVO usersUserVO = new UsersUserVO();
|
||||
|
||||
usersUserVO.setId( result.getId() );
|
||||
usersUserVO.setMobile( result.getMobile() );
|
||||
usersUserVO.setNickname( result.getNickname() );
|
||||
usersUserVO.setAvatar( result.getAvatar() );
|
||||
|
||||
return usersUserVO;
|
||||
}
|
||||
|
||||
protected AdminsUserVO userBOToAdminsUserVO(UserBO userBO) {
|
||||
if ( userBO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
AdminsUserVO adminsUserVO = new AdminsUserVO();
|
||||
|
||||
adminsUserVO.setId( userBO.getId() );
|
||||
adminsUserVO.setMobile( userBO.getMobile() );
|
||||
adminsUserVO.setNickname( userBO.getNickname() );
|
||||
adminsUserVO.setAvatar( userBO.getAvatar() );
|
||||
adminsUserVO.setStatus( userBO.getStatus() );
|
||||
adminsUserVO.setCreateTime( userBO.getCreateTime() );
|
||||
|
||||
return adminsUserVO;
|
||||
}
|
||||
|
||||
protected List<AdminsUserVO> userBOListToAdminsUserVOList(List<UserBO> list) {
|
||||
if ( list == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
List<AdminsUserVO> list1 = new ArrayList<AdminsUserVO>( list.size() );
|
||||
for ( UserBO userBO : list ) {
|
||||
list1.add( userBOToAdminsUserVO( userBO ) );
|
||||
}
|
||||
|
||||
return list1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
spring:
|
||||
# datasource
|
||||
datasource:
|
||||
url: jdbc:mysql://192.168.88.14:3306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: ${MALL_MYSQL_PASSWORD}
|
||||
@@ -0,0 +1,5 @@
|
||||
##################### 业务模块 #####################
|
||||
## MobileCodeService
|
||||
modules.mobile-code-service.code-expire-time-millis = 600000
|
||||
modules.mobile-code-service.send-maximum-quantity-per-day = 10
|
||||
modules.mobile-code-service.send-frequency = 60000
|
||||
@@ -0,0 +1,44 @@
|
||||
spring:
|
||||
# datasource
|
||||
datasource:
|
||||
url: jdbc:mysql://180.167.213.26:13306/mall_user?useSSL=false&useUnicode=true&characterEncoding=UTF-8
|
||||
driver-class-name: com.mysql.jdbc.Driver
|
||||
username: root
|
||||
password: ${MALL_MYSQL_PASSWORD}
|
||||
|
||||
# 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:
|
||||
application:
|
||||
name: user-service
|
||||
registry:
|
||||
address: zookeeper://127.0.0.1:2181
|
||||
protocol:
|
||||
port: -1
|
||||
name: dubbo
|
||||
scan:
|
||||
base-packages: cn.iocoder.mall.user.biz.service
|
||||
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
|
||||
72
user/user-service-impl/target/classes/mapper/UserAddress.xml
Normal file
72
user/user-service-impl/target/classes/mapper/UserAddress.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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>
|
||||
88
user/user-service-impl/target/classes/mapper/UserMapper.xml
Normal file
88
user/user-service-impl/target/classes/mapper/UserMapper.xml
Normal file
@@ -0,0 +1,88 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.mall.user.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.user.api.bo.OAuth2AccessTokenBO;
|
||||
import cn.iocoder.mall.user.api.bo.OAuth2AuthenticationBO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.OAuth2AccessTokenDO;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-05-24T11:12:12+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class OAuth2ConvertImpl implements OAuth2Convert {
|
||||
|
||||
@Override
|
||||
public OAuth2AccessTokenBO convertToAccessToken(OAuth2AccessTokenDO oauth2AccessTokenDO) {
|
||||
if ( oauth2AccessTokenDO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OAuth2AccessTokenBO oAuth2AccessTokenBO = new OAuth2AccessTokenBO();
|
||||
|
||||
oAuth2AccessTokenBO.setAccessToken( oauth2AccessTokenDO.getId() );
|
||||
oAuth2AccessTokenBO.setRefreshToken( oauth2AccessTokenDO.getRefreshToken() );
|
||||
|
||||
return oAuth2AccessTokenBO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OAuth2AuthenticationBO convertToAuthentication(OAuth2AccessTokenDO oauth2AccessTokenDO) {
|
||||
if ( oauth2AccessTokenDO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
OAuth2AuthenticationBO oAuth2AuthenticationBO = new OAuth2AuthenticationBO();
|
||||
|
||||
oAuth2AuthenticationBO.setUserId( oauth2AccessTokenDO.getUserId() );
|
||||
|
||||
return oAuth2AuthenticationBO;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.mall.user.biz.convert;
|
||||
|
||||
import cn.iocoder.mall.user.api.dto.UserAccessLogAddDTO;
|
||||
import cn.iocoder.mall.user.biz.dataobject.UserAccessLogDO;
|
||||
import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
date = "2019-05-24T11:12:12+0800",
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class UserAccessLogConvertImpl implements UserAccessLogConvert {
|
||||
|
||||
@Override
|
||||
public UserAccessLogDO convert(UserAccessLogAddDTO adminAccessLogAddDTO) {
|
||||
if ( adminAccessLogAddDTO == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
UserAccessLogDO userAccessLogDO = new UserAccessLogDO();
|
||||
|
||||
userAccessLogDO.setUserId( adminAccessLogAddDTO.getUserId() );
|
||||
userAccessLogDO.setUri( adminAccessLogAddDTO.getUri() );
|
||||
userAccessLogDO.setQueryString( adminAccessLogAddDTO.getQueryString() );
|
||||
userAccessLogDO.setMethod( adminAccessLogAddDTO.getMethod() );
|
||||
userAccessLogDO.setUserAgent( adminAccessLogAddDTO.getUserAgent() );
|
||||
userAccessLogDO.setIp( adminAccessLogAddDTO.getIp() );
|
||||
userAccessLogDO.setStartTime( adminAccessLogAddDTO.getStartTime() );
|
||||
userAccessLogDO.setResponseTime( adminAccessLogAddDTO.getResponseTime() );
|
||||
|
||||
return userAccessLogDO;
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,11 @@ import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
<<<<<<< Updated upstream
|
||||
date = "2019-05-31T17:43:38+0800",
|
||||
=======
|
||||
date = "2019-05-24T11:27:48+0800",
|
||||
>>>>>>> Stashed changes
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class UserAddressConvertImpl implements UserAddressConvert {
|
||||
|
||||
@@ -10,7 +10,11 @@ import javax.annotation.Generated;
|
||||
|
||||
@Generated(
|
||||
value = "org.mapstruct.ap.MappingProcessor",
|
||||
<<<<<<< Updated upstream
|
||||
date = "2019-05-31T17:43:37+0800",
|
||||
=======
|
||||
date = "2019-05-24T11:27:49+0800",
|
||||
>>>>>>> Stashed changes
|
||||
comments = "version: 1.3.0.Final, compiler: javac, environment: Java 1.8.0_121 (Oracle Corporation)"
|
||||
)
|
||||
public class UserConvertImpl implements UserConvert {
|
||||
|
||||
Reference in New Issue
Block a user