Browse Source

init from phab

xielq 5 years ago
parent
commit
835e290cda
46 changed files with 4512 additions and 0 deletions
  1. 8 0
      README.md
  2. 82 0
      pom.xml
  3. 35 0
      usoft-sso-bl/pom.xml
  4. 96 0
      usoft-sso-bl/src/main/java/com/usoft/sso/grpc/bl/EnterpriseBl.java
  5. 128 0
      usoft-sso-bl/src/main/java/com/usoft/sso/grpc/bl/UserBl.java
  6. 0 0
      usoft-sso-dal/db/init-data.sql
  7. 32 0
      usoft-sso-dal/db/t_enterprise.sql
  8. 32 0
      usoft-sso-dal/db/t_user.sql
  9. 11 0
      usoft-sso-dal/db/t_user_enterprise.sql
  10. 0 0
      usoft-sso-dal/db/v2.0_update_schema.sql
  11. 414 0
      usoft-sso-dal/db/账户中心数据库设计.md
  12. BIN
      usoft-sso-dal/mybatis_generate/mysql-connector-java-6.0.6.jar
  13. 65 0
      usoft-sso-dal/pom.xml
  14. 654 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/entity/Enterprise.java
  15. 710 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/entity/User.java
  16. 94 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/entity/UserEnterprise.java
  17. 69 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/mapper/EnterpriseMapper.java
  18. 89 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/mapper/UserEnterpriseMapper.java
  19. 70 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/mapper/UserMapper.java
  20. 80 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/EnterpriseExtMapper.xml
  21. 315 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/EnterpriseMapper.xml
  22. 25 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserEnterpriseExtMapper.xml
  23. 72 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserEnterpriseMapper.xml
  24. 84 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserExtMapper.xml
  25. 337 0
      usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserMapper.xml
  26. 74 0
      usoft-sso-dal/src/main/resources/generatorConfig.xml
  27. 86 0
      usoft-sso-grpc-api/pom.xml
  28. 82 0
      usoft-sso-grpc-api/src/main/proto/SSOGrpcEntity.proto
  29. 76 0
      usoft-sso-grpc-api/src/main/proto/SSOGrpcService.proto
  30. 73 0
      usoft-sso-grpc-service/pom.xml
  31. 25 0
      usoft-sso-grpc-service/src/main/java/com/usoft/sso/grpc/SsoGrpcServiceStart.java
  32. 152 0
      usoft-sso-grpc-service/src/main/java/com/usoft/sso/grpc/service/impl/SSOServiceImpl.java
  33. 12 0
      usoft-sso-grpc-service/src/main/resources/application-dev.properties
  34. 2 0
      usoft-sso-grpc-service/src/main/resources/application-prod.properties
  35. 8 0
      usoft-sso-grpc-service/src/main/resources/application-test.properties
  36. 16 0
      usoft-sso-grpc-service/src/main/resources/application.properties
  37. 42 0
      usoft-sso-grpc-service/src/main/resources/logback-dev.xml
  38. 33 0
      usoft-sso-grpc-service/src/main/resources/logback-product.xml
  39. 49 0
      usoft-sso-grpc-service/src/main/resources/logback-test.xml
  40. 13 0
      usoft-sso-grpc-service/src/main/resources/mybatis-config.xml
  41. 26 0
      usoft-sso-grpc-service/src/test/java/com/usoft/sso/grpc/DefaultTest.java
  42. 88 0
      usoft-sso-grpc-service/src/test/java/com/usoft/sso/grpc/service/impl/SSOServiceImplTest.java
  43. 44 0
      usoft-sso-utils/pom.xml
  44. 28 0
      usoft-sso-utils/src/main/java/com/usoft/sso/common/ResponseUtil.java
  45. 52 0
      usoft-sso-utils/src/main/java/com/usoft/sso/common/VerifyParamsUtil.java
  46. 29 0
      usoft-sso-utils/src/main/java/com/usoft/sso/exception/SSORuntimeException.java

+ 8 - 0
README.md

@@ -0,0 +1,8 @@
+##开发环境如下:开发者使用
+###账号服务
+####grpc端: 
+发布地址:http://10.10.100.200:5001/view/usoft-fx/job/ufinance-sso-grpc-Pdev/build?token=xlq   
+访问地址:192.168.253.3:28810
+####rest端:   
+发布地址:http://10.10.100.200:5001/view/usoft-fx/job/ufinance-sso-rest-Pdev/build?token=xlq   
+访问地址:192.168.253.3:28800

+ 82 - 0
pom.xml

@@ -0,0 +1,82 @@
+<?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">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.usoft.sso</groupId>
+    <artifactId>usoft-sso-grpc-parent</artifactId>
+    <packaging>pom</packaging>
+    <version>1.0.0-SNAPSHOT</version>
+    <modules>
+        <module>usoft-sso-grpc-api</module>
+        <module>usoft-sso-grpc-service</module>
+        <module>usoft-sso-utils</module>
+        <module>usoft-sso-bl</module>
+        <module>usoft-sso-dal</module>
+    </modules>
+
+    <properties>
+        <protoc-gen-grpc-java.version>1.11.0</protoc-gen-grpc-java.version>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <maven.compiler.source>1.8</maven.compiler.source>
+        <maven.compiler.target>1.8</maven.compiler.target>
+    </properties>
+
+    <dependencyManagement>
+
+        <dependencies>
+            <dependency>
+            <groupId>com.usoft.framework</groupId>
+            <artifactId>usoft-grpc-dependencies</artifactId>
+            <version>dev-1.0-SNAPSHOT</version>
+            <type>pom</type>
+            <scope>import</scope>
+        </dependency>
+        </dependencies>
+
+    </dependencyManagement>
+
+    <distributionManagement>
+        <!-- 发布release仓库 -->
+        <repository>
+            <id>platform-release</id>
+            <name>platform-release</name>
+            <url>http://113.105.74.141:8081/artifactory/libs-release-local</url>
+        </repository>
+        <!-- 发布快照版本 -->
+        <snapshotRepository>
+            <id>platform-snapshots</id>
+            <name>platform-snapshots</name>
+            <url>http://113.105.74.141:8081/artifactory/libs-snapshot-local</url>
+        </snapshotRepository>
+    </distributionManagement>
+
+    <profiles>
+        <profile>
+            <!-- 开发环境 -->
+            <id>dev</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <properties>
+                <spring.active.profile>dev</spring.active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 测试环境 -->
+            <id>test</id>
+            <properties>
+                <spring.active.profile>test</spring.active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 生产环境 -->
+            <id>prod</id>
+            <properties>
+                <spring.active.profile>prod</spring.active.profile>
+            </properties>
+        </profile>
+    </profiles>
+
+</project>

+ 35 - 0
usoft-sso-bl/pom.xml

@@ -0,0 +1,35 @@
+<?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>usoft-sso-grpc-parent</artifactId>
+        <groupId>com.usoft.sso</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>usoft-sso-bl</artifactId>
+    <packaging>jar</packaging>
+    <dependencies>
+
+        <dependency>
+            <groupId>com.usoft.sso</groupId>
+            <artifactId>usoft-sso-dal</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.sso</groupId>
+            <artifactId>usoft-sso-grpc-api</artifactId>
+            <version>${spring.active.profile}-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.sso</groupId>
+            <artifactId>usoft-sso-utils</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.framework</groupId>
+            <artifactId>usoft-protobuf-utils</artifactId>
+        </dependency>
+    </dependencies>
+</project>

+ 96 - 0
usoft-sso-bl/src/main/java/com/usoft/sso/grpc/bl/EnterpriseBl.java

@@ -0,0 +1,96 @@
+package com.usoft.sso.grpc.bl;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.usoft.protobuf.utils.ProtoBufUtil;
+import com.usoft.sso.common.VerifyParamsUtil;
+import com.usoft.sso.dal.entity.Enterprise;
+import com.usoft.sso.dal.entity.User;
+import com.usoft.sso.dal.entity.UserEnterprise;
+import com.usoft.sso.dal.mapper.EnterpriseMapper;
+import com.usoft.sso.dal.mapper.UserEnterpriseMapper;
+import com.usoft.sso.dal.mapper.UserMapper;
+import com.usoft.sso.exception.SSORuntimeException;
+import com.usoft.sso.grpc.api.protobuf.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * @author: huyy
+ * @date: 2018/8/23 8:50
+ */
+@Service
+public class EnterpriseBl {
+
+    @Autowired
+    private EnterpriseMapper enterpriseMapper;
+    @Autowired
+    private UserEnterpriseMapper userEnterpriseMapper;
+    @Autowired
+    private UserMapper userMapper;
+
+    private static final Logger logger = LoggerFactory.getLogger(EnterpriseBl.class);
+
+
+    /**
+     * 企业信息保存+更换管理员同步信息接口-restAPI /api/public/enterprise, method:post, type:kv
+     *
+     * @param request
+     * @return
+     * @throws InvalidProtocolBufferException
+     */
+
+    @Transactional(rollbackFor = Exception.class)
+    public UpdateEntInfoResponse.Builder updateEntInfo(UpdateEntInfoRequest request) throws InvalidProtocolBufferException {
+        if ("".equals(request.getEnterprise().getSpaceUU())) {
+            throw new SSORuntimeException(-1, "spaceuu为空,无法进行更新企业操作");
+        }
+        Enterprise enterprise = enterpriseMapper.selectBySpaceuu(request.getEnterprise().getSpaceUU());
+        Enterprise enterprise1Info = ProtoBufUtil.toBean(request.getEnterprise(), Enterprise.class);
+        //如果没有改企业信息,则添加企业信息
+        if (enterprise == null) {
+            enterpriseMapper.insert(enterprise1Info);
+            logger.info("添加新企业,{}", request.getEnterprise().getSpaceName());
+        } else {
+            //若企业存在,则修改企业信息
+            enterpriseMapper.updateBySpaceuuSelective(enterprise1Info);
+            logger.info("企业信息更改,{}", request.getEnterprise().getSpaceName());
+        }
+        //查找管理员信息,若不存在则添加管理员信息
+        User user = userMapper.selectByUseruu(request.getEnterprise().getAdminUU());
+        if (user == null) {
+            User userInfo = ProtoBufUtil.toBean(request.getUser(), User.class);
+            userMapper.insertSelective(userInfo);
+        }
+        //查找用户和企业绑定信息
+        UserEnterprise userEnterprise = userEnterpriseMapper.selectByUseruuSpaceuu(request.getUser().getUserUU(), request.getEnterprise().getSpaceUU());
+        //若企业与管理员未绑定 则绑定管理员与企业
+        if(userEnterprise == null){
+            if (!"".equals(request.getEnterprise().getAdminUU())) {
+                userEnterpriseMapper.bindUserEnterpries(request.getUser().getUserUU(), request.getEnterprise().getSpaceUU());
+                logger.info("绑定管理员与企业UU, useruu:{}, spaceuu:{}", request.getUser().getUserUU(), request.getEnterprise().getAdminUU());
+            }
+        }
+        return UpdateEntInfoResponse.newBuilder();
+    }
+
+    /**
+     * 查询企业信息
+     *
+     * @param request
+     * @return
+     * @throws InvalidProtocolBufferException
+     */
+    public SelectEntInfoResponse.Builder selectEntInfo(SelectEntInfoRequest request) throws InvalidProtocolBufferException {
+        SelectEntInfoResponse.Builder response = SelectEntInfoResponse.newBuilder();
+        VerifyParamsUtil.notNull(request.getSpaceUU(), "企业UU号不能为空");
+        Enterprise enterprise = enterpriseMapper.selectBySpaceuu(request.getSpaceUU());
+        if (enterprise == null) {
+            throw new SSORuntimeException(-1, "企业信息为空");
+        }
+        response.setAccessSecret(enterprise.getAccessSecret());
+        return response;
+    }
+}

+ 128 - 0
usoft-sso-bl/src/main/java/com/usoft/sso/grpc/bl/UserBl.java

@@ -0,0 +1,128 @@
+package com.usoft.sso.grpc.bl;
+
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.usoft.protobuf.utils.ProtoBufUtil;
+import com.usoft.sso.common.VerifyParamsUtil;
+import com.usoft.sso.dal.entity.Enterprise;
+import com.usoft.sso.dal.entity.User;
+import com.usoft.sso.dal.entity.UserEnterprise;
+import com.usoft.sso.dal.mapper.EnterpriseMapper;
+import com.usoft.sso.dal.mapper.UserEnterpriseMapper;
+import com.usoft.sso.dal.mapper.UserMapper;
+import com.usoft.sso.exception.SSORuntimeException;
+import com.usoft.sso.grpc.api.protobuf.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.InvalidPropertiesFormatException;
+
+/**
+ * @author: huyy
+ * @date: 2018/8/22 14:50
+ */
+@Service
+public class UserBl {
+    @Autowired
+    private UserMapper userMapper;
+    @Autowired
+    private EnterpriseMapper enterpriseMapper;
+    @Autowired
+    private UserEnterpriseMapper userEnterpriseMapper;
+
+    public static final String TYPE_BIND = "bind";
+
+    public static final String TYPE_UNBIND = "unbind";
+
+    /**
+     * 账户中心保存用户信息接口
+     *
+     * @param request
+     * @return
+     */
+
+    @Transactional(rollbackFor = Exception.class)
+    public SaveUserInfoResponse.Builder save(SaveUserInfoRequest request) throws InvalidProtocolBufferException {
+        VerifyParamsUtil.notNull(request.getUserInfo().getUserUU(), "UU号不为空");
+        User userInfo = ProtoBufUtil.toBean(request.getUserInfo(), User.class);
+        //若请求值为空,则不能进行操作
+        if (userInfo == null) {
+            throw new SSORuntimeException(-1, "用户信息为空");
+        }
+        //查找用户信息,不存在则添加到数据库,若存在则更新用户信息
+        User user = userMapper.selectByUseruu(request.getUserInfo().getUserUU());
+        if (user == null) {
+            userMapper.insertSelective(userInfo);
+            return SaveUserInfoResponse.newBuilder().setMsg("保存用户信息成功!");
+        } else {
+            userMapper.updateByUseruuKeySelective(userInfo);
+            return SaveUserInfoResponse.newBuilder().setMsg("更新用户信息成功!");
+        }
+    }
+
+    /**
+     * 账户中心用户 绑定/解绑
+     *
+     * @param request
+     * @return
+     * @throws InvalidPropertiesFormatException
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public BindUserInfoResponse.Builder bindOrUnbind(BindUserInfoRequest request) throws InvalidPropertiesFormatException {
+        VerifyParamsUtil.notNull(request.getSpaceUU(), "spaceuu不能为空");
+        VerifyParamsUtil.notNull(request.getUserUU(), "useruu不能为空");
+        //查找用户信息
+        User userInfo = userMapper.selectByUseruu(request.getUserUU());
+        //查找企业信息
+        Enterprise enterpriseInfo = enterpriseMapper.selectBySpaceuu(request.getSpaceUU());
+        //查找用户和企业绑定信息
+        UserEnterprise userEnterprise = userEnterpriseMapper.selectByUseruuSpaceuu(request.getUserUU(), request.getSpaceUU());
+        if (userInfo == null) {
+            throw new SSORuntimeException(-1, "用户不存在!");
+        }
+        if (enterpriseInfo == null) {
+            throw new SSORuntimeException(-1, "企业不存在!");
+        }
+        //bind为绑定  unbind为解绑
+        if (request.getType() != null) {
+            if (TYPE_BIND.equals(request.getType())) {
+                //若用户和企业绑定信息不存在,则保存信息
+                if (userEnterprise != null) {
+                    return BindUserInfoResponse.newBuilder().setMsg("用户已绑定该企业");
+                } else {
+                    userEnterpriseMapper.bindUserEnterpries(request.getUserUU(), request.getSpaceUU());
+                    return BindUserInfoResponse.newBuilder().setMsg("用户绑定企业成功!");
+                }
+            } else {
+                //若请求type为 unbind 这进行解绑操作
+                userEnterpriseMapper.deleteByUseruuSpaceuu(request.getUserUU(), request.getSpaceUU());
+                return BindUserInfoResponse.newBuilder().setMsg("用户解除绑定企业成功!");
+
+            }
+        }
+        return BindUserInfoResponse.newBuilder();
+    }
+
+    /**
+     * //U融链查找用户信息
+     *
+     * @param request
+     * @return
+     * @throws InvalidProtocolBufferException
+     */
+    public SelectUserInfoResponse.Builder selectUserInfo(SelectUserInfoRequest request) throws InvalidProtocolBufferException {
+        SelectUserInfoResponse.Builder response = SelectUserInfoResponse.newBuilder();
+        VerifyParamsUtil.notNull(request.getUserUU(), "用户UU号不能为空");
+        VerifyParamsUtil.notNull(request.getSpaceUU(), "企业UU号不能为空");
+        User user = userMapper.selectByUseruu(request.getUserUU());
+        Enterprise enterprise = enterpriseMapper.selectBySpaceuu(request.getSpaceUU());
+        if (user == null) {
+            throw new SSORuntimeException(-1, "用户信息为空");
+        }
+        response.setVipName(user.getVipName());
+        response.setUserImage(user.getUserImage());
+        response.setSpaceName(enterprise.getSpaceName());
+        response.setMobile(user.getMobile());
+        return response;
+    }
+}

+ 0 - 0
usoft-sso-dal/db/init-data.sql


+ 32 - 0
usoft-sso-dal/db/t_enterprise.sql

