|
|
|
@ -52,32 +52,65 @@
|
|
|
|
|
<select id="selectBPlanEnterPriseTreeRequestRequestList"
|
|
|
|
|
resultType="com.ruoyi.programManagement.entity.request.BPlanEnterPriseTreeResponse">
|
|
|
|
|
|
|
|
|
|
-- SELECT a.subdistrict AS subdistrict,a.county,c.id,a.institution_name as institutionName,
|
|
|
|
|
-- COUNT(b.subdistrict) AS enterpriseCount,
|
|
|
|
|
-- COUNT(DISTINCT k.ent_code) - COUNT(DISTINCT c.enterprise_id) AS remainingKeyEnterpriseCount,
|
|
|
|
|
-- COUNT(DISTINCT c.enterprise_id) AS plannedEnterpriseCount,
|
|
|
|
|
-- COUNT(DISTINCT CASE WHEN k.ent_code IS NOT NULL THEN c.enterprise_id END) AS planneKeyEnterpriseCount
|
|
|
|
|
-- FROM b_administrative a
|
|
|
|
|
-- LEFT JOIN sz_ent_basic_info b ON a.subdistrict = LPAD(b.subdistrict, LENGTH(a.subdistrict), '0')
|
|
|
|
|
-- LEFT JOIN b_key_enterprise k ON a.subdistrict = k.district
|
|
|
|
|
-- LEFT JOIN b_plan_enterprise c ON k.ent_code = c.enterprise_id
|
|
|
|
|
-- WHERE a.SUBDISTRICT LIKE '%13205%'
|
|
|
|
|
select s.institutionName ,s.plannedEnterpriseCount,s.checkEnterpriseCount,s.pt from (SELECT
|
|
|
|
|
a. institution_name AS institutionName,
|
|
|
|
|
COUNT(DISTINCT b.enterprise_id) AS plannedEnterpriseCount,
|
|
|
|
|
COUNT(DISTINCT c.USC_CODE) AS checkEnterpriseCount,
|
|
|
|
|
COUNT(DISTINCT c.USC_CODE) / COUNT(DISTINCT b.enterprise_id) AS pt
|
|
|
|
|
SELECT
|
|
|
|
|
s.institutionName,
|
|
|
|
|
s.county,
|
|
|
|
|
s.plannedEnterpriseCount,
|
|
|
|
|
IFNULL( s.checkEnterpriseCount, 0 ) AS checkEnterpriseCount,
|
|
|
|
|
IFNULL( s.pt, 0 ) AS pt
|
|
|
|
|
FROM
|
|
|
|
|
b_administrative a
|
|
|
|
|
LEFT JOIN b_plan_enterprise b ON SUBSTRING(a.county, 1, 8) = SUBSTRING(b.district, 1, 8)
|
|
|
|
|
LEFT JOIN sz_enfor_examine c ON b.enterprise_id = c.USC_CODE
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
institution_name AS institutionName,
|
|
|
|
|
county,
|
|
|
|
|
COUNT( enterprise_id ) AS plannedEnterpriseCount,
|
|
|
|
|
SUM( checkStatus ) AS checkEnterpriseCount,
|
|
|
|
|
SUM( checkStatus ) / COUNT( enterprise_id ) AS pt
|
|
|
|
|
FROM
|
|
|
|
|
( SELECT institution_name, county FROM b_administrative WHERE SUBDISTRICT = '' AND institution_name != '苏州市'
|
|
|
|
|
) a
|
|
|
|
|
LEFT JOIN (
|
|
|
|
|
SELECT
|
|
|
|
|
enterprise_id,
|
|
|
|
|
district,
|
|
|
|
|
max( checkStatus ) AS checkStatus
|
|
|
|
|
FROM
|
|
|
|
|
(
|
|
|
|
|
SELECT
|
|
|
|
|
e.enterprise_id,
|
|
|
|
|
SUBSTRING( e.district, 1, 8 ) AS district,
|
|
|
|
|
CASE
|
|
|
|
|
|
|
|
|
|
WHEN f.USC_CODE IS NOT NULL
|
|
|
|
|
AND SUBSTRING( e.planned_year, 1, 7 ) = SUBSTRING( f.EXAMINE_START_TIME, 1, 7 ) THEN
|
|
|
|
|
1 ELSE 0
|
|
|
|
|
END AS checkStatus
|
|
|
|
|
FROM
|
|
|
|
|
b_plan_enterprise e
|
|
|
|
|
LEFT JOIN sz_enfor_examine f ON e.enterprise_id = f.USC_CODE
|
|
|
|
|
<where>
|
|
|
|
|
<if test="req.plannedYear!=null and req.plannedYear!=''">
|
|
|
|
|
b.planned_year like concat('%',#{req.plannedYear}, '%')
|
|
|
|
|
e.planned_year like concat('%',#{req.plannedYear}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
GROUP BY SUBSTRING(a.county, 1, 8) )s
|
|
|
|
|
where s.institutionName!='苏州市'
|
|
|
|
|
) t
|
|
|
|
|
GROUP BY
|
|
|
|
|
enterprise_id
|
|
|
|
|
) p ON SUBSTRING( a.county, 1, 8 ) = p.district
|
|
|
|
|
GROUP BY
|
|
|
|
|
a.county
|
|
|
|
|
ORDER BY
|
|
|
|
|
a.county
|
|
|
|
|
) s
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getBydistinct" resultType="java.lang.String">
|
|
|
|
|
select institution_name
|
|
|
|
|
from b_administrative
|
|
|
|
|
where county = #{paddedString} and subdistrict =''
|
|
|
|
|
union all
|
|
|
|
|
select institution_name
|
|
|
|
|
from b_administrative
|
|
|
|
|
where subdistrict = #{district}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|