zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?xml version="1.0" encoding="UTF-8" ?>  
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >  
<mapper namespace="cn.autoform.fw.mapper.UserManMapper" >  
    <cache eviction="FIFO" flushInterval="60000" size="512" readOnly="true"/>
    <select id="findByUsername" resultType="cn.autoform.bean.User" parameterType="cn.autoform.bean.User" useCache="true">  
        select * from user where username = #{username}
    </select>
    
    <insert id = "insert" parameterType="cn.autoform.bean.User" flushCache="true">
        insert into user(id,username,password,email,lastPasswordResetDate) values (#{id},#{username},#{password},#{email},current_timestamp())
    </insert>
    
    <select id="findRolesByUserID" resultType="java.lang.String" parameterType="cn.autoform.bean.User" useCache="true">  
        select 
            tb2.role 
        from 
            user tb0 inner join rolemanagement tb1
            on tb0.id = tb1.user_id
            inner join role tb2
            on tb1.role_id = tb2.id
        where tb0.id = #{id}
    </select>
    
    <select id="findAll" resultType="cn.autoform.bean.User" useCache="true">  
        select * from user
    </select>
    
</mapper>