@@ -0,0 +1,32 @@
+CREATE TABLE
+IF NOT EXISTS t_enterprise (
+	id int(10) NOT NULL auto_increment COMMENT '主键',
+	spaceuu bigint(20) NOT NULL COMMENT '企业UU号',
+	adminuu bigint(20) NOT NULL COMMENT '管理员UU号',
+	bank VARCHAR(30) NOT NULL DEFAULT '' COMMENT '银行',
+	bank_account VARCHAR(30) NOT NULL DEFAULT '' COMMENT '银行账户',
+	business_code VARCHAR(30) NOT NULL DEFAULT '' COMMENT '营业执照号',
+	business_code_image VARCHAR(255) NOT NULL DEFAULT '' COMMENT '营业执照',
+	company_address VARCHAR(50) NOT NULL DEFAULT '' COMMENT '公司地址',
+	company_city VARCHAR(30) NOT NULL  DEFAULT '' COMMENT '城市',
+	company_country VARCHAR(30) NOT NULL DEFAULT '' COMMENT '国家',
+	company_province VARCHAR(30) NOT NULL DEFAULT '' COMMENT '省份',
+	corporation VARCHAR(25) NOT NULL DEFAULT ''  COMMENT '法定代表人',
+	invite_space_uu BIGINT(20) NOT NULL DEFAULT '0' COMMENT '邀请企业UU号',
+	invite_user_uu BIGINT(20) NOT NULL DEFAULT '0' COMMENT '邀请人UU号',
+	main_business VARCHAR(50) NOT NULL DEFAULT '' COMMENT '主营业务',
+	profession VARCHAR(50) NOT NULL DEFAULT '' COMMENT '行业',
+	space_name VARCHAR(60) NOT NULL DEFAULT '' COMMENT '企业名称',
+	tags VARCHAR(120) NOT NULL DEFAULT '' COMMENT '经营范围',
+	telephone VARCHAR(20) NOT NULL DEFAULT '' COMMENT '公司联系电话',
+	valid_code smallint(2) NOT NULL DEFAULT '0' COMMENT '企业认证状态',
+	access_secret VARCHAR(50) NOT NULL DEFAULT '' COMMENT '企业秘钥',
+	website VARCHAR(120) NOT NULL DEFAULT '' COMMENT 'ERP外网地址',
+	invite_time VARCHAR(23) NOT NULL DEFAULT '' COMMENT '邀请时间',
+	create_time TIMESTAMP DEFAULT current_timestamp COMMENT '创建时间',
+	update_time TIMESTAMP DEFAULT current_timestamp ON UPDATE current_timestamp COMMENT '修改时间',
+	PRIMARY KEY (id) USING BTREE,
+	UNIQUE KEY space_name (space_name) USING BTREE,
+	UNIQUE KEY business_code (business_code) USING BTREE,
+	INDEX `FKfbavsugp68mxbewk6cuxklwfw`(`adminuu`) USING BTREE
+) ENGINE = INNODB auto_increment = 1 DEFAULT charset = utf8mb4 COMMENT '企业信息表';

+ 32 - 0
usoft-sso-dal/db/t_user.sql

@@ -0,0 +1,32 @@
+CREATE TABLE
+IF NOT EXISTS t_user (
+	id int(10) NOT NULL auto_increment COMMENT '主键',
+	useruu bigint(20) NOT NULL COMMENT '用户UU号',
+	user_image VARCHAR(100) NOT NULL DEFAULT '' COMMENT '用户头像',
+	user_city VARCHAR(30) NOT NULL DEFAULT '' COMMENT '城市',
+	user_country VARCHAR(30) NOT NULL DEFAULT '' COMMENT '国家',
+	user_email VARCHAR(50) NOT NULL DEFAULT '' COMMENT '邮箱',
+	email_valid_code smallint(2) NOT NULL DEFAULT '0' COMMENT '邮箱有效状态',
+	first_name VARCHAR(25) NOT NULL  DEFAULT '' COMMENT '姓',
+	id_card VARCHAR(20) NOT NULL DEFAULT '' COMMENT '身份证号码',
+	identity_valid_code smallint(2) NOT NULL DEFAULT '0' COMMENT '身份认证状态',
+	last_name VARCHAR(25) NOT NULL  DEFAULT '' COMMENT '名',
+	mobile VARCHAR(20) NOT NULL DEFAULT '' COMMENT '手机号码',
+	mobile_valid_code smallint(2) NOT NULL DEFAULT '0' COMMENT '手机认证状态',
+	_password VARCHAR(50) NOT NULL COMMENT '密码',
+	user_province VARCHAR(25) NOT NULL DEFAULT '' COMMENT '省份',
+	qq_number VARCHAR(15) NOT NULL DEFAULT '' COMMENT 'qq号码',
+	real_name VARCHAR(40) NOT NULL DEFAULT '' COMMENT '真实姓名',
+	salt VARCHAR(30) NOT NULL DEFAULT '' COMMENT '盐值',
+	vip_name VARCHAR(50) NOT NULL DEFAULT '' COMMENT '用户名',
+	im_id VARCHAR(50) NOT NULL DEFAULT '' COMMENT 'imid',
+	password_level int(11) NOT NULL DEFAULT '0' COMMENT '密码强度',
+	birthday VARCHAR(30) NOT NULL DEFAULT '' COMMENT '生日',
+	sex VARCHAR(4) NOT NULL DEFAULT '' COMMENT '性别',
+	wx_unionid VARCHAR(50) NOT NULL DEFAULT '' COMMENT '微信unionid',
+	bh_openid VARCHAR(50) NOT NULL DEFAULT '' COMMENT '碧合openid',
+	create_time TIMESTAMP DEFAULT current_timestamp COMMENT '创建时间',
+  update_time TIMESTAMP DEFAULT current_timestamp ON UPDATE current_timestamp COMMENT '修改时间',
+	PRIMARY KEY (id) USING BTREE,
+	UNIQUE KEY user_mobile_index (mobile) USING BTREE
+) ENGINE = INNODB auto_increment = 1 DEFAULT charset = utf8mb4 COMMENT '用户信息表';

+ 11 - 0
usoft-sso-dal/db/t_user_enterprise.sql

@@ -0,0 +1,11 @@
+CREATE TABLE
+IF NOT EXISTS t_user_enterprise (
+	id int(10) NOT NULL auto_increment COMMENT '主键',
+	spaceuu bigint(20) NOT NULL COMMENT '企业UU号',
+	useruu bigint(20) NOT NULL COMMENT '用户UU号',
+	create_time TIMESTAMP DEFAULT current_timestamp COMMENT '创建时间',
+	update_time TIMESTAMP DEFAULT current_timestamp ON UPDATE current_timestamp COMMENT '修改时间',
+	PRIMARY KEY (id) USING BTREE,
+	INDEX `FKl4n5kbxma68mjnws8w6d409wv`(`useruu`) USING BTREE,
+	INDEX `FKaawxsh58ir9u8r6pp2h55puqe`(`spaceuu`) USING BTREE
+) ENGINE = INNODB auto_increment = 1 DEFAULT charset = utf8mb4 COMMENT '关联用户和企业信息表';

+ 0 - 0
usoft-sso-dal/db/v2.0_update_schema.sql


+ 414 - 0
usoft-sso-dal/db/账户中心数据库设计.md

