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

52 lines
2.4 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" >
<mapper namespace="com.securitycontrol.background.humanvehiclemanage.dao.HumanManageMapper">
<!--新增/修改 工程-->
2024-03-20 10:29:43 +08:00
<insert id="addHuman" useGeneratedKeys="true" keyProperty="userId">
INSERT INTO t_team_people
<trim prefix="(" suffix=")" suffixOverrides=",">
<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="proCode != null and proCode!=''">user_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<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>
</trim>
</insert>
<update id="updateHuman">
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="delFalge != null and delFalge != ''">del_falge = #{delFalge},</if>
</set>
WHERE user_id= #{userId}
</update>
<!--获取人员列表-->
<select id="getHumanLists" resultType="com.securitycontrol.background.humanvehiclemanage.entity.HumanManageVo">
SELECT
user_name as userName,
id_number as idnumber,
phone,
user_type as usertype
from
t_team_people ttp
<where>
<if test="keyWord !=null and keyWord!=''">
AND (
INSTR(ttp.user_name,#{keyWord}) > 0 OR
INSTR(tp.id_number,#{keyWord}) > 0
)
</if>
</where>
</select>
</mapper>