@Select("select 'sys_struct_dict' node_type,id,'' parent_id,struct_name title from sys_struct_dict ssd where ssd.depart_id = #{departId}\n"+
"union all\n"+
"select 'equip_info' node_type,ei.id,ssd.id parent_id,ei.equipment_name title from equipment_info ei left join sys_struct_dict ssd on "+
" ei.structures = ssd.id where ssd.depart_id = #{departId}")
@Select("SELECT * FROM\t(\tSELECT 'sys_struct_dict' AS node_type,ssd.id,'' AS parent_id,ssd.struct_name AS title,ssd.sort_num,NULL AS equipment_name\n"+
"\tFROM sys_struct_dict ssd WHERE ssd.depart_id = #{departId}\n"+
"\tUNION ALL SELECT\n"+
"\t\t'equip_info' AS node_type,ei.id,ssd.id AS parent_id,ei.equipment_name AS title,ssd.sort_num,ei.equipment_name -- 用于排序\n"+
"\tFROM equipment_info ei LEFT JOIN sys_struct_dict ssd ON ei.structures = ssd.id \n"+
"\tWHERE ssd.depart_id = #{departId}\n"+
"\t) AS combined_result ORDER BY node_type DESC,sort_num,equipment_name;")
Stringsql="select count(1) 'totalInspectionTaskCount' , sum(CASE WHEN t.task_state = '1' THEN 1 ELSE 0 END) AS 'inProgressInspectionTaskCount' ,";
sql+=" sum(CASE WHEN t.task_state = '2' THEN 1 ELSE 0 END) AS 'checkedInspectionTaskCount',sum(CASE WHEN t.task_state = '3' THEN 1 ELSE 0 END) AS 'notCheckedInspectionTaskCount' ";
sql+=" from inspection_task t where 1=1 AND DATE_FORMAT(t.inspection_cycle_start_date,'%Y-%m-%d') >= '"+startDate+"' AND DATE_FORMAT(t.inspection_cycle_start_date,'%Y-%m-%d') <= '"+endDate+"' ";
sql+=" and depart_id in ("+JSUtils.quoteEach(departIds,",")+")";
sql=" select count(cc.inspection_task_id) 'abnormalInspectionTaskCount' from ( ";
sql+=" SELECT t.depart_id, itfc.inspection_task_id FROM inspection_task_fill_content itfc ,inspection_task t WHERE inspection_task_id =t.id and t.task_state IN ('2') ";
sql+=" AND DATE_FORMAT(t.inspection_cycle_start_date,'%Y-%m-%d') >= '"+startDate+"' AND DATE_FORMAT(t.inspection_cycle_start_date,'%Y-%m-%d') <= '"+endDate+"' ";
sql+=" and t.depart_id in ("+JSUtils.quoteEach(departIds,",")+")";
sql+=" AND choice_state = '0' GROUP BY itfc.inspection_task_id ,t.depart_id) cc ";
sql+=" SELECT equip_info_id ,inspection_point_fill_group_id ,inspection_fill_group_id ,inspection_task_id FROM inspection_task_point_fill_group ";
sql+=" WHERE inspection_task_id IN ( select id FROM inspection_task WHERE inspection_cycle_start_date >= '"+startDate+" 00:00:00' AND inspection_cycle_start_date <= '"+endDate+" 23:59:59' AND task_state IN ('2','3') ";
...
...
@@ -1073,7 +1181,6 @@ public class InspectionAnalysisServiceImpl implements IInspectionAnalysisService