@@ -0,0 +1,414 @@
+[TOC]
+
+#					表汇总
+
+| 所属功能模块 | 表名            | 描述                    |
+| :----------: | :--------------- | :------------------------ |
+|   应用 |  sso$app | 应用 |
+        |  sso$app$style | 页面对应用独特样式 |         
+|	用户 |	sso$user	| 用户表实体 |
+        |	sso$user$question	| 用户密保 |
+         |	sso$user$record	| 用户登录记录 |
+         |	sso$apply$userspace	| 用户绑定企业 |
+|	企业 |	sso$userspace	| 企业实体 |
+|	后台管理 |	sso$admin_manage	| 管理员的信息 |
+|	关联表 |	sso$app_userspace	| 企业开通的应用 |
+          |	sso$partnership$record	| 合作关系申请的记录 |
+          |	sso$user_userspace	| 企业下的用户 |
+|	日志  |	sso$log$partnership	| 合作伙伴日志 |
+          |	sso$log$register	| 注册日志 |
+          |	 sso$log$sync	| 同步日志 |
+          |	sso$log$user	| 用户信息修改日志 |
+          |	 sso$us$admin	| 更换管理员实体 |
+          |	 sso$us$valid	| 企业信息认证日志 |
+          |	 sso$us_admin_change_record	| 管理员变更信息表 |
+          |	sso$user$valid	| 用户申请日志 |
+          |	sso$valid$appeal	| 认证申述 |
+|	配置  |	sso$setting	| 短信邮箱设置 |          
+          
+
+
+##		 管理员的信息 sso$admin_manage
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|id|bigint(20)|否||主键|应用名称|
+|create_time|datetime(0)|可|NULL||创建时间|
+|admin_pass|varchar(255)|可|NULL||密码|
+|admin_name|varchar(255)|可|NULL|唯一索引|用户名|
+|createdTime|timestamp|否|current_timestamp||创建时间|
+|updatedTime|timestamp|否|current_timestamp||更新时间|
+
+##			应用 sso$app
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|uid|varchar(255)|否||主键|应用唯一标志|
+|back_change_admin_url|varchar(255)|可|NULL||更换企业管理员回调接口(用于同步)|
+|back_partner_url|varchar(255)|可|NULL||合作伙伴回调接口(用于应用同步)|
+|back_relation_url|varchar(255)|可|NULL||用户企业绑定关系回调接口(用于应用同步)|
+|back_space_url|varchar(255)|可|NULL||企业信息回调接口(用于应用同步)|
+|back_user_url|varchar(255)|可|NULL||用户信息回调接口(用于应用同步)|
+|default_use|smallint(6)|可|NULL||是否默认开通|
+|description|varchar(255)|否||NULL|应用描述(名称)|
+|home_page|varchar(255)|可|NULL||应用首页Url|
+|login_url|varchar(255)|可|NULL||登录通知接口|
+|logout_url|varchar(255)|可|NULL||登出通知接口|
+|personal_enable|int|否|''|是否支持个人账号|
+|public_key|varchar(255)|可|NULL||公钥,用于跨域认证|
+|us_count|int|可|NULL||绑定企业数|
+|user_control|varchar(255)|可|NULL||级联应用,为空时为独立应用|
+|wx_appid|varchar(20)|可|NULL||微信appid|
+|createdTime|timestamp|否|current_timestamp||创建时间|
+|updatedTime|timestamp|否|current_timestamp||更新时间|
+
+##			页面对应用独特样式  sso$app$style
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|app_uid|varchar(255)|否|||应用Id|
+|bg_color|varchar(255)|可|NULL||背景颜色| 
+|bg_link|varchar(255)|可|NULL|背景图片链接|
+|bg_url|varchar(255)|可|NULL|背景图片|
+|btns|varchar(255)|可|NULL|按钮样式(json字符串)|
+|app_desc|varchar(255)|可|NULL|应用描述|
+|font_color|varchar(255)|可|NULL|字体颜色|
+|logo_url|varchar(255)|可|NULL|logo图片|
+|reserve_color|varchar(255)|可|NULL|相对字体颜色| 
+|subtitle|varchar(255)|可|NULL|副标题|
+|title|varchar(255)|可|NULL|主标题| 
+|foot_url|text|可|NULL|底部样式链接|  
+|return_home_url|可|varchar(255)|NULL| 登录返回首页(json字符串,name为链接名称,url为返回链接, needHelp为是否需要帮助按钮)|
+|terms|varchar(255)|可|NULL|服务条款(json字符串,name为条款名,url为条款链接)| 
+|need_remember_password|bit(1)|可|NULL|是否需要记住密码功能| 
+|rebg_url|varchar(255)|可|NULL|注册完成背景颜色| 
+|bg_url_mobile|varchar(255)|可|NULL|背景图片| 
+|logo_url_mobile|varchar(255)|可|NULL|logo图片| 
+|title_mobile|varchar(10)|可|NULL|主标题|  
+|createdTime|timestamp(6)|否|current_timestamp|创建时间|  
+|updatedTime|timestamp(6)|否|current_timestamp|更新时间|  
+
+
+
+##	    企业开通的应用  sso$app_userspace
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|space_uu|bigint(20)|否||普通索引|企业UU|
+|app_uid|varchar(255)|否||普通索引|应用Id| 
+|createdTime|timestamp(6)|否|current_timestamp|创建时间|  
+|updatedTime|timestamp(6)|否|current_timestamp|更新时间|  
+
+	
+##		用户绑定企业  sso$apply$userspace
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|process_time|datetime(0)|可|NULL||处理时间|
+|spaceuu|bigint(20)|可|NULL|普通索引|企业uu号|
+|status|int(11)|可|NULL||申请状态|
+|submit_date|datetime(0)|可|NULL|申请时间||
+|useruu|bigint(20)|可|NULL|普通索引|用户uu号|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+## 		合作伙伴日志 sso$log$partnership
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|msg|varchar(1000)|可|NULL||同步信息描述|
+|time|datetime(0)|可|NULL||操作时间|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		同步日志 sso$log$sync
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|level|varchar(255)|否|||同步等级(info or error)|
+|msg|varchar(255)|可|NULL||同步信息描述|
+|msg_detail|varchar(2000)|可|NULL||同步信息|
+|return_msg|varchar(255)|可|NULL||返回信息|
+|time|datetime(0)|可|NULL||同步时间|
+|to_app|varchar(255)|可|NULL||同步应用uid|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		用户信息修改日志 sso$log$user
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|level|varchar(255)|否|||修改等级(info or error)|
+|other_msg|varchar(2000)|可|NULL||其他信息|
+|time|datetime(0|否|||修改时间|
+|type|varchar(255)|否|||修改类型(mobile, email, password, detail...)|
+|user_msg|varchar(2000)|否|||修改后用户信息|
+|useruu|bigint(20)|可|NULL|普通索引|用户uu号|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##	合作关系申请的记录 sso$partnership$record
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|app_uid|varchar(255)|可|NULL||应用|
+|cust_business_code|varchar(255)|可|NULL||申请企业的营业执照号|
+|cust_space_name|varchar(255)|可|NULL||申请企业的名称|
+|cust_space_uu|bigint(20)|可|NULL|普通索引|申请企业uu号|
+|cust_user_email|varchar(255)|可|NULL||申请人的联系方式|
+|cust_user_name|varchar(255|可|NULL||申请人的姓名|
+|cust_user_tel|varchar(255)|可|NULL||申请人的联系方式|
+|cust_user_uu|bigint(20)|可|NULL|普通索引|申请人的uu号|
+|method|varchar(255)|可|NULL||添加合作伙伴关系后方式|
+|operate_date|datetime(0)|可|NULL||审核时间|
+|reason|varchar(255)|可|NULL||原因|
+|request_date|datetime(0)|可|NULL||申请时间|
+|status|varchar(255)|可|NULL||申请状态|
+|status_code|int(11)|可|NULL||申请状态码|
+|vend_business_code|varchar(255)|可|NULL||客户的营业执照号|
+|vend_space_name|varchar(255)|可|NULL||客户的企业名称|
+|vend_space_uu|bigint(20)|可|NULL|普通索引| 客户的标识(如UU号等)|
+|vend_user|tinyblob|可|NULL||审核人标志(uu号等)|
+|vend_user_email|varchar(255)|可|NULL||审核人邮箱|
+|vend_user_name|varchar(255)|可|NULL||审核人姓名|
+|vend_user_tel|varchar(255)|可|NULL||审核人电话|
+|vend_useruu|bigint(20)|可|NULL||审核人标志(uu号等)|
+|vend_user_code|bigint(20)|可|NULL|| 审核人标志(uu号等)|
+|vend_user_uu|bigint(20)|可|NULL|普通索引|审核人标志(uu号等)|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+
+
+##	******* sso$register$style
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|app_uid|varchar(255)|否||主键|应用名称|
+|login_when_over|bit(1)|可|NULL||??|
+|logo_url|varchar(255)|可|NULL||??|
+|over_type|int(11)|可|NULL||??|
+|terms|varchar(255)|可|NULL||??|
+|title|varchar(255)|可|NULL||??|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+
+
+##    	短信邮箱设置 sso$setting
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_key|varchar(255)|否||主键|唯一标志|
+|deleteable|int(11)|可|NULL||是否允许删除|
+|description|varchar(255)|可|NULL||描述|
+|value|varchar(255)|可|NULL||模板id|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+
+## 		更换管理员实体  sso$us$admin
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------- | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|after_admin_uu|bigint(20)|可|NULL||更换后管理员的uu号|
+|auditor|varchar(255)|可|NULL||审核人|
+|before_admin_uu|bigint(20)|可|NULL||更换前管理员的uu号|
+|change_reason|varchar(1000)|可|NULL||更换管理员原因|
+|contact_tel|varchar(255)|可|NULL||联系人电话|
+|invalid_reason|varchar(255)|可|NULL||不通过原因|
+|submit_time|datetime(0)|可|NULL||提交时间|
+|submitter_name|varchar(255)|可|NULL||提交人姓名|
+|submitteruu|bigint(20)|可|NULL||提交人uu号|
+|valid_code|smallint(6)|可|NULL||认证状态|
+|valid_date|varchar(255)|可|NULL||认证日期|
+|userspace_spaceuu|bigint(20)|可|NULL|普通索引|??|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		企业信息认证日志  sso$us$valid
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------- | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|auditor|varchar(255)|否|NULL||审核人|
+|invalid_reason|varchar(255)|否|NULL||审核不通过原因|
+|space_uu|bigint(20)|可|NULL||认证企业uu号|
+|submit_date|datetime(0)|可|NULL||提交日期|
+|submitter_info|varchar(2000)|可|NULL||提交信息|
+|submitter_uu|bigint(20)|可|NULL||提交者uu号|
+|valid_code|smallint(6)|可|NULL||审核状态|
+|valid_date|varchar(255)|否|NULL||审核日期|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+
+##		管理员变更信息表  sso$us_admin_change_record
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|id|bigint(20)|否||主键|id|
+|audit_time|datetime(0)|可|NULL||??|
+|auditor_name|varchar(50)|可|NULL||??|
+|auditor_tel|varchar(24)|可|NULL||??|
+|launch_time|datetime(0)|可|NULL||??|
+|sponsor_name|varchar(50)|可|NULL||??|
+|sponsor_tel|varchar(24)|可|NULL||??|
+|change_type|varchar(255)|可|NULL||管理更换方式|
+|admin_name_new|varchar(50)|可|NULL||新管理员姓名|
+|admin_tel_new|varchar(24)|可|NULL||新管理员手机|
+|admin_name_old|varchar(50)|可|NULL||原管理员姓名|
+|admin_tel_old|varchar(24)|可|NULL||原管理员手机|
+|space_uu|bigint(20)|可|NULL||space_uu|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		用户表实体  sso$user
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|useruu|bigint(20)|否||主键|uu号|
+|user_city|varchar(255)|可|NULL||现在所在城市(不用出现在注册页面,预留)|
+|user_country|varchar(255)|可|NULL||现在所在国家(不用出现在注册页面,预留)|
+|user_email|varchar(255)|可|NULL||用户邮箱|
+|email_valid_code|smallint(6)|可|NULL||用户邮箱认证状态|
+|erp_password|varchar(255)|可|NULL||??|
+|first_name|varchar(255)|可|NULL||姓|
+|from_app|varchar(255)|可|NULL||用户注册应用|
+|id_card|varchar(255)|可|NULL||用户身份证号|
+|identity_valid_code|smallint(6)|否|||用户身份认证状态|
+|last_name|varchar(255)|可|NULL||名|
+|_lock|smallint(6)|可|NULL||账户是否冻结(1、冻结)|
+|mobile|varchar(255)|否||唯一索引|手机号|
+|mobile_area|varchar(255)|可|NULL||手机号所属区域(continent or Hongkong)|
+|mobile_valid_code|smallint(6)|可|NULL||手机号认证状态|
+|nationality|varchar(255)|可|NULL||国籍(不用出现在注册页面,预留)|
+|native_place|varchar(255)|可|NULL||籍贯(不用出现在注册页面,预留)|
+|_password|varchar(255)|否|||用户密码|
+|user_province|varchar(255)|可|NULL||现在所在省份、州、直辖市、行政区(不用出现在注册页面,预留)|
+|qq_number|int(11)|可|NULL||qq号(qq扫码或qq客户端授权,不用出现在注册页面,预留)|
+|real_name|varchar(255)|可|NULL||用户真实姓名|
+|user_register_date|datetime(0)|可|NULL||用户注册时间|
+|salt|varchar(255)|可|NULL||盐值|
+|vip_name|varchar(255)|否|||会员名|
+|wx_openid|varchar(255)|可|NULL||微信号(微信扫码授权或微信客户端授权,不用出现在注册页面,预留)|
+|im_id|varchar(255)|可|NULL||imId|
+|password_level|int(11)|否|NULL||用户密码等级|
+|birthday|varchar(255)|可|NULL||出生日期|
+|sex|varchar(255)|可|NULL||性别|
+|wx_unionid|varchar(255)|可|NULL|| 微信号(微信扫码授权或微信客户端授权,不用出现在注册页面,预留)|
+|bh_openid|varchar(255)|可|NULL|唯一索引|碧合唯一id|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		用户密保  sso$user$question
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|answer|varchar(255)|可|NULL||密保答案|
+|question|varchar(255)|可|NULL||密保问题|
+|sort|varchar(255)|可|NULL||排序|
+|useruu|bigint(20)|可|NULL|普通索引|用户uu号|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		用户登录记录  sso$user$record
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|last_login_time|datetime(0)|可|NULL||上次登录时间|
+|pwd_error_count|int(11)|否|||密码错误次数|
+|user_uu|bigint(20)|否||主键|用户uu号|
+|serial_versionuid|bigint(20)|可|NULL||??|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		用户申请日志  sso$user$valid
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|auditor|varchar(255)|可|NULL||审核人|
+|invalid_reason|varchar(1000)|可|NULL||审核不通过原因|
+|submit_date|datetime(0)|否|||提交日期|
+|submitter_info|varchar(1000)|否|||提交信息|
+|submitter_uu|bigint(20)|否||| 提交者uu号|
+|valid_code|smallint(6)|否|||审核状态|
+|valid_date|datetime(0)|可|NULL||审核日期|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		企业下的用户  sso$user_userspace
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|space_uu|bigint(20)|否||普通索引|企业UU|
+|user_uu|bigint(20)|否||普通索引|userUU|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		企业实体  sso$userspace
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|spaceuu|bigint(20)|否||主键|企业uu号|
+|adminuu|bigint(20)|可|NULL|普通索引|管理员uu号|
+|bank|varchar(255)|可|NULL||对公银行账户开户行|
+|bank_account|varchar(255)|可|NULL||对公银行账户|
+|business_code|varchar(255)|可|NULL|唯一索引|营业执照号|
+|business_code_image|varchar(255)|可|NULL||营业执照|
+|company_address|varchar(255)|可|NULL|| 公司地址|
+|company_city|varchar(255)|可|NULL||公司所在城市|
+|company_country|varchar(255)|可|NULL||公司所在国家|
+|company_latitude|varchar(255)|可|NULL|| 公司地址纬度|
+|company_longitude|varchar(255)|可|NULL||公司地址经度|
+|company_province|varchar(255)|可|NULL||公司所在省份、州、直辖市、行政区|
+|corporation|varchar(255)|可|NULL||法定代表人|
+|domain|varchar(255)|可|NULL||企业域名|
+|invite_space_uu|bigint(20)|可|NULL|| 邀请人企业uu号|
+|invite_user_uu|bigint(20)|可|NULL||邀请人uu号|
+|logo_image|varchar(255)|可|NULL||logo图片|
+|main_business|varchar(255)|可|NULL||主营业务范围|
+|profession|varchar(255)|可|NULL||行业|
+|reg_address|varchar(255)|可|NULL||注册地址|
+|reg_city|varchar(255)|可|NULL||注册地址所在城市|
+|reg_district|varchar(255)|可|NULL||注册地址所在区域|
+|reg_province|varchar(255)|可|NULL||注册地址所在省份、州、直辖市、行政区|
+|reg_street|varchar(255)|可|NULL||注册地址所在街道|
+|space_register_date|datetime(0)|可|NULL||注册日期|
+|space_name|varchar(255)|否||唯一索引|企业名称|
+|tags|varchar(255)|可|NULL||经营范围标签,逗号分隔|
+|telephone|varchar(255)|可|NULL||企业联系电话|
+|valid_code|smallint(6)|否|||企业信息认证状态|
+|access_secret|varchar(255)|可|NULL||企业秘钥|
+|area|varchar(255)|可|NULL||企业注册地区|
+|website|varchar(255)|可|NULL||企业对应erp的地址|
+|from_app|varchar(255)|可|NULL||注册来源|
+|invite_time|datetime(0)|可|NULL||邀请时间|
+|source|varchar(30)|可|NULL||邀请来源|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|
+
+##		认证申述  sso$valid$appeal
+
+|字段|类型|可否为空|默认值|索引|备注|
+| :----------: | :--------------- | :------------------------ | ------------------------- | ------------------------- | ------------------------- |
+|_id|bigint(20)|否||主键|id|
+|audit_date|datetime(0)|可|NULL||审核日期|
+|auditor|varchar(255)|可|NULL||审核人|
+|contact_email|varchar(255)|否|||联系人email|
+|contact_name|varchar(255)|否|||联系人|
+|contact_tel|varchar(255)|否|||联系人手机号|
+|description|varchar(2000)|否|||申述说明|
+|mobile|varchar(255)|否|||新手机号|
+|status|smallint(6)|否|||审核状态(Status枚举)|
+|submit_date|datetime(0)|可|NULL||提交日期|
+|submit_info|varchar(2000)|否|||提交信息|
+|submitter_uu|bigint(20)|可|NULL||申请人uu号|
+|type|varchar(255)|否|||申述类型(resetPwd or validAccount or changeAdmin)|
+|submitter_name|varchar(255)|可|NULL||申请人uu号|
+|from_app|varchar(30)|可|NULL||注册来源|
+|create_time|timestamp|否|current_timestamp||创建时间|
+|update_time|timestamp|否|current_timestamp||更新时间|

BIN
usoft-sso-dal/mybatis_generate/mysql-connector-java-6.0.6.jar


+ 65 - 0
usoft-sso-dal/pom.xml

@@ -0,0 +1,65 @@
+<?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>usoft-sso-grpc-parent</artifactId>
+        <groupId>com.usoft.sso</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>usoft-sso-dal</artifactId>
+    <packaging>jar</packaging>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <finalName>usoft-sso-dal</finalName>
+        <!-- 一定要声明如下配置-->
+        <resources>
+            <resource>
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/com/usoft/sso/dal/xml/*.xml</include>
+                </includes>
+                <!-- 是否替换资源中的属性-->
+                <filtering>false</filtering>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+                <groupId>org.mybatis.generator</groupId>
+                <artifactId>mybatis-generator-maven-plugin</artifactId>
+                <version>1.3.7</version>
+                <configuration>
+                    <verbose>true</verbose>
+                    <overwrite>true</overwrite>
+                </configuration>
+                <dependencies>
+                    <dependency>
+                        <groupId>com.usoft.framework</groupId>
+                        <artifactId>usoft-mybatis-utils</artifactId>
+                        <version>dev-1.0-SNAPSHOT</version>
+                    </dependency>
+                </dependencies>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 654 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/entity/Enterprise.java

@@ -0,0 +1,654 @@
+package com.usoft.sso.dal.entity;
+
+/**
+ * <pre>
+ * 企业信息表
+ * 表名 : t_enterprise
+ * </pre>
+ * @author: Mybatis Generator
+ */
+public class Enterprise {
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_enterprise.id
+     * </pre>
+     */
+    private Integer id;
+
+    /**
+     * <pre>
+     * 企业UU号
+     * 表字段 : t_enterprise.spaceuu
+     * </pre>
+     */
+    private Long spaceuu;
+
+    /**
+     * <pre>
+     * 管理员UU号
+     * 表字段 : t_enterprise.adminuu
+     * </pre>
+     */
+    private Long adminuu;
+
+    /**
+     * <pre>
+     * 银行
+     * 表字段 : t_enterprise.bank
+     * </pre>
+     */
+    private String bank;
+
+    /**
+     * <pre>
+     * 银行账户
+     * 表字段 : t_enterprise.bank_account
+     * </pre>
+     */
+    private String bankAccount;
+
+    /**
+     * <pre>
+     * 营业执照号
+     * 表字段 : t_enterprise.business_code
+     * </pre>
+     */
+    private String businessCode;
+
+    /**
+     * <pre>
+     * 营业执照
+     * 表字段 : t_enterprise.business_code_image
+     * </pre>
+     */
+    private String businessCodeImage;
+
+    /**
+     * <pre>
+     * 公司地址
+     * 表字段 : t_enterprise.company_address
+     * </pre>
+     */
+    private String companyAddress;
+
+    /**
+     * <pre>
+     * 城市
+     * 表字段 : t_enterprise.company_city
+     * </pre>
+     */
+    private String companyCity;
+
+    /**
+     * <pre>
+     * 国家
+     * 表字段 : t_enterprise.company_country
+     * </pre>
+     */
+    private String companyCountry;
+
+    /**
+     * <pre>
+     * 省份
+     * 表字段 : t_enterprise.company_province
+     * </pre>
+     */
+    private String companyProvince;
+
+    /**
+     * <pre>
+     * 法定代表人
+     * 表字段 : t_enterprise.corporation
+     * </pre>
+     */
+    private String corporation;
+
+    /**
+     * <pre>
+     * 邀请企业UU号
+     * 表字段 : t_enterprise.invite_space_uu
+     * </pre>
+     */
+    private Long inviteSpaceUu;
+
+    /**
+     * <pre>
+     * 邀请人UU号
+     * 表字段 : t_enterprise.invite_user_uu
+     * </pre>
+     */
+    private Long inviteUserUu;
+
+    /**
+     * <pre>
+     * 主营业务
+     * 表字段 : t_enterprise.main_business
+     * </pre>
+     */
+    private String mainBusiness;
+
+    /**
+     * <pre>
+     * 行业
+     * 表字段 : t_enterprise.profession
+     * </pre>
+     */
+    private String profession;
+
+    /**
+     * <pre>
+     * 企业名称
+     * 表字段 : t_enterprise.space_name
+     * </pre>
+     */
+    private String spaceName;
+
+    /**
+     * <pre>
+     * 经营范围
+     * 表字段 : t_enterprise.tags
+     * </pre>
+     */
+    private String tags;
+
+    /**
+     * <pre>
+     * 公司联系电话
+     * 表字段 : t_enterprise.telephone
+     * </pre>
+     */
+    private String telephone;
+
+    /**
+     * <pre>
+     * 企业认证状态
+     * 表字段 : t_enterprise.valid_code
+     * </pre>
+     */
+    private Short validCode;
+
+    /**
+     * <pre>
+     * 企业秘钥
+     * 表字段 : t_enterprise.access_secret
+     * </pre>
+     */
+    private String accessSecret;
+
+    /**
+     * <pre>
+     * ERP外网地址
+     * 表字段 : t_enterprise.website
+     * </pre>
+     */
+    private String website;
+
+    /**
+     * <pre>
+     * 邀请时间
+     * 表字段 : t_enterprise.invite_time
+     * </pre>
+     */
+    private String inviteTime;
+
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_enterprise.id
+     * </pre>
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_enterprise.id
+     * </pre>
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * <pre>
+     * 企业UU号
+     * 表字段 : t_enterprise.spaceuu
+     * </pre>
+     */
+    public Long getSpaceuu() {
+        return spaceuu;
+    }
+
+    /**
+     * <pre>
+     * 企业UU号
+     * 表字段 : t_enterprise.spaceuu
+     * </pre>
+     */
+    public void setSpaceuu(Long spaceuu) {
+        this.spaceuu = spaceuu;
+    }
+
+    /**
+     * <pre>
+     * 管理员UU号
+     * 表字段 : t_enterprise.adminuu
+     * </pre>
+     */
+    public Long getAdminuu() {
+        return adminuu;
+    }
+
+    /**
+     * <pre>
+     * 管理员UU号
+     * 表字段 : t_enterprise.adminuu
+     * </pre>
+     */
+    public void setAdminuu(Long adminuu) {
+        this.adminuu = adminuu;
+    }
+
+    /**
+     * <pre>
+     * 银行
+     * 表字段 : t_enterprise.bank
+     * </pre>
+     */
+    public String getBank() {
+        return bank;
+    }
+
+    /**
+     * <pre>
+     * 银行
+     * 表字段 : t_enterprise.bank
+     * </pre>
+     */
+    public void setBank(String bank) {
+        this.bank = bank == null ? null : bank.trim();
+    }
+
+    /**
+     * <pre>
+     * 银行账户
+     * 表字段 : t_enterprise.bank_account
+     * </pre>
+     */
+    public String getBankAccount() {
+        return bankAccount;
+    }
+
+    /**
+     * <pre>
+     * 银行账户
+     * 表字段 : t_enterprise.bank_account
+     * </pre>
+     */
+    public void setBankAccount(String bankAccount) {
+        this.bankAccount = bankAccount == null ? null : bankAccount.trim();
+    }
+
+    /**
+     * <pre>
+     * 营业执照号
+     * 表字段 : t_enterprise.business_code
+     * </pre>
+     */
+    public String getBusinessCode() {
+        return businessCode;
+    }
+
+    /**
+     * <pre>
+     * 营业执照号
+     * 表字段 : t_enterprise.business_code
+     * </pre>
+     */
+    public void setBusinessCode(String businessCode) {
+        this.businessCode = businessCode == null ? null : businessCode.trim();
+    }
+
+    /**
+     * <pre>
+     * 营业执照
+     * 表字段 : t_enterprise.business_code_image
+     * </pre>
+     */
+    public String getBusinessCodeImage() {
+        return businessCodeImage;
+    }
+
+    /**
+     * <pre>
+     * 营业执照
+     * 表字段 : t_enterprise.business_code_image
+     * </pre>
+     */
+    public void setBusinessCodeImage(String businessCodeImage) {
+        this.businessCodeImage = businessCodeImage == null ? null : businessCodeImage.trim();
+    }
+
+    /**
+     * <pre>
+     * 公司地址
+     * 表字段 : t_enterprise.company_address
+     * </pre>
+     */
+    public String getCompanyAddress() {
+        return companyAddress;
+    }
+
+    /**
+     * <pre>
+     * 公司地址
+     * 表字段 : t_enterprise.company_address
+     * </pre>
+     */
+    public void setCompanyAddress(String companyAddress) {
+        this.companyAddress = companyAddress == null ? null : companyAddress.trim();
+    }
+
+    /**
+     * <pre>
+     * 城市
+     * 表字段 : t_enterprise.company_city
+     * </pre>
+     */
+    public String getCompanyCity() {
+        return companyCity;
+    }
+
+    /**
+     * <pre>
+     * 城市
+     * 表字段 : t_enterprise.company_city
+     * </pre>
+     */
+    public void setCompanyCity(String companyCity) {
+        this.companyCity = companyCity == null ? null : companyCity.trim();
+    }
+
+    /**
+     * <pre>
+     * 国家
+     * 表字段 : t_enterprise.company_country
+     * </pre>
+     */
+    public String getCompanyCountry() {
+        return companyCountry;
+    }
+
+    /**
+     * <pre>
+     * 国家
+     * 表字段 : t_enterprise.company_country
+     * </pre>
+     */
+    public void setCompanyCountry(String companyCountry) {
+        this.companyCountry = companyCountry == null ? null : companyCountry.trim();
+    }
+
+    /**
+     * <pre>
+     * 省份
+     * 表字段 : t_enterprise.company_province
+     * </pre>
+     */
+    public String getCompanyProvince() {
+        return companyProvince;
+    }
+
+    /**
+     * <pre>
+     * 省份
+     * 表字段 : t_enterprise.company_province
+     * </pre>
+     */
+    public void setCompanyProvince(String companyProvince) {
+        this.companyProvince = companyProvince == null ? null : companyProvince.trim();
+    }
+
+    /**
+     * <pre>
+     * 法定代表人
+     * 表字段 : t_enterprise.corporation
+     * </pre>
+     */
+    public String getCorporation() {
+        return corporation;
+    }
+
+    /**
+     * <pre>
+     * 法定代表人
+     * 表字段 : t_enterprise.corporation
+     * </pre>
+     */
+    public void setCorporation(String corporation) {
+        this.corporation = corporation == null ? null : corporation.trim();
+    }
+
+    /**
+     * <pre>
+     * 邀请企业UU号
+     * 表字段 : t_enterprise.invite_space_uu
+     * </pre>
+     */
+    public Long getInviteSpaceUu() {
+        return inviteSpaceUu;
+    }
+
+    /**
+     * <pre>
+     * 邀请企业UU号
+     * 表字段 : t_enterprise.invite_space_uu
+     * </pre>
+     */
+    public void setInviteSpaceUu(Long inviteSpaceUu) {
+        this.inviteSpaceUu = inviteSpaceUu;
+    }
+
+    /**
+     * <pre>
+     * 邀请人UU号
+     * 表字段 : t_enterprise.invite_user_uu
+     * </pre>
+     */
+    public Long getInviteUserUu() {
+        return inviteUserUu;
+    }
+
+    /**
+     * <pre>
+     * 邀请人UU号
+     * 表字段 : t_enterprise.invite_user_uu
+     * </pre>
+     */
+    public void setInviteUserUu(Long inviteUserUu) {
+        this.inviteUserUu = inviteUserUu;
+    }
+
+    /**
+     * <pre>
+     * 主营业务
+     * 表字段 : t_enterprise.main_business
+     * </pre>
+     */
+    public String getMainBusiness() {
+        return mainBusiness;
+    }
+
+    /**
+     * <pre>
+     * 主营业务
+     * 表字段 : t_enterprise.main_business
+     * </pre>
+     */
+    public void setMainBusiness(String mainBusiness) {
+        this.mainBusiness = mainBusiness == null ? null : mainBusiness.trim();
+    }
+
+    /**
+     * <pre>
+     * 行业
+     * 表字段 : t_enterprise.profession
+     * </pre>
+     */
+    public String getProfession() {
+        return profession;
+    }
+
+    /**
+     * <pre>
+     * 行业
+     * 表字段 : t_enterprise.profession
+     * </pre>
+     */
+    public void setProfession(String profession) {
+        this.profession = profession == null ? null : profession.trim();
+    }
+
+    /**
+     * <pre>
+     * 企业名称
+     * 表字段 : t_enterprise.space_name
+     * </pre>
+     */
+    public String getSpaceName() {
+        return spaceName;
+    }
+
+    /**
+     * <pre>
+     * 企业名称
+     * 表字段 : t_enterprise.space_name
+     * </pre>
+     */
+    public void setSpaceName(String spaceName) {
+        this.spaceName = spaceName == null ? null : spaceName.trim();
+    }
+
+    /**
+     * <pre>
+     * 经营范围
+     * 表字段 : t_enterprise.tags
+     * </pre>
+     */
+    public String getTags() {
+        return tags;
+    }
+
+    /**
+     * <pre>
+     * 经营范围
+     * 表字段 : t_enterprise.tags
+     * </pre>
+     */
+    public void setTags(String tags) {
+        this.tags = tags == null ? null : tags.trim();
+    }
+
+    /**
+     * <pre>
+     * 公司联系电话
+     * 表字段 : t_enterprise.telephone
+     * </pre>
+     */
+    public String getTelephone() {
+        return telephone;
+    }
+
+    /**
+     * <pre>
+     * 公司联系电话
+     * 表字段 : t_enterprise.telephone
+     * </pre>
+     */
+    public void setTelephone(String telephone) {
+        this.telephone = telephone == null ? null : telephone.trim();
+    }
+
+    /**
+     * <pre>
+     * 企业认证状态
+     * 表字段 : t_enterprise.valid_code
+     * </pre>
+     */
+    public Short getValidCode() {
+        return validCode;
+    }
+
+    /**
+     * <pre>
+     * 企业认证状态
+     * 表字段 : t_enterprise.valid_code
+     * </pre>
+     */
+    public void setValidCode(Short validCode) {
+        this.validCode = validCode;
+    }
+
+    /**
+     * <pre>
+     * 企业秘钥
+     * 表字段 : t_enterprise.access_secret
+     * </pre>
+     */
+    public String getAccessSecret() {
+        return accessSecret;
+    }
+
+    /**
+     * <pre>
+     * 企业秘钥
+     * 表字段 : t_enterprise.access_secret
+     * </pre>
+     */
+    public void setAccessSecret(String accessSecret) {
+        this.accessSecret = accessSecret == null ? null : accessSecret.trim();
+    }
+
+    /**
+     * <pre>
+     * ERP外网地址
+     * 表字段 : t_enterprise.website
+     * </pre>
+     */
+    public String getWebsite() {
+        return website;
+    }
+
+    /**
+     * <pre>
+     * ERP外网地址
+     * 表字段 : t_enterprise.website
+     * </pre>
+     */
+    public void setWebsite(String website) {
+        this.website = website == null ? null : website.trim();
+    }
+
+    /**
+     * <pre>
+     * 邀请时间
+     * 表字段 : t_enterprise.invite_time
+     * </pre>
+     */
+    public String getInviteTime() {
+        return inviteTime;
+    }
+
+    /**
+     * <pre>
+     * 邀请时间
+     * 表字段 : t_enterprise.invite_time
+     * </pre>
+     */
+    public void setInviteTime(String inviteTime) {
+        this.inviteTime = inviteTime == null ? null : inviteTime.trim();
+    }
+}

+ 710 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/entity/User.java

@@ -0,0 +1,710 @@
+package com.usoft.sso.dal.entity;
+
+/**
+ * <pre>
+ * 用户信息表
+ * 表名 : t_user
+ * </pre>
+ * @author: Mybatis Generator
+ */
+public class User {
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_user.id
+     * </pre>
+     */
+    private Integer id;
+
+    /**
+     * <pre>
+     * 用户UU号
+     * 表字段 : t_user.useruu
+     * </pre>
+     */
+    private Long useruu;
+
+    /**
+     * <pre>
+     * 用户头像
+     * 表字段 : t_user.user_image
+     * </pre>
+     */
+    private String userImage;
+
+    /**
+     * <pre>
+     * 城市
+     * 表字段 : t_user.user_city
+     * </pre>
+     */
+    private String userCity;
+
+    /**
+     * <pre>
+     * 国家
+     * 表字段 : t_user.user_country
+     * </pre>
+     */
+    private String userCountry;
+
+    /**
+     * <pre>
+     * 邮箱
+     * 表字段 : t_user.user_email
+     * </pre>
+     */
+    private String userEmail;
+
+    /**
+     * <pre>
+     * 邮箱有效状态
+     * 表字段 : t_user.email_valid_code
+     * </pre>
+     */
+    private Short emailValidCode;
+
+    /**
+     * <pre>
+     * 姓
+     * 表字段 : t_user.first_name
+     * </pre>
+     */
+    private String firstName;
+
+    /**
+     * <pre>
+     * 身份证号码
+     * 表字段 : t_user.id_card
+     * </pre>
+     */
+    private String idCard;
+
+    /**
+     * <pre>
+     * 身份认证状态
+     * 表字段 : t_user.identity_valid_code
+     * </pre>
+     */
+    private Short identityValidCode;
+
+    /**
+     * <pre>
+     * 名
+     * 表字段 : t_user.last_name
+     * </pre>
+     */
+    private String lastName;
+
+    /**
+     * <pre>
+     * 手机号码
+     * 表字段 : t_user.mobile
+     * </pre>
+     */
+    private String mobile;
+
+    /**
+     * <pre>
+     * 手机认证状态
+     * 表字段 : t_user.mobile_valid_code
+     * </pre>
+     */
+    private Short mobileValidCode;
+
+    /**
+     * <pre>
+     * 密码
+     * 表字段 : t_user._password
+     * </pre>
+     */
+    private String password;
+
+    /**
+     * <pre>
+     * 省份
+     * 表字段 : t_user.user_province
+     * </pre>
+     */
+    private String userProvince;
+
+    /**
+     * <pre>
+     * qq号码
+     * 表字段 : t_user.qq_number
+     * </pre>
+     */
+    private String qqNumber;
+
+    /**
+     * <pre>
+     * 真实姓名
+     * 表字段 : t_user.real_name
+     * </pre>
+     */
+    private String realName;
+
+    /**
+     * <pre>
+     * 盐值
+     * 表字段 : t_user.salt
+     * </pre>
+     */
+    private String salt;
+
+    /**
+     * <pre>
+     * 用户名
+     * 表字段 : t_user.vip_name
+     * </pre>
+     */
+    private String vipName;
+
+    /**
+     * <pre>
+     * imid
+     * 表字段 : t_user.im_id
+     * </pre>
+     */
+    private String imId;
+
+    /**
+     * <pre>
+     * 密码强度
+     * 表字段 : t_user.password_level
+     * </pre>
+     */
+    private Integer passwordLevel;
+
+    /**
+     * <pre>
+     * 生日
+     * 表字段 : t_user.birthday
+     * </pre>
+     */
+    private String birthday;
+
+    /**
+     * <pre>
+     * 性别
+     * 表字段 : t_user.sex
+     * </pre>
+     */
+    private String sex;
+
+    /**
+     * <pre>
+     * 微信unionid
+     * 表字段 : t_user.wx_unionid
+     * </pre>
+     */
+    private String wxUnionid;
+
+    /**
+     * <pre>
+     * 碧合openid
+     * 表字段 : t_user.bh_openid
+     * </pre>
+     */
+    private String bhOpenid;
+
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_user.id
+     * </pre>
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_user.id
+     * </pre>
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * <pre>
+     * 用户UU号
+     * 表字段 : t_user.useruu
+     * </pre>
+     */
+    public Long getUseruu() {
+        return useruu;
+    }
+
+    /**
+     * <pre>
+     * 用户UU号
+     * 表字段 : t_user.useruu
+     * </pre>
+     */
+    public void setUseruu(Long useruu) {
+        this.useruu = useruu;
+    }
+
+    /**
+     * <pre>
+     * 用户头像
+     * 表字段 : t_user.user_image
+     * </pre>
+     */
+    public String getUserImage() {
+        return userImage;
+    }
+
+    /**
+     * <pre>
+     * 用户头像
+     * 表字段 : t_user.user_image
+     * </pre>
+     */
+    public void setUserImage(String userImage) {
+        this.userImage = userImage == null ? null : userImage.trim();
+    }
+
+    /**
+     * <pre>
+     * 城市
+     * 表字段 : t_user.user_city
+     * </pre>
+     */
+    public String getUserCity() {
+        return userCity;
+    }
+
+    /**
+     * <pre>
+     * 城市
+     * 表字段 : t_user.user_city
+     * </pre>
+     */
+    public void setUserCity(String userCity) {
+        this.userCity = userCity == null ? null : userCity.trim();
+    }
+
+    /**
+     * <pre>
+     * 国家
+     * 表字段 : t_user.user_country
+     * </pre>
+     */
+    public String getUserCountry() {
+        return userCountry;
+    }
+
+    /**
+     * <pre>
+     * 国家
+     * 表字段 : t_user.user_country
+     * </pre>
+     */
+    public void setUserCountry(String userCountry) {
+        this.userCountry = userCountry == null ? null : userCountry.trim();
+    }
+
+    /**
+     * <pre>
+     * 邮箱
+     * 表字段 : t_user.user_email
+     * </pre>
+     */
+    public String getUserEmail() {
+        return userEmail;
+    }
+
+    /**
+     * <pre>
+     * 邮箱
+     * 表字段 : t_user.user_email
+     * </pre>
+     */
+    public void setUserEmail(String userEmail) {
+        this.userEmail = userEmail == null ? null : userEmail.trim();
+    }
+
+    /**
+     * <pre>
+     * 邮箱有效状态
+     * 表字段 : t_user.email_valid_code
+     * </pre>
+     */
+    public Short getEmailValidCode() {
+        return emailValidCode;
+    }
+
+    /**
+     * <pre>
+     * 邮箱有效状态
+     * 表字段 : t_user.email_valid_code
+     * </pre>
+     */
+    public void setEmailValidCode(Short emailValidCode) {
+        this.emailValidCode = emailValidCode;
+    }
+
+    /**
+     * <pre>
+     * 姓
+     * 表字段 : t_user.first_name
+     * </pre>
+     */
+    public String getFirstName() {
+        return firstName;
+    }
+
+    /**
+     * <pre>
+     * 姓
+     * 表字段 : t_user.first_name
+     * </pre>
+     */
+    public void setFirstName(String firstName) {
+        this.firstName = firstName == null ? null : firstName.trim();
+    }
+
+    /**
+     * <pre>
+     * 身份证号码
+     * 表字段 : t_user.id_card
+     * </pre>
+     */
+    public String getIdCard() {
+        return idCard;
+    }
+
+    /**
+     * <pre>
+     * 身份证号码
+     * 表字段 : t_user.id_card
+     * </pre>
+     */
+    public void setIdCard(String idCard) {
+        this.idCard = idCard == null ? null : idCard.trim();
+    }
+
+    /**
+     * <pre>
+     * 身份认证状态
+     * 表字段 : t_user.identity_valid_code
+     * </pre>
+     */
+    public Short getIdentityValidCode() {
+        return identityValidCode;
+    }
+
+    /**
+     * <pre>
+     * 身份认证状态
+     * 表字段 : t_user.identity_valid_code
+     * </pre>
+     */
+    public void setIdentityValidCode(Short identityValidCode) {
+        this.identityValidCode = identityValidCode;
+    }
+
+    /**
+     * <pre>
+     * 名
+     * 表字段 : t_user.last_name
+     * </pre>
+     */
+    public String getLastName() {
+        return lastName;
+    }
+
+    /**
+     * <pre>
+     * 名
+     * 表字段 : t_user.last_name
+     * </pre>
+     */
+    public void setLastName(String lastName) {
+        this.lastName = lastName == null ? null : lastName.trim();
+    }
+
+    /**
+     * <pre>
+     * 手机号码
+     * 表字段 : t_user.mobile
+     * </pre>
+     */
+    public String getMobile() {
+        return mobile;
+    }
+
+    /**
+     * <pre>
+     * 手机号码
+     * 表字段 : t_user.mobile
+     * </pre>
+     */
+    public void setMobile(String mobile) {
+        this.mobile = mobile == null ? null : mobile.trim();
+    }
+
+    /**
+     * <pre>
+     * 手机认证状态
+     * 表字段 : t_user.mobile_valid_code
+     * </pre>
+     */
+    public Short getMobileValidCode() {
+        return mobileValidCode;
+    }
+
+    /**
+     * <pre>
+     * 手机认证状态
+     * 表字段 : t_user.mobile_valid_code
+     * </pre>
+     */
+    public void setMobileValidCode(Short mobileValidCode) {
+        this.mobileValidCode = mobileValidCode;
+    }
+
+    /**
+     * <pre>
+     * 密码
+     * 表字段 : t_user._password
+     * </pre>
+     */
+    public String getPassword() {
+        return password;
+    }
+
+    /**
+     * <pre>
+     * 密码
+     * 表字段 : t_user._password
+     * </pre>
+     */
+    public void setPassword(String password) {
+        this.password = password == null ? null : password.trim();
+    }
+
+    /**
+     * <pre>
+     * 省份
+     * 表字段 : t_user.user_province
+     * </pre>
+     */
+    public String getUserProvince() {
+        return userProvince;
+    }
+
+    /**
+     * <pre>
+     * 省份
+     * 表字段 : t_user.user_province
+     * </pre>
+     */
+    public void setUserProvince(String userProvince) {
+        this.userProvince = userProvince == null ? null : userProvince.trim();
+    }
+
+    /**
+     * <pre>
+     * qq号码
+     * 表字段 : t_user.qq_number
+     * </pre>
+     */
+    public String getQqNumber() {
+        return qqNumber;
+    }
+
+    /**
+     * <pre>
+     * qq号码
+     * 表字段 : t_user.qq_number
+     * </pre>
+     */
+    public void setQqNumber(String qqNumber) {
+        this.qqNumber = qqNumber == null ? null : qqNumber.trim();
+    }
+
+    /**
+     * <pre>
+     * 真实姓名
+     * 表字段 : t_user.real_name
+     * </pre>
+     */
+    public String getRealName() {
+        return realName;
+    }
+
+    /**
+     * <pre>
+     * 真实姓名
+     * 表字段 : t_user.real_name
+     * </pre>
+     */
+    public void setRealName(String realName) {
+        this.realName = realName == null ? null : realName.trim();
+    }
+
+    /**
+     * <pre>
+     * 盐值
+     * 表字段 : t_user.salt
+     * </pre>
+     */
+    public String getSalt() {
+        return salt;
+    }
+
+    /**
+     * <pre>
+     * 盐值
+     * 表字段 : t_user.salt
+     * </pre>
+     */
+    public void setSalt(String salt) {
+        this.salt = salt == null ? null : salt.trim();
+    }
+
+    /**
+     * <pre>
+     * 用户名
+     * 表字段 : t_user.vip_name
+     * </pre>
+     */
+    public String getVipName() {
+        return vipName;
+    }
+
+    /**
+     * <pre>
+     * 用户名
+     * 表字段 : t_user.vip_name
+     * </pre>
+     */
+    public void setVipName(String vipName) {
+        this.vipName = vipName == null ? null : vipName.trim();
+    }
+
+    /**
+     * <pre>
+     * imid
+     * 表字段 : t_user.im_id
+     * </pre>
+     */
+    public String getImId() {
+        return imId;
+    }
+
+    /**
+     * <pre>
+     * imid
+     * 表字段 : t_user.im_id
+     * </pre>
+     */
+    public void setImId(String imId) {
+        this.imId = imId == null ? null : imId.trim();
+    }
+
+    /**
+     * <pre>
+     * 密码强度
+     * 表字段 : t_user.password_level
+     * </pre>
+     */
+    public Integer getPasswordLevel() {
+        return passwordLevel;
+    }
+
+    /**
+     * <pre>
+     * 密码强度
+     * 表字段 : t_user.password_level
+     * </pre>
+     */
+    public void setPasswordLevel(Integer passwordLevel) {
+        this.passwordLevel = passwordLevel;
+    }
+
+    /**
+     * <pre>
+     * 生日
+     * 表字段 : t_user.birthday
+     * </pre>
+     */
+    public String getBirthday() {
+        return birthday;
+    }
+
+    /**
+     * <pre>
+     * 生日
+     * 表字段 : t_user.birthday
+     * </pre>
+     */
+    public void setBirthday(String birthday) {
+        this.birthday = birthday == null ? null : birthday.trim();
+    }
+
+    /**
+     * <pre>
+     * 性别
+     * 表字段 : t_user.sex
+     * </pre>
+     */
+    public String getSex() {
+        return sex;
+    }
+
+    /**
+     * <pre>
+     * 性别
+     * 表字段 : t_user.sex
+     * </pre>
+     */
+    public void setSex(String sex) {
+        this.sex = sex == null ? null : sex.trim();
+    }
+
+    /**
+     * <pre>
+     * 微信unionid
+     * 表字段 : t_user.wx_unionid
+     * </pre>
+     */
+    public String getWxUnionid() {
+        return wxUnionid;
+    }
+
+    /**
+     * <pre>
+     * 微信unionid
+     * 表字段 : t_user.wx_unionid
+     * </pre>
+     */
+    public void setWxUnionid(String wxUnionid) {
+        this.wxUnionid = wxUnionid == null ? null : wxUnionid.trim();
+    }
+
+    /**
+     * <pre>
+     * 碧合openid
+     * 表字段 : t_user.bh_openid
+     * </pre>
+     */
+    public String getBhOpenid() {
+        return bhOpenid;
+    }
+
+    /**
+     * <pre>
+     * 碧合openid
+     * 表字段 : t_user.bh_openid
+     * </pre>
+     */
+    public void setBhOpenid(String bhOpenid) {
+        this.bhOpenid = bhOpenid == null ? null : bhOpenid.trim();
+    }
+}

+ 94 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/entity/UserEnterprise.java

@@ -0,0 +1,94 @@
+package com.usoft.sso.dal.entity;
+
+/**
+ * <pre>
+ * 关联用户和企业信息表
+ * 表名 : t_user_enterprise
+ * </pre>
+ * @author: Mybatis Generator
+ */
+public class UserEnterprise {
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_user_enterprise.id
+     * </pre>
+     */
+    private Integer id;
+
+    /**
+     * <pre>
+     * 企业UU号
+     * 表字段 : t_user_enterprise.spaceuu
+     * </pre>
+     */
+    private Long spaceuu;
+
+    /**
+     * <pre>
+     * 用户UU号
+     * 表字段 : t_user_enterprise.useruu
+     * </pre>
+     */
+    private Long useruu;
+
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_user_enterprise.id
+     * </pre>
+     */
+    public Integer getId() {
+        return id;
+    }
+
+    /**
+     * <pre>
+     * 主键
+     * 表字段 : t_user_enterprise.id
+     * </pre>
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * <pre>
+     * 企业UU号
+     * 表字段 : t_user_enterprise.spaceuu
+     * </pre>
+     */
+    public Long getSpaceuu() {
+        return spaceuu;
+    }
+
+    /**
+     * <pre>
+     * 企业UU号
+     * 表字段 : t_user_enterprise.spaceuu
+     * </pre>
+     */
+    public void setSpaceuu(Long spaceuu) {
+        this.spaceuu = spaceuu;
+    }
+
+    /**
+     * <pre>
+     * 用户UU号
+     * 表字段 : t_user_enterprise.useruu
+     * </pre>
+     */
+    public Long getUseruu() {
+        return useruu;
+    }
+
+    /**
+     * <pre>
+     * 用户UU号
+     * 表字段 : t_user_enterprise.useruu
+     * </pre>
+     */
+    public void setUseruu(Long useruu) {
+        this.useruu = useruu;
+    }
+}

+ 69 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/mapper/EnterpriseMapper.java

@@ -0,0 +1,69 @@
+package com.usoft.sso.dal.mapper;
+
+import com.usoft.sso.dal.entity.Enterprise;
+
+public interface EnterpriseMapper {
+    /**
+     * deleteByPrimaryKey
+     * 
+     * @param id
+     * @return int
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * insert
+     * 
+     * @param record
+     * @return int
+     */
+    int insert(Enterprise record);
+
+    /**
+     * insertSelective
+     * 
+     * @param record
+     * @return int
+     */
+    int insertSelective(Enterprise record);
+
+    /**
+     * selectByPrimaryKey
+     * 
+     * @param id
+     * @return Enterprise
+     */
+    Enterprise selectByPrimaryKey(Integer id);
+
+    /**
+     * updateByPrimaryKeySelective
+     * 
+     * @param record
+     * @return int
+     */
+    int updateByPrimaryKeySelective(Enterprise record);
+
+    /**
+     * updateByPrimaryKey
+     * 
+     * @param record
+     * @return int
+     */
+    int updateByPrimaryKey(Enterprise record);
+
+    /**
+     * 通过spaceUU查找企业信息
+     *
+     * @param spaceuu
+     * @return
+     */
+    Enterprise selectBySpaceuu(Long spaceuu);
+
+    /**
+     * 通过请求值,更新企业信息。
+     *
+     * @param record
+     * @return
+     */
+    int updateBySpaceuuSelective(Enterprise record);
+}

+ 89 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/mapper/UserEnterpriseMapper.java

@@ -0,0 +1,89 @@
+package com.usoft.sso.dal.mapper;
+
+import com.usoft.sso.dal.entity.UserEnterprise;
+
+public interface UserEnterpriseMapper {
+    /**
+     * deleteByPrimaryKey
+     * 
+     * @param id
+     * @return int
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * insert
+     * 
+     * @param record
+     * @return int
+     */
+    int insert(UserEnterprise record);
+
+    /**
+     * insertSelective
+     * 
+     * @param record
+     * @return int
+     */
+    int insertSelective(UserEnterprise record);
+
+    /**
+     * selectByPrimaryKey
+     * 
+     * @param id
+     * @return UserEnterprise
+     */
+    UserEnterprise selectByPrimaryKey(Integer id);
+
+    /**
+     * updateByPrimaryKeySelective
+     * 
+     * @param record
+     * @return int
+     */
+    int updateByPrimaryKeySelective(UserEnterprise record);
+
+    /**
+     * updateByPrimaryKey
+     * 
+     * @param record
+     * @return int
+     */
+    int updateByPrimaryKey(UserEnterprise record);
+
+    /**
+     * 通过userUU和spaceUU绑定用户和企业
+     *
+     * @param useruu
+     * @param spaceuu
+     * @return
+     */
+    int bindUserEnterpries(Long useruu, Long spaceuu);
+
+    /**
+     * 通过userUU和spaceUU解绑用户和企业
+     *
+     * @param useruu
+     * @param spaceuu
+     * @return
+     */
+    int deleteByUseruuSpaceuu(Long useruu, Long spaceuu);
+
+    /**
+     * 通过userUU查找spaceUU
+     *
+     * @param useruu
+     * @return
+     */
+    Long selectSpaceuuByUseruu(Long useruu);
+
+    /**
+     * 通过userUU和spaceUU确定用户和企业是否绑定
+     *
+     * @param useruu
+     * @param spaceuu
+     * @return
+     */
+    UserEnterprise selectByUseruuSpaceuu(Long useruu, Long spaceuu);
+
+}

+ 70 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/mapper/UserMapper.java

@@ -0,0 +1,70 @@
+package com.usoft.sso.dal.mapper;
+
+import com.usoft.sso.dal.entity.User;
+
+public interface UserMapper {
+    /**
+     * deleteByPrimaryKey
+     * 
+     * @param id
+     * @return int
+     */
+    int deleteByPrimaryKey(Integer id);
+
+    /**
+     * insert
+     * 
+     * @param record
+     * @return int
+     */
+    int insert(User record);
+
+    /**
+     * insertSelective
+     * 
+     * @param record
+     * @return int
+     */
+    int insertSelective(User record);
+
+    /**
+     * selectByPrimaryKey
+     * 
+     * @param id
+     * @return User
+     */
+    User selectByPrimaryKey(Integer id);
+
+    /**
+     * updateByPrimaryKeySelective
+     * 
+     * @param record
+     * @return int
+     */
+    int updateByPrimaryKeySelective(User record);
+
+    /**
+     * updateByPrimaryKey
+     * 
+     * @param record
+     * @return int
+     */
+    int updateByPrimaryKey(User record);
+
+    /**
+     * 通过userUU查找用户信息
+     *
+     * @param useruu
+     * @return
+     */
+    User selectByUseruu(Long useruu);
+
+    /**
+     * 通过请求值更新用户信息
+     *
+     * @param useruu
+     * @return
+     */
+    int updateByUseruuKeySelective(User useruu);
+
+}

+ 80 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/EnterpriseExtMapper.xml

@@ -0,0 +1,80 @@
+<?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="com.usoft.sso.dal.mapper.EnterpriseMapper">
+  <select id="selectBySpaceuu" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_enterprise
+    where spaceuu = #{spaceuu,jdbcType=BIGINT}
+  </select>
+
+  <update id="updateBySpaceuuSelective" parameterType="com.usoft.sso.dal.entity.Enterprise">
+    update t_enterprise
+    <set>
+      <if test="adminuu != null">
+        adminuu = #{adminuu,jdbcType=BIGINT},
+      </if>
+      <if test="bank != null">
+        bank = #{bank,jdbcType=VARCHAR},
+      </if>
+      <if test="bankAccount != null">
+        bank_account = #{bankAccount,jdbcType=VARCHAR},
+      </if>
+      <if test="businessCode != null">
+        business_code = #{businessCode,jdbcType=VARCHAR},
+      </if>
+      <if test="businessCodeImage != null">
+        business_code_image = #{businessCodeImage,jdbcType=VARCHAR},
+      </if>
+      <if test="companyAddress != null">
+        company_address = #{companyAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="companyCity != null">
+        company_city = #{companyCity,jdbcType=VARCHAR},
+      </if>
+      <if test="companyCountry != null">
+        company_country = #{companyCountry,jdbcType=VARCHAR},
+      </if>
+      <if test="companyProvince != null">
+        company_province = #{companyProvince,jdbcType=VARCHAR},
+      </if>
+      <if test="corporation != null">
+        corporation = #{corporation,jdbcType=VARCHAR},
+      </if>
+      <if test="inviteSpaceUu != null">
+        invite_space_uu = #{inviteSpaceUu,jdbcType=BIGINT},
+      </if>
+      <if test="inviteUserUu != null">
+        invite_user_uu = #{inviteUserUu,jdbcType=BIGINT},
+      </if>
+      <if test="mainBusiness != null">
+        main_business = #{mainBusiness,jdbcType=VARCHAR},
+      </if>
+      <if test="profession != null">
+        profession = #{profession,jdbcType=VARCHAR},
+      </if>
+      <if test="spaceName != null">
+        space_name = #{spaceName,jdbcType=VARCHAR},
+      </if>
+      <if test="tags != null">
+        tags = #{tags,jdbcType=VARCHAR},
+      </if>
+      <if test="telephone != null">
+        telephone = #{telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="validCode != null">
+        valid_code = #{validCode,jdbcType=BIT},
+      </if>
+      <if test="accessSecret != null">
+        access_secret = #{accessSecret,jdbcType=VARCHAR},
+      </if>
+      <if test="website != null">
+        website = #{website,jdbcType=VARCHAR},
+      </if>
+      <if test="inviteTime != null">
+        invite_time = #{inviteTime,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where spaceuu = #{spaceuu,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 315 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/EnterpriseMapper.xml

@@ -0,0 +1,315 @@
+<?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="com.usoft.sso.dal.mapper.EnterpriseMapper">
+  <resultMap id="BaseResultMap" type="com.usoft.sso.dal.entity.Enterprise">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="spaceuu" jdbcType="BIGINT" property="spaceuu" />
+    <result column="adminuu" jdbcType="BIGINT" property="adminuu" />
+    <result column="bank" jdbcType="VARCHAR" property="bank" />
+    <result column="bank_account" jdbcType="VARCHAR" property="bankAccount" />
+    <result column="business_code" jdbcType="VARCHAR" property="businessCode" />
+    <result column="business_code_image" jdbcType="VARCHAR" property="businessCodeImage" />
+    <result column="company_address" jdbcType="VARCHAR" property="companyAddress" />
+    <result column="company_city" jdbcType="VARCHAR" property="companyCity" />
+    <result column="company_country" jdbcType="VARCHAR" property="companyCountry" />
+    <result column="company_province" jdbcType="VARCHAR" property="companyProvince" />
+    <result column="corporation" jdbcType="VARCHAR" property="corporation" />
+    <result column="invite_space_uu" jdbcType="BIGINT" property="inviteSpaceUu" />
+    <result column="invite_user_uu" jdbcType="BIGINT" property="inviteUserUu" />
+    <result column="main_business" jdbcType="VARCHAR" property="mainBusiness" />
+    <result column="profession" jdbcType="VARCHAR" property="profession" />
+    <result column="space_name" jdbcType="VARCHAR" property="spaceName" />
+    <result column="tags" jdbcType="VARCHAR" property="tags" />
+    <result column="telephone" jdbcType="VARCHAR" property="telephone" />
+    <result column="valid_code" jdbcType="SMALLINT" property="validCode" />
+    <result column="access_secret" jdbcType="VARCHAR" property="accessSecret" />
+    <result column="website" jdbcType="VARCHAR" property="website" />
+    <result column="invite_time" jdbcType="VARCHAR" property="inviteTime" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, spaceuu, adminuu, bank, bank_account, business_code, business_code_image, company_address, 
+    company_city, company_country, company_province, corporation, invite_space_uu, invite_user_uu, 
+    main_business, profession, space_name, tags, telephone, valid_code, access_secret, 
+    website, invite_time
+  </sql>
+  <sql id="Table_Base_Column_List">
+    t_enterprise.id, t_enterprise.spaceuu, t_enterprise.adminuu, t_enterprise.bank, t_enterprise.bank_account, 
+    t_enterprise.business_code, t_enterprise.business_code_image, t_enterprise.company_address, 
+    t_enterprise.company_city, t_enterprise.company_country, t_enterprise.company_province, 
+    t_enterprise.corporation, t_enterprise.invite_space_uu, t_enterprise.invite_user_uu, 
+    t_enterprise.main_business, t_enterprise.profession, t_enterprise.space_name, t_enterprise.tags, 
+    t_enterprise.telephone, t_enterprise.valid_code, t_enterprise.access_secret, t_enterprise.website, 
+    t_enterprise.invite_time
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_enterprise
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_enterprise
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoft.sso.dal.entity.Enterprise">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into t_enterprise (spaceuu, adminuu, bank, 
+      bank_account, business_code, business_code_image, 
+      company_address, company_city, company_country, 
+      company_province, corporation, invite_space_uu, 
+      invite_user_uu, main_business, profession, 
+      space_name, tags, telephone, 
+      valid_code, access_secret, website, 
+      invite_time)
+    values (#{spaceuu,jdbcType=BIGINT}, #{adminuu,jdbcType=BIGINT}, #{bank,jdbcType=VARCHAR}, 
+      #{bankAccount,jdbcType=VARCHAR}, #{businessCode,jdbcType=VARCHAR}, #{businessCodeImage,jdbcType=VARCHAR}, 
+      #{companyAddress,jdbcType=VARCHAR}, #{companyCity,jdbcType=VARCHAR}, #{companyCountry,jdbcType=VARCHAR}, 
+      #{companyProvince,jdbcType=VARCHAR}, #{corporation,jdbcType=VARCHAR}, #{inviteSpaceUu,jdbcType=BIGINT}, 
+      #{inviteUserUu,jdbcType=BIGINT}, #{mainBusiness,jdbcType=VARCHAR}, #{profession,jdbcType=VARCHAR}, 
+      #{spaceName,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{telephone,jdbcType=VARCHAR}, 
+      #{validCode,jdbcType=SMALLINT}, #{accessSecret,jdbcType=VARCHAR}, #{website,jdbcType=VARCHAR}, 
+      #{inviteTime,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoft.sso.dal.entity.Enterprise">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into t_enterprise
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="spaceuu != null">
+        spaceuu,
+      </if>
+      <if test="adminuu != null">
+        adminuu,
+      </if>
+      <if test="bank != null">
+        bank,
+      </if>
+      <if test="bankAccount != null">
+        bank_account,
+      </if>
+      <if test="businessCode != null">
+        business_code,
+      </if>
+      <if test="businessCodeImage != null">
+        business_code_image,
+      </if>
+      <if test="companyAddress != null">
+        company_address,
+      </if>
+      <if test="companyCity != null">
+        company_city,
+      </if>
+      <if test="companyCountry != null">
+        company_country,
+      </if>
+      <if test="companyProvince != null">
+        company_province,
+      </if>
+      <if test="corporation != null">
+        corporation,
+      </if>
+      <if test="inviteSpaceUu != null">
+        invite_space_uu,
+      </if>
+      <if test="inviteUserUu != null">
+        invite_user_uu,
+      </if>
+      <if test="mainBusiness != null">
+        main_business,
+      </if>
+      <if test="profession != null">
+        profession,
+      </if>
+      <if test="spaceName != null">
+        space_name,
+      </if>
+      <if test="tags != null">
+        tags,
+      </if>
+      <if test="telephone != null">
+        telephone,
+      </if>
+      <if test="validCode != null">
+        valid_code,
+      </if>
+      <if test="accessSecret != null">
+        access_secret,
+      </if>
+      <if test="website != null">
+        website,
+      </if>
+      <if test="inviteTime != null">
+        invite_time,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="spaceuu != null">
+        #{spaceuu,jdbcType=BIGINT},
+      </if>
+      <if test="adminuu != null">
+        #{adminuu,jdbcType=BIGINT},
+      </if>
+      <if test="bank != null">
+        #{bank,jdbcType=VARCHAR},
+      </if>
+      <if test="bankAccount != null">
+        #{bankAccount,jdbcType=VARCHAR},
+      </if>
+      <if test="businessCode != null">
+        #{businessCode,jdbcType=VARCHAR},
+      </if>
+      <if test="businessCodeImage != null">
+        #{businessCodeImage,jdbcType=VARCHAR},
+      </if>
+      <if test="companyAddress != null">
+        #{companyAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="companyCity != null">
+        #{companyCity,jdbcType=VARCHAR},
+      </if>
+      <if test="companyCountry != null">
+        #{companyCountry,jdbcType=VARCHAR},
+      </if>
+      <if test="companyProvince != null">
+        #{companyProvince,jdbcType=VARCHAR},
+      </if>
+      <if test="corporation != null">
+        #{corporation,jdbcType=VARCHAR},
+      </if>
+      <if test="inviteSpaceUu != null">
+        #{inviteSpaceUu,jdbcType=BIGINT},
+      </if>
+      <if test="inviteUserUu != null">
+        #{inviteUserUu,jdbcType=BIGINT},
+      </if>
+      <if test="mainBusiness != null">
+        #{mainBusiness,jdbcType=VARCHAR},
+      </if>
+      <if test="profession != null">
+        #{profession,jdbcType=VARCHAR},
+      </if>
+      <if test="spaceName != null">
+        #{spaceName,jdbcType=VARCHAR},
+      </if>
+      <if test="tags != null">
+        #{tags,jdbcType=VARCHAR},
+      </if>
+      <if test="telephone != null">
+        #{telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="validCode != null">
+        #{validCode,jdbcType=SMALLINT},
+      </if>
+      <if test="accessSecret != null">
+        #{accessSecret,jdbcType=VARCHAR},
+      </if>
+      <if test="website != null">
+        #{website,jdbcType=VARCHAR},
+      </if>
+      <if test="inviteTime != null">
+        #{inviteTime,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.sso.dal.entity.Enterprise">
+    update t_enterprise
+    <set>
+      <if test="spaceuu != null">
+        spaceuu = #{spaceuu,jdbcType=BIGINT},
+      </if>
+      <if test="adminuu != null">
+        adminuu = #{adminuu,jdbcType=BIGINT},
+      </if>
+      <if test="bank != null">
+        bank = #{bank,jdbcType=VARCHAR},
+      </if>
+      <if test="bankAccount != null">
+        bank_account = #{bankAccount,jdbcType=VARCHAR},
+      </if>
+      <if test="businessCode != null">
+        business_code = #{businessCode,jdbcType=VARCHAR},
+      </if>
+      <if test="businessCodeImage != null">
+        business_code_image = #{businessCodeImage,jdbcType=VARCHAR},
+      </if>
+      <if test="companyAddress != null">
+        company_address = #{companyAddress,jdbcType=VARCHAR},
+      </if>
+      <if test="companyCity != null">
+        company_city = #{companyCity,jdbcType=VARCHAR},
+      </if>
+      <if test="companyCountry != null">
+        company_country = #{companyCountry,jdbcType=VARCHAR},
+      </if>
+      <if test="companyProvince != null">
+        company_province = #{companyProvince,jdbcType=VARCHAR},
+      </if>
+      <if test="corporation != null">
+        corporation = #{corporation,jdbcType=VARCHAR},
+      </if>
+      <if test="inviteSpaceUu != null">
+        invite_space_uu = #{inviteSpaceUu,jdbcType=BIGINT},
+      </if>
+      <if test="inviteUserUu != null">
+        invite_user_uu = #{inviteUserUu,jdbcType=BIGINT},
+      </if>
+      <if test="mainBusiness != null">
+        main_business = #{mainBusiness,jdbcType=VARCHAR},
+      </if>
+      <if test="profession != null">
+        profession = #{profession,jdbcType=VARCHAR},
+      </if>
+      <if test="spaceName != null">
+        space_name = #{spaceName,jdbcType=VARCHAR},
+      </if>
+      <if test="tags != null">
+        tags = #{tags,jdbcType=VARCHAR},
+      </if>
+      <if test="telephone != null">
+        telephone = #{telephone,jdbcType=VARCHAR},
+      </if>
+      <if test="validCode != null">
+        valid_code = #{validCode,jdbcType=SMALLINT},
+      </if>
+      <if test="accessSecret != null">
+        access_secret = #{accessSecret,jdbcType=VARCHAR},
+      </if>
+      <if test="website != null">
+        website = #{website,jdbcType=VARCHAR},
+      </if>
+      <if test="inviteTime != null">
+        invite_time = #{inviteTime,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoft.sso.dal.entity.Enterprise">
+    update t_enterprise
+    set spaceuu = #{spaceuu,jdbcType=BIGINT},
+      adminuu = #{adminuu,jdbcType=BIGINT},
+      bank = #{bank,jdbcType=VARCHAR},
+      bank_account = #{bankAccount,jdbcType=VARCHAR},
+      business_code = #{businessCode,jdbcType=VARCHAR},
+      business_code_image = #{businessCodeImage,jdbcType=VARCHAR},
+      company_address = #{companyAddress,jdbcType=VARCHAR},
+      company_city = #{companyCity,jdbcType=VARCHAR},
+      company_country = #{companyCountry,jdbcType=VARCHAR},
+      company_province = #{companyProvince,jdbcType=VARCHAR},
+      corporation = #{corporation,jdbcType=VARCHAR},
+      invite_space_uu = #{inviteSpaceUu,jdbcType=BIGINT},
+      invite_user_uu = #{inviteUserUu,jdbcType=BIGINT},
+      main_business = #{mainBusiness,jdbcType=VARCHAR},
+      profession = #{profession,jdbcType=VARCHAR},
+      space_name = #{spaceName,jdbcType=VARCHAR},
+      tags = #{tags,jdbcType=VARCHAR},
+      telephone = #{telephone,jdbcType=VARCHAR},
+      valid_code = #{validCode,jdbcType=SMALLINT},
+      access_secret = #{accessSecret,jdbcType=VARCHAR},
+      website = #{website,jdbcType=VARCHAR},
+      invite_time = #{inviteTime,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 25 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserEnterpriseExtMapper.xml

@@ -0,0 +1,25 @@
+<?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="com.usoft.sso.dal.mapper.UserEnterpriseMapper">
+
+    <insert id="bindUserEnterpries" parameterType="java.lang.Long">
+        insert into t_user_enterprise (useruu, spaceuu)
+        values (#{arg0,jdbcType=BIGINT},#{arg1,jdbcType=BIGINT})
+    </insert>
+    <delete id="deleteByUseruuSpaceuu" parameterType="java.lang.Long">
+        delete from t_user_enterprise
+        where useruu = #{arg0,jdbcType=BIGINT} and spaceuu = #{arg1,jdbcType=BIGINT}
+    </delete>
+    <select id="selectSpaceuuByUseruu" parameterType="java.lang.Long" resultType="java.lang.Long">
+        select
+        spaceuu
+        from t_user_enterprise
+        where useruu = #{useruu,jdbcType=BIGINT}
+    </select>
+    <select id="selectByUseruuSpaceuu" parameterType="java.lang.Long" resultMap="BaseResultMap">
+        select
+        <include refid="Base_Column_List" />
+        from t_user_enterprise
+        where useruu = #{arg0,jdbcType=BIGINT} and spaceuu = #{arg1,jdbcType=BIGINT}
+    </select>
+</mapper>

+ 72 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserEnterpriseMapper.xml

@@ -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="com.usoft.sso.dal.mapper.UserEnterpriseMapper">
+  <resultMap id="BaseResultMap" type="com.usoft.sso.dal.entity.UserEnterprise">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="spaceuu" jdbcType="BIGINT" property="spaceuu" />
+    <result column="useruu" jdbcType="BIGINT" property="useruu" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, spaceuu, useruu
+  </sql>
+  <sql id="Table_Base_Column_List">
+    t_user_enterprise.id, t_user_enterprise.spaceuu, t_user_enterprise.useruu
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_user_enterprise
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_user_enterprise
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoft.sso.dal.entity.UserEnterprise">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into t_user_enterprise (spaceuu, useruu)
+    values (#{spaceuu,jdbcType=BIGINT}, #{useruu,jdbcType=BIGINT})
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoft.sso.dal.entity.UserEnterprise">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into t_user_enterprise
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="spaceuu != null">
+        spaceuu,
+      </if>
+      <if test="useruu != null">
+        useruu,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="spaceuu != null">
+        #{spaceuu,jdbcType=BIGINT},
+      </if>
+      <if test="useruu != null">
+        #{useruu,jdbcType=BIGINT},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.sso.dal.entity.UserEnterprise">
+    update t_user_enterprise
+    <set>
+      <if test="spaceuu != null">
+        spaceuu = #{spaceuu,jdbcType=BIGINT},
+      </if>
+      <if test="useruu != null">
+        useruu = #{useruu,jdbcType=BIGINT},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoft.sso.dal.entity.UserEnterprise">
+    update t_user_enterprise
+    set spaceuu = #{spaceuu,jdbcType=BIGINT},
+      useruu = #{useruu,jdbcType=BIGINT}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 84 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserExtMapper.xml

@@ -0,0 +1,84 @@
+<?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="com.usoft.sso.dal.mapper.UserMapper">
+  <select id="selectByUseruu" parameterType="java.lang.Long" resultMap="BaseResultMap">
+    select
+    <include refid="Base_Column_List" />
+    from t_user
+    where useruu = #{useruu,jdbcType=BIGINT}
+  </select>
+  <update id="updateByUseruuKeySelective" parameterType="com.usoft.sso.dal.entity.User">
+    update t_user
+    <set>
+      <if test="userCity != null">
+        user_city = #{userCity,jdbcType=VARCHAR},
+      </if>
+      <if test="userCountry != null">
+        user_country = #{userCountry,jdbcType=VARCHAR},
+      </if>
+      <if test="userEmail != null">
+        user_email = #{userEmail,jdbcType=VARCHAR},
+      </if>
+      <if test="emailValidCode != null">
+        email_valid_code = #{emailValidCode,jdbcType=BIT},
+      </if>
+      <if test="firstName != null">
+        first_name = #{firstName,jdbcType=VARCHAR},
+      </if>
+      <if test="idCard != null">
+        id_card = #{idCard,jdbcType=VARCHAR},
+      </if>
+      <if test="identityValidCode != null">
+        identity_valid_code = #{identityValidCode,jdbcType=BIT},
+      </if>
+      <if test="lastName != null">
+        last_name = #{lastName,jdbcType=VARCHAR},
+      </if>
+      <if test="mobile != null">
+        mobile = #{mobile,jdbcType=VARCHAR},
+      </if>
+      <if test="mobileValidCode != null">
+        mobile_valid_code = #{mobileValidCode,jdbcType=BIT},
+      </if>
+      <if test="password != null">
+        _password = #{password,jdbcType=VARCHAR},
+      </if>
+      <if test="userProvince != null">
+        user_province = #{userProvince,jdbcType=VARCHAR},
+      </if>
+      <if test="qqNumber != null">
+        qq_number = #{qqNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="realName != null">
+        real_name = #{realName,jdbcType=VARCHAR},
+      </if>
+      <if test="salt != null">
+        salt = #{salt,jdbcType=VARCHAR},
+      </if>
+      <if test="vipName != null">
+        vip_name = #{vipName,jdbcType=VARCHAR},
+      </if>
+      <if test="imId != null">
+        im_id = #{imId,jdbcType=VARCHAR},
+      </if>
+      <if test="passwordLevel != null">
+        password_level = #{passwordLevel,jdbcType=INTEGER},
+      </if>
+      <if test="birthday != null">
+        birthday = #{birthday,jdbcType=VARCHAR},
+      </if>
+      <if test="sex != null">
+        sex = #{sex,jdbcType=VARCHAR},
+      </if>
+      <if test="wxUnionid != null">
+        wx_unionid = #{wxUnionid,jdbcType=VARCHAR},
+      </if>
+      <if test="bhOpenid != null">
+        bh_openid = #{bhOpenid,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where useruu = #{useruu,jdbcType=BIGINT}
+  </update>
+
+
+</mapper>

+ 337 - 0
usoft-sso-dal/src/main/java/com/usoft/sso/dal/xml/UserMapper.xml

@@ -0,0 +1,337 @@
+<?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="com.usoft.sso.dal.mapper.UserMapper">
+  <resultMap id="BaseResultMap" type="com.usoft.sso.dal.entity.User">
+    <id column="id" jdbcType="INTEGER" property="id" />
+    <result column="useruu" jdbcType="BIGINT" property="useruu" />
+    <result column="user_image" jdbcType="VARCHAR" property="userImage" />
+    <result column="user_city" jdbcType="VARCHAR" property="userCity" />
+    <result column="user_country" jdbcType="VARCHAR" property="userCountry" />
+    <result column="user_email" jdbcType="VARCHAR" property="userEmail" />
+    <result column="email_valid_code" jdbcType="SMALLINT" property="emailValidCode" />
+    <result column="first_name" jdbcType="VARCHAR" property="firstName" />
+    <result column="id_card" jdbcType="VARCHAR" property="idCard" />
+    <result column="identity_valid_code" jdbcType="SMALLINT" property="identityValidCode" />
+    <result column="last_name" jdbcType="VARCHAR" property="lastName" />
+    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
+    <result column="mobile_valid_code" jdbcType="SMALLINT" property="mobileValidCode" />
+    <result column="_password" jdbcType="VARCHAR" property="password" />
+    <result column="user_province" jdbcType="VARCHAR" property="userProvince" />
+    <result column="qq_number" jdbcType="VARCHAR" property="qqNumber" />
+    <result column="real_name" jdbcType="VARCHAR" property="realName" />
+    <result column="salt" jdbcType="VARCHAR" property="salt" />
+    <result column="vip_name" jdbcType="VARCHAR" property="vipName" />
+    <result column="im_id" jdbcType="VARCHAR" property="imId" />
+    <result column="password_level" jdbcType="INTEGER" property="passwordLevel" />
+    <result column="birthday" jdbcType="VARCHAR" property="birthday" />
+    <result column="sex" jdbcType="VARCHAR" property="sex" />
+    <result column="wx_unionid" jdbcType="VARCHAR" property="wxUnionid" />
+    <result column="bh_openid" jdbcType="VARCHAR" property="bhOpenid" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    id, useruu, user_image, user_city, user_country, user_email, email_valid_code, first_name, 
+    id_card, identity_valid_code, last_name, mobile, mobile_valid_code, _password, user_province, 
+    qq_number, real_name, salt, vip_name, im_id, password_level, birthday, sex, wx_unionid, 
+    bh_openid
+  </sql>
+  <sql id="Table_Base_Column_List">
+    t_user.id, t_user.useruu, t_user.user_image, t_user.user_city, t_user.user_country, 
+    t_user.user_email, t_user.email_valid_code, t_user.first_name, t_user.id_card, t_user.identity_valid_code, 
+    t_user.last_name, t_user.mobile, t_user.mobile_valid_code, t_user._password, t_user.user_province, 
+    t_user.qq_number, t_user.real_name, t_user.salt, t_user.vip_name, t_user.im_id, t_user.password_level, 
+    t_user.birthday, t_user.sex, t_user.wx_unionid, t_user.bh_openid
+  </sql>
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
+    select 
+    <include refid="Base_Column_List" />
+    from t_user
+    where id = #{id,jdbcType=INTEGER}
+  </select>
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
+    delete from t_user
+    where id = #{id,jdbcType=INTEGER}
+  </delete>
+  <insert id="insert" parameterType="com.usoft.sso.dal.entity.User">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into t_user (useruu, user_image, user_city, 
+      user_country, user_email, email_valid_code, 
+      first_name, id_card, identity_valid_code, 
+      last_name, mobile, mobile_valid_code, 
+      _password, user_province, qq_number, 
+      real_name, salt, vip_name, 
+      im_id, password_level, birthday, 
+      sex, wx_unionid, bh_openid
+      )
+    values (#{useruu,jdbcType=BIGINT}, #{userImage,jdbcType=VARCHAR}, #{userCity,jdbcType=VARCHAR}, 
+      #{userCountry,jdbcType=VARCHAR}, #{userEmail,jdbcType=VARCHAR}, #{emailValidCode,jdbcType=SMALLINT}, 
+      #{firstName,jdbcType=VARCHAR}, #{idCard,jdbcType=VARCHAR}, #{identityValidCode,jdbcType=SMALLINT}, 
+      #{lastName,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{mobileValidCode,jdbcType=SMALLINT}, 
+      #{password,jdbcType=VARCHAR}, #{userProvince,jdbcType=VARCHAR}, #{qqNumber,jdbcType=VARCHAR}, 
+      #{realName,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR}, #{vipName,jdbcType=VARCHAR}, 
+      #{imId,jdbcType=VARCHAR}, #{passwordLevel,jdbcType=INTEGER}, #{birthday,jdbcType=VARCHAR}, 
+      #{sex,jdbcType=VARCHAR}, #{wxUnionid,jdbcType=VARCHAR}, #{bhOpenid,jdbcType=VARCHAR}
+      )
+  </insert>
+  <insert id="insertSelective" parameterType="com.usoft.sso.dal.entity.User">
+    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
+      SELECT LAST_INSERT_ID()
+    </selectKey>
+    insert into t_user
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="useruu != null">
+        useruu,
+      </if>
+      <if test="userImage != null">
+        user_image,
+      </if>
+      <if test="userCity != null">
+        user_city,
+      </if>
+      <if test="userCountry != null">
+        user_country,
+      </if>
+      <if test="userEmail != null">
+        user_email,
+      </if>
+      <if test="emailValidCode != null">
+        email_valid_code,
+      </if>
+      <if test="firstName != null">
+        first_name,
+      </if>
+      <if test="idCard != null">
+        id_card,
+      </if>
+      <if test="identityValidCode != null">
+        identity_valid_code,
+      </if>
+      <if test="lastName != null">
+        last_name,
+      </if>
+      <if test="mobile != null">
+        mobile,
+      </if>
+      <if test="mobileValidCode != null">
+        mobile_valid_code,
+      </if>
+      <if test="password != null">
+        _password,
+      </if>
+      <if test="userProvince != null">
+        user_province,
+      </if>
+      <if test="qqNumber != null">
+        qq_number,
+      </if>
+      <if test="realName != null">
+        real_name,
+      </if>
+      <if test="salt != null">
+        salt,
+      </if>
+      <if test="vipName != null">
+        vip_name,
+      </if>
+      <if test="imId != null">
+        im_id,
+      </if>
+      <if test="passwordLevel != null">
+        password_level,
+      </if>
+      <if test="birthday != null">
+        birthday,
+      </if>
+      <if test="sex != null">
+        sex,
+      </if>
+      <if test="wxUnionid != null">
+        wx_unionid,
+      </if>
+      <if test="bhOpenid != null">
+        bh_openid,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="useruu != null">
+        #{useruu,jdbcType=BIGINT},
+      </if>
+      <if test="userImage != null">
+        #{userImage,jdbcType=VARCHAR},
+      </if>
+      <if test="userCity != null">
+        #{userCity,jdbcType=VARCHAR},
+      </if>
+      <if test="userCountry != null">
+        #{userCountry,jdbcType=VARCHAR},
+      </if>
+      <if test="userEmail != null">
+        #{userEmail,jdbcType=VARCHAR},
+      </if>
+      <if test="emailValidCode != null">
+        #{emailValidCode,jdbcType=SMALLINT},
+      </if>
+      <if test="firstName != null">
+        #{firstName,jdbcType=VARCHAR},
+      </if>
+      <if test="idCard != null">
+        #{idCard,jdbcType=VARCHAR},
+      </if>
+      <if test="identityValidCode != null">
+        #{identityValidCode,jdbcType=SMALLINT},
+      </if>
+      <if test="lastName != null">
+        #{lastName,jdbcType=VARCHAR},
+      </if>
+      <if test="mobile != null">
+        #{mobile,jdbcType=VARCHAR},
+      </if>
+      <if test="mobileValidCode != null">
+        #{mobileValidCode,jdbcType=SMALLINT},
+      </if>
+      <if test="password != null">
+        #{password,jdbcType=VARCHAR},
+      </if>
+      <if test="userProvince != null">
+        #{userProvince,jdbcType=VARCHAR},
+      </if>
+      <if test="qqNumber != null">
+        #{qqNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="realName != null">
+        #{realName,jdbcType=VARCHAR},
+      </if>
+      <if test="salt != null">
+        #{salt,jdbcType=VARCHAR},
+      </if>
+      <if test="vipName != null">
+        #{vipName,jdbcType=VARCHAR},
+      </if>
+      <if test="imId != null">
+        #{imId,jdbcType=VARCHAR},
+      </if>
+      <if test="passwordLevel != null">
+        #{passwordLevel,jdbcType=INTEGER},
+      </if>
+      <if test="birthday != null">
+        #{birthday,jdbcType=VARCHAR},
+      </if>
+      <if test="sex != null">
+        #{sex,jdbcType=VARCHAR},
+      </if>
+      <if test="wxUnionid != null">
+        #{wxUnionid,jdbcType=VARCHAR},
+      </if>
+      <if test="bhOpenid != null">
+        #{bhOpenid,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.sso.dal.entity.User">
+    update t_user
+    <set>
+      <if test="useruu != null">
+        useruu = #{useruu,jdbcType=BIGINT},
+      </if>
+      <if test="userImage != null">
+        user_image = #{userImage,jdbcType=VARCHAR},
+      </if>
+      <if test="userCity != null">
+        user_city = #{userCity,jdbcType=VARCHAR},
+      </if>
+      <if test="userCountry != null">
+        user_country = #{userCountry,jdbcType=VARCHAR},
+      </if>
+      <if test="userEmail != null">
+        user_email = #{userEmail,jdbcType=VARCHAR},
+      </if>
+      <if test="emailValidCode != null">
+        email_valid_code = #{emailValidCode,jdbcType=SMALLINT},
+      </if>
+      <if test="firstName != null">
+        first_name = #{firstName,jdbcType=VARCHAR},
+      </if>
+      <if test="idCard != null">
+        id_card = #{idCard,jdbcType=VARCHAR},
+      </if>
+      <if test="identityValidCode != null">
+        identity_valid_code = #{identityValidCode,jdbcType=SMALLINT},
+      </if>
+      <if test="lastName != null">
+        last_name = #{lastName,jdbcType=VARCHAR},
+      </if>
+      <if test="mobile != null">
+        mobile = #{mobile,jdbcType=VARCHAR},
+      </if>
+      <if test="mobileValidCode != null">
+        mobile_valid_code = #{mobileValidCode,jdbcType=SMALLINT},
+      </if>
+      <if test="password != null">
+        _password = #{password,jdbcType=VARCHAR},
+      </if>
+      <if test="userProvince != null">
+        user_province = #{userProvince,jdbcType=VARCHAR},
+      </if>
+      <if test="qqNumber != null">
+        qq_number = #{qqNumber,jdbcType=VARCHAR},
+      </if>
+      <if test="realName != null">
+        real_name = #{realName,jdbcType=VARCHAR},
+      </if>
+      <if test="salt != null">
+        salt = #{salt,jdbcType=VARCHAR},
+      </if>
+      <if test="vipName != null">
+        vip_name = #{vipName,jdbcType=VARCHAR},
+      </if>
+      <if test="imId != null">
+        im_id = #{imId,jdbcType=VARCHAR},
+      </if>
+      <if test="passwordLevel != null">
+        password_level = #{passwordLevel,jdbcType=INTEGER},
+      </if>
+      <if test="birthday != null">
+        birthday = #{birthday,jdbcType=VARCHAR},
+      </if>
+      <if test="sex != null">
+        sex = #{sex,jdbcType=VARCHAR},
+      </if>
+      <if test="wxUnionid != null">
+        wx_unionid = #{wxUnionid,jdbcType=VARCHAR},
+      </if>
+      <if test="bhOpenid != null">
+        bh_openid = #{bhOpenid,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+  <update id="updateByPrimaryKey" parameterType="com.usoft.sso.dal.entity.User">
+    update t_user
+    set useruu = #{useruu,jdbcType=BIGINT},
+      user_image = #{userImage,jdbcType=VARCHAR},
+      user_city = #{userCity,jdbcType=VARCHAR},
+      user_country = #{userCountry,jdbcType=VARCHAR},
+      user_email = #{userEmail,jdbcType=VARCHAR},
+      email_valid_code = #{emailValidCode,jdbcType=SMALLINT},
+      first_name = #{firstName,jdbcType=VARCHAR},
+      id_card = #{idCard,jdbcType=VARCHAR},
+      identity_valid_code = #{identityValidCode,jdbcType=SMALLINT},
+      last_name = #{lastName,jdbcType=VARCHAR},
+      mobile = #{mobile,jdbcType=VARCHAR},
+      mobile_valid_code = #{mobileValidCode,jdbcType=SMALLINT},
+      _password = #{password,jdbcType=VARCHAR},
+      user_province = #{userProvince,jdbcType=VARCHAR},
+      qq_number = #{qqNumber,jdbcType=VARCHAR},
+      real_name = #{realName,jdbcType=VARCHAR},
+      salt = #{salt,jdbcType=VARCHAR},
+      vip_name = #{vipName,jdbcType=VARCHAR},
+      im_id = #{imId,jdbcType=VARCHAR},
+      password_level = #{passwordLevel,jdbcType=INTEGER},
+      birthday = #{birthday,jdbcType=VARCHAR},
+      sex = #{sex,jdbcType=VARCHAR},
+      wx_unionid = #{wxUnionid,jdbcType=VARCHAR},
+      bh_openid = #{bhOpenid,jdbcType=VARCHAR}
+    where id = #{id,jdbcType=INTEGER}
+  </update>
+</mapper>

+ 74 - 0
usoft-sso-dal/src/main/resources/generatorConfig.xml

@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE generatorConfiguration
+        PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
+        "http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
+
+<generatorConfiguration>
+    <!-- 配置mysql 驱动jar包路径.用了相对路径 -->
+    <classPathEntry location="./mybatis_generate/mysql-connector-java-6.0.6.jar"/>
+
+    <context id="usoft_mysql_tables">
+        <plugin type="com.usoft.mybatis.utils.plugin.SelectByCodePlugin"/>
+        <plugin type="com.usoft.mybatis.utils.plugin.TableBaseColumnListPlugin"/>
+
+        <commentGenerator type="com.usoft.mybatis.utils.MybatisCommentGenerator">
+            <!-- 定义是否生成原生注释,我们这里自定义了,所以选择false -->
+            <property name="suppressAllComments" value="false"/>
+            <!-- This property is used to specify whether MBG will include the generation timestamp in the generated comments -->
+            <property name="suppressDate" value="true"/>
+        </commentGenerator>
+
+        <!-- 数据库连接 -->
+        <jdbcConnection driverClass="com.mysql.cj.jdbc.Driver"
+                        connectionURL="jdbc:mysql://192.168.253.12:3306/usoft_sso?useUnicode=true&amp;useSSL=false&amp;characterEncoding=UTF-8&amp;nullCatalogMeansCurrent=true&amp;useInformationSchema=true&amp;serverTimezone=GMT%2B8"
+                        userId="root"
+                        password="select111***">
+        </jdbcConnection>
+
+        <javaTypeResolver>
+            <property name="forceBigDecimals" value="false"/>
+        </javaTypeResolver>
+
+        <!-- 数据表对应的model层  -->
+        <javaModelGenerator targetPackage="com.usoft.sso.dal.entity" targetProject="mybatis_generate">
+            <property name="enableSubPackages" value="true"/>
+            <property name="trimStrings" value="true"/>
+        </javaModelGenerator>
+
+        <!-- sql mapper 映射配置文件 -->
+        <sqlMapGenerator targetPackage="com.usoft.sso.dal.xml" targetProject="mybatis_generate">
+            <property name="enableSubPackages" value="true"/>
+        </sqlMapGenerator>
+
+        <!-- mybatis3中的mapper接口 -->
+        <javaClientGenerator type="XMLMAPPER" targetPackage="com.usoft.sso.dal.mapper"
+                             targetProject="mybatis_generate">
+            <property name="enableSubPackages" value="true"/>
+        </javaClientGenerator>
+
+        <table tableName="t_user" domainObjectName="User"
+               enableCountByExample="false" enableUpdateByExample="false"
+               enableDeleteByExample="false" enableSelectByExample="false"
+               selectByExampleQueryId="false">
+            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
+            <ignoreColumn column="create_time"/>
+            <ignoreColumn column="update_time"/>
+        </table>
+        <table tableName="t_enterprise" domainObjectName="Enterprise"
+               enableCountByExample="false" enableUpdateByExample="false"
+               enableDeleteByExample="false" enableSelectByExample="false"
+               selectByExampleQueryId="false">
+            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
+            <ignoreColumn column="create_time"/>
+            <ignoreColumn column="update_time"/>
+        </table>
+        <table tableName="t_user_enterprise" domainObjectName="UserEnterprise"
+               enableCountByExample="false" enableUpdateByExample="false"
+               enableDeleteByExample="false" enableSelectByExample="false"
+               selectByExampleQueryId="false">
+            <generatedKey column="id" sqlStatement="MySql" identity="true"/>
+            <ignoreColumn column="create_time"/>
+            <ignoreColumn column="update_time"/>
+        </table>
+    </context>
+</generatorConfiguration>

+ 86 - 0
usoft-sso-grpc-api/pom.xml

@@ -0,0 +1,86 @@
+<?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>usoft-sso-grpc-parent</artifactId>
+        <groupId>com.usoft.sso</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>usoft-sso-grpc-api</artifactId>
+    <packaging>jar</packaging>
+    <version>${spring.active.profile}-SNAPSHOT</version>
+    <dependencies>
+        <dependency>
+            <groupId>io.grpc</groupId>
+            <artifactId>grpc-all</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <extensions>
+            <extension>
+                <groupId>kr.motd.maven</groupId>
+                <artifactId>os-maven-plugin</artifactId>
+                <version>1.5.0.Final</version>
+            </extension>
+        </extensions>
+        <plugins>
+            <plugin>
+                <groupId>org.xolstice.maven.plugins</groupId>
+                <artifactId>protobuf-maven-plugin</artifactId>
+                <version>0.5.1</version>
+                <configuration>
+                    <protocArtifact>com.google.protobuf:protoc:3.4.0:exe:${os.detected.classifier}
+                    </protocArtifact>
+                    <pluginId>grpc-java</pluginId>
+                    <pluginArtifact>
+                        io.grpc:protoc-gen-grpc-java:${protoc-gen-grpc-java.version}:exe:${os.detected.classifier}
+                    </pluginArtifact>
+                </configuration>
+                <extensions>true</extensions>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>compile</goal>
+                            <goal>compile-custom</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.8</source>
+                    <target>1.8</target>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-source-plugin</artifactId>
+                <version>3.0.1</version>
+                <executions>
+                    <execution>
+                        <id>attach-sources</id>
+                        <phase>verify</phase>
+                        <goals>
+                            <goal>jar-no-fork</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.12.4</version>
+                <configuration>
+                    <!-- 设置打包过程中不编译单元测试代码 TEST -->
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 82 - 0
usoft-sso-grpc-api/src/main/proto/SSOGrpcEntity.proto

@@ -0,0 +1,82 @@
+syntax = "proto3";
+
+package sso;
+option java_multiple_files = true;
+option java_package = "com.usoft.sso.grpc.api.entity";
+
+// 每次响应的头信息
+message ResponseHeader {
+    int32 code = 1; // 状态码 0.正常 非0.异常
+    string msg = 2; // 错误信息 code!=0时,有值
+}
+
+// 分页信息
+message PagingInfo {
+    int32 totalPage = 1; // 总页数
+    int32 totalCount = 2; // 总条数
+    int32 pageSize = 3; // 每页条数
+    int32 pageNumber = 4; // 当前页码
+}
+
+// 用户信息
+message UserInfo {
+    int32 id = 1; // 主键
+    int64 userUU = 2; // 用户UU号
+    string userImage =3; //头像
+    string userCity = 4; //城市
+    string userCountry = 5; //国家
+    string userEmail = 6; //邮箱
+    int32 emailValidCode = 7; //邮箱有效编码
+    string firstName = 8; //姓
+    string idCard = 9; //身份证号码
+    int32 identityValidCode = 10; //身份认证状态
+    string lastName = 11; //名
+    string mobile = 12; //  手机号
+    int32 mobileValidCode = 13; //手机认证状态
+    string Password = 14; // 密码
+    string userProvince = 15; //省份
+    string qqNumber = 16; //qq号码
+    string realName = 17; // 用户真实姓名
+    string salt = 18; //盐值
+    string vipName = 19; //  会员名
+    string imId = 20; // imid
+    int32 passwordLevel = 21; // 密码强度
+    string birthday = 22; //生日
+    string sex = 23; //  性别
+    string wxUnionid = 24; //微信unionid
+    string bhOpenid = 25; //碧合openid
+}
+
+//企业信息
+message Enterprise {
+    int32 id = 1; //主键
+    int64 spaceUU = 2; //企业UU号
+    int64 adminUU = 3; //管理员UU号
+    string bank = 4; // 银行
+    string bankAccount = 5; //银行账户
+    string businessCode = 6; // 营业执照号
+    string businessCodeImage = 7; //营业执照
+    string companyAddress = 8; //公司地址
+    string companyCity = 9; //公司所处城市
+    string companyCountry = 10; //公司所处国家
+    string companyProvince = 11; //公司所处省份
+    string corporation = 12; //法定代表人
+    int64 inviteSpaceUu = 13; //邀请企业UU号
+    int64 inviteUserUu = 14; //邀请人UU号
+    string mainBusiness = 15; //主营业务
+    string profession = 16; //行业
+    string spaceName = 17; //企业名称
+    string tags = 18; //经营范围
+    string telephone = 19; //联系电话
+    int32 validCode = 20; //企业认证状态
+    string accessSecret = 21; //企业秘钥
+    string website = 22; //ERP外网地址
+    string inviteTime = 23; //邀请时间
+}
+
+//用户和企业关联
+message user_enterprise {
+    int32 id = 1; //主键
+    int64 space_uu = 2; //企业UU
+    int64 user_uu = 3; //用户UU
+}

+ 76 - 0
usoft-sso-grpc-api/src/main/proto/SSOGrpcService.proto

@@ -0,0 +1,76 @@
+syntax = "proto3";
+import "SSOGrpcEntity.proto";
+package sso;
+option java_multiple_files = true;
+option java_package = "com.usoft.sso.grpc.api.protobuf";
+
+//用户信息
+service SSOGrpcService {
+    /********************用户信息*********************/
+    // 账户中心保存用户信息接口
+    rpc save (SaveUserInfoRequest) returns (SaveUserInfoResponse) {}
+    // 账户中心用户 绑定/解绑
+    rpc bindUser (BindUserInfoRequest) returns (BindUserInfoResponse) {}
+    // U融链查找用户信息
+    rpc selectUserInfo (SelectUserInfoRequest) returns (SelectUserInfoResponse) {}
+    /********************企业信息*********************/
+    // 企业信息保存+更换管理员同步信息接口
+    rpc update (UpdateEntInfoRequest) returns (UpdateEntInfoResponse) {}
+    // 查询企业信息
+    rpc selectEntInfo (SelectEntInfoRequest) returns (SelectEntInfoResponse) {}
+}
+
+// 账户中心保存用户信息接口 请求参数
+message SaveUserInfoRequest {
+    UserInfo userInfo = 1; //用户信息
+}
+// 账户中心保存用户信息接口 响应参数
+message SaveUserInfoResponse {
+    ResponseHeader responseHeader = 1;
+    string msg = 2;
+}
+//账户中心用户 绑定/解绑 请求参数
+message BindUserInfoRequest {
+    int64 userUU = 1; // 用户uu号
+    int64 spaceUU = 2; // 企业uu号
+    string type = 3; //  类型(bind为绑定,unbind为解绑)
+}
+//账户中心用户 绑定/解绑 响应参数
+message BindUserInfoResponse {
+    ResponseHeader responseHeader = 1;
+    string msg = 2;
+}
+//企业信息保存+更换管理员同步信息接口 请求参数
+message UpdateEntInfoRequest {
+    Enterprise enterprise = 1; // 企业信息
+    UserInfo user = 2; // 用户信息
+}
+//企业信息保存+更换管理员同步信息接口 响应参数
+message UpdateEntInfoResponse {
+    ResponseHeader responseHeader = 1;
+    string msg = 2;
+}
+
+message SelectUserInfoRequest {
+    int64 userUU = 1; //UU号
+    int64 spaceUU = 2; //企业uu号
+}
+
+message SelectUserInfoResponse {
+    ResponseHeader responseHeader = 1;
+    string msg = 2;
+    string vipName = 3; //  会员名
+    string spaceName = 4; //企业UU号
+    string userImage = 5; //头像
+    string mobile = 6; //  手机号
+}
+
+message SelectEntInfoRequest {
+    int64 spaceUU = 1; //企业UU号
+}
+
+message SelectEntInfoResponse {
+    ResponseHeader responseHeader = 1;
+    string msg = 2;
+    string accessSecret = 3; //企业秘钥
+}

+ 73 - 0
usoft-sso-grpc-service/pom.xml

@@ -0,0 +1,73 @@
+<?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>usoft-sso-grpc-parent</artifactId>
+        <groupId>com.usoft.sso</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>usoft-sso-grpc-service</artifactId>
+    <packaging>jar</packaging>
+    <dependencies>
+        <dependency>
+            <groupId>org.lognet</groupId>
+            <artifactId>grpc-spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.sso</groupId>
+            <artifactId>usoft-sso-bl</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.sso</groupId>
+            <artifactId>usoft-sso-grpc-api</artifactId>
+            <version>${spring.active.profile}-SNAPSHOT</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>usoft-sso-gprc-service</finalName>
+        <!-- 开启资源文件过滤  -->
+        <resources>
+            <resource>
+                <directory>${project.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+                <targetPath>${project.build.directory}/classes</targetPath>
+            </resource>
+        </resources>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>1.5.11.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <executable>true</executable>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <version>2.12.4</version>
+                <configuration>
+                    <!-- 设置打包过程中不编译单元测试代码 TEST -->
+                    <skipTests>true</skipTests>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

+ 25 - 0
usoft-sso-grpc-service/src/main/java/com/usoft/sso/grpc/SsoGrpcServiceStart.java

@@ -0,0 +1,25 @@
+package com.usoft.sso.grpc;
+
+import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+/**
+ * @author wangcanyi
+ * @description 产品库GRPC服务
+ * @date 2018/3/28
+ */
+@EnableTransactionManagement
+@SpringBootApplication(scanBasePackages = {"com.usoft.sso"})
+@MapperScan("com.usoft.sso.dal")
+public class SsoGrpcServiceStart {
+	public static void main(String[] args) throws Exception {
+		try {
+
+			SpringApplication.run(SsoGrpcServiceStart.class);
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+}

+ 152 - 0
usoft-sso-grpc-service/src/main/java/com/usoft/sso/grpc/service/impl/SSOServiceImpl.java

@@ -0,0 +1,152 @@
+package com.usoft.sso.grpc.service.impl;
+
+import com.usoft.protobuf.utils.ProtoBufUtil;
+import com.usoft.sso.common.ResponseUtil;
+import com.usoft.sso.exception.SSORuntimeException;
+import com.usoft.sso.grpc.api.entity.ResponseHeader;
+import com.usoft.sso.grpc.api.protobuf.*;
+import com.usoft.sso.grpc.bl.EnterpriseBl;
+import com.usoft.sso.grpc.bl.UserBl;
+import io.grpc.stub.StreamObserver;
+import org.lognet.springboot.grpc.GRpcService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.annotation.Resource;
+
+/**
+ * @author: wangcanyi
+ * @date: 2018-07-31 17:57
+ */
+@GRpcService
+public class SSOServiceImpl extends SSOGrpcServiceGrpc.SSOGrpcServiceImplBase {
+    private static final Logger LOGGER = LoggerFactory.getLogger(SSOServiceImpl.class);
+
+    @Resource
+    private UserBl userBL;
+
+    @Resource
+    private EnterpriseBl enterpriseBl;
+
+
+    /**
+     * 账户中心保存用户信息接口
+     *
+     * @param request
+     * @param responseObserver
+     */
+    @Override
+    public void save(SaveUserInfoRequest request, StreamObserver<SaveUserInfoResponse> responseObserver) {
+        SaveUserInfoResponse.Builder builder = SaveUserInfoResponse.newBuilder();
+        try {
+            builder = userBL.save(request);
+            LOGGER.info("保存或修改用户信息[SSOServiceImpl.save]正常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request));
+        } catch (SSORuntimeException e) {
+            LOGGER.warn("保存或修改用户信息[SSOServiceImpl.save]告警,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(e.getErrorCode(), e.getErrorMessage());
+            builder.setResponseHeader(responseHeader);
+        } catch (Exception e) {
+            LOGGER.error("保存或修改用户信息[SSOServiceImpl.save]异常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(SSORuntimeException.ERROR_CODE_100, e.getMessage());
+            builder.setResponseHeader(responseHeader);
+        }
+        responseObserver.onNext(builder.build());
+        responseObserver.onCompleted();
+    }
+
+    /**
+     * 账户中心用户 绑定/解绑
+     *
+     * @param request
+     * @param responseObserver
+     */
+    @Override
+    public void bindUser(BindUserInfoRequest request, StreamObserver<BindUserInfoResponse> responseObserver) {
+        BindUserInfoResponse.Builder builder = BindUserInfoResponse.newBuilder();
+        try {
+            builder = userBL.bindOrUnbind(request);
+            LOGGER.info("用户绑定/解绑[SSOServiceImpl.bindOrUnbind]正常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request));
+        } catch (SSORuntimeException e) {
+            LOGGER.warn("用户绑定/解绑[SSOServiceImpl.bindOrUnbind]告警,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(e.getErrorCode(), e.getErrorMessage());
+            builder.setResponseHeader(responseHeader);
+        } catch (Exception e) {
+            LOGGER.error("用户绑定/解绑[SSOServiceImpl.bindOrUnbind]异常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(SSORuntimeException.ERROR_CODE_100, e.getMessage());
+            builder.setResponseHeader(responseHeader);
+        }
+        responseObserver.onNext(builder.build());
+        responseObserver.onCompleted();
+    }
+
+    /**
+     * 企业信息保存+更换管理员同步信息接口
+     *
+     * @param request
+     * @param responseObserver
+     */
+    @Override
+    public void update(UpdateEntInfoRequest request, StreamObserver<UpdateEntInfoResponse> responseObserver) {
+        UpdateEntInfoResponse.Builder builder = UpdateEntInfoResponse.newBuilder();
+        try {
+            builder = enterpriseBl.updateEntInfo(request);
+            LOGGER.info("更新企业信息[SSOServiceImpl.update]正常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request));
+        } catch (SSORuntimeException e) {
+            LOGGER.warn("更新企业信息[SSOServiceImpl.update]告警,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(e.getErrorCode(), e.getErrorMessage());
+            builder.setResponseHeader(responseHeader);
+        } catch (Exception e) {
+            LOGGER.error("更新企业信息[SSOServiceImpl.update]异常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(SSORuntimeException.ERROR_CODE_100, e.getMessage());
+            builder.setResponseHeader(responseHeader);
+        }
+        responseObserver.onNext(builder.build());
+        responseObserver.onCompleted();
+    }
+
+    /**
+     * U融链查找用户信息
+     *
+     * @param request
+     * @param responseObserver
+     */
+    @Override
+    public void selectUserInfo(SelectUserInfoRequest request, StreamObserver<SelectUserInfoResponse> responseObserver) {
+        SelectUserInfoResponse.Builder builder = SelectUserInfoResponse.newBuilder();
+        try {
+            builder = userBL.selectUserInfo(request);
+            LOGGER.info("获取用户信息[SSOServiceImpl.selectUserInfo]正常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request));
+        } catch (SSORuntimeException e) {
+            LOGGER.warn("获取用户信息[SSOServiceImpl.selectUserInfo]告警,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(e.getErrorCode(), e.getErrorMessage());
+            builder.setResponseHeader(responseHeader);
+        } catch (Exception e) {
+            LOGGER.error("获取用户信息[SSOServiceImpl.selectUserInfo]异常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(SSORuntimeException.ERROR_CODE_100, e.getMessage());
+            builder.setResponseHeader(responseHeader);
+        }
+        responseObserver.onNext(builder.build());
+        responseObserver.onCompleted();
+
+    }
+
+    @Override
+    public void selectEntInfo(SelectEntInfoRequest request, StreamObserver<SelectEntInfoResponse> responseObserver) {
+        SelectEntInfoResponse.Builder builder = SelectEntInfoResponse.newBuilder();
+        try {
+            builder = enterpriseBl.selectEntInfo(request);
+            LOGGER.info("获取用户信息[SSOServiceImpl.selectEntInfo]正常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request));
+        } catch (SSORuntimeException e) {
+            LOGGER.warn("获取用户信息[SSOServiceImpl.selectEntInfo]告警,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(e.getErrorCode(), e.getErrorMessage());
+            builder.setResponseHeader(responseHeader);
+        } catch (Exception e) {
+            LOGGER.error("获取用户信息[SSOServiceImpl.selectEntInfo]异常,参数:{}", ProtoBufUtil.toJSONHasTryCatch(request), e);
+            ResponseHeader responseHeader = ResponseUtil.getResponseHeader(SSORuntimeException.ERROR_CODE_100, e.getMessage());
+            builder.setResponseHeader(responseHeader);
+        }
+        responseObserver.onNext(builder.build());
+        responseObserver.onCompleted();
+
+    }
+}

+ 12 - 0
usoft-sso-grpc-service/src/main/resources/application-dev.properties

@@ -0,0 +1,12 @@
+#postgresql 配置
+spring.datasource.url=jdbc:mysql://192.168.253.12:3306/usoft_sso?useUnicode=true&characterEncoding=UTF-8&useSSL=false
+spring.datasource.username=root
+spring.datasource.password=select111***
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
+
+#打印sql
+mybatis.configuration.log-prefix=dal.
+
+#Example GRPC 配置地址
+sso.grpc.host=192.168.253.3
+sso.grpc.port=28810

+ 2 - 0
usoft-sso-grpc-service/src/main/resources/application-prod.properties

@@ -0,0 +1,2 @@
+
+

+ 8 - 0
usoft-sso-grpc-service/src/main/resources/application-test.properties

@@ -0,0 +1,8 @@
+#postgresql 配置
+spring.datasource.url=jdbc:mysql://127.0.0.1:3306/testgrpc?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
+spring.datasource.username=root
+spring.datasource.password=123456
+spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
+
+#打印sql
+mybatis.configuration.log-prefix=dal.

+ 16 - 0
usoft-sso-grpc-service/src/main/resources/application.properties

@@ -0,0 +1,16 @@
+# 指定起作用的profile
+spring.profiles.active=${spring.active.profile}
+
+
+# 指定其作用的日志配置
+logging.config=classpath:logback-${spring.active.profile}.xml
+#GRPC启动端口
+grpc.port=28810
+
+#mybatis 配置
+mybatis.config-locations=classpath:mybatis-config.xml
+mybatis.mapper-locations[0]=classpath:com/usoft/sso/dal/xml/*.xml
+mybatis.type-aliases-package=com.usoft.sso.dal.mapper
+mybatis.configuration.map-underscore-to-camel-case=true
+
+############################ 公共配置 ###############################

+ 42 - 0
usoft-sso-grpc-service/src/main/resources/logback-dev.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- For assistance related to logback-translator or configuration  -->
+<!-- files in general, please contact the logback user mailing list -->
+<!-- at http://www.qos.ch/mailman/listinfo/logback-user             -->
+<!--                                                                -->
+<!-- For professional support please see                            -->
+<!--    http://www.qos.ch/shop/products/professionalSupport         -->
+<!--                                                                -->
+<!--
+  configuration 包含的属性
+  scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
+  scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。
+  debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
+ -->
+<configuration>
+
+    <!--appender负责将格式化后的输出发送到目的地 -->
+    <!-- 控制台输出日志 -->
+    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <!-- layout 负责根据用户意愿对记录请求进行格式化
+             1.第一个字段是自程序启动以来的逝去时间,单位是毫秒。
+             2.第二个字段发出记录请求的线程。
+             3.第三个字段是记录请求的级别。
+             4.第四个字段是与记录请求关联的logger的名称
+             “-”之后是请求的消息文字。
+             -->
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20}[%L] - %msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+
+    <!-- root与logger类似,它表示根logger,只有大于等于level级别的日志才交由appender处理,level默认为DEBUG -->
+    <root level="INFO">
+        <appender-ref ref="stdout" />
+    </root>
+
+    <!-- 开发环境 打印sql -->
+    <logger name="dal" level="DEBUG"/>
+
+</configuration>

+ 33 - 0
usoft-sso-grpc-service/src/main/resources/logback-product.xml

@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+    <!-- 文件输出指定项目日志 -->
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>/data/log/usoft/sso.grpc.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <maxHistory>30</maxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}[%L] - %msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+
+    <!-- 异步输出指定项目日志 -->
+    <appender name="async" class="ch.qos.logback.classic.AsyncAppender">
+        <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
+        <discardingThreshold>0</discardingThreshold>
+        <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
+        <queueSize>512</queueSize>
+        <!-- 添加附加的appender,最多只能添加一个 -->
+        <appender-ref ref="file"/>
+        <includeCallerData>true</includeCallerData>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="async"/>
+    </root>
+
+</configuration>

+ 49 - 0
usoft-sso-grpc-service/src/main/resources/logback-test.xml

@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<configuration>
+
+    <!-- 控制台输出日志 -->
+    <appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <!-- layout 负责根据用户意愿对记录请求进行格式化
+             1.第一个字段是自程序启动以来的逝去时间,单位是毫秒。
+             2.第二个字段发出记录请求的线程。
+             3.第三个字段是记录请求的级别。
+             4.第四个字段是与记录请求关联的logger的名称
+             “-”之后是请求的消息文字。
+             -->
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20}[%L] - %msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+
+    <!-- 文件输出指定项目日志 -->
+    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <fileNamePattern>/data/log/usoft/sso.grpc.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <maxHistory>30</maxHistory>
+        </rollingPolicy>
+
+        <encoder>
+            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36}[%L] - %msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+    </appender>
+
+    <!-- 异步输出指定项目日志 -->
+    <appender name="async" class="ch.qos.logback.classic.AsyncAppender">
+        <!-- 不丢失日志.默认的,如果队列的80%已满,则会丢弃TRACT、DEBUG、INFO级别的日志 -->
+        <discardingThreshold>0</discardingThreshold>
+        <!-- 更改默认的队列的深度,该值会影响性能.默认值为256 -->
+        <queueSize>512</queueSize>
+        <!-- 添加附加的appender,最多只能添加一个 -->
+        <appender-ref ref="file"/>
+        <includeCallerData>true</includeCallerData>
+    </appender>
+
+    <root level="INFO">
+        <appender-ref ref="async"/>
+        <appender-ref ref="stdout" />
+    </root>
+
+</configuration>

+ 13 - 0
usoft-sso-grpc-service/src/main/resources/mybatis-config.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
+<configuration>
+    <typeAliases>
+        <typeAlias alias="Integer" type="java.lang.Integer"/>
+        <typeAlias alias="Long" type="java.lang.Long"/>
+        <typeAlias alias="HashMap" type="java.util.HashMap"/>
+        <typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/>
+        <typeAlias alias="ArrayList" type="java.util.ArrayList"/>
+        <typeAlias alias="LinkedList" type="java.util.LinkedList"/>
+    </typeAliases>
+    
+</configuration>

+ 26 - 0
usoft-sso-grpc-service/src/test/java/com/usoft/sso/grpc/DefaultTest.java

@@ -0,0 +1,26 @@
+/**
+ *
+ */
+package com.usoft.sso.grpc;
+
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class DefaultTest {
+
+	protected ManagedChannel grpcChannel;
+
+	public DefaultTest() {
+		String host = "127.0.0.1";
+		grpcChannel = ManagedChannelBuilder.forAddress(host, 28810).usePlaintext().build();
+	}
+
+	@Test
+	public void test() {
+		System.out.println(97 + 102 + 105 + 94 + 82 + 60 + 90 * 0.7 + 84 * 0.3 + 84 * 0.3 + 98 * 0.3);
+	}
+}

+ 88 - 0
usoft-sso-grpc-service/src/test/java/com/usoft/sso/grpc/service/impl/SSOServiceImplTest.java

@@ -0,0 +1,88 @@
+package com.usoft.sso.grpc.service.impl;
+
+import com.usoft.protobuf.utils.ProtoBufUtil;
+import com.usoft.sso.grpc.DefaultTest;
+import com.usoft.sso.grpc.api.entity.Enterprise;
+import com.usoft.sso.grpc.api.entity.UserInfo;
+import com.usoft.sso.grpc.api.entity.user_enterprise;
+import com.usoft.sso.grpc.api.protobuf.*;
+import org.junit.Test;
+import org.springframework.util.Assert;
+
+/**
+ * @author: huyy
+ * @date: 2018/8/22 18:26
+ */
+public class SSOServiceImplTest extends DefaultTest{
+    @Test
+    public void selectUserInfo() throws Exception {
+        SelectUserInfoRequest.Builder request = SelectUserInfoRequest.newBuilder();
+        request.setUserUU(1000010030);
+        request.setSpaceUU(10041166);
+        SelectUserInfoResponse response = ssoGrpcServiceBlockingStub.selectUserInfo(request.build());
+        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
+        System.out.println("------返回结果--------");
+        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
+    }
+
+    SSOGrpcServiceGrpc.SSOGrpcServiceBlockingStub ssoGrpcServiceBlockingStub = SSOGrpcServiceGrpc.newBlockingStub(this.grpcChannel);
+
+    @Test
+    public void save() throws Exception {
+        SaveUserInfoRequest.Builder request = SaveUserInfoRequest.newBuilder();
+        UserInfo.Builder userinfo = UserInfo.newBuilder();
+        userinfo.setUserUU(2);
+        userinfo.setPassword("2");
+        userinfo.setUserCity("上号");
+        userinfo.setMobile("12222222333");
+        userinfo.setBhOpenid("32334");
+        request.setUserInfo(userinfo);
+        SaveUserInfoResponse response = ssoGrpcServiceBlockingStub.save(request.build());
+        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
+        System.out.println("------返回结果--------");
+        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
+    }
+
+    @Test
+    public void bindUser() throws Exception {
+        BindUserInfoRequest.Builder request = BindUserInfoRequest.newBuilder();
+        user_enterprise.Builder ue = user_enterprise.newBuilder();
+        request.setUserUU(1000010030);
+        request.setSpaceUU(10050250);
+        request.setType("bind");
+        BindUserInfoResponse response = ssoGrpcServiceBlockingStub.bindUser(request.build());
+        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
+        System.out.println("------返回结果--------");
+        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
+    }
+
+    @Test
+    public void selectEntInfo() throws Exception {
+        SelectEntInfoRequest.Builder request = SelectEntInfoRequest.newBuilder();
+        request.setSpaceUU(10041166);
+        SelectEntInfoResponse response = ssoGrpcServiceBlockingStub.selectEntInfo(request.build());
+        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
+        System.out.println("------返回结果--------");
+        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
+    }
+    @Test
+    public void update() throws Exception {
+        UpdateEntInfoRequest.Builder request = UpdateEntInfoRequest.newBuilder();
+        Enterprise.Builder enterprise = Enterprise.newBuilder();
+        UserInfo.Builder userInfo = UserInfo.newBuilder();
+        enterprise.setSpaceUU(2);
+        enterprise.setAdminUU(44);
+        enterprise.setBusinessCode("23242");
+        enterprise.setSpaceName("软商城444");
+        userInfo.setUserUU(44);
+        userInfo.setBhOpenid("3");
+        userInfo.setMobile("3334");
+        userInfo.setPassword("342");
+        request.setUser(userInfo);
+        request.setEnterprise(enterprise);
+        UpdateEntInfoResponse response = ssoGrpcServiceBlockingStub.update(request.build());
+        Assert.isTrue(response.getResponseHeader().getCode() == 0, response.getResponseHeader().getMsg());
+        System.out.println("------返回结果--------");
+        System.out.println(ProtoBufUtil.toJSONHasTryCatch(response));
+    }
+}

+ 44 - 0
usoft-sso-utils/pom.xml

@@ -0,0 +1,44 @@
+<?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>usoft-sso-grpc-parent</artifactId>
+        <groupId>com.usoft.sso</groupId>
+        <version>1.0.0-SNAPSHOT</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>usoft-sso-utils</artifactId>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.sso</groupId>
+            <artifactId>usoft-sso-grpc-api</artifactId>
+            <version>${spring.active.profile}-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>com.usoft.framework</groupId>
+            <artifactId>usoft-exception-utils</artifactId>
+        </dependency>
+    </dependencies>
+
+
+</project>

+ 28 - 0
usoft-sso-utils/src/main/java/com/usoft/sso/common/ResponseUtil.java

@@ -0,0 +1,28 @@
+package com.usoft.sso.common;
+
+
+import com.usoft.sso.grpc.api.entity.ResponseHeader;
+
+/**
+ * 响应工具类
+ *
+ * @author: wangcanyi
+ * @date: 2018-07-31 17:57
+ */
+public class ResponseUtil {
+
+	/**
+	 * 获取自定义响应头
+	 *
+	 * @param code 返回码
+	 * @param msg  返回消息
+	 * @return
+	 */
+	public static ResponseHeader getResponseHeader(int code, String msg) {
+		ResponseHeader.Builder builder = ResponseHeader.newBuilder();
+		builder.setCode(code);
+		builder.setMsg(msg);
+		return builder.build();
+	}
+
+}

+ 52 - 0
usoft-sso-utils/src/main/java/com/usoft/sso/common/VerifyParamsUtil.java

@@ -0,0 +1,52 @@
+package com.usoft.sso.common;
+
+import com.usoft.sso.exception.SSORuntimeException;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * 参数校验
+ *
+ * @author: wangcanyi
+ * @date: 2018-07-31 17:57
+ */
+public class VerifyParamsUtil {
+
+	/**
+	 * 对象是否为空
+	 *
+	 * @param object  对象
+	 * @param message 错误消息
+	 * @throws SSORuntimeException
+	 */
+	public static void notNull(Object object, String message) throws SSORuntimeException {
+		if (object == null) {
+			throw new SSORuntimeException(-1, message);
+		}
+	}
+
+	/**
+	 * 是否有值
+	 *
+	 * @param text    文本
+	 * @param message 错误消息
+	 * @throws SSORuntimeException
+	 */
+	public static void hasText(String text, String message) throws SSORuntimeException {
+		if (StringUtils.isBlank(text)) {
+			throw new SSORuntimeException(-1, message);
+		}
+	}
+
+	/**
+	 * 表达式是否正确
+	 *
+	 * @param expression 表达式
+	 * @param message    错误消息
+	 * @throws SSORuntimeException
+	 */
+	public static void isTrue(boolean expression, String message) throws SSORuntimeException {
+		if (!expression) {
+			throw new SSORuntimeException(-1, message);
+		}
+	}
+}

+ 29 - 0
usoft-sso-utils/src/main/java/com/usoft/sso/exception/SSORuntimeException.java

@@ -0,0 +1,29 @@
+package com.usoft.sso.exception;
+
+import com.usoft.exception.utils.BaseRuntimeException;
+
+/**
+ * @author: huyy
+ * @date: 2018/8/16 10:59
+ */
+public class SSORuntimeException extends BaseRuntimeException {
+    /**
+     * Example公用异常
+     *
+     * @param errorMessage 错误信息
+     */
+    public SSORuntimeException(String errorMessage) {
+        super(errorMessage);
+    }
+
+    /**
+     * Example公用异常
+     *
+     * @param errorCode    错误号
+     * @param errorMessage 错误信息
+     */
+    public SSORuntimeException(int errorCode, String errorMessage) {
+        super(errorCode, errorMessage);
+    }
+
+}