bns_jjsp_service/securityControl-modules/securityControl-decision/target/classes/mapper/PeccancyMapper.xml

95 lines
4.5 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.sercurityControl.decision.mapper.PeccancyMapper">
<select id="getPeccancyProject" resultType="com.sercurityControl.decision.domain.Pie">
select * from (
select count(tnv.id) as value,tcm.bid_code,bid_name as name
from t_notice_voi tnv
inner join t_class_metting tcm on tnv.class_id = tcm.class_id
where year(tnv.create_day) = year(current_date)
group by tcm.bid_code,bid_name) a
order by value desc
limit 10
</select>
<select id="getPeccancyReport" resultType="com.sercurityControl.decision.domain.Pie">
select count(*) as value,level_id as name
from t_notice_voi
where level_id in ('一般违章','建议整改','严重违章') and month(create_day) = month(current_date)
group by level_id
order by level_id
</select>
<select id="getPeccancTeam" resultType="com.sercurityControl.decision.domain.Pie">
select * from (
select count(tnv.id) as value,tcm.team_name as name
from t_notice_voi tnv
inner join t_class_metting tcm on tnv.class_id = tcm.class_id
where year(tnv.create_day) = year(current_date)
group by tcm.team_name) a
order by value desc
limit 10
</select>
<select id="getReformPercent" resultType="com.sercurityControl.decision.domain.Pie">
select round(ifnull(a.value,0) * 100 / sum.value,0) as value ,sum.name
from (select count(*) as value,level_id as name
from t_notice_voi
where level_id in ('一般违章','建议整改','严重违章') and month(create_day) = month(current_date) and status = '5'
group by level_id
order by level_id) a
right join
(select count(*) as value,level_id as name
from t_notice_voi
where level_id in ('一般违章','建议整改','严重违章') and month(create_day) = month(current_date)
group by level_id
order by level_id) sum
on a.name = sum.name
</select>
<select id="getReformList" resultType="com.sercurityControl.decision.domain.Pie">
select count(*) as value, status as name
from t_notice_voi
where level_id in ('一般违章','建议整改','严重违章') and month(create_day) = month(current_date)
group by status
order by status
</select>
<select id="getSeriousPeccancy" resultType="com.sercurityControl.decision.domain.SeriousPeccancy">
select city_name as build_org_name,level_id,content,tnv.create_time as supervise_date,
su.user_name as supervise_user,tnv.status,count(tp.id) as photo_num
from t_notice_voi tnv
inner join sys_org org on tnv.org = org.org_id
inner join sys_user su on tnv.iss_user = su.id
left join t_notice_voi_photo tp on tnv.id = tp.noti_id and tp.image_type = '1'
group by tnv.id
</select>
<select id="getRiskPeccancyNum" resultType="com.sercurityControl.decision.domain.Pie">
select count(tv.id) as value,job_risk_fc_level_num as name
from t_notice_voi tv
inner join t_ticket_info ti on tv.ticket_no = ti.job_num
where month(tv.create_day) = month(current_date) and ti.job_risk_fc_level_num in ('2级','3级','4级','5级')
group by ti.job_risk_fc_level_num
</select>
<select id="getRiskReformPercent" resultType="com.sercurityControl.decision.domain.Pie">
select round(ifnull(a.name,0) * 100 / sum.name,0) as name ,sum.value
from
(select count(tv.id) as name,job_risk_fc_level_num as value
from t_notice_voi tv
inner join t_ticket_info ti on tv.ticket_no = ti.job_num
where month(tv.create_day) = month(current_date) and ti.job_risk_fc_level_num in ('2级','3级','4级','5级')
group by ti.job_risk_fc_level_num) sum
left join
(select count(tv.id) as name,job_risk_fc_level_num as value
from t_notice_voi tv
inner join t_ticket_info ti on tv.ticket_no = ti.job_num
where month(tv.create_day) = month(current_date) and ti.job_risk_fc_level_num in ('2级','3级','4级','5级') and tv.status = '5'
group by ti.job_risk_fc_level_num) a on a.value = sum.value
order by value
</select>
</mapper>