员工mapper

This commit is contained in:
oepraxxx 2022-03-17 22:20:09 +08:00
parent 641fee0e4e
commit b443c6c093

View File

@ -0,0 +1,78 @@
<?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.oa.domain.mapper.EmployeeInfoMapper">
<resultMap type="EmployeeInfo" id="EmployeeInfoResult">
<result property="userId" column="user_id" />
<result property="deptId" column="dept_id" />
<result property="postId" column="post_id" />
<result property="phone" column="phone" />
<result property="idCard" column="id_card" />
<result property="bankCard" column="bank_card" />
</resultMap>
<sql id="selectEmployeeInfoVo">
select user_id, dept_id, post_id, phone, id_card, bank_card from oa_employee_info
</sql>
<select id="selectEmployeeInfoList" parameterType="EmployeeInfo" resultMap="EmployeeInfoResult">
<include refid="selectEmployeeInfoVo"/>
<where>
<if test="deptId != null "> and dept_id = #{deptId}</if>
<if test="postId != null "> and post_id = #{postId}</if>
<if test="phone != null and phone != ''"> and phone = #{phone}</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="bankCard != null and bankCard != ''"> and bank_card = #{bankCard}</if>
</where>
</select>
<select id="selectEmployeeInfoByUserId" parameterType="Long" resultMap="EmployeeInfoResult">
<include refid="selectEmployeeInfoVo"/>
where user_id = #{userId}
</select>
<insert id="insertEmployeeInfo" parameterType="EmployeeInfo">
insert into oa_employee_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">user_id,</if>
<if test="deptId != null">dept_id,</if>
<if test="postId != null">post_id,</if>
<if test="phone != null">phone,</if>
<if test="idCard != null">id_card,</if>
<if test="bankCard != null">bank_card,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">#{userId},</if>
<if test="deptId != null">#{deptId},</if>
<if test="postId != null">#{postId},</if>
<if test="phone != null">#{phone},</if>
<if test="idCard != null">#{idCard},</if>
<if test="bankCard != null">#{bankCard},</if>
</trim>
</insert>
<update id="updateEmployeeInfo" parameterType="EmployeeInfo">
update oa_employee_info
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null">dept_id = #{deptId},</if>
<if test="postId != null">post_id = #{postId},</if>
<if test="phone != null">phone = #{phone},</if>
<if test="idCard != null">id_card = #{idCard},</if>
<if test="bankCard != null">bank_card = #{bankCard},</if>
</trim>
where user_id = #{userId}
</update>
<delete id="deleteEmployeeInfoByUserId" parameterType="Long">
delete from oa_employee_info where user_id = #{userId}
</delete>
<delete id="deleteEmployeeInfoByUserIds" parameterType="String">
delete from oa_employee_info where user_id in
<foreach item="userId" collection="array" open="(" separator="," close=")">
#{userId}
</foreach>
</delete>
</mapper>