heheng
2024-12-09 473a007e3f8dc9f54d73f691578624251bdc7185
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?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.system.mapper.SysExpertInfoMapper">
 
    <sql id="selectExpertInfoVo">
        select id,name,sex,birthday,phone,title,state,electronic_photo,id_card,duty_status,
               company_name,company_address,dept_name,job,company_telephone,fax_num,email,
               graduation_school,degree,speciality,current_profession,support_direction_safety,
               support_direction_prevention,support_direction_emergency,resume_key,paper_situation_key,
               reward_key,achievement_key,personal_opinion_key,recommend_unit_opinion_key,remark,create_by,
               create_time,big_classify,small_classify,del_flag,source,rating_level,employment_date_start,employment_date_end,expert_certificate,dept_id,domain,evidence
        from sys_expert_info
    </sql>
 
    <update id="deleteBatchByIds">
        update expert_info set del_flag = 1  where id in
        <foreach collection="expertIds" item="expertId" separator="," open="(" close=")">
            #{expertId}
        </foreach>
    </update>
 
    <select id="expertInfoList" resultType="com.gkhy.system.domain.SysExpertInfo">
        select id,name,sex,birthday,phone,title,degree,state,speciality,big_classify,small_classify,id_card,company_name,evidence,
            domain,level,current_profession,duty_status,support_direction_safety,support_direction_prevention,support_direction_emergency,create_time,
            rating_level,employment_date_start,employment_date_end,expert_certificate,update_time from sys_expert_info
        <where>
            and del_flag = 0
            <if test="name != null and name != ''">
                and name like concat('%', #{name}, '%')
            </if>
            <if test="phone != null and phone != ''">
                and phone like concat('%', #{phone}, '%')
            </if>
            <if test="idCard != null and idCard != ''">
                and id_card like concat('%', #{idCard}, '%')
            </if>
            <if test="domain != null and domain != ''">
                and domain  = #{domain}
            </if>
            <if test="level != null and level != ''">
                and level  = #{level}
            </if>
            <if test="bigClassify != null">
                and big_classify = #{bigClassify}
            </if>
            <if test="ratingLevel != null and ratingLevel != ''">
                and rating_level = #{ratingLevel}
            </if>
            <if test="smallClassify != null">
                and small_classify = #{smallClassify}
            </if>
            <if test="dutyStatus != null">
                and duty_status = #{dutyStatus}
            </if>
            <if test="state != null">
                and state = #{state}
            </if>
            <if test="deptId != null">
                and dept_id = #{deptId}
            </if>
            <if test="params.startTime != null "><!-- 开始时间检索 -->
                and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.startTime},'%y%m%d')
            </if>
            <if test="params.endTime != null "><!-- 结束时间检索 -->
                and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
 
        </where>
        order by create_time desc
    </select>
 
 
    <select id="expertInfoListV2" resultType="com.gkhy.system.domain.SysExpertInfo">
        select a.id,a.name,a.sex,a.birthday,a.phone,a.title,a.degree,a.state,a.speciality,a.big_classify bigClassify,a.small_classify smallClassify,a.id_card idCard,a.company_name companyName,a.evidence,
        a.domain,a.level,a.current_profession currentProfession,a.duty_status dutyStatus,a.support_direction_safety supportDirectionSafety,
        a.support_direction_prevention supportDirectionPrevention,a.support_direction_emergency supportDirectionEmergency,a.create_time createTime,
        a.rating_level ratingLevel,a.employment_date_start employmentDateStart,a.employment_date_end employmentDateEnd,a.expert_certificate expertCertificate,a.update_time updateTime ,b.classify_name as bigClassifyName from sys_expert_info a
         left join  sys_expert_classify b on a.big_classify = b.id
        <where>
            and a.del_flag = 0
            <if test="name != null and name != ''">
                and a.name like concat('%', #{name}, '%')
            </if>
            <if test="phone != null and phone != ''">
                and a.phone like concat('%', #{phone}, '%')
            </if>
            <if test="idCard != null and idCard != ''">
                and a.id_card like concat('%', #{idCard}, '%')
            </if>
            <if test="domain != null and domain != ''">
                and a.domain  = #{domain}
            </if>
            <if test="level != null and level != ''">
                and a.level  = #{level}
            </if>
            <if test="bigClassify != null">
                and a.big_classify = #{bigClassify}
            </if>
            <if test="ratingLevel != null and ratingLevel != ''">
                and a.rating_level = #{ratingLevel}
            </if>
            <if test="smallClassify != null">
                and a.small_classify = #{smallClassify}
            </if>
            <if test="dutyStatus != null">
                and a.duty_status = #{dutyStatus}
            </if>
            <if test="state != null">
                and a.state = #{state}
            </if>
            <if test="deptId != null">
                and a.dept_id = #{deptId}
            </if>
            <if test="params.startTime != null "><!-- 开始时间检索 -->
                and a.date_format(create_time,'%y%m%d') &gt;= date_format(#{params.startTime},'%y%m%d')
            </if>
            <if test="params.endTime != null "><!-- 结束时间检索 -->
                and a.date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
            </if>
 
        </where>
        order by a.create_time desc
    </select>
 
 
 
    <select id="checkIdcardUnique" resultType="com.gkhy.system.domain.SysExpertInfo">
        select id,name from sys_expert_info where id_card=#{idCard} and dept_id = #{deptId} and del_flag=0 limit 1
    </select>
 
    <select id="getExpertInfoById" resultType="com.gkhy.system.domain.SysExpertInfo">
        <include refid="selectExpertInfoVo"/>
        where id=#{expertId}
    </select>
 
 
    <select id="queryApprove" parameterType="com.gkhy.system.domain.vo.request.SysExpertSearchReqDto" resultType="com.gkhy.system.domain.vo.response.SysExpertSearchRep">
        select a.name,a.employment_date_start employmentDateStart,a.employment_date_end employmentDateEnd,
               a.update_time updateTime,a.state,b.classify_name bigClassifyName,a.id,a.domain
        from sys_expert_info a
        left join sys_expert_classify b on a.big_classify = b.id
        where a.id_card=#{idCard} and a.dept_id = #{deptId} and a.phone = #{phone} and a.del_flag=0 limit 1
    </select>
 
    <select id="getExpertRound" parameterType="com.gkhy.system.domain.vo.request.SysExpertInfoRoundReq"
            resultType="com.gkhy.system.domain.vo.response.ProjectExpertSectionResp">
        select id,name,sex,id_card idCard,
            domain,rating_level ratingLevel from sys_expert_info
        where del_flag = 0
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="domain != null and domain.size() > 0">
                and domain in
                <foreach collection="domain" item="item" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        <if test="ratingLevel != null and ratingLevel.size() > 0">
            and rating_level in
        <foreach collection="ratingLevel" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        </if>
        ORDER BY RAND()
            LIMIT #{num}
    </select>
</mapper>