CenterUserMapper.xml
3.31 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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="org.nafmii.admin.user.dao.CenterUserMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="org.nafmii.admin.user.entity.CenterUserPO">
<id column="ID" property="id" />
<result column="LOGIN_NAME" property="loginName" />
<result column="LOGIN_PWD" property="loginPwd" />
<result column="CN_NAME" property="cnName" />
<result column="EN_NAME" property="enName" />
<result column="PHONE" property="phone" />
<result column="TELPHONE" property="telphone" />
<result column="SEX" property="sex" />
<result column="EMAIL" property="email" />
<result column="CREATE_USER_ID" property="createUserId" />
<result column="UPDATE_USER_ID" property="updateUserId" />
<result column="CREATE_TIME" property="createTime" />
<result column="UPDATE_TIME" property="updateTime" />
<result column="IS_ENABLE" property="isEnable" />
<result column="DEL_FLAG" property="delFlag" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
ID, LOGIN_NAME, LOGIN_PWD, CN_NAME, EN_NAME, PHONE, TELPHONE, SEX, EMAIL, CREATE_USER_ID, UPDATE_USER_ID, CREATE_TIME, UPDATE_TIME, IS_ENABLE, DEL_FLAG
</sql>
<select id="selectUserByPhone" parameterType="org.nafmii.admin.user.dto.LoginDto" resultType="org.nafmii.admin.user.vo.CenterUserVO">
select
ID as id, LOGIN_NAME as loginName, LOGIN_PWD as loginPwd, CN_NAME as cnName, EN_NAME as enName, PHONE as phone,
TELPHONE as telphone, SEX as sex, EMAIL as email, CREATE_USER_ID as createUserId, UPDATE_USER_ID as updateUserId,
CREATE_TIME as createTime, UPDATE_TIME as updateTime, IS_ENABLE as isEnable
from CENTER_USER
where 1 = 1
<if test="loginName !=null">
and LOGIN_NAME =#{loginName}
</if>
<if test="loginPwd !=null">
and LOGIN_PWD =#{loginPwd}
</if>
</select>
<select id="selectUserAndRole" parameterType="org.nafmii.admin.user.dto.QueryUsersDto" resultType="org.nafmii.admin.user.vo.CenterUserAndRoleVo">
select
cur.ID as id,
cu.LOGIN_NAME as loginName,
cr.R_NAME as rName,
cr.ID as roleId,
cu.PHONE as phone,
cu.IS_ENABLE as isEnable
from CENTER_USER cu
left join CENTER_USER_ROLE cur
on cu.ID = cur.USER_ID
left join CENTER_ROLE cr
on cur.ROLE_ID = cr.ID
where cu.DEL_FLAG = 0
<if test="loginName != null">
cu.LOGIN_NAME like CONCAT('%',#{loginName},'%')
</if>
<if test="roleId != null">
cr.ID = #{roleId}
</if>
</select>
<select id="queryUserList" parameterType="org.nafmii.admin.user.dto.QueryUsersDto"
resultType="org.nafmii.admin.user.vo.CenterUserVO">
SELECT
<include refid="Base_Column_List" />
FROM CENTER_USER CU
<where>
<if test="StartCreateTime != null and endCreateTime != null">
DATE_FORMAT(CU.CREATE_TIME,'%Y-%m-%d') BETWEEN #{StartCreateTime} and #{endCreateTime}
</if>
</where>
</select>
</mapper>