You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

254 lines
9.5 KiB

<?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.programManagement.mapper.BPlanEnterpriseMapper">
2 years ago
<sql id="selectBPlanEnterpriseVo">
select id,
enterprise_id,
create_id,
create_by,
create_time,
update_id,
update_by,
update_time,
remark,
user_id,
dept_id,
district,
planned_year,
2 years ago
is_point,
enterprise_name,
law_sort,
law_areas,
law_level,
law_hierarchy,
planned_month,
status,
check_status,
check_id,
check_ageing
2 years ago
from b_plan_enterprise
</sql>
<select id="selectBPlanEnterpriseList" parameterType="BPlanEnterprise" resultType="BPlanEnterprise">
select a.id,
a. enterprise_id,
a.create_id,
a.create_by,
a.create_time,
a.update_id,
a. update_by,
a.update_time,
a.remark,
a. user_id,
a. dept_id,
a. district,
a.planned_year,
a. is_point,
a.enterprise_name,
a.law_sort,
a.law_areas,
a.law_level,
a. law_hierarchy,
a. planned_month,
a.status,
a. check_status,
a. check_id,
a.check_ageing,
CASE WHEN b.ent_code IS NOT NULL THEN 1 ELSE 2 END AS isPoint
from b_plan_enterprise a
LEFT JOIN
b_key_enterprise b ON a.enterprise_id = b.ent_code
2 years ago
<where>
<if test="enterpriseId != null and enterpriseId != ''">and a.enterprise_id = #{enterpriseId}</if>
<if test="createId != null ">and a.create_id = #{createId}</if>
<if test="updateId != null ">and a.update_id = #{updateId}</if>
<if test="userId != null ">and a.user_id = #{userId}</if>
<if test="deptId != null ">and a.dept_id = #{deptId}</if>
<if test="district != null and district != ''">and a.district like concat('%', #{district}, '%')</if>
<if test="plannedYear != null and plannedYear != ''">and a.planned_year = #{plannedYear}</if>
<if test="isPoint != null ">and a.is_point = #{isPoint}</if>
<if test="enterpriseName != null and enterpriseName != ''">and a.enterprise_name like
concat('%',#{enterpriseName}, '%')
</if>
2 years ago
</where>
order by isPoint desc
2 years ago
</select>
<delete id="deleteByPlanId">
delete
2 years ago
from b_plan_enterprise
where plan_id =
#{planId}
</delete>
<select id="getZhifa" resultType="com.ruoyi.programManagement.entity.response.BPlanEnterpriseZhifaResponse">
select * from b_plan_enterprise
<where>
<if test="req.plannedYear !=null and req.plannedYear !=''">
and planned_year =#{req.plannedYear}
</if>
<if test="req.district !=null and req.district !=''">
and district like concat('%', #{req.district}, '%')
</if>
<if test="req.plannedMonth != null and req.plannedMonth.length > 0">
AND planned_month IN
<foreach item="item" collection="req.plannedMonth" open="(" separator="," close=")">
#{item}
</foreach>
2 years ago
</if>
</where>
</select>
2 years ago
<select id="page" resultType="com.ruoyi.programManagement.entity.BPlanEnterprise">
2 years ago
select * from b_plan_enterprise
<where>
<if test="req.plannedYear !=null and req.plannedYear !=''">
and plannedYear =#{req.plannedYear}
</if>
<if test="req.district !=null and req.district !=''">
and district =#{req.district}
</if>
</where>
</select>
<select id="getzhifacount" resultType="com.ruoyi.programManagement.entity.response.zhifaCountResponse">
SELECT bpm.dept_id as deptId,
c.dept_name as deptName ,
COUNT(CASE WHEN bpe.is_point = 1 THEN 1 END) as keyPlan,
COUNT(CASE WHEN bpe.is_point = 2 THEN 1 END) as nonKeyPlan,
COUNT(CASE WHEN bpe.is_point = 1 AND exm.USC_CODE IS NOT NULL THEN 1 END) as keyCompleted ,
COUNT(CASE WHEN bpe.is_point = 2 AND exm.USC_CODE IS NULL THEN 1 END) as nonKeyCompleted,
COUNT(CASE WHEN bpe.is_point = 1 AND exm.USC_CODE IS NOT NULL THEN 1 END) * 100 /
COUNT(CASE WHEN bpe.is_point = 1 THEN 1 END) as percentageCompleted,
COUNT(CASE WHEN bpe.is_point = 2 AND exm.USC_CODE IS NULL THEN 1 END) * 100 /
COUNT(CASE WHEN bpe.is_point = 2 THEN 1 END) as percentageNonCompleted,
COUNT(*) as totalPlanCount
FROM b_plan_manage bpm
JOIN
b_plan_enterprise bpe ON bpm.id = bpe.plan_id
LEFT JOIN
sz_enfor_examine exm ON bpe.enterprise_id = exm.USC_CODE
LEFT JOIN sys_dept c on bpm.dept_id = c.dept_id
<where>
<if test="req.plannedYear !=null and req.plannedYear !=''">
and bpm.planned_year =#{req.plannedYear}
</if>
<if test="req.deptName !=null and req.deptName !=''">
and c.dept_name =#{req.deptName}
</if>
</where>
GROUP BY bpm.dept_id
</select>
<select id="getplan" resultType="com.ruoyi.programManagement.entity.response.zhifaPlanResponse">
SELECT COUNT(*) AS count, b.dept_name AS deptName
FROM b_plan_manage a
LEFT JOIN sys_dept b
ON a.dept_id = b.dept_id
WHERE b.ancestors REGEXP '^([^,]*,){0,1}[^,]*$'
GROUP BY a.dept_id
</select>
<select id="getPlanMx" resultType="com.ruoyi.programManagement.entity.response.PlanMxResponse">
SELECT
a.*,
2 years ago
b.DISTRICT_NAME AS institutionName,
2 years ago
a.ENTERPRISE_NAME as enterpriseName
2 years ago
FROM
b_plan_enterprise a
2 years ago
LEFT JOIN szs_administrative_division b ON a.district = b.DISTRICT_CODE
2 years ago
<where>
<if test="req.district !=null and req.district!='' ">
2 years ago
AND a.district like concat('%', #{req.district}, '%')
2 years ago
</if>
<if test="req.plannedYear !=null and req.plannedYear!='' ">
and a.planned_year =#{req.plannedYear}
</if>
2 years ago
<if test="req.enterpriseName !=null and req.enterpriseName!='' ">
2 years ago
and a.ENTERPRISE_NAME like concat('%', #{req.enterpriseName}, '%')
2 years ago
</if>
2 years ago
</where>
2 years ago
group by a.id order by a.id desc
2 years ago
</select>
2 years ago
<select id="selectById" resultType="com.ruoyi.programManagement.entity.BPlanEnterprise">
select a.id,
a.enterprise_id,
a.create_id,
a.create_by,
a.create_time,
a.update_id,
a.update_by,
1 year ago
a.update_time,
2 years ago
a.remark,
2 years ago
a.user_id,
1 year ago
a.dept_id,
2 years ago
a.district,
a.planned_year,
a.is_point,
2 years ago
a.enterprise_name as entprName
from b_plan_enterprise a
1 year ago
where a.id = #{id}
</select>
<select id="getShouyeList"
resultType="com.ruoyi.programManagement.entity.response.BPlanEnterPriseTreeResponse">
1 year ago
SELECT
IFNULL(law_areas, '合计') AS lawAreas,
MAX(law_sort) AS sort,
COUNT(law_areas) AS count,
SUM(CASE WHEN check_status = 1 THEN 1 ELSE 0 END) AS completed,
100 * SUM(CASE WHEN check_status = 1 THEN 1 ELSE 0 END) / COUNT(law_areas) AS completion_rate
FROM b_plan_enterprise
1 year ago
<where>
<if test="req.plannedYear !=null and req.plannedYear!='' ">
and planned_year =#{req.plannedYear}
</if>
<if test="req.plannedMonth != null and req.plannedMonth.length > 0">
AND planned_month IN
<foreach item="item" collection="req.plannedMonth" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY law_areas WITH ROLLUP
ORDER BY
CASE WHEN GROUPING(law_areas) = 1 THEN 1 ELSE 0 END,
sort
1 year ago
</select>
<select id="getShouYeMxList"
resultType="com.ruoyi.programManagement.entity.response.BPlanEnterPriseTreeResponse">
SELECT
IFNULL(law_hierarchy, '合计') AS lawAreas,
MAX(law_sort) AS sort,
COUNT(law_areas) AS count,
SUM(CASE WHEN check_status = 1 THEN 1 ELSE 0 END) AS completed,
100 * SUM(CASE WHEN check_status = 1 THEN 1 ELSE 0 END) / COUNT(law_areas) AS completion_rate
FROM b_plan_enterprise
1 year ago
<where>
<if test="req.plannedYear !=null and req.plannedYear!='' ">
and planned_year =#{req.plannedYear}
</if>
<if test="req.plannedMonth != null and req.plannedMonth.length > 0">
AND planned_month IN
<foreach item="item" collection="req.plannedMonth" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="req.lawAreas !=null and req.lawAreas!='' ">
and law_areas =#{req.lawAreas}
</if>
1 year ago
</where>
GROUP BY law_hierarchy WITH ROLLUP
ORDER BY
CASE WHEN GROUPING(law_hierarchy) = 1 THEN 1 ELSE 0 END,
sort
1 year ago
2 years ago
</select>
</mapper>