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
<?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.yiboshi.science.dao.SystemUserDAO">
<sql id="allColumns">
t.username as username, t.password as password, t.login_name as loginName, t.person_id as personId, t.user_type as userType, t.note_state as noteState, t.role_id as roleId, t.created as created
</sql>
<select id="findByName" parameterType="java.lang.String" resultType="com.yiboshi.science.param.dto.SystemUserDTO">
SELECT a.*,b.unit_id,b.person_name personName,c.unit_name unitName,c.tree_code unitCode,c.unit_state unitState,d.id expertId
FROM system_user a
left join com_person b on a.person_id =b.id
left join com_unit c on b.unit_id=c.id
left join com_expert d on b.id=d.person_id
where a.username=#{userName}
</select>
<select id="getMaxUsername" parameterType="java.lang.String" resultType="java.lang.String">
select cast((ifnull(max(username),0)+1) as char) code from system_user where username like concat(#{Code},'%')
</select>
<select id="getByUserName" parameterType="java.lang.String" resultType="com.yiboshi.science.entity.SystemUser">
SELECT a.* FROM system_user a where binary a.username=#{userName}
</select>
<select id="getListByPage" resultType="com.yiboshi.science.param.dto.SystemUserDTO">
SELECT
a.*,e.person_name,e.cert_id,e.sex,e.birthday,e.mobile,e.email,d.unit_name,d.unit_type,g.name nation_name,h.name education_name,
i.name title_name,j.name spec_name
FROM system_user a
LEFT JOIN com_person e ON a.person_id = e.id
LEFT JOIN com_unit d ON e.unit_id = d.id
LEFT JOIN system_parameter g on e.nation=g.id and g.type_id=11
LEFT JOIN system_parameter h on e.education=h.id and h.type_id=8
LEFT JOIN system_parameter i on e.title=i.id and i.type_id=7
LEFT JOIN system_parameter j on e.spec=j.id and j.type_id=42
LEFT JOIN system_parameter k on j.parent_id = k.id
<where>
${ew.sqlSegment}
</where>
ORDER BY a.person_id ASC
</select>
<select id="getSystemUserById" resultType="com.yiboshi.science.param.dto.SystemUserDTO">
SELECT
a.*,e.person_name,e.cert_id,e.sex,e.birthday,e.mobile,e.email,d.unit_name,d.unit_type,g.name nation_name,h.name education_name,
i.name title_name,j.name spec_name
FROM system_user a
LEFT JOIN com_person e ON a.person_id = e.id
LEFT JOIN com_unit d ON e.unit_id = d.id
LEFT JOIN system_parameter g on e.nation=g.id and g.type_id=11
LEFT JOIN system_parameter h on e.education=h.id and h.type_id=8
LEFT JOIN system_parameter i on e.title=i.id and i.type_id=7
LEFT JOIN system_parameter j on e.spec=j.id and j.type_id=42
LEFT JOIN system_parameter k on j.parent_id = k.id
where a.id = #{id}
</select>
</mapper>