heheng
2025-05-20 dc4f8829472baf47345e3a01384d7b5eaf7ee727
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?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.ProjectManagementMapper">
    
    <resultMap type="ProjectManagement" id="ProjectManagementResult">
        <result property="id"    column="id"    />
        <result property="projectName"    column="project_name"    />
        <result property="projectCode"    column="project_code"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="jobCategory"    column="job_category"    />
        <result property="projectAddress"    column="project_address"    />
<!--        <result property="deptUserName"    column="dept_user_name"    />-->
        <result property="deptPostName"    column="dept_post_name"   typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler" />
        <result property="version"    column="version"    />
        <result property="state"    column="state"    />
        <result property="remark"    column="remark"    />
        <result property="projectDateStart"    column="project_date_start"    />
        <result property="projectDateEnd"    column="project_date_end"    />
        <result property="projectCheckTime"    column="project_check_time"    />
        <result property="expertCertificate"    column="expert_certificate"    />
        <result property="evaluationState"    column="evaluation_state"    />
        <result property="expertNum"    column="expert_num"    />
        <result property="expertId"    column="expert_id"    />
        <result property="expertName"    column="expert_name"    />
        <result property="projectEndTime"    column="project_end_time"    />
        <result property="desc"    column="desc"    />
        <result property="step"    column="step"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <resultMap type="com.gkhy.system.domain.vo.response.ProjectExpertManagementInfoRes" id="ProjectManagementInfoResult">
        <result property="id"    column="id"    />
        <result property="projectName"    column="project_name"    />
        <result property="projectCode"    column="project_code"    />
        <result property="deptName"    column="dept_name"    />
        <result property="remark"    column="remark"    />
        <result property="state"    column="state"    />
        <result property="step"    column="step"    />
        <result property="jobCategory"    column="job_category"    />
        <result property="projectAddress"    column="project_address"    />
        <result property="expertNum"    column="expert_num"    />
