Browse Source

新增 阿里云人脸识别

Administrator 1 năm trước cách đây
mục cha
commit
ca05e52830

+ 11 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/OcrController.java

@@ -52,4 +52,15 @@ public class OcrController {
     public AjaxResult ocrSample(@RequestBody SysUserIdcardVo sysUserIdcardVo) {
     public AjaxResult ocrSample(@RequestBody SysUserIdcardVo sysUserIdcardVo) {
         return IdCardUtil.sample(sysUserIdcardVo);
         return IdCardUtil.sample(sysUserIdcardVo);
     }
     }
+
+    /**
+     * 人脸识别阿里云金融级实人认证
+     *
+     * @return
+     */
+    @PostMapping("/ocrSampleAliYun")
+    @RepeatSubmit(interval = 1000, message = "请求过于频繁")
+    public AjaxResult ocrSampleAliYun(@RequestBody SysUserIdcardVo sysUserIdcardVo) {
+        return IdCardUtil.ocrSampleAliYun(sysUserIdcardVo);
+    }
 }
 }

+ 12 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java

@@ -229,6 +229,18 @@ public class SysUserController extends BaseController
         return toAjax(userService.updateUserStatus(user));
         return toAjax(userService.updateUserStatus(user));
     }
     }
 
 
+    /**
+     * 状态人脸识别认证状态
+     */
+    @PostMapping("/changeFace")
+    public AjaxResult changeFace(@RequestBody SysUser user)
+    {
+        userService.checkUserAllowed(user);
+        userService.checkUserDataScope(user.getUserId());
+        user.setUpdateBy(getUsername());
+        return toAjax(userService.updateUserStatus(user));
+    }
+
     /**
     /**
      * 根据用户编号获取授权角色
      * 根据用户编号获取授权角色
      */
      */

+ 12 - 1
ruoyi-common/pom.xml

@@ -17,7 +17,18 @@
 
 
 
 
     <dependencies>
     <dependencies>
-
+        <!--阿里云人脸识别-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>cloudauth20190307</artifactId>
+            <version>2.0.8</version>
+        </dependency>
+        <!--身份验证依赖-->
+        <dependency>
+            <groupId>com.aliyun</groupId>
+            <artifactId>credentials-java</artifactId>
+            <version>LATEST</version>
+        </dependency>
         <!--压缩目录-->
         <!--压缩目录-->
         <dependency>
         <dependency>
             <groupId>net.lingala.zip4j</groupId>
             <groupId>net.lingala.zip4j</groupId>

+ 15 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/SysUserIdcardVo.java

@@ -56,6 +56,21 @@ public class SysUserIdcardVo extends BaseEntity
      */
      */
     private String result;
     private String result;
 
 
+    /**
+     * MetaInfo环境参数,需要通过客户端SDK获取
+     *
+     * {"zimVer":"3.0.0","appVersion": "1","bioMetaInfo": "4.1.0:1150****,0","appName": "com.aliyun.antcloudauth","deviceType": "ios","osVersion": "iOS 10.3.2","apdidToken": "","deviceModel": "iPhone9,1"}
+     */
+    private String metaInfo;
+
+    public String getMetaInfo() {
+        return metaInfo;
+    }
+
+    public void setMetaInfo(String metaInfo) {
+        this.metaInfo = metaInfo;
+    }
+
     public String getImage() {
     public String getImage() {
         return image;
         return image;
     }
     }

+ 12 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java

@@ -40,6 +40,10 @@ public class SysUser extends BaseEntity
     /** 用户昵称 */
     /** 用户昵称 */
     @Excel(name = "用户类型", readConverterExp = "00=系统用户,01=注册用户,02=管理用户")
     @Excel(name = "用户类型", readConverterExp = "00=系统用户,01=注册用户,02=管理用户")
     private String userType;
     private String userType;
+    /**
+     * 是否人脸认证 N:否 Y:是
+     */
+    private String initFace;
 
 
     /** 用户邮箱 */
     /** 用户邮箱 */
     @Excel(name = "用户邮箱")
     @Excel(name = "用户邮箱")
