2024-03-19 21:26:12 +08:00
|
|
|
<?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" >
|
2024-03-20 13:36:22 +08:00
|
|
|
<mapper namespace="com.securitycontrol.background.mapper.HumanManageMapper">
|
2024-03-21 20:16:03 +08:00
|
|
|
<!--新增/修改人员-->
|
|
|
|
|
<insert id="addOrUpdatePersonnel">
|
|
|
|
|
<if test="type == 1">
|
|
|
|
|
INSERT INTO t_team_people
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null and userId != ''">user_id,</if>
|
|
|
|
|
<if test="teamId != null and teamId != ''">team_id,</if>
|
|
|
|
|
<if test="userName != null and userName != ''">user_name,</if>
|
|
|
|
|
<if test="idNumber != null and idNumber!=''">id_number,</if>
|
|
|
|
|
<if test="phone != null and phone!=''">phone,</if>
|
|
|
|
|
<if test="userType != null and userType!=''">user_type,</if>
|
|
|
|
|
<if test="createTime != null and createTime!=''">cratet_time,</if>
|
|
|
|
|
del_falge,
|
|
|
|
|
<if test="status != null and status!=''">status,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="userId != null and userId != ''">#{userId},</if>
|
|
|
|
|
<if test="teamId != null and teamId != ''">#{teamId},</if>
|
|
|
|
|
<if test="userName != null and userName != ''">#{userName},</if>
|
|
|
|
|
<if test="idNumber != null and idNumber!=''">#{idNumber},</if>
|
|
|
|
|
<if test="phone != null and phone!=''">#{phone},</if>
|
|
|
|
|
<if test="userType != null and userType!=''">#{userType},</if>
|
|
|
|
|
<if test="createTime != null and createTime!=''">#{createTime},</if>
|
|
|
|
|
'0',
|
|
|
|
|
<if test="status != null and status!=''">#{status},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="type == 2">
|
|
|
|
|
UPDATE t_team_people
|
|
|
|
|
<set>
|
|
|
|
|
<if test="teamId != null and teamId != ''">team_id = #{teamId},</if>
|
|
|
|
|
<if test="userName != null and userName != ''">user_name = #{userName},</if>
|
|
|
|
|
<if test="idNumber != null and idNumber != ''">id_number = #{idNumber},</if>
|
|
|
|
|
<if test="phone != null and phone != ''">phone = #{phone},</if>
|
|
|
|
|
<if test="userType != null and userType != ''">user_type = #{userType},</if>
|
|
|
|
|
<if test="status != null and status!=''">#{status},</if>
|
|
|
|
|
</set>
|
|
|
|
|
WHERE user_id= #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
</insert>
|
|
|
|
|
<!--保存人员照片资源-->
|
|
|
|
|
<insert id="addFiles">
|
|
|
|
|
INSERT INTO tb_resource_file
|
2024-03-19 21:26:12 +08:00
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
2024-03-21 20:16:03 +08:00
|
|
|
<if test="resourceId != null and resourceId != ''">id,</if>
|
|
|
|
|
<if test="fileType != null">file_type,</if>
|
|
|
|
|
<if test="fileId != null and fileId!=''">file_id,</if>
|
|
|
|
|
<if test="fileSuffix != null and fileSuffix!=''">file_suffix,</if>
|
|
|
|
|
<if test="fileName != null and fileName!=''">file_name,</if>
|
|
|
|
|
<if test="sourceId != null and sourceId!=''">source_id,</if>
|
|
|
|
|
<if test="sourceType != null and sourceType!=''">source_type,</if>
|
|
|
|
|
del_flag,
|
|
|
|
|
<if test="updateTime != null and updateTime!=''">update_time,</if>
|
2024-03-19 21:26:12 +08:00
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
2024-03-21 20:16:03 +08:00
|
|
|
<if test="resourceId != null and resourceId != ''">#{resourceId},</if>
|
|
|
|
|
<if test="fileType != null">#{fileType},</if>
|
|
|
|
|
<if test="fileId != null and fileId!=''">#{fileId},</if>
|
|
|
|
|
<if test="fileSuffix != null and fileSuffix!=''">#{fileSuffix},</if>
|
|
|
|
|
<if test="fileName != null and fileName!=''">#{fileName},</if>
|
|
|
|
|
<if test="sourceId != null and sourceId!=''">#{sourceId},</if>
|
|
|
|
|
<if test="sourceType != null and sourceType!=''">#{sourceType},</if>
|
|
|
|
|
1,
|
|
|
|
|
<if test="updateTime != null and updateTime!=''">#{updateTime},</if>
|
2024-03-19 21:26:12 +08:00
|
|
|
</trim>
|
|
|
|
|
</insert>
|
2024-03-21 20:16:03 +08:00
|
|
|
<!--删除人员照片资源文件-->
|
|
|
|
|
<delete id="delFile">
|
|
|
|
|
DELETE FROM tb_resource_file WHERE file_id = #{fileId}
|
|
|
|
|
</delete>
|
2024-03-19 21:26:12 +08:00
|
|
|
<!--获取人员列表-->
|
2024-03-20 13:36:22 +08:00
|
|
|
<select id="getHumanLists" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
|
2024-03-19 21:26:12 +08:00
|
|
|
SELECT
|
2024-03-21 20:16:03 +08:00
|
|
|
ttp.user_id AS userId,
|
|
|
|
|
ttp.user_name as userName,
|
|
|
|
|
sd.dict_name AS userType,
|
|
|
|
|
twt.team_leader AS teamLeader,
|
|
|
|
|
twt.team_name AS teamName,
|
|
|
|
|
tp.pro_name AS proName
|
|
|
|
|
FROM t_team_people ttp
|
|
|
|
|
LEFT JOIN tb_work_team twt on ttp.team_id = twt.team_id
|
|
|
|
|
LEFT JOIN sys_dict sd ON ttp.user_type = sd.dict_code
|
|
|
|
|
LEFT JOIN tb_project tp ON twt.bid_code = tp.bid_code
|
2024-03-19 21:26:12 +08:00
|
|
|
<where>
|
2024-03-21 20:16:03 +08:00
|
|
|
<if test="bidCode!=null and bidCode !=''">
|
|
|
|
|
AND twt.bid_code = #{bidCode}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userName!=null and userName !=''">
|
|
|
|
|
AND INSTR(ttp.user_name,#{userName}) > 0
|
2024-03-19 21:26:12 +08:00
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
2024-03-21 20:16:03 +08:00
|
|
|
<!--人员是否存在-->
|
|
|
|
|
<select id="userIsExist" resultType="java.util.Map">
|
|
|
|
|
<if test="userId == null or userId == ''">
|
|
|
|
|
SELECT user_id AS id,id_number AS value FROM t_team_people
|
|
|
|
|
</if>
|
|
|
|
|
<if test="userId != null and userId != ''">
|
|
|
|
|
SELECT user_id AS id,id_number AS value FROM t_team_people WHERE user_id != #{userId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
2024-03-19 21:26:12 +08:00
|
|
|
</mapper>
|