select sp.id as projectId,sp.projectName, pui.unitId,pui.unitName,
(select count(1) from smz_ssp_problemmodify a where a.projectId = sp.id and a.roleType=5 and a.infoType=0 and a.isDel=0
<iftest="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and a.createTime between #{params.beginTime} and #{params.endTime}</if>
)as aqyhpc_jfdb,
(select count(1) from smz_ssp_problemmodify a where a.projectId = sp.id and a.roleType=6 and a.infoType=0 and a.isDel=0
<iftest="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and a.createTime between #{params.beginTime} and #{params.endTime}</if>
)as aqyhpc_jldw,
(select count(1) from smz_ssp_problemmodify a LEFT JOIN sys_user u on u.user_name=a.createUser where a.isDel=0 and a.projectId = sp.id and a.roleType=7 and u.dept_id = pui.unitId and a.infoType=0
<iftest="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and a.createTime between #{params.beginTime} and #{params.endTime}</if>
)as aqyhpc_zbdw,
(select count(1) from work_train a LEFT JOIN work_train_dept b on a.id=b.train_id and b.is_main='Y' where a.project_id=sp.id and b.dept_id=pui.unitId and a.train_type=1 and a.is_del=0 ) as yjyl,
(select count(1) from work_train a LEFT JOIN work_train_dept b on a.id=b.train_id and b.is_main='Y' where a.project_id=sp.id and b.dept_id=pui.unitId and a.train_type=0 and a.is_del=0 ) as zxpx,
(select count(1) from smz_ssp_problemmodify a where a.projectId = sp.id and a.roleType=5 and a.infoType=1 and a.isDel=0
<iftest="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and a.createTime between #{params.beginTime} and #{params.endTime}</if>
)as zlyhpc_jfdb,
(select count(1) from smz_ssp_problemmodify a where a.projectId = sp.id and a.roleType=6 and a.infoType=1 and a.isDel=0
<iftest="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and a.createTime between #{params.beginTime} and #{params.endTime}</if>
)as zlyhpc_jldw,
(select count(1) from smz_ssp_problemmodify a LEFT JOIN sys_user u on u.user_name=a.createUser where a.isDel=0 and a.projectId = sp.id and a.roleType=7 and u.dept_id = pui.unitId and a.infoType=1
<iftest="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and a.createTime between #{params.beginTime} and #{params.endTime}</if>
)as zlyhpc_zbdw,
(select count(1) from sur_project_work_special a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0)as tzry,
(select count(1) from sur_project_check_detection a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0)as clqyfs,
(select count(1) from sur_project_checking a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0)as jpys,
(select count(1) from sur_project_measure a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0)as cscl,
(select count(1) from sur_project_material_seal a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0)as clfy,
(select count(1) from sur_project_insurance a where a.project_id = sp.id and a.dept_id=pui.unitId and a.is_del=0 and a.insurance_type=1)as yqx,