kongzy
2024-07-12 28aaf2ffa1dbb860a292ba330a7e9362e60e7832
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
<?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.gkhy.assess.system.mapper.AssPlanPersonMapper">
    <resultMap type="com.gkhy.assess.system.domain.AssPlanPerson" id="planPersonResult">
        <id     property="id"        column="id"         />
        <result property="personId"     column="person_id"      />
        <result property="jobType"     column="job_type"      />
        <result property="laterPromise"     column="later_promise"      />
        <result property="work"     column="work"      />
        <result property="informed"     column="informed"      />
        <result property="sort"     column="sort"      />
        <result property="playRole"     column="play_role"      />
        <result property="reason"     column="reason"      />
        <result property="projectId"     column="project_id"      />
        <result property="delFlag"     column="del_flag"      />
        <result property="version"     column="version"      />
        <result property="createBy"     column="create_by"      />
        <result property="createTime"     column="create_time"      />
        <result property="updateBy"     column="update_by"      />
        <result property="updateTime"     column="update_time"      />
        <result property="remark"     column="remark"      />
        <association property="person" javaType="com.gkhy.assess.system.domain.SysUser" resultMap="userResult" />
    </resultMap>
 
    <resultMap id="userResult" type="com.gkhy.assess.system.domain.SysUser">
        <id     property="id"       column="person_id"        />
        <result property="name"     column="person_name"      />
        <result property="major"      column="person_major"       />
        <result property="certificateNo"      column="certificate_no"       />
        <collection property="majorNames" ofType="java.lang.String" select="getMajorById" column="{major=person_major}"/>
    </resultMap>
 
    <sql id="selectPlanPersonVo">
        select p.id,p.person_id, p.job_type,p.later_promise,p.informed,p.work,p.sort,p.reason,p.project_id,p.play_role,
               p.del_flag,p.create_by,p.create_time,p.update_by,p.update_time,p.remark,u.name as person_name,u.major as person_major,u.certificate_no
        from ass_plan_person p
        left join sys_user u on u.id=p.person_id
    </sql>
 
    <update id="deletePlanPersonByIds">
        update ass_plan_person set del_flag=1 where id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
 
 
 
    <select id="getPlanPersonByProjectId" resultMap="planPersonResult">
        <include refid="selectPlanPersonVo"/>
        where p.project_id=#{projectId} and p.del_flag=0 and p.play_role=2
    </select>
 
 
    <select id="getAllPlanPersonByProjectId" resultMap="planPersonResult">
        <include refid="selectPlanPersonVo"/>
        where p.project_id=#{projectId} and p.del_flag=0
    </select>
 
    <select id="getPlanPersonsByIds" resultType="com.gkhy.assess.system.domain.AssPlanPerson">
        select * from ass_plan_person
        where id in
        <foreach collection="ids" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
 
    <select id="getMajorById" resultType="java.lang.String">
        select label from sys_dict_data where id in
        <foreach item="item" index="index" collection="major.split(',')"  open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
 
    <select id="getPersonAndRecognitionCount" resultType="com.gkhy.assess.system.domain.vo.PersonRecognitionVO">
        select count(1) as person_cnt,project_id,(select count(1) from ass_face_recognition where project_id =a.project_id) as recognition_cnt from ass_plan_person a
        where a.del_flag=0 and a.project_id in
        <foreach collection="projectIds" item="projectId" open="(" separator="," close=")">
            #{projectId}
        </foreach>
        group by a.project_id
    </select>
 
    <select id="getMajorPlanPersonCountByProject" resultType="java.lang.Integer">
        select count(1) from ass_plan_person where del_flag=0 and job_type=2 and project_id=#{projectId}
    </select>
 
</mapper>