if(ifnull(f.OCCUPATIONAL_DISEASE_FLAG,1) != 1 and ifnull(f.INFECTIOUS_DISEASE_FLAG,1) != 1 and ifnull(f.DISABILITY_FLAG,1) != 1 and ifnull(f.OTHER_FLAG,1) != 1,'1',null) as disabilityFlag,
if(ifnull(b.REMARK,1) != 1,'1',null) as badRecordFlag,
if(c.count >0,'1',null) as educationFlag,
if(g.count >0,'1',null) as familyFlag
from
t_employee_project a
left join (
select
ee.ID,
ee.EMP_SEX,
ee.VALIDITY_START,
ee.VALIDITY_END,
ee.EMP_BIRTHDAY,
ee.EMP_AGE,
ee.EMP_MARRI_STATUS,
ee.EMP_NATIONAL,
ee.POLITICAL_STATUS,
ee.EMP_PHONE,
ee.EMP_REGIS_TYPE,
ee.FILE_PROVINCE,
ee.FILE_CITY,
ee.IS_COLLEGE,
ee.HIGN_EDUCATION,
ee.SCHOOL,
ee.MAJOR,
ee.ADMISSION_DATE,
ee.GRADUTION_DATE,
ee.CONTACT_ADDRESS,
ee.FIRST_WORK_FLAG,
ee.HAVE_QUALIFICATION
from t_employee_info ee
left join t_atta_info tt on ee.id = tt.DOMAIN_ID and tt.RELATION_TYPE = '9'
left join t_atta_info yy on ee.id = yy.DOMAIN_ID and yy.RELATION_TYPE = '10'
where ee.DELETE_FLAG = '0' and ee.FILE_STATUS = 0 and tt.id is not null and yy.id is not null
group by ee.ID
) e on a.EMP_ID = e.ID
left join t_emp_bad_record b on a.EMP_IDCARD = b.EMP_IDCARD
left join (select EMP_ID,sum(if(ifnull(HIGH_IDENTIFICATION,-1) != -1 and ifnull(SCHOOL,-1) != -1 and ifnull(MAJOR,-1) != -1 and ifnull(TYPE,-1) != -1 and ifnull(ENTRY_DATE,-1) != -1 and ifnull(GRADUTION_DATE,-1) != -1,1,0)) as count from t_emp_education a left join t_atta_info b on a.id = b.domain_id where a.DELETE_FLAG = '0' and b.RELATION_TYPE = '0' group by a.EMP_ID) c on a.EMP_ID = c.EMP_ID
left join t_emp_contact_info d on a.EMP_IDCARD = d.EMP_IDCARD
left join t_emp_disability_info f on a.EMP_ID = f.EMP_ID and f.DELETE_FLAG = '1'
left join (select EMP_ID,sum(if(ifnull(RELATIONSHIP_SELF,-1) != -1 and ifnull(FAMILY_NAME,-1) != -1 and ifnull(CONTRACT_TEL,-1) != -1,1,0)) as count from t_emp_family where DELETE_FLAG = '1' group by EMP_ID) g on a.EMP_ID = g.EMP_ID
where a.DELETE_FLAG = '0' and a.PROJECT_STATUS = 0
<iftest="deptNo != null and deptNo.trim() != ''">
and a.DEPT_NO = #{deptNo}
</if>
group by a.ID
</select>
<!--删除所有监控数据-->
<updateid="deleteAllMonitorInfo">
TRUNCATE t_complete_monitor
</update>
<!--根据项目编码删除监控数据-->
<deleteid="deleteMonitorInfoByDeptNo">
delete from t_complete_monitor WHERE DEPT_NO = #{deptNo}