weaver-hrm-salary/src/com/engine/salary/mapper/extemp/ExternalEmployeeMapper.xml

468 lines
15 KiB
XML
Raw Normal View History

2023-03-01 09:05:03 +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" >
<mapper namespace="com.engine.salary.mapper.extemp.ExternalEmployeeMapper">
<resultMap id="BaseResultMap" type="com.engine.salary.entity.extemp.po.ExtEmpPO">
<result column="id" property="id"/>
<result column="username" property="username"/>
<result column="department_name" property="departmentName"/>
<result column="department_id" property="departmentId"/>
<result column="subcompany_name" property="subcompanyName"/>
<result column="subcompany_id" property="subcompanyId"/>
<result column="jobtitle_name" property="jobtitleName"/>
<result column="jobtitle_id" property="jobtitleId"/>
<result column="companystartdate" property="companystartdate"/>
<result column="mobile" property="mobile"/>
<result column="status" property="status"/>
<result column="workcode" property="workcode"/>
<result column="sex" property="sex"/>
<result column="email" property="email"/>
<result column="telephone" property="telephone"/>
<result column="jobcall" property="jobcall"/>
<result column="birthday" property="birthday"/>
<result column="id_no" property="idNo"/>
<result column="bank_card_num" property="bankCardNum"/>
<result column="bank_name" property="bankName"/>
<result column="delete_type" property="deleteType"/>
<result column="creator" property="creator"/>
<result column="modifier" property="modifier"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="tenant_key" property="tenantKey"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.username
, t.department_name
, t.department_id
, t.subcompany_name
, t.subcompany_id
, t.jobtitle_name
, t.jobtitle_id
, t.companystartdate
, t.mobile
, t.status
, t.workcode
, t.sex
, t.email
, t.telephone
, t.jobcall
, t.birthday
, t.id_no
, t.bank_card_num
, t.bank_name
, t.delete_type
, t.creator
, t.modifier
, t.create_time
, t.update_time
, t.tenant_key
</sql>
<!-- 查询全部 -->
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hrsa_external_employee t
WHERE delete_type = 0
</select>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_external_employee t
WHERE id = #{id} AND delete_type = 0
</select>
<!-- 条件查询 -->
<select id="listSome" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.extemp.po.ExtEmpPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_external_employee t
WHERE delete_type = 0
<if test="id != null">
AND id = #{id}
</if>
<if test="username != null">
AND username = #{username}
</if>
<if test="departmentName != null">
AND department_name = #{departmentName}
</if>
<if test="departmentId != null">
AND department_id = #{departmentId}
</if>
<if test="subcompanyName != null">
AND subcompany_name = #{subcompanyName}
</if>
<if test="subcompanyId != null">
AND subcompany_id = #{subcompanyId}
</if>
<if test="jobtitleName != null">
AND jobtitle_name = #{jobtitleName}
</if>
<if test="jobtitleId != null">
AND jobtitle_id = #{jobtitleId}
</if>
<if test="companystartdate != null">
AND companystartdate = #{companystartdate}
</if>
<if test="mobile != null">
AND mobile = #{mobile}
</if>
<if test="status != null">
AND status = #{status}
</if>
<if test="workcode != null">
AND workcode = #{workcode}
</if>
<if test="sex != null">
AND sex = #{sex}
</if>
<if test="email != null">
AND email = #{email}
</if>
<if test="telephone != null">
AND telephone = #{telephone}
</if>
<if test="jobcall != null">
AND jobcall = #{jobcall}
</if>
<if test="birthday != null">
AND birthday = #{birthday}
</if>
<if test="idNo != null">
AND id_no = #{idNo}
</if>
<if test="bankCardNum != null">
AND bank_card_num = #{bankCardNum}
</if>
<if test="bankName != null">
AND bank_name = #{bankName}
</if>
<if test="deleteType != null">
AND delete_type = #{deleteType}
</if>
<if test="creator != null">
AND creator = #{creator}
</if>
<if test="modifier != null">
AND modifier = #{modifier}
</if>
<if test="createTime != null">
AND create_time = #{createTime}
</if>
<if test="updateTime != null">
AND update_time = #{updateTime}
</if>
<if test="tenantKey != null">
AND tenant_key = #{tenantKey}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
ORDER BY id DESC
</select>
<!-- 插入不为NULL的字段 -->
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.extemp.po.ExtEmpPO">
INSERT INTO hrsa_external_employee
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="username != null">
username,
</if>
<if test="departmentName != null">
department_name,
</if>
<if test="departmentId != null">
department_id,
</if>
<if test="subcompanyName != null">
subcompany_name,
</if>
<if test="subcompanyId != null">
subcompany_id,
</if>
<if test="jobtitleName != null">
jobtitle_name,
</if>
<if test="jobtitleId != null">
jobtitle_id,
</if>
<if test="companystartdate != null">
companystartdate,
</if>
<if test="mobile != null">
mobile,
</if>
<if test="status != null">
status,
</if>
<if test="workcode != null">
workcode,
</if>
<if test="sex != null">
sex,
</if>
<if test="email != null">
email,
</if>
<if test="telephone != null">
telephone,
</if>
<if test="jobcall != null">
jobcall,
</if>
<if test="birthday != null">
birthday,
</if>
<if test="idNo != null">
id_no,
</if>
<if test="bankCardNum != null">
bank_card_num,
</if>
<if test="bankName != null">
bank_name,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="creator != null">
creator,
</if>
<if test="modifier != null">
modifier,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="tenantKey != null">
tenant_key,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="username != null">
#{username},
</if>
<if test="departmentName != null">
#{departmentName},
</if>
<if test="departmentId != null">
#{departmentId},
</if>
<if test="subcompanyName != null">
#{subcompanyName},
</if>
<if test="subcompanyId != null">
#{subcompanyId},
</if>
<if test="jobtitleName != null">
#{jobtitleName},
</if>
<if test="jobtitleId != null">
#{jobtitleId},
</if>
<if test="companystartdate != null">
#{companystartdate},
</if>
<if test="mobile != null">
#{mobile},
</if>
<if test="status != null">
#{status},
</if>
<if test="workcode != null">
#{workcode},
</if>
<if test="sex != null">
#{sex},
</if>
<if test="email != null">
#{email},
</if>
<if test="telephone != null">
#{telephone},
</if>
<if test="jobcall != null">
#{jobcall},
</if>
<if test="birthday != null">
#{birthday},
</if>
<if test="idNo != null">
#{idNo},
</if>
<if test="bankCardNum != null">
#{bankCardNum},
</if>
<if test="bankName != null">
#{bankName},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="creator != null">
#{creator},
</if>
<if test="modifier != null">
#{modifier},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="tenantKey != null">
#{tenantKey},
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.extemp.po.ExtEmpPO">
UPDATE hrsa_external_employee
<set>
username=#{username},
department_name=#{departmentName},
department_id=#{departmentId},
subcompany_name=#{subcompanyName},
subcompany_id=#{subcompanyId},
jobtitle_name=#{jobtitleName},
jobtitle_id=#{jobtitleId},
companystartdate=#{companystartdate},
mobile=#{mobile},
status=#{status},
workcode=#{workcode},
sex=#{sex},
email=#{email},
telephone=#{telephone},
jobcall=#{jobcall},
birthday=#{birthday},
id_no=#{idNo},
bank_card_num=#{bankCardNum},
bank_name=#{bankName},
delete_type=#{deleteType},
creator=#{creator},
modifier=#{modifier},
create_time=#{createTime},
update_time=#{updateTime},
tenant_key=#{tenantKey},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 更新不为NULL的字段 -->
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.extemp.po.ExtEmpPO">
UPDATE hrsa_external_employee
<set>
<if test="username != null">
username=#{username},
</if>
<if test="departmentName != null">
department_name=#{departmentName},
</if>
<if test="departmentId != null">
department_id=#{departmentId},
</if>
<if test="subcompanyName != null">
subcompany_name=#{subcompanyName},
</if>
<if test="subcompanyId != null">
subcompany_id=#{subcompanyId},
</if>
<if test="jobtitleName != null">
jobtitle_name=#{jobtitleName},
</if>
<if test="jobtitleId != null">
jobtitle_id=#{jobtitleId},
</if>
<if test="companystartdate != null">
companystartdate=#{companystartdate},
</if>
<if test="mobile != null">
mobile=#{mobile},
</if>
<if test="status != null">
status=#{status},
</if>
<if test="workcode != null">
workcode=#{workcode},
</if>
<if test="sex != null">
sex=#{sex},
</if>
<if test="email != null">
email=#{email},
</if>
<if test="telephone != null">
telephone=#{telephone},
</if>
<if test="jobcall != null">
jobcall=#{jobcall},
</if>
<if test="birthday != null">
birthday=#{birthday},
</if>
<if test="idNo != null">
id_no=#{idNo},
</if>
<if test="bankCardNum != null">
bank_card_num=#{bankCardNum},
</if>
<if test="bankName != null">
bank_name=#{bankName},
</if>
<if test="deleteType != null">
delete_type=#{deleteType},
</if>
<if test="creator != null">
creator=#{creator},
</if>
<if test="modifier != null">
modifier=#{modifier},
</if>
<if test="createTime != null">
create_time=#{createTime},
</if>
<if test="updateTime != null">
update_time=#{updateTime},
</if>
<if test="tenantKey != null">
tenant_key=#{tenantKey},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<!-- 根据主键删除记录 -->
<delete id="delete">
UPDATE hrsa_external_employee
SET delete_type=1
WHERE id = #{id}
AND delete_type = 0
</delete>
</mapper>