zss
2024-12-24 8216fd30e7eb970fd175f658c502ec2563174c37
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
<?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.PersonTrackRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.yuanchu.mom.pojo.PersonTrackRecord">
        <id column="id" property="id" />
        <result column="start_time" property="startTime" />
        <result column="end_time" property="endTime" />
        <result column="place_work" property="placeWork" />
        <result column="department" property="department" />
        <result column="post" property="post" />
        <result column="remarks" property="remarks" />
        <result column="create_time" property="createTime" />
        <result column="create_user" property="createUser" />
        <result column="user_id" property="userId" />
        <result column="file_name" property="fileName" />
    </resultMap>
 
    <select id="personTrackRecordSelect" resultType="com.yuanchu.mom.pojo.PersonTrackRecord">
        select cpt.*,name
        from cnas_person_track_record cpt
        left join user u on cpt.user_id = u.id
        <where>
            <if test="userId != null and userId != '' and userId != 'null'">
                and cpt.user_id = #{userId}
            </if>
            <if test="departLimsId != null and departLimsId != '' and departLimsId != 'null'">
                and FIND_IN_SET(#{departLimsId},u.depart_lims_id)
            </if>
        </where>
    </select>
 
    <select id="personTrackRecordExport" resultMap="BaseResultMap">
        select *
        from cnas_person_track_record cpt
        left join user u on cpt.user_id = u.id
        <where>
            <if test="userId != null and userId != '' and userId != 'null'">
                and cpt.user_id = #{userId}
            </if>
            <if test="departLimsId != null and departLimsId != '' and departLimsId != 'null'">
                and FIND_IN_SET(#{departLimsId},u.depart_lims_id)
            </if>
        </where>
    </select>
</mapper>