You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
weaver-hrm-organization/src/com/engine/organization/mapper/staff/StaffMapper.xml

207 lines
6.6 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.engine.organization.mapper.staff.StaffMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.staff.po.StaffPO">
<result column="id" property="id"/>
<result column="plan_id" property="planId"/>
<result column="comp_id" property="compId"/>
<result column="dept_id" property="deptId"/>
<result column="job_id" property="jobId"/>
<result column="staff_num" property="staffNum"/>
<result column="control_policy" property="controlPolicy"/>
<result column="permanent_num" property="permanentNum"/>
<result column="freeze_num" property="freezeNum"/>
<result column="lack_status" property="lackStatus"/>
<result column="staff_desc" property="staffDesc"/>
<result column="description" property="description"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t
.
id
, t.plan_id
, t.comp_id
, t.dept_id
, t.job_id
, t.staff_num
, t.control_policy
, t.permanent_num
, t.freeze_num
, t.lack_status
, t.staff_desc
, t.description
</sql>
<select id="getStaffByID" parameterType="com.engine.organization.entity.staff.po.StaffPO"
resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staff t where id = #{id} AND delete_type = 0
</select>
<select id="listUsedId" resultType="java.lang.String">
select staff_id
from jcl_org_staffs
where delete_type = 0
</select>
<select id="getStaffByFilter" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staff t
where delete_type = 0
<if test="companyId != null">
and comp_id = #{companyId}
</if>
<if test="departmentId != null">
and dept_id = #{departmentId}
</if>
<if test="jobId != null">
and job_id = #{jobId}
</if>
</select>
<select id="getStaffsByIds" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_staff t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<update id="updateStaff" parameterType="com.engine.organization.entity.staff.po.StaffPO">
update jcl_org_staff
<set>
creator=#{creator},
update_time=#{updateTime},
plan_id=#{planId},
comp_id=#{compId},
dept_id=#{deptId},
job_id=#{jobId},
staff_num=#{staffNum},
control_policy=#{controlPolicy},
permanent_num=#{permanentNum},
freeze_num=#{freezeNum},
lack_status=#{lackStatus},
staff_desc=#{staffDesc},
description=#{description},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.staff.po.StaffPO" keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_staff
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="creator != null">
creator,
</if>
<if test="deleteType != null">
delete_type,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="planId != null ">
plan_id,
</if>
<if test="compId != null ">
comp_id,
</if>
<if test="deptId != null ">
dept_id,
</if>
<if test="jobId != null ">
job_id,
</if>
<if test="staffNum != null ">
staff_num,
</if>
<if test="controlPolicy != null ">
control_policy,
</if>
<if test="permanentNum != null ">
permanent_num,
</if>
<if test="freezeNum != null ">
freeze_num,
</if>
<if test="lackStatus != null ">
lack_status,
</if>
<if test="staffDesc != null ">
staff_desc,
</if>
<if test="description != null ">
description,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="creator != null">
#{creator},
</if>
<if test="deleteType != null">
#{deleteType},
</if>
<if test="createTime != null">
#{createTime},
</if>
<if test="updateTime != null">
#{updateTime},
</if>
<if test="planId != null ">
#{planId},
</if>
<if test="compId != null ">
#{compId},
</if>
<if test="deptId != null ">
#{deptId},
</if>
<if test="jobId != null ">
#{jobId},
</if>
<if test="staffNum != null ">
#{staffNum},
</if>
<if test="controlPolicy != null ">
#{controlPolicy},
</if>
<if test="permanentNum != null ">
#{permanentNum},
</if>
<if test="freezeNum != null ">
#{freezeNum},
</if>
<if test="lackStatus != null ">
#{lackStatus},
</if>
<if test="staffDesc != null ">
#{staffDesc},
</if>
<if test="description != null ">
#{description},
</if>
</trim>
</insert>
<update id="deleteByIds">
UPDATE jcl_org_staff
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>