bug修改

This commit is contained in:
GUO 2024-06-03 23:04:49 +08:00
parent a5db704a76
commit 8337728613
3 changed files with 35 additions and 10 deletions

View File

@ -606,7 +606,7 @@
</include>
su.real_name as workerName
from xz_security_quality_inspection_record t
left join system_user su on su.user_id = t.change_id
join system_user su on su.user_id = t.change_id
WHERE record_type = 1
and t.status != 6
and project_sn = #{param.projectSn}

View File

@ -60,6 +60,13 @@
join xz_emergency_type xet on xet.id = t.emergency_type_id
where t.project_sn = #{param.projectSn} and t.alarm_time >= current_date
group by t.emergency_type_id
union all
select count(*) as count,
'一键报警' as name,
t.emergency_type_id as enumType
from xz_emergency_record t
where t.project_sn = #{param.projectSn} and t.alarm_time >= current_date
and t.emergency_type_id = -1
</select>
<select id="countAlarmNumByEnterprise"

View File

@ -51,7 +51,17 @@
</include>
where t.id = #{param.id}
</select>
<sql id="lastWeek">
SELECT
DATE_FORMAT( DATE_ADD( CONCAT( date_sub(current_date,interval 7 day) ), INTERVAL ( help_topic_id ) DAY ), '%Y-%m-%d' ) DT
FROM
mysql.help_topic
WHERE
help_topic_id &lt;= TIMESTAMPDIFF(
DAY,
CONCAT( date_sub(current_date,interval 7 day) ),
CONCAT( current_date ))
</sql>
<select id="countAllSpecial" resultType="com.zhgd.xmgl.modules.xz.special.entity.vo.CountSpecialVo">
select
t.date,
@ -67,73 +77,81 @@
from
(
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
1 as type
from xz_blind_plate_plug_safe
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
2 as type
from xz_ground_safet
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
3 as type
from xz_high_job_safe
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
4 as type
from xz_hoist_safety_work
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
5 as type
from xz_limit_space_safe
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(create_date,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
6 as type
from xz_open_circuit_safe
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
7 as type
from xz_special_operation_fire_safety
join (<include refid="lastWeek"/>) as t on IF(hot_work_execution_begin_time is not null and hot_work_execution_end_time is not null,t.DT>=date_format(hot_work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(hot_work_execution_end_time,'%Y-%m-%d'), IF((hot_work_execution_begin_time is not null and hot_work_execution_end_time is null) or (hot_work_execution_begin_time is null and hot_work_execution_end_time is not null),t.DT>=date_format(hot_work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(hot_work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
union all
select
date_format(job_application_time,'%Y-%m-%d') as date,
t.DT as date,
count(*) as num,
8 as type
from xz_temporary_electricity_safe
join (<include refid="lastWeek"/>) as t on IF(work_execution_begin_time is not null and work_execution_end_time is not null,t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') and t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'), IF((work_execution_begin_time is not null and work_execution_end_time is null) or (work_execution_begin_time is null and work_execution_end_time is not null),t.DT>=date_format(work_execution_begin_time,'%Y-%m-%d') or t.DT&lt;=date_format(work_execution_end_time,'%Y-%m-%d'),0))
where project_sn = #{param.projectSn}
group by date
)t