@@ -93,6 +97,14 @@ public class SysUser extends BaseEntity
     /** 角色ID */
     /** 角色ID */
     private Long roleId;
     private Long roleId;
 
 
+    public String getInitFace() {
+        return initFace;
+    }
+
+    public void setInitFace(String initFace) {
+        this.initFace = initFace;
+    }
+
     public String getUserType() {
     public String getUserType() {
         return userType;
         return userType;
     }
     }

+ 161 - 27
ruoyi-common/src/main/java/com/ruoyi/common/utils/IdCardUtil.java

@@ -6,15 +6,27 @@ package com.ruoyi.common.utils;
  * @Describe:
  * @Describe:
  */
  */
 
 
+import com.aliyun.cloudauth20190307.Client;
+import com.aliyun.cloudauth20190307.models.*;
+import com.aliyun.teaopenapi.models.Config;
+import com.aliyun.teautil.models.RuntimeOptions;
+
+import java.util.Arrays;
+import java.util.List;
+
 import cn.hutool.http.HttpUtil;
 import cn.hutool.http.HttpUtil;
+
+import java.util.Arrays;
+import java.util.List;
+
+import com.aliyun.cloudauth20190307.Client;
+import com.aliyun.cloudauth20190307.models.*;
+import com.aliyun.teaopenapi.models.Config;
+import com.aliyun.teautil.models.RuntimeOptions;
 import com.ruoyi.common.core.domain.SysUserIdcardVo;
 import com.ruoyi.common.core.domain.SysUserIdcardVo;
-import com.ruoyi.common.core.redis.RedisCache;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONObject;
 import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.core.domain.IdCardVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
 
 
 import javax.crypto.Cipher;
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
 import javax.crypto.spec.SecretKeySpec;
@@ -23,10 +35,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.net.URLEncoder;
 import java.nio.file.Files;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.nio.file.Paths;
-import java.util.Base64;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
+import java.util.*;
 
 
 import static com.ruoyi.common.constant.CommonConstants.*;
 import static com.ruoyi.common.constant.CommonConstants.*;
 
 
