zhangtao
dongdingding 2 years ago
parent b5bd26c78b
commit 8073b61d9e

@ -103,23 +103,8 @@
-- WHERE
-- b.USC_CODE IS NOT NULL
-- ) s
SELECT p.*
SELECT s.*
FROM (
SELECT
a.*,
a.planned_year AS plannedYear,
NULL AS longId,
NULL AS EXAMINE_START_TIME,
NULL AS EXAMINE_END_TIME,
2 AS checkStatus
FROM
b_plan_enterprise a
WHERE
a.enterprise_id NOT IN (SELECT USC_CODE FROM sz_enfor_examine WHERE USC_CODE IS NOT NULL)
UNION
SELECT
a.*,
a.planned_year AS plannedYear,
@ -130,26 +115,24 @@
CASE
WHEN b.USC_CODE IS NOT NULL AND SUBSTRING(a.planned_year, 1, 7) = SUBSTRING(b.EXAMINE_START_TIME, 1, 7) THEN 1
ELSE 2
END AS checkStatus
FROM (
SELECT *,
ROW_NUMBER() OVER (PARTITION BY USC_CODE ORDER BY EXAMINE_START_TIME DESC) AS rn
FROM sz_enfor_examine
WHERE USC_CODE IS NOT NULL
) b
INNER JOIN b_plan_enterprise a ON a.enterprise_id = b.USC_CODE AND b.rn = 1
) p
END AS checkStatus,
ROW_NUMBER() OVER (PARTITION BY a.enterprise_id ORDER BY b.EXAMINE_START_TIME DESC) AS rn
FROM
b_plan_enterprise a
LEFT JOIN sz_enfor_examine b ON a.enterprise_id = b.USC_CODE AND b.USC_CODE IS NOT NULL
) s
<where>
<if test="req.plannedYear !=null and req.plannedYear !=''">
and p.plannedYear =#{req.plannedYear}
and s.plannedYear =#{req.plannedYear}
</if>
<if test="req.district !=null and req.district !=''">
and p.district like concat('%', #{req.district}, '%')
and s.district like concat('%', #{req.district}, '%')
</if>
<if test="req.checkStatus !=null and req.checkStatus !=''">
and p.checkStatus =#{req.checkStatus}
and s.checkStatus =#{req.checkStatus}
</if>
and s.rn = 1
</where>
</select>
<select id="page" resultType="com.ruoyi.programManagement.entity.BPlanEnterprise">

Loading…
Cancel
Save