88 lines
3.4 KiB
XML
88 lines
3.4 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.ruoyi.oa.mapper.OaProgressMapper">
|
|||
|
|
|
|||
|
|
<resultMap type="com.ruoyi.oa.domain.OaProgress" id="OaProgressResult">
|
|||
|
|
<result property="progressId" column="progress_id"/>
|
|||
|
|
<result property="projectId" column="project_id"/>
|
|||
|
|
<result property="type" column="type"/>
|
|||
|
|
<result property="progressName" column="progress_name"/>
|
|||
|
|
<result property="parentId" column="parent_id"/>
|
|||
|
|
<result property="createBy" column="create_by"/>
|
|||
|
|
<result property="createTime" column="create_time"/>
|
|||
|
|
<result property="updateBy" column="update_by"/>
|
|||
|
|
<result property="updateTime" column="update_time"/>
|
|||
|
|
<result property="delFlag" column="del_flag"/>
|
|||
|
|
<result property="sort" column="sort"/>
|
|||
|
|
<result property="remark" column="remark"/>
|
|||
|
|
<result property="status" column="status"/>
|
|||
|
|
<result property="timeRemark" column="time_remark"/>
|
|||
|
|
<result property="contactPhone" column="contact_phone"/>
|
|||
|
|
</resultMap>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<select id="getKeyList" resultType="com.ruoyi.oa.domain.OaProgressDetail">
|
|||
|
|
select distinct detail_name, department
|
|||
|
|
from oa_progress_detail
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
|
|||
|
|
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaProgressVo">
|
|||
|
|
SELECT
|
|||
|
|
op.progress_id,
|
|||
|
|
op.project_id,
|
|||
|
|
op.contact_phone,
|
|||
|
|
op.type,
|
|||
|
|
op.progress_name,
|
|||
|
|
op.parent_id,
|
|||
|
|
op.del_flag,
|
|||
|
|
op.sort,
|
|||
|
|
op.remark,
|
|||
|
|
op.status,
|
|||
|
|
op.amount,
|
|||
|
|
op.time_remark,
|
|||
|
|
sop.project_name,
|
|||
|
|
sop.project_num,
|
|||
|
|
sop.funds,
|
|||
|
|
-- 获取 detail_status = 0 且 plan_start_date 最小的记录的 detail_name 作为 nowLevel
|
|||
|
|
(
|
|||
|
|
SELECT d.detail_name
|
|||
|
|
FROM oa_progress_detail d
|
|||
|
|
WHERE d.progress_id = op.progress_id
|
|||
|
|
AND d.detail_status = 0
|
|||
|
|
ORDER BY d.plan_start_date ASC
|
|||
|
|
LIMIT 1
|
|||
|
|
) AS nowLevel,
|
|||
|
|
(
|
|||
|
|
SELECT d.detail_id
|
|||
|
|
FROM oa_progress_detail d
|
|||
|
|
WHERE d.progress_id = op.progress_id
|
|||
|
|
AND d.detail_status = 0
|
|||
|
|
ORDER BY d.plan_start_date ASC
|
|||
|
|
LIMIT 1
|
|||
|
|
) AS nowLevelId,
|
|||
|
|
-- 计算该记录 plan_end_date 与当前时间的天数差值作为 remainTime
|
|||
|
|
(
|
|||
|
|
SELECT TIMESTAMPDIFF(DAY, NOW(), d.plan_end_date)
|
|||
|
|
FROM oa_progress_detail d
|
|||
|
|
WHERE d.progress_id = op.progress_id
|
|||
|
|
AND d.detail_status = 0
|
|||
|
|
ORDER BY d.plan_start_date ASC
|
|||
|
|
LIMIT 1
|
|||
|
|
) AS remainTime,
|
|||
|
|
-- 计算当前 progress 对应的 detail 完成比例:满足 detail_status = 1 的条数 / 总条数(避免除0)
|
|||
|
|
(
|
|||
|
|
SELECT IF(COUNT(*) = 0, 0, ROUND(SUM(CASE WHEN d.detail_status = 1 THEN 1 ELSE 0 END) / COUNT(*), 2))
|
|||
|
|
FROM oa_progress_detail d
|
|||
|
|
WHERE d.progress_id = op.progress_id
|
|||
|
|
) AS detailCompletePercent
|
|||
|
|
FROM oa_progress op
|
|||
|
|
LEFT JOIN sys_oa_project sop ON sop.project_id = op.project_id
|
|||
|
|
${ew.getCustomSqlSegment}
|
|||
|
|
</select>
|
|||
|
|
|
|||
|
|
|
|||
|
|
</mapper>
|