2025-07-16 15:37:19 +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.weaver.seconddev.xianghui.performance.mapper.HrKpiFlowMapper">
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="hrKpiFlowResultMap" type="com.weaver.seconddev.xianghui.performance.entity.po.HrKpiFlowPO">
|
|
|
|
|
|
<id property="id" column="id"/>
|
|
|
|
|
|
<result property="kpiUser" column="KPI_USER"/>
|
|
|
|
|
|
<result property="name" column="NAME"/>
|
|
|
|
|
|
<result property="kpiCurrentStep" column="kpi_current_step"/>
|
|
|
|
|
|
<result property="dateType" column="DATE_TYPE"/>
|
|
|
|
|
|
<result property="flowStatus" column="flow_status"/>
|
|
|
|
|
|
<result property="realPeriod" column="REAL_PERIOD"/>
|
|
|
|
|
|
<result property="createTime" column="create_time"/>
|
|
|
|
|
|
<result property="departmentId" column="department"/>
|
|
|
|
|
|
<result property="score" column="score"/>
|
2025-07-16 18:04:58 +08:00
|
|
|
|
<result property="jobNum" column="job_num"/>
|
2025-07-16 15:37:19 +08:00
|
|
|
|
<!-- 未查询的字段不需要映射,会自动为null -->
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectHrKpiFlowList" resultMap="hrKpiFlowResultMap">
|
|
|
|
|
|
SELECT
|
|
|
|
|
|
hkf.id,
|
|
|
|
|
|
hkf.KPI_USER,
|
|
|
|
|
|
hkf.NAME,
|
|
|
|
|
|
hkf.kpi_current_step,
|
|
|
|
|
|
hkf.DATE_TYPE,
|
|
|
|
|
|
hkf.score,
|
2025-07-16 18:04:58 +08:00
|
|
|
|
e.job_num,
|
2025-07-16 15:37:19 +08:00
|
|
|
|
CASE
|
|
|
|
|
|
WHEN hkf.flow_status IN ('noScore', 'noApprove')
|
|
|
|
|
|
THEN 'scoreOverTime'
|
|
|
|
|
|
ELSE hkf.flow_status
|
|
|
|
|
|
END AS flow_status,
|
|
|
|
|
|
hkf.create_time,
|
|
|
|
|
|
hkf.REAL_PERIOD,
|
|
|
|
|
|
CASE
|
|
|
|
|
|
WHEN d.id = sub.id AND sub.id IS NOT NULL
|
|
|
|
|
|
THEN NULL
|
|
|
|
|
|
ELSE d.id
|
|
|
|
|
|
END AS department
|
|
|
|
|
|
FROM
|
|
|
|
|
|
HR_KPI_FLOW hkf
|
|
|
|
|
|
JOIN
|
|
|
|
|
|
eteams.employee e ON hkf.kpi_user = e.id
|
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
|
eteams.department d ON e.department = d.id
|
|
|
|
|
|
LEFT JOIN
|
|
|
|
|
|
eteams.department sub ON d.subcompanyid = sub.id
|
|
|
|
|
|
WHERE
|
|
|
|
|
|
hkf.delete_type = 0
|
|
|
|
|
|
AND hkf.TENANT_KEY = #{tenantKey}
|
|
|
|
|
|
AND hkf.REAL_PERIOD >= #{startDate}
|
|
|
|
|
|
AND hkf.REAL_PERIOD <= #{endDate}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="findOperatorsByStepId" resultType="java.lang.Long">
|
|
|
|
|
|
SELECT CASE WHEN hrfs.step_status='appeals' THEN Hkfo.complainant_User ELSE hkfo.OPERATER END AS OPERATER
|
|
|
|
|
|
FROM hr_kpi_flow_step hrfs
|
|
|
|
|
|
LEFT JOIN hr_kpi_flow_step hrfs2 ON hrfs.KPI_FLOW = hrfs2.KPI_FLOW
|
|
|
|
|
|
and hrfs.STEP_TYPE = hrfs2.STEP_TYPE
|
|
|
|
|
|
AND (
|
|
|
|
|
|
(hrfs2.DISTRIBUTE_TYPE = hrfs.DISTRIBUTE_TYPE and (hrfs.next_step = hrfs2.next_step or (hrfs.next_step IS NULL
|
|
|
|
|
|
AND hrfs2.next_step IS NULL)) and
|
|
|
|
|
|
(hrfs2.STEP_STATUS = 'kpsing' or hrfs2.STEP_STATUS = 'kpsback'))
|
|
|
|
|
|
or (
|
|
|
|
|
|
hrfs2.STEP_STATUS = 'processing' or hrfs2.STEP_STATUS = 'back' or hrfs2.STEP_STATUS = 'appeals')
|
|
|
|
|
|
)
|
|
|
|
|
|
JOIN HR_KPI_FLOW_OPERATOR hkfo ON hkfo.KPI_FLOW_STEP = hrfs.id
|
|
|
|
|
|
and hkfo.OPERATER is not null
|
|
|
|
|
|
and hkfo.OPERATE_STATUS = 'opKpsStart'
|
|
|
|
|
|
and hkfo.delete_type = 0
|
|
|
|
|
|
and (hrfs.delete_type=0 or hrfs.delete_type is null)
|
|
|
|
|
|
and (hrfs2.delete_type=0 or hrfs2.delete_type is null)
|
|
|
|
|
|
and hkfo.TENANT_KEY = #{tenantKey}
|
|
|
|
|
|
WHERE hrfs.id = #{stepId}
|
|
|
|
|
|
and hrfs.TENANT_KEY = #{tenantKey}
|
|
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
|
|
SELECT CASE WHEN hrfs2.step_status='appeals' THEN Hkfo.complainant_User ELSE hkfo.OPERATER END AS OPERATER
|
|
|
|
|
|
FROM hr_kpi_flow_step hrfs
|
|
|
|
|
|
LEFT JOIN hr_kpi_flow_step hrfs2 ON hrfs.KPI_FLOW = hrfs2.KPI_FLOW
|
|
|
|
|
|
and hrfs.STEP_TYPE = hrfs2.STEP_TYPE
|
|
|
|
|
|
AND ((hrfs2.DISTRIBUTE_TYPE = hrfs.DISTRIBUTE_TYPE and (hrfs.next_step = hrfs2.next_step or (hrfs.next_step IS
|
|
|
|
|
|
NULL AND hrfs2.next_step IS NULL)) and
|
|
|
|
|
|
(hrfs2.STEP_STATUS = 'kpsing' or hrfs2.STEP_STATUS = 'kpsback'))
|
|
|
|
|
|
or (
|
|
|
|
|
|
hrfs2.STEP_STATUS = 'processing' or hrfs2.STEP_STATUS = 'back' or hrfs2.STEP_STATUS = 'appeals')
|
|
|
|
|
|
)
|
|
|
|
|
|
JOIN HR_KPI_FLOW_OPERATOR hkfo ON hkfo.KPI_FLOW_STEP = hrfs2.id
|
|
|
|
|
|
and hkfo.OPERATER is not null
|
|
|
|
|
|
and hkfo.OPERATE_STATUS = 'opKpsStart'
|
|
|
|
|
|
and hkfo.delete_type = 0
|
|
|
|
|
|
and (hrfs.delete_type=0 or hrfs.delete_type is null)
|
|
|
|
|
|
and (hrfs2.delete_type=0 or hrfs2.delete_type is null)
|
|
|
|
|
|
and hkfo.TENANT_KEY = #{tenantKey}
|
|
|
|
|
|
WHERE hrfs.id = #{stepId}
|
|
|
|
|
|
and hrfs.TENANT_KEY = #{tenantKey}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|