@@ -184,19 +193,19 @@ public class IdCardUtil {
             String decryptResult = parseResult(encryptResult);
             String decryptResult = parseResult(encryptResult);
             JSONObject jsonObject = JSON.parseObject(decryptResult);
             JSONObject jsonObject = JSON.parseObject(decryptResult);
             String wordsResult = jsonObject.getString("words_result");
             String wordsResult = jsonObject.getString("words_result");
-            Map<String,Object> map = new HashMap<>(3);
-            if (StringUtils.isNotEmpty(wordsResult)){
+            Map<String, Object> map = new HashMap<>(3);
+            if (StringUtils.isNotEmpty(wordsResult)) {
                 JSONObject jsonObjectWordsResult = JSON.parseObject(wordsResult);
                 JSONObject jsonObjectWordsResult = JSON.parseObject(wordsResult);
-                if (FRONT.equals(idCardSide)){
+                if (FRONT.equals(idCardSide)) {
                     String name = JSON.parseObject(jsonObjectWordsResult.getString("姓名")).getString("words");
                     String name = JSON.parseObject(jsonObjectWordsResult.getString("姓名")).getString("words");
                     String address = JSON.parseObject(jsonObjectWordsResult.getString("住址")).getString("words");
                     String address = JSON.parseObject(jsonObjectWordsResult.getString("住址")).getString("words");
                     String idCard = JSON.parseObject(jsonObjectWordsResult.getString("公民身份号码")).getString("words");
                     String idCard = JSON.parseObject(jsonObjectWordsResult.getString("公民身份号码")).getString("words");
-                    map.put("realName",name);
-                    map.put("address",address);
-                    map.put("idCard",idCard);
-                }else if (BACK.equals(idCardSide)){
+                    map.put("realName", name);
+                    map.put("address", address);
+                    map.put("idCard", idCard);
+                } else if (BACK.equals(idCardSide)) {
                     String date = JSON.parseObject(jsonObjectWordsResult.getString("失效日期")).getString("words");
                     String date = JSON.parseObject(jsonObjectWordsResult.getString("失效日期")).getString("words");
-                    map.put("expirationDate",date);
+                    map.put("expirationDate", date);
                 }
                 }
             }
             }
             return AjaxResult.success(map);
             return AjaxResult.success(map);
@@ -521,8 +530,8 @@ public class IdCardUtil {
              */
              */
             JSONObject jsonObject = JSONObject.parseObject(result);
             JSONObject jsonObject = JSONObject.parseObject(result);
             String wordsResult = jsonObject.getString("words_result");
             String wordsResult = jsonObject.getString("words_result");
-            Map<String,Object> map = new HashMap<>(9);
-            if (StringUtils.isNotEmpty(wordsResult)){
+            Map<String, Object> map = new HashMap<>(9);
+            if (StringUtils.isNotEmpty(wordsResult)) {
                 JSONObject jsonObjectWordsResult = JSON.parseObject(wordsResult);
                 JSONObject jsonObjectWordsResult = JSON.parseObject(wordsResult);
                 String creditCode = JSON.parseObject(jsonObjectWordsResult.getString("社会信用代码")).getString("words");
                 String creditCode = JSON.parseObject(jsonObjectWordsResult.getString("社会信用代码")).getString("words");
                 String enterpriseName = JSON.parseObject(jsonObjectWordsResult.getString("单位名称")).getString("words");
                 String enterpriseName = JSON.parseObject(jsonObjectWordsResult.getString("单位名称")).getString("words");
@@ -533,15 +542,15 @@ public class IdCardUtil {
                 String establishData = JSON.parseObject(jsonObjectWordsResult.getString("成立日期")).getString("words");
                 String establishData = JSON.parseObject(jsonObjectWordsResult.getString("成立日期")).getString("words");
                 String businessTerm = JSON.parseObject(jsonObjectWordsResult.getString("有效期")).getString("words");
                 String businessTerm = JSON.parseObject(jsonObjectWordsResult.getString("有效期")).getString("words");
                 String businessScope = JSON.parseObject(jsonObjectWordsResult.getString("经营范围")).getString("words");
                 String businessScope = JSON.parseObject(jsonObjectWordsResult.getString("经营范围")).getString("words");
-                map.put("creditCode",creditCode);
-                map.put("enterpriseName",enterpriseName);
-                map.put("enterpriseType",enterpriseType);
-                map.put("enterpriseAddress",enterpriseAddress);
-                map.put("legalName",legalName);
-                map.put("registeredCapital",registeredCapital);
-                map.put("establishData",establishData);
-                map.put("businessTerm",businessTerm);
-                map.put("businessScope",businessScope);
+                map.put("creditCode", creditCode);
+                map.put("enterpriseName", enterpriseName);
+                map.put("enterpriseType", enterpriseType);
+                map.put("enterpriseAddress", enterpriseAddress);
+                map.put("legalName", legalName);
+                map.put("registeredCapital", registeredCapital);
+                map.put("establishData", establishData);
+                map.put("businessTerm", businessTerm);
+                map.put("businessScope", businessScope);
             }
             }
             return AjaxResult.success(map);
             return AjaxResult.success(map);
         } catch (Exception e) {
         } catch (Exception e) {
@@ -641,4 +650,129 @@ public class IdCardUtil {
         String accessToken = jsonObject.getString("access_token");
         String accessToken = jsonObject.getString("access_token");
         return accessToken;
         return accessToken;
     }
     }
+
+
+    /**
+     * 人脸识别阿里云金融级实人认证
+     *
+     * @throws IOException
+     */
+    public static AjaxResult ocrSampleAliYun(SysUserIdcardVo sysUserIdcardVo) {
+
+        return AjaxResult.success(initFaceVerify(sysUserIdcardVo));
+    }
+
+    /**
+     * 阿里云调用人脸识别
+     * 每次开始认证前通过本接口获取CertifyId,用来串联认证请求中的各个接口。
+     */
+    public static String initFaceVerify(SysUserIdcardVo sysUserIdcardVo) {
+        InitFaceVerifyRequest request = new InitFaceVerifyRequest();
+        // 请输入场景ID+L。1000009979场景id固定值
+        request.setSceneId(1000009979L);
+        // 设置商户请求的唯一标识。
+        request.setOuterOrderNo(UUID.randomUUID().toString());
+        // 认证方案。
+        request.setProductCode("ID_PRO");
+        // 模式。要进行活体检测的类型。取值:
+        //LIVENESS(默认):眨眼动作活体检测。
+        //
+        //PHOTINUS_LIVENESS:眨眼动作活体+炫彩活体双重检测。
+        //
+        //MULTI_ACTION:多动作活体检测。当前为眨眼+任意摇头检测。
+        request.setModel("PHOTINUS_LIVENESS");
+        //不同证件类型,取值均为IDENTITY_CARD
+        request.setCertType("IDENTITY_CARD");
+        //您的终端用户的真实姓名
+        request.setCertName(sysUserIdcardVo.getRealName());
+        //您的终端用户的证件号码。
+        request.setCertNo(sysUserIdcardVo.getIdCard());
+        // MetaInfo环境参数。
+        request.setMetaInfo(sysUserIdcardVo.getMetaInfo());
+        //request.setMobile("130xxxxxxxx");
+        //request.setIp("114.xxx.xxx.xxx");
+        //request.setUserId("12345xxxx");
+        //request.setCallbackUrl("https://www.aliyundoc.com");
+        //request.setCallbackToken("xxxxx");
+        // 如需开启个人信息加密传输。
+        //request.setEncryptType("SM2");
+        //request.setCertName("BCRD/7ZkNy7Q*****M1BMBezZe8GaYHrLwyJv558w==");
+        //request.setCertNo("BMjsstxK3S4b1YH*****Pet8ECObfxmLN92SLsNg==");
+
+        // 推荐,支持服务路由。
+        InitFaceVerifyResponse response = initFaceVerifyAutoRoute(request);
+
+        // 不支持服务自动路由。
+        //InitFaceVerifyResponse response = initFaceVerify("cloudauth.cn-shanghai.aliyuncs.com", request);
+
+        response.getBody().getRequestId();
+        String certifyId = response.getBody().getResultObject().getCertifyId();
+        System.out.println(response.getBody().getRequestId());
+        System.out.println(response.getBody().getCode());
+        System.out.println(response.getBody().getMessage());
+        System.out.println(response.getBody().getResultObject() == null ? null
+                : response.getBody().getResultObject().getCertifyId());
+
+        return certifyId;
+    }
+
+    private static InitFaceVerifyResponse initFaceVerifyAutoRoute(InitFaceVerifyRequest request) {
+        // 第一个为主区域Endpoint,第二个为备区域Endpoint。
+        List<String> endpoints = Arrays.asList("cloudauth.cn-shanghai.aliyuncs.com", "cloudauth.cn-beijing.aliyuncs.com");
+        InitFaceVerifyResponse lastResponse = null;
+        for (int i = 0; i < endpoints.size(); i++) {
+            try {
+                InitFaceVerifyResponse response = initFaceVerify(endpoints.get(i), request);
+                lastResponse = response;
+
+                // 服务端错误,切换到下个区域调用。
+                if (response != null) {
+                    if (500 == response.getStatusCode()) {
+                        continue;
+                    }
+                    if (response.getBody() != null) {
+                        if ("500".equals(response.getBody().getCode())) {
+                            continue;
+                        }
+                    }
+                }
+
+                // 正常返回
+                return lastResponse;
+            } catch (Exception e) {
+                e.printStackTrace();
+                if (i == endpoints.size() - 1) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+
+        return lastResponse;
+    }
+
+    private static InitFaceVerifyResponse initFaceVerify(String endpoint, InitFaceVerifyRequest request)
+            throws Exception {
+        // 阿里云账号AccessKey拥有所有API的访问权限,建议您使用RAM用户进行API访问或日常运维。
+        // 强烈建议不要把AccessKey ID和AccessKey Secret保存到工程代码里,否则可能导致AccessKey泄露,威胁您账号下所有资源的安全。
+        // 本示例通过阿里云Credentials工具从环境变量中读取AccessKey,来实现API访问的身份验证。如何配置环境变量,请参见https://help.aliyun.com/document_detail/378657.html。
+        Config credentialConfig = new Config();
+        credentialConfig.setType("access_key");
+        //使用阿里云RAM用户的AK。最小的权限
+        credentialConfig.setAccessKeyId("LTAI5tCwkQRjuJYzbohaveEz");
+        credentialConfig.setAccessKeySecret("8VW0H8GL7hmm5td8cYxO49FcVLPzOj");
+        credentialConfig.setEndpoint(endpoint);
+        Client client = new Client(credentialConfig);
+        // 设置http代理。
+        //config.setHttpProxy("http://xx.xx.xx.xx:xxxx");
+        // 设置https代理。
+        //config.setHttpsProxy("https://xx.xx.xx.xx:xxxx");
+
+
+        // 创建RuntimeObject实例并设置运行参数。
+        RuntimeOptions runtime = new RuntimeOptions();
+        runtime.readTimeout = 10000;
+        runtime.connectTimeout = 10000;
+
+        return client.initFaceVerifyWithOptions(request, runtime);
+    }
 }
 }

+ 2 - 2
ruoyi-common/src/main/java/com/ruoyi/common/utils/SendSmsUtils.java

@@ -6,12 +6,12 @@ import com.aliyun.dysmsapi20170525.models.SendBatchSmsResponse;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.aliyun.tea.TeaException;
 import com.aliyun.tea.TeaException;
 
 
-/**
+/**阿里云
  * @author tjf
  * @author tjf
  * @Date: 2021/07/15/10:21
  * @Date: 2021/07/15/10:21
  */
  */
 public class SendSmsUtils {
 public class SendSmsUtils {
-    //短信参数
+    //阿里云ACCESS_KEY短信参数
     static final String ACCESS_KEY_ID = "LTAI5tNA2fcBJH6EWRH6Pxr6";
     static final String ACCESS_KEY_ID = "LTAI5tNA2fcBJH6EWRH6Pxr6";
     static final String ACCESS_KEY_SECRET = "5WdaPEOvC3u9LC7pwy2DQ9pgmJvgUr";
     static final String ACCESS_KEY_SECRET = "5WdaPEOvC3u9LC7pwy2DQ9pgmJvgUr";
 
 

+ 9 - 5
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -10,6 +10,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="userName"     column="user_name"    />
         <result property="userName"     column="user_name"    />
         <result property="nickName"     column="nick_name"    />
         <result property="nickName"     column="nick_name"    />
 		<result property="userType"     column="user_type"    />
 		<result property="userType"     column="user_type"    />
+		<result property="initFace"     column="init_face"    />
         <result property="email"        column="email"        />
         <result property="email"        column="email"        />
         <result property="phonenumber"  column="phonenumber"  />
         <result property="phonenumber"  column="phonenumber"  />
         <result property="sex"          column="sex"          />
         <result property="sex"          column="sex"          />
@@ -48,7 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
     </resultMap>
 	
 	
 	<sql id="selectUserVo">
 	<sql id="selectUserVo">
-        select u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
+        select u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type,u.init_face, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
         d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
         d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
         from sys_user u
         from sys_user u
@@ -58,7 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </sql>
     </sql>
     
     
     <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
     <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult">
-		select u.user_id, u.dept_id, u.nick_name,u.user_type, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
+		select u.user_id, u.dept_id, u.nick_name,u.user_type,u.init_face, u.user_name, u.email, u.avatar, u.phonenumber, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, d.dept_name, d.leader from sys_user u
 		left join sys_dept d on u.dept_id = d.dept_id
 		left join sys_dept d on u.dept_id = d.dept_id
 		where u.del_flag = '0'
 		where u.del_flag = '0'
 		<if test="userId != null and userId != 0">
 		<if test="userId != null and userId != 0">
@@ -90,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	</select>
 	
 	
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
 	<select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type, u.email, u.phonenumber, u.status, u.create_time
+	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type,u.init_face, u.email, u.phonenumber, u.status, u.create_time
 	    from sys_user u
 	    from sys_user u
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
@@ -107,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	</select>
 	
 	
 	<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
 	<select id="selectUnallocatedList" parameterType="SysUser" resultMap="SysUserResult">
-	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type, u.email, u.phonenumber, u.status, u.create_time
+	    select distinct u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type,u.init_face, u.email, u.phonenumber, u.status, u.create_time
 	    from sys_user u
 	    from sys_user u
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_dept d on u.dept_id = d.dept_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
 			 left join sys_user_role ur on u.user_id = ur.user_id
@@ -143,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	</select>
 	</select>
 
 
 	<select id="selectUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
 	<select id="selectUserByPhonenumber" parameterType="String" resultMap="SysUserResult">
-		select u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type, u.email, u.avatar, u.phonenumber, u.password,u.plaintext, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
+		select u.user_id, u.dept_id, u.user_name, u.nick_name,u.user_type,u.init_face, u.email, u.avatar, u.phonenumber, u.password,u.plaintext, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark,
 			   d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
 			   d.dept_id, d.parent_id, d.ancestors, d.dept_name, d.order_num, d.leader, d.status as dept_status,
 			   r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
 			   r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status
 		from sys_user u
 		from sys_user u
@@ -164,6 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="userName != null and userName != ''">user_name,</if>
  			<if test="userName != null and userName != ''">user_name,</if>
  			<if test="nickName != null and nickName != ''">nick_name,</if>
  			<if test="nickName != null and nickName != ''">nick_name,</if>
 			<if test="userType != null and userType != ''">user_type,</if>
 			<if test="userType != null and userType != ''">user_type,</if>
+			<if test="initFace != null and initFace != ''">init_face,,</if>
  			<if test="email != null and email != ''">email,</if>
  			<if test="email != null and email != ''">email,</if>
  			<if test="avatar != null and avatar != ''">avatar,</if>
  			<if test="avatar != null and avatar != ''">avatar,</if>
  			<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
  			<if test="phonenumber != null and phonenumber != ''">phonenumber,</if>
@@ -179,6 +181,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="userName != null and userName != ''">#{userName},</if>
  			<if test="userName != null and userName != ''">#{userName},</if>
  			<if test="nickName != null and nickName != ''">#{nickName},</if>
  			<if test="nickName != null and nickName != ''">#{nickName},</if>
 			<if test="userType != null and userType != ''">#{userType},</if>
 			<if test="userType != null and userType != ''">#{userType},</if>
+			<if test="initFace != null and initFace != ''">#{initFace},</if>
  			<if test="email != null and email != ''">#{email},</if>
  			<if test="email != null and email != ''">#{email},</if>
  			<if test="avatar != null and avatar != ''">#{avatar},</if>
  			<if test="avatar != null and avatar != ''">#{avatar},</if>
  			<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
  			<if test="phonenumber != null and phonenumber != ''">#{phonenumber},</if>
@@ -198,6 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  			<if test="userName != null and userName != ''">user_name = #{userName},</if>
  			<if test="userName != null and userName != ''">user_name = #{userName},</if>
  			<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
  			<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
 			<if test="userType != null and userType != ''">user_type = #{userType},</if>
 			<if test="userType != null and userType != ''">user_type = #{userType},</if>
+			<if test="initFace != null and initFace != ''">init_face = #{initFace},</if>
  			<if test="email != null ">email = #{email},</if>
  			<if test="email != null ">email = #{email},</if>
  			<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
  			<if test="phonenumber != null ">phonenumber = #{phonenumber},</if>
  			<if test="sex != null and sex != ''">sex = #{sex},</if>
  			<if test="sex != null and sex != ''">sex = #{sex},</if>