新增 AesTypeHandler 处理字段数据加密解密或脱敏;新增 JsonTypeHandler 处理字段数据进行 JSON 字符串与 Java 对象 自动互转
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
*/
|
||||
package com.jeesite.modules.sys.dao;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeesite.common.dao.CrudDao;
|
||||
import com.jeesite.common.mybatis.annotation.MyBatisDao;
|
||||
import com.jeesite.modules.sys.entity.EmpUser;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 员工管理DAO接口
|
||||
* @author ThinkGem
|
||||
@@ -20,6 +20,14 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
@ConditionalOnProperty(name="user.enabled", havingValue="true", matchIfMissing=true)
|
||||
public interface EmpUserDao extends CrudDao<EmpUser> {
|
||||
|
||||
// @Override
|
||||
// @Results({
|
||||
// @Result(column = "mobile", property = "mobile",
|
||||
// javaType = String.class, typeHandler = AesTypeHandler.class)
|
||||
// })
|
||||
// @SelectProvider(type = SelectSqlProvider.class, method = "get")
|
||||
// EmpUser get(EmpUser entity);
|
||||
|
||||
/**
|
||||
* 查询全部用户,仅返回基本信息
|
||||
*/
|
||||
|
||||
@@ -27,6 +27,10 @@ import javax.validation.Valid;
|
||||
* @version 2017-03-25
|
||||
*/
|
||||
@Table(name="${_prefix}sys_user", alias="a", label="员工信息", columns={
|
||||
// 手机号加密脱敏例子,共同打开 EmpUserDao.java 和 EmpUserDao.xml 中的 result 注释
|
||||
// 详细 typeHandler 用法,请看文档:https://jeesite.com/docs/dao-mybatis/#手机号加密脱敏
|
||||
// @Column(name="mobile", attrName="mobile", label="手机号码", queryType=QueryType.EQ,
|
||||
// javaType = String.class, typeHandler = AesTypeHandler.class),
|
||||
@Column(includeEntity=User.class),
|
||||
}, joinTable={
|
||||
@JoinTable(type=Type.JOIN, entity=Employee.class, alias="e",
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<?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.jeesite.modules.sys.dao.EmpUserDao">
|
||||
|
||||
<!-- 查询数据 -->
|
||||
|
||||
<!-- 结果集映射
|
||||
<resultMap id="empUserResult" type="EmpUser">
|
||||
<result column="mobile" property="mobile" javaType="java.lang.String"
|
||||
typeHandler="com.jeesite.common.mybatis.type.AesTypeHandler"/>
|
||||
</resultMap> -->
|
||||
|
||||
<!-- 查询数据
|
||||
<select id="findList" resultMap="empUserResult"> -->
|
||||
<select id="findList" resultType="EmpUser">
|
||||
SELECT ${sqlMap.column.toSql()}
|
||||
FROM ${sqlMap.table.toSql()}
|
||||
|
||||
Reference in New Issue
Block a user