zss
2024-12-23 0d930cdcf56bb92e67afabf45ec860689baf0282
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?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.PersonBasicInfoMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.PersonBasicInfo">
        <id column="id" property="id"/>
        <result column="current_state" property="currentState"/>
        <result column="entry_time" property="entryTime"/>
        <result column="post" property="post"/>
        <result column="professional_title" property="professionalTitle"/>
        <result column="sex" property="sex"/>
        <result column="personnel_classification" property="personnelClassification"/>
        <result column="date_birth" property="dateBirth"/>
        <result column="identity_card" property="identityCard"/>
        <result column="nation" property="nation"/>
        <result column="political_status" property="politicalStatus"/>
        <result column="official_academic_redentials" property="officialAcademicRedentials"/>
        <result column="graduation_time1" property="graduationTime1"/>
        <result column="graduated_institutions1" property="graduatedInstitutions1"/>
        <result column="major1" property="major1"/>
        <result column="graduation_time2" property="graduationTime2"/>
        <result column="graduated_institutions2" property="graduatedInstitutions2"/>
        <result column="major2" property="major2"/>
        <result column="telephone" property="telephone"/>
        <result column="end_planned_internship" property="endPlannedInternship"/>
        <result column="end_practical_practice" property="endPracticalPractice"/>
        <result column="date_departure" property="dateDeparture"/>
        <result column="desktop_picture" property="desktopPicture"/>
        <result column="attachment_information" property="attachmentInformation"/>
        <result column="remarks" property="remarks"/>
        <result column="user_id" property="userId"/>
        <result column="current_position" property="currentPosition"/>
    </resultMap>
 
    <select id="selectLimsUser" resultType="com.yuanchu.mom.dto.DepartmentDto">
        SELECT u.id userId, u.name, SUBSTRING_INDEX(SUBSTRING_INDEX(u.depart_lims_id, ',', -2), ',', 1) AS fatherId
        FROM user u
        where u.is_custom = 0
          and u.depart_lims_id is not null
          and u.depart_lims_id != ''
    </select>
 
    <select id="getCNASPersonnelInfo" resultType="com.yuanchu.mom.dto.PersonBasicInfoDto">
        SELECT *
        FROM user u
                 left join cnas_person_basic_info cpbi on cpbi.user_id = u.id
        where u.id = #{userId}
    </select>
 
    <select id="basicInformationOfPersonnelSelectPage" resultType="java.util.Map">
        select u.id,
               u.name,
               u.account,
               cpbi.sex,
               cpbi.date_birth,
               u.age,
               cpbi.entry_time,
               cpbi.personnel_classification,
               cpbi.official_academic_redentials,
               cpbi.current_position,
               u.phone,
               cpbi.date_departure,
               cpbi.current_state,
               u1.name createUser
        from user u
                 left join cnas_person_basic_info cpbi on cpbi.user_id = u.id
                 left join user u1 on u1.id = u.create_user
        where FIND_IN_SET(#{departmentId}, u.depart_lims_id)
    </select>
    <select id="selectPersonBasecInfoAndUser" resultType="java.util.Map">
        select
        u.id userId,
        u.`name` name,
        u.account account,
        DATE_FORMAT(cpbi.group_time, '%Y-%m-%d') groupTime,
        DATE_FORMAT(cpbi.end_practical_practice, '%Y-%m-%d') endPracticalPracticeStr,
        cpbi.native_place nativePlace,
        cpbi.identity_card identityCard,
        cpbi.id_address idAddress,
        u.phone telephone,
        cpbi.graduated_institutions1 graduatedInstitutions1,
        cpbi.major1 major1,
        DATE_FORMAT(cpbi.graduation_time1, '%Y-%m-%d') graduationTime1,
        cpbi.official_academic_redentials officialAcademicRedentials,
        cpbi.highest_degree highestDegree,
        cpbi.professional_title professionalTitle,
        cpbi.emergency_contact emergencyContact,
        cpbi.emergency_contact_phone emergencyContactPhone,
        group_concat( DISTINCT technical_post SEPARATOR ',') technicalPost
        from user u
        left join cnas_person_basic_info cpbi on cpbi.user_id = u.id
        left join cnas_person_personnel_capacity cppc on u.id = cppc.user_id
        left join user u1 on u1.id = u.create_user
        <where>
            FIND_IN_SET(#{departmentId},u.depart_lims_id)
            <if test="name != null and name != ''">
                and u.name like concat('%',#{name},'%')
            </if>
        </where>
    </select>
</mapper>