ah_jjzhgd_service/securitycontrol-model/securitycontrol-background/src/main/resources/mapper/TeamManageMapper.xml

94 lines
4.2 KiB
XML
Raw Normal View History

<?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.TeamManageMapper">
2024-03-21 13:28:01 +08:00
<!--新增/修改班组-->
<insert id="addOrUpdateTeam">
<if test="type == 1">
INSERT INTO tb_work_team
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="teamId != null and teamId != ''">team_id,</if>
<if test="teamName != null and teamName != ''">team_name,</if>
<if test="teamLeader != null and teamLeader != ''">team_leader,</if>
<if test="bidCode != null and bidCode!=''">bid_code,</if>
<if test="teamLeaderPhone != null and teamLeaderPhone!=''">team_leader_phone,</if>
<if test="idNumber != null and idNumber!=''">id_number,</if>
<if test="status != null and status!=''">status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="teamId != null and teamId != ''">#{teamId},</if>
<if test="teamName != null and teamName != ''">#{teamName},</if>
<if test="teamLeader != null and teamLeader != ''">#{teamLeader},</if>
<if test="bidCode != null and bidCode!=''">#{bidCode},</if>
<if test="teamLeaderPhone != null and teamLeaderPhone!=''">#{teamLeaderPhone},</if>
<if test="idNumber != null and idNumber!=''">#{idNumber},</if>
<if test="status != null and status!=''">#{status},</if>
</trim>
</if>
<if test="type == 2">
UPDATE tb_work_team
<set>
<if test="teamName != null and teamName != ''">team_name = #{teamName},</if>
<if test="teamLeader != null and teamLeader != ''">team_leader = #{teamLeader},</if>
<if test="bidCode != null and bidCode != ''">bid_code = #{bidCode},</if>
<if test="teamLeaderPhone != null and teamLeaderPhone != ''">team_leader_phone = #{teamLeaderPhone},</if>
<if test="idNumber != null and idNumber != ''">id_number = #{idNumber},</if>
<if test="status != null and status != ''">status = #{status},</if>
</set>
WHERE team_id = #{teamId}
</if>
</insert>
2024-03-21 13:28:01 +08:00
<!--删除班组-->
<delete id="delTeam">
DELETE FROM tb_work_team WHERE team_id = #{id}
</delete>
<!--获取班组列表-->
2024-03-20 13:36:22 +08:00
<select id="getTeamLists" resultType="com.securitycontrol.entity.background.vo.TeamManageVo">
SELECT
2024-03-21 13:28:01 +08:00
twt.team_id AS teamId,
twt.team_name as teamName,
twt.team_leader as teamleader,
twt.team_leader_phone as teamleaderphone,
tp.pro_name AS proName,
twt.team_num as teamNum,
twt.status,
twt.bid_code AS bidCode
FROM tb_work_team twt
LEFT JOIN tb_project tp on twt.bid_code = tp.bid_code
<where>
<if test="keyWord !=null and keyWord!=''">
AND (
2024-03-21 13:28:01 +08:00
INSTR(twt.team_leader,#{keyWord}) > 0
)
</if>
</where>
</select>
2024-03-21 13:28:01 +08:00
<!--班组是否存在-->
<select id="isTeamExist" resultType="java.util.Map">
<if test="teamId == null or teamId == ''">
SELECT team_id AS id,id_number AS value FROM tb_work_team
</if>
<if test="teamId != null and teamId != ''">
SELECT team_id AS id,id_number AS value FROM tb_work_team WHERE team_id != #{teamId}
</if>
</select>
<!--班组详情-->
<select id="getTeamDetailById" resultType="com.securitycontrol.entity.background.vo.TeamManageVo">
SELECT
twt.team_id AS teamId,
twt.team_name as teamname,
twt.team_leader as teamleader,
twt.team_leader_phone as teamleaderphone,
twt.status,
twt.bid_code AS bidCode,
twt.id_number AS idNumber
FROM tb_work_team twt
WHERE team_id = #{id}
</select>
<!--班组是否存在班组人员-->
<select id="isPeopleByTeam" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_team_people WHERE team_id = #{id}
</select>
</mapper>