search_tools_service/search-tool/src/main/resources/mapper/TbOtherPeopleMapper.xml

88 lines
4.7 KiB
XML

<?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.bonus.tool.mapper.TbOtherPeopleMapper">
<insert id="addTbOtherPeople" useGeneratedKeys="true" keyProperty="id">
insert into tb_other_people
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userName != null ">user_name,</if>
<if test="idCard != null ">id_card,</if>
<if test="userPhone != null ">user_phone,</if>
<if test="qualification != null ">qualification,</if>
<if test="workType != null">work_type,</if>
<if test="title != null ">title,</if>
<if test="major != null ">major,</if>
<if test="diploma != null ">diploma,</if>
<if test="diplomaNum != null ">diploma_num,</if>
<if test="level != null ">level,</if>
<if test="isNormal != null ">is_normal,</if>
<if test="createTime != null">create_time,</if>
<if test="createUser != null ">create_user,</if>
<if test="updateUser != null">update_user,</if>
<if test="updateTime != null ">update_time,</if>
del_flag
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userName != null ">#{userName},</if>
<if test="idCard != null ">#{idCard},</if>
<if test="userPhone != null ">#{userPhone},</if>
<if test="qualification != null ">#{qualification},</if>
<if test="workType != null ">#{workType},</if>
<if test="title != null ">#{title},</if>
<if test="major != null ">#{major},</if>
<if test="diploma != null ">#{diploma},</if>
<if test="diplomaNum != null ">#{diplomaNum},</if>
<if test="level != null ">#{level},</if>
<if test="isNormal != null ">#{isNormal},</if>
<if test="createTime != null ">#{createTime},</if>
<if test="createUser != null ">#{createUser},</if>
<if test="updateUser != null ">#{updateUser},</if>
<if test="updateTime != null">#{updateTime},</if>
0
</trim>
</insert>
<update id="updateTbOtherPeople">
update tb_other_people
<trim prefix="SET" suffixOverrides=",">
<if test="userName != null">user_name = #{userName},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="userPhone != null">user_phone = #{userPhone},</if>
<if test="qualification != null">qualification = #{qualification},</if>
<if test="workType != null">work_type = #{workType},</if>
<if test="title != null">title = #{title},</if>
<if test="major != null">major = #{major},</if>
<if test="diploma != null">diploma = #{diploma},</if>
<if test="diplomaNum != null">diploma_num = #{diplomaNum},</if>
<if test="level != null">level = #{level},</if>
<if test="isNormal != null">is_normal = #{isNormal},</if>
<if test="updateUser != null">update_user = #{updateUser},</if>
update_time = now()
</trim>
where id = #{id}
</update>
<delete id="delTbOtherPeople">
update tb_other_people set del_flag = 1 where id =#{id}
</delete>
<select id="getTbOtherPeopleList" resultType="com.bonus.tool.dto.TbOtherPeopleVo">
select id,user_name as userName,id_card as idCard,user_phone,qualification,work_type as workType,
title,major,diploma, diploma_num as diplomaNum,level,is_normal as isNormal,
create_time,create_user,update_time,update_user
from tb_other_people where del_flag = 0
<if test="userName != '' and userName != null">and user_name like concat('%', #{userName}, '%')</if>
<if test="title != '' and title != null"> and title = #{title}</if>
<if test="diploma != '' and diploma != null"> and diploma = #{diploma}</if>
<if test="major != '' and major != null"> and major = #{major}</if>
</select>
<select id="getTbOtherPeopleById" resultType="com.bonus.tool.dto.TbOtherPeopleVo">
select id,user_name,id_card,user_phone,qualification,work_type,title,major,diploma,
diploma_num,level,is_normal,create_time,create_user,update_time,update_user
from tb_other_people where id = #{id}
</select>
<select id="getTbOtherPeopleByIdCard" resultType="com.bonus.tool.dto.TbOtherPeopleVo">
select id,user_name,id_card,user_phone,qualification,work_type,title,major,diploma,
diploma_num,level,is_normal,create_time,create_user,update_time,update_user
from tb_other_people where id_card = #{idCard} and del_flag = 0
</select>
</mapper>