zss
2024-10-30 d8ba960d180c0ad08b7dfb5a17e7ad351ca2eb62
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.yuanchu.mom.mapper.UserMapper">
    <select id="selectUserDtoPageList" resultType="com.yuanchu.mom.dto.UserPageDto">
        select * from (
        select u1.id, u1.account, u1.name, u1.state, u1.create_time, u1.update_time, u1.create_user, u1.update_user,
        u1.age, u1.email, u1.phone, u1.department, u1.company, u1.address, u1.is_custom, u1.role_id, u2.name
        create_user_name, u3.name update_user_name, r.name role_name,u1.signature_url,u1.picture_url,u1.depart_id,
        u1.name_en,u1.depart_lims_id
        from user u1
        left join user u2 on u2.id = u1.create_user
        left join user u3 on u3.id = u1.update_user
        left join role r on u1.role_id = r.id
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
 
    <select id="selectPersonnelOverview" resultType="com.yuanchu.mom.dto.UserPageDto">
        select * from (
        select u1.id, u1.account, u1.name, u1.state, u1.create_time, u1.update_time, u1.create_user, u1.update_user,
        u1.age, u1.email, u1.phone, u1.department, u1.company, u1.address, u1.is_custom, u1.role_id, u2.name
        create_user_name, u3.name update_user_name, r.name role_name,u1.signature_url,u1.picture_url,u1.depart_id,
        u1.name_en
        from user u1
        left join user u2 on u2.id = u1.create_user
        left join user u3 on u3.id = u1.update_user
        left join role r on u1.role_id = r.id
        where u1.depart_lims_id is not null
        ) a
        <if test="ew.customSqlSegment != null and ew.customSqlSegment != ''">
            ${ew.customSqlSegment}
        </if>
    </select>
 
    <select id="getDeviceManager" resultType="com.yuanchu.mom.dto.UserPageDto">
        select id, name
        from user
        where state = 1
    </select>
    <select id="getCustom" resultType="com.yuanchu.mom.pojo.User">
        select u.id,c.company,u.name,c.code,u.phone,c.id departId from user u
        left join custom c on u.company = c.id
        where u.id = #{userId}
    </select>
    <select id="getUser" resultType="com.yuanchu.mom.pojo.User">
        select * from user where state = 1
    </select>
    <select id="selectDepartLims" resultType="java.lang.String">
        select name from department_lims
        where  id= (select  SUBSTRING_INDEX(SUBSTRING_INDEX(depart_lims_id, ',', -2), ',', 1) AS depart_lims_id  from user where name=#{prepareUser})
    </select>
</mapper>