<!--        <result property="deptUserName"    column="dept_user_name"    />-->
        <result property="projectDateStart"    column="project_date_start"    />
        <result property="projectDateEnd"    column="project_date_end"    />
        <result property="projectCheckTime"    column="project_check_time"    />
        <collection  property="projectExpertCheckResp"   javaType="java.util.List"  resultMap="ExpertCheck" />
    </resultMap>
    <resultMap id="ExpertCheck" type="com.gkhy.system.domain.vo.response.ProjectExpertCheckResp">
        <result  property="id"       column="project_expert_id"        />
        <result property="expertId"     column="expert_id_info"      />
        <result property="name"      column="name"       />
        <result property="sex"     column="sex"      />
        <result property="idCard"    column="id_card"     />
        <result property="domain"       column="domain"    />
        <result property="ratingLevel"     column="rating_level"      />
        <result property="selectionMode"    column="selection_mode"     />
        <result property="teamLeader"       column="team_leader"    />
        <result property="companyName"       column="company_name"    />
        <result property="phone"       column="phone"    />
        <result property="selectionTime"       column="selection_time"    />
        <result property="expertRemark"       column="expert_remark"    />
    </resultMap>
 
    <sql id="selectProjectManagementVo">
        select id, project_name, dept_id, dept_name, job_category, project_address,dept_post_name,
               version, state, remark, project_date_start, project_date_end, expert_certificate,
               evaluation_state, expert_num, del_flag, create_by, create_time, update_by, update_time,project_check_time,expert_id,
               expert_name,project_end_time,`desc`,step,project_code
        from project_management
    </sql>
 
    <select id="selectProjectManagementList" parameterType="ProjectManagement" resultMap="ProjectManagementResult">
        <include refid="selectProjectManagementVo"/>
        <where>
            and del_flag = 0
            <if test="projectName != null  and projectName != ''"> and project_name like concat('%', #{projectName}, '%')</if>
            <if test="projectCode != null  and projectCode != ''"> and project_code like concat('%', #{projectCode}, '%')</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
            <if test="jobCategory != null  and jobCategory != ''"> and job_category like concat('%', #{jobCategory}, '%')</if>
            <if test="projectAddress != null  and projectAddress != ''"> and project_address = #{projectAddress}</if>
<!--            <if test="deptUserName != null  and deptUserName != ''"> and dept_user_name like concat('%', #{deptUserName}, '%')</if>-->
            <if test="version != null "> and version = #{version}</if>
            <if test="state != null "> and state = #{state}</if>
            <if test="step!= null "> and step = #{step}</if>
            <if test="projectDateStart != null "> and date_format(project_date_start,'%Y%m%d') &gt;= date_format(#{projectDateStart},'%Y%m%d')</if>
            <if test="projectDateEnd != null "> and date_format(project_date_end,'%Y%m%d') &lt;= date_format(#{projectDateEnd},'%Y%m%d')</if>
            <if test="expertCertificate != null  and expertCertificate != ''"> and expert_certificate = #{expertCertificate}</if>
            <if test="evaluationState != null "> and evaluation_state = #{evaluationState}</if>
            <if test="expertNum != null "> and expert_num = #{expertNum}</if>
        </where>
        order by create_time desc
    </select>
 
    <select id="selectProjectData" parameterType="ProjectManagement" resultType="com.gkhy.system.domain.vo.response.ProjectDataResp">
        select  a.dept_name deptName,c.name expertName,b.tax_expert_fee expertFee,a.create_time createTime,a.project_name projectName,
        b.major_dangers majorDangers,b.general_hazards generalHazards,b.travel_expenses travelExpenses,b.accommodation_fee accommodationFee
        from project_management a
                 left join project_expert b on a.id = b.project_id and b.del_flag = 0 and b.evaluation_state = 1
                 left join sys_expert_info c on b.expert_id = c.id
        where a.del_flag = 0 and a.state = 4 and a.evaluation_state = 1
        <if test="projectName != null  and projectName != ''"> and a.project_name like concat('%', #{projectName}, '%')</if>
        <if test="projectCode != null  and projectCode != ''"> and a.project_code like concat('%', #{projectCode}, '%')</if>
        <if test="deptId != null "> and a.dept_id = #{deptId}</if>
        <if test="projectDateStart != null "> and date_format(a.project_date_start,'%Y%m%d') &gt;= date_format(#{projectDateStart},'%Y%m%d')</if>
        <if test="projectDateEnd != null "> and date_format(a.project_date_end,'%Y%m%d') &lt;= date_format(#{projectDateEnd},'%Y%m%d')</if>
        order BY a.dept_name asc ,c.`name` desc
    </select>
 
    
    <select id="selectProjectManagementById" parameterType="Long" resultMap="ProjectManagementResult">
        <include refid="selectProjectManagementVo"/>
        where id = #{id} and del_flag = 0
    </select>
 
    <insert id="insertProjectManagement" parameterType="ProjectManagement" useGeneratedKeys="true" keyProperty="id">
        insert into project_management
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="projectName != null and projectName != ''">project_name,</if>
            <if test="projectCode != null and projectCode != ''">project_code,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="deptName != null and deptName != ''">dept_name,</if>
            <if test="jobCategory != null and jobCategory != ''">job_category,</if>
            <if test="projectAddress != null and projectAddress != ''">project_address,</if>
<!--            <if test="deptUserName != null and deptUserName != ''">dept_user_name,</if>-->
            <if test="deptPostName != null and deptPostName != ''">dept_post_name,</if>
            <if test="version != null">version,</if>
            <if test="state != null">state,</if>
            <if test="step != null">step,</if>
            <if test="remark != null">remark,</if>
            <if test="projectDateStart != null">project_date_start,</if>
            <if test="projectDateEnd != null">project_date_end,</if>
            <if test="expertCertificate != null">expert_certificate,</if>
            <if test="evaluationState != null">evaluation_state,</if>
            <if test="expertNum != null">expert_num,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="projectName != null and projectName != ''">#{projectName},</if>
            <if test="projectCode != null and projectCode != ''">#{projectCode},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="deptName != null and deptName != ''">#{deptName},</if>
            <if test="jobCategory != null and jobCategory != ''">#{jobCategory},</if>
            <if test="projectAddress != null and projectAddress != ''">#{projectAddress},</if>
<!--            <if test="deptUserName != null and deptUserName != ''">#{deptUserName},</if>-->
            <if test="deptPostName != null and deptPostName != ''">#{deptPostName},</if>
            <if test="version != null">#{version},</if>
            <if test="state != null">#{state},</if>
            <if test="step != null">#{step},</if>
            <if test="remark != null">#{remark},</if>
            <if test="projectDateStart != null">#{projectDateStart},</if>
            <if test="projectDateEnd != null">#{projectDateEnd},</if>
            <if test="expertCertificate != null">#{expertCertificate},</if>
            <if test="evaluationState != null">#{evaluationState},</if>
            <if test="expertNum != null">#{expertNum},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
 
    <update id="updateProjectManagement" parameterType="ProjectManagement">
        update project_management
        <trim prefix="SET" suffixOverrides=",">
            <if test="projectName != null and projectName != ''">project_name = #{projectName},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
            <if test="jobCategory != null and jobCategory != ''">job_category = #{jobCategory},</if>
            <if test="projectAddress != null and projectAddress != ''">project_address = #{projectAddress},</if>
<!--            <if test="deptUserName != null and deptUserName != ''">dept_user_name = #{deptUserName},</if>-->
            <if test="deptPostName != null and deptPostName != ''">dept_post_name = #{deptPostName},</if>
            <if test="version != null">version = #{version},</if>
            <if test="state != null">state = #{state},</if>
            <if test="step != null">step = #{step},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="projectDateStart != null">project_date_start = #{projectDateStart},</if>
            <if test="projectDateEnd != null">project_date_end = #{projectDateEnd},</if>
            <if test="projectCheckTime != null">project_check_time = #{projectCheckTime},</if>
            <if test="expertCertificate != null">expert_certificate = #{expertCertificate},</if>
            <if test="evaluationState != null">evaluation_state = #{evaluationState},</if>
            <if test="expertNum != null">expert_num = #{expertNum},</if>
            <if test="expertId != null">expert_id = #{expertId},</if>
            <if test="expertName != null">expert_name = #{expertName},</if>
            <if test="projectEndTime != null">project_end_time = #{projectEndTime},</if>
            <if test="desc != null and desc != ''">`desc` = #{desc},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <update id="deleteProjectManagementById" parameterType="Long">
        update  project_management set del_flag = 1 where id = #{id}
    </update>
 
    <update id="deleteProjectManagementByIds" parameterType="String">
        update  project_management set del_flag = 1 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
 
    <select id="projectExpertCheckInfo" parameterType="Long" resultMap="ProjectManagementInfoResult">
        select a.id,a.step, a.project_name, a.dept_name, a.job_category, a.project_address, a.project_date_start, a.project_date_end, a.remark,a.project_check_time,a.state,
            b.id project_expert_id,b.expert_id expert_id_info,c.name,c.sex,c.id_card,c.domain,c.rating_level,b.selection_mode,b.team_leader,
            c.company_name,c.phone,a.create_time selection_time,c.remark expert_remark,a.project_code,a.expert_num
        from project_management a
        left join project_expert b on a.id = b.project_id and b.del_flag = 0
        left join sys_expert_info c on b.expert_id = c.id
         where a.id = #{id}
        order by b.team_leader desc , b.create_time desc
    </select>
    <select id="getProjectExpertSate" parameterType="com.gkhy.system.domain.vo.request.ProjectExpertStateReq" resultType="com.gkhy.system.domain.vo.response.ProjectExpertStateResp">
        select a.id, a.project_name, a.evaluation_state, a.project_check_time, a.project_end_time, a.dept_name, a.expert_num
        from project_management a
        where a.del_flag = 0 and a.state = 4
        <if test="deptId != null "> and a.dept_id = #{deptId}</if>
        <if test="projectCheckTime != null "> and a.project_check_time = #{projectCheckTime}</if>
        <if test="projectName != null  and projectName != ''"> and a.project_name like concat('%', #{projectName}, '%')</if>
        <if test="evaluationState != null "> and a.evaluation_state = #{evaluationState}</if>
        order by a.create_time desc
    </select>
 
    <select id="getDataNum" parameterType="Long" resultType="Integer">
        select state from project_management where del_flag = 0
        <if test="deptId != null "> and dept_id = #{deptId}</if>
    </select>
</mapper>