2022-05-25 16:37:44 +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.organization.mapper.staff.StaffPlanMapper" >
<resultMap id= "BaseResultMap" type= "com.engine.organization.entity.staff.po.StaffPlanPO" >
<result column= "id" property= "id" />
<result column= "plan_no" property= "planNo" />
<result column= "plan_name" property= "planName" />
<result column= "plan_year" property= "planYear" />
<result column= "time_start" property= "timeStart" />
<result column= "time_end" property= "timeEnd" />
<result column= "company_id" property= "companyId" />
2022-09-06 09:45:56 +08:00
<result column= "ec_company" property= "ecCompany" />
2022-08-02 13:39:47 +08:00
<result column= "control_dimension" property= "controlDimension" />
2022-05-25 16:37:44 +08:00
<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.plan_no
, t.plan_name
, t.plan_year
, t.time_start
, t.time_end
, t.company_id
2022-09-06 09:45:56 +08:00
, t.ec_company
2022-08-02 13:39:47 +08:00
, t.control_dimension
2022-05-25 16:37:44 +08:00
, t.description
, t.forbidden_tag
, t.creator
, t.delete_type
, t.create_time
, t.update_time
</sql>
<select id= "getStaffPlanByID" parameterType= "com.engine.organization.entity.staff.po.StaffPlanPO"
resultMap="BaseResultMap">
select
<include refid= "baseColumns" />
from jcl_org_staffplan t where id = #{id} AND delete_type = 0
</select>
<select id= "listByNo" parameterType= "com.engine.organization.entity.staff.po.StaffPlanPO"
resultMap="BaseResultMap">
select
<include refid= "baseColumns" />
from jcl_org_staffplan t where plan_no = #{planNo} AND delete_type = 0
</select>
2022-05-26 10:11:02 +08:00
<select id= "listPlansByIds" resultType= "java.util.Map" >
select
2022-08-12 10:12:55 +08:00
id as "id",
plan_name as "name"
2022-05-26 10:11:02 +08:00
from jcl_org_staffplan t
WHERE delete_type = 0
AND id IN
<foreach collection= "ids" open= "(" item= "id" separator= "," close= ")" >
#{id}
</foreach>
</select>
2022-06-01 16:35:28 +08:00
<select id= "listUsedId" resultType= "java.lang.String" >
select plan_id
from JCL_ORG_STAFF
where delete_type = 0
</select>
2022-07-07 14:19:56 +08:00
<select id= "getStaffPlansByIds" resultMap= "BaseResultMap" >
select
<include refid= "baseColumns" />
from jcl_org_staffplan t
WHERE delete_type = 0
AND id IN
<foreach collection= "ids" open= "(" item= "id" separator= "," close= ")" >
#{id}
</foreach>
</select>
2022-05-25 16:37:44 +08:00
<update id= "updateStaffPlan" parameterType= "com.engine.organization.entity.staff.po.StaffPlanPO" >
update jcl_org_staffplan
<set >
creator=#{creator},
update_time=#{updateTime},
plan_no=#{planNo},
plan_name=#{planName},
plan_year=#{planYear},
time_start=#{timeStart},
time_end=#{timeEnd},
company_id=#{companyId},
2022-09-06 09:45:56 +08:00
ec_company=#{ecCompany},
2022-08-02 13:39:47 +08:00
control_dimension=#{controlDimension},
2022-05-25 16:37:44 +08:00
description=#{description},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<insert id= "insertIgnoreNull" parameterType= "com.engine.organization.entity.staff.po.StaffPlanPO" keyProperty= "id"
keyColumn="id" useGeneratedKeys="true">
INSERT INTO jcl_org_staffplan
<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= "planNo != null " >
plan_no,
</if>
<if test= "planName != null " >
plan_name,
</if>
<if test= "planYear != null " >
plan_year,
</if>
<if test= "timeStart != null " >
time_start,
</if>
<if test= "timeEnd != null " >
time_end,
</if>
<if test= "companyId != null " >
2022-08-11 10:43:52 +08:00
company_id,
</if>
2022-09-06 09:45:56 +08:00
<if test= "ecCompany != null " >
ec_company,
</if>
2022-08-11 10:43:52 +08:00
<if test= "controlDimension != null " >
control_dimension,
</if>
<if test= "description != null " >
description,
</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= "planNo != null " >
#{planNo},
</if>
<if test= "planName != null " >
#{planName},
</if>
<if test= "planYear != null " >
#{planYear},
</if>
<if test= "timeStart != null " >
#{timeStart},
</if>
<if test= "timeEnd != null " >
#{timeEnd},
</if>
<if test= "companyId != null " >
#{companyId},
</if>
2022-09-06 09:45:56 +08:00
<if test= "ecCompany != null " >
#{ecCompany},
</if>
2022-08-11 10:43:52 +08:00
<if test= "controlDimension != null " >
#{controlDimension},
</if>
<if test= "description != null " >
#{description},
</if>
0,
</trim>
</insert>
2022-09-06 09:45:56 +08:00
<insert id= "insertIgnoreNull" parameterType= "com.engine.organization.entity.staff.po.StaffPlanPO"
databaseId="oracle">
<selectKey keyProperty= "id" resultType= "long" order= "AFTER" >
2022-08-11 10:43:52 +08:00
select JCL_ORG_STAFFPLAN_ID.currval from dual
</selectKey>
INSERT INTO jcl_org_staffplan
<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= "planNo != null " >
plan_no,
</if>
<if test= "planName != null " >
plan_name,
</if>
<if test= "planYear != null " >
plan_year,
</if>
<if test= "timeStart != null " >
time_start,
</if>
<if test= "timeEnd != null " >
time_end,
</if>
<if test= "companyId != null " >
2022-05-25 16:37:44 +08:00
company_id,
</if>
2022-09-06 09:45:56 +08:00
<if test= "ecCompany != null " >
ec_company,
</if>
2022-08-02 13:39:47 +08:00
<if test= "controlDimension != null " >
control_dimension,
</if>
2022-05-25 16:37:44 +08:00
<if test= "description != null " >
description,
</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= "planNo != null " >
#{planNo},
</if>
<if test= "planName != null " >
#{planName},
</if>
<if test= "planYear != null " >
#{planYear},
</if>
<if test= "timeStart != null " >
#{timeStart},
</if>
<if test= "timeEnd != null " >
#{timeEnd},
</if>
<if test= "companyId != null " >
#{companyId},
</if>
2022-09-06 09:45:56 +08:00
<if test= "ecCompany != null " >
#{ecCompany},
</if>
2022-08-02 13:39:47 +08:00
<if test= "controlDimension != null " >
#{controlDimension},
</if>
2022-05-25 16:37:44 +08:00
<if test= "description != null " >
#{description},
</if>
0,
</trim>
</insert>
<update id= "updateForbiddenTagById" parameterType= "com.engine.organization.entity.staff.po.StaffPlanPO" >
update jcl_org_staffplan
<set >
forbidden_tag=#{forbiddenTag},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id= "deleteByIds" >
UPDATE jcl_org_staffplan
SET delete_type = 1
WHERE delete_type = 0
AND id IN
<foreach collection= "ids" open= "(" item= "id" separator= "," close= ")" >
#{id}
</foreach>
</update>
2023-09-06 09:55:43 +08:00
<select id= "customSelect" resultMap= "BaseResultMap" >
select
<include refid= "baseColumns" />
2023-09-07 15:28:30 +08:00
from jcl_org_staffplan t where
((time_start < = #{timeStart,jdbcType=DATE} AND time_end >= #{timeStart,jdbcType=DATE} OR (time_end < = #{timeEnd,jdbcType=DATE} AND time_end >= #{timeEnd,jdbcType=DATE})
2023-09-06 09:55:43 +08:00
AND ec_company = #{ecCompany}
AND control_dimension = #{controlDimension}
AND delete_type = 0
</select>
2022-05-25 16:37:44 +08:00
</mapper>