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/job/JobMapper.xml

356 lines
12 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.job.JobMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.job.po.JobPO">
<result column="id" property="id"/>
<result column="job_no" property="jobNo"/>
<result column="job_name" property="jobName"/>
<result column="parent_comp" property="parentComp"/>
<result column="parent_dept" property="parentDept"/>
<result column="sequence_id" property="sequenceId"/>
<result column="scheme_id" property="schemeId"/>
<result column="parent_job" property="parentJob"/>
<result column="is_key" property="isKey"/>
<result column="workplace" property="workplace"/>
<result column="work_duty" property="workDuty"/>
<result column="work_authority" property="workAuthority"/>
<result column="description" property="description"/>
<result column="forbidden_tag" property="forbiddenTag"/>
<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.job_no,
t.job_name,
t.parent_comp,
t.parent_dept,
t.sequence_id,
t.scheme_id,
t.parent_job,
t.is_key,
t.workplace,
t.description,
t.work_duty,
t.work_authority,
t.forbidden_tag
</sql>
<insert id="insertIgnoreNull" parameterType="com.engine.organization.entity.job.po.JobPO"
keyProperty="id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_job
<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="jobNo != null ">
job_no,
</if>
<if test="jobName != null ">
job_name,
</if>
<if test="parentComp != null ">
parent_comp,
</if>
<if test="parentDept != null ">
parent_dept,
</if>
<if test="sequenceId != null ">
sequence_id,
</if>
<if test="schemeId != null ">
scheme_id,
</if>
<if test="parentJob != null ">
parent_job,
</if>
<if test="isKey != null ">
is_key,
</if>
<if test="workplace != null ">
workplace,
</if>
<if test="description != null ">
description,
</if>
<if test="workDuty != null ">
work_duty,
</if>
<if test="workAuthority != null ">
work_authority,
</if>
forbidden_tag,
</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="jobNo != null ">
#{jobNo},
</if>
<if test="jobName != null ">
#{jobName},
</if>
<if test="parentComp != null ">
#{parentComp},
</if>
<if test="parentDept != null ">
#{parentDept},
</if>
<if test="sequenceId != null ">
#{sequenceId},
</if>
<if test="schemeId != null ">
#{schemeId},
</if>
<if test="parentJob != null ">
#{parentJob},
</if>
<if test="isKey != null ">
#{isKey},
</if>
<if test="workplace != null ">
#{workplace},
</if>
<if test="description != null ">
#{description},
</if>
<if test="workDuty != null ">
#{workDuty},
</if>
<if test="workAuthority != null ">
#{workAuthority},
</if>
0,
</trim>
</insert>
<update id="updateBaseJob" parameterType="com.engine.organization.entity.job.po.JobPO">
update jcl_org_job
<set>
creator=#{creator},
update_time=#{updateTime},
job_name=#{jobName},
parent_comp=#{parentComp},
parent_dept=#{parentDept},
sequence_id=#{sequenceId},
scheme_id=#{schemeId},
parent_job=#{parentJob},
is_key=#{isKey},
workplace=#{workplace},
description=#{description},
work_duty=#{workDuty},
work_authority=#{workAuthority},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="updateForbiddenTagById">
update jcl_org_job
<set>
forbidden_tag=#{forbiddenTag},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="deleteByIds">
UPDATE jcl_org_job
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</update>
<select id="listByFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO"
parameterType="com.engine.organization.entity.job.po.JobPO">
SELECT
a.comp_name ,
b.dept_name ,
c.sequence_name,
d.scheme_name,
<include refid="baseColumns"/>
FROM jcl_org_job t
inner join jcl_org_comp a on
t.parent_comp = a.id
inner join jcl_org_dept b on
t.parent_dept = b.id
left join jcl_org_sequence c on
t.sequence_id = c.id
left join jcl_org_scheme d on
t.scheme_id = d.id
WHERE t.delete_type = 0
<include refid="likeSQL"/>
<if test=" parentComp != null ">
and t.parent_comp = #{parentComp}
</if>
<if test=" parentDept != null ">
and t.parent_dept = #{parentDept}
</if>
<if test=" sequenceId != null ">
and t.sequence_id = #{sequenceId}
</if>
<if test=" schemeId != null ">
and t.scheme_id = #{schemeId}
</if>
<if test=" isKey != null ">
and t.is_key = #{isKey}
</if>
<if test=" forbiddenTag != null ">
and t.forbidden_tag = #{forbiddenTag}
</if>
</select>
<select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO">
SELECT
a.comp_name ,
b.dept_name ,
c.sequence_name,
d.scheme_name,
<include refid="baseColumns"/>
FROM jcl_org_job t
inner join jcl_org_comp a on
t.parent_comp = a.id
inner join jcl_org_dept b on
t.parent_dept = b.id
left join jcl_org_sequence c on
t.sequence_id = c.id
left join jcl_org_scheme d on
t.scheme_id = d.id
WHERE t.delete_type = 0
</select>
<select id="getJobById" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_job t
where delete_type = 0
and id = #{id}
</select>
<select id="listJobsByIds" resultType="java.util.Map">
select
id,
job_name as name
from jcl_org_job t
WHERE delete_type = 0
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<select id="listByNo" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_job t where job_no = #{jobNo} AND delete_type = 0
</select>
<select id="getJobsByPid" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_job t
where delete_type = 0
and parent_job = #{pid}
</select>
3 years ago
<select id="listUsedId" resultType="java.lang.String">
select job_id
from JCL_ORG_STAFF
where delete_type = 0
</select>
3 years ago
<select id="listJobsByDepartmentId" resultMap="BaseResultMap">
select
<include refid="baseColumns"/>
from jcl_org_job t
where delete_type = 0
and parent_dept = #{departmentId}
</select>
<sql id="likeSQL">
<if test=" jobNo != null and jobNo != '' ">
and t.job_no like CONCAT('%',#{jobNo},'%')
</if>
<if test=" jobName != null and jobName != '' ">
and t.job_name like CONCAT('%',#{jobName},'%')
</if>
<if test=" workplace != null and workplace != '' ">
and t.workplace like CONCAT('%',#{workplace},'%')
</if>
<if test=" description != null and description != '' ">
and t.description like CONCAT('%',#{description},'%')
</if>
<if test=" workDuty != null and workDuty != '' ">
and t.work_duty like CONCAT('%',#{workDuty},'%')
</if>
<if test=" workAuthority != null and workAuthority != '' ">
and t.work_authority like CONCAT('%',#{workAuthority},'%')
</if>
</sql>
<sql id="likeSQL" databaseId="oracle">
<if test=" jobNo != null and jobNo != '' ">
and t.job_no like '%'||#{jobNo}||'%'
</if>
<if test=" jobName != null and jobName != '' ">
and t.job_name like '%'||#{jobName}||'%'
</if>
<if test=" workplace != null and workplace != '' ">
and t.workplace like '%'||#{workplace}||'%'
</if>
<if test=" description != null and description != '' ">
and t.description like '%'||#{description}||'%'
</if>
<if test=" workDuty != null and workDuty != '' ">
and t.work_duty like '%'||#{workDuty}||'%'
</if>
<if test=" workAuthority != null and workAuthority != '' ">
and t.work_authority like '%'||#{workAuthority}||'%'
</if>
</sql>
<sql id="likeSQL" databaseId="sqlserver">
<if test=" jobNo != null and jobNo != '' ">
and t.job_no like '%'+#{jobNo}+'%'
</if>
<if test=" jobName != null and jobName != '' ">
and t.job_name like '%'+#{jobName}+'%'
</if>
<if test=" workplace != null and workplace != '' ">
and t.workplace like '%'+#{workplace}+'%'
</if>
<if test=" description != null and description != '' ">
and t.description like '%'+#{description}+'%'
</if>
<if test=" workDuty != null and workDuty != '' ">
and t.work_duty like '%'+#{workDuty}+'%'
</if>
<if test=" workAuthority != null and workAuthority != '' ">
and t.work_authority like '%'+#{workAuthority}+'%'
</if>
</sql>
</mapper>