TCompleteMonitorMapper.xml 23.5 KB
Newer Older
huyuchen's avatar
huyuchen committed
1 2 3 4 5 6 7 8 9 10 11 12
<?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.yifu.cloud.plus.v1.yifu.archives.mapper.TCompleteMonitorMapper">

  <resultMap id="tCompleteMonitorMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TCompleteMonitor">
    <id property="id" column="ID"/>
    <result property="unitName" column="UNIT_NAME"/>
    <result property="unitNo" column="UNIT_NO"/>
    <result property="deptName" column="DEPT_NAME"/>
    <result property="deptNo" column="DEPT_NO"/>
huyuchen's avatar
huyuchen committed
13
    <result property="deptId" column="DEPT_ID"/>
huyuchen's avatar
huyuchen committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
    <result property="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
    <result property="businessSecondType" column="BUSINESS_SECOND_TYPE"/>
    <result property="businessThirdType" column="BUSINESS_THIRD_TYPE"/>
    <result property="inusePersonNum" column="INUSE_PERSON_NUM"/>
    <result property="isComplete" column="IS_COMPLETE"/>
    <result property="incompleteNum" column="INCOMPLETE_NUM"/>
    <result property="completePer" column="COMPLETE_PER"/>
    <result property="afterEmployment" column="AFTER_EMPLOYMENT"/>
    <result property="afterIsComplete" column="AFTER_IS_COMPLETE"/>
    <result property="afterIncompleteNum" column="AFTER_INCOMPLETE_NUM"/>
    <result property="alertUser" column="ALERT_USER"/>
  </resultMap>

	<resultMap id="tCompleteMonitorExport" type="com.yifu.cloud.plus.v1.yifu.archives.vo.TCompleteMonitorVo">
		<result property="unitName" column="UNIT_NAME"/>
		<result property="unitNo" column="UNIT_NO"/>
		<result property="deptName" column="DEPT_NAME"/>
		<result property="deptNo" column="DEPT_NO"/>
		<result property="businessPrimaryType" column="BUSINESS_PRIMARY_TYPE"/>
		<result property="inusePersonNum" column="INUSE_PERSON_NUM"/>
		<result property="isComplete" column="IS_COMPLETE"/>
		<result property="incompleteNum" column="INCOMPLETE_NUM"/>
		<result property="completePer" column="COMPLETE_PER"/>
		<result property="afterEmployment" column="AFTER_EMPLOYMENT"/>
		<result property="afterIsComplete" column="AFTER_IS_COMPLETE"/>
		<result property="afterIncompleteNum" column="AFTER_INCOMPLETE_NUM"/>
		<result property="alertUser" column="ALERT_USER"/>
	</resultMap>

    <sql id="Base_Column_List">
                a.ID,
                a.UNIT_NAME,
                a.UNIT_NO,
                a.DEPT_NAME,
                a.DEPT_NO,
huyuchen's avatar
huyuchen committed
49
                a.DEPT_ID,
huyuchen's avatar
huyuchen committed
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
                a.BUSINESS_PRIMARY_TYPE,
                a.BUSINESS_SECOND_TYPE,
                a.BUSINESS_THIRD_TYPE,
                a.INUSE_PERSON_NUM,
                a.IS_COMPLETE,
                a.INCOMPLETE_NUM,
                a.COMPLETE_PER,
                a.AFTER_EMPLOYMENT,
                a.AFTER_IS_COMPLETE,
                a.AFTER_INCOMPLETE_NUM,
                a.ALERT_USER
    </sql>
    <sql id="tCompleteMonitor_where">
        <if test="tCompleteMonitor != null">
                    <if test="tCompleteMonitor.id != null and tCompleteMonitor.id.trim() != ''">
                        AND a.ID = #{tCompleteMonitor.id}
                    </if>
                    <if test="tCompleteMonitor.unitName != null and tCompleteMonitor.unitName.trim() != ''">
                        AND a.UNIT_NAME like concat('%',#{tCompleteMonitor.unitName},'%')
                    </if>
                    <if test="tCompleteMonitor.unitNo != null and tCompleteMonitor.unitNo.trim() != ''">
                        AND a.UNIT_NO = #{tCompleteMonitor.unitNo}
                    </if>
                    <if test="tCompleteMonitor.deptName != null and tCompleteMonitor.deptName.trim() != ''">
                        AND a.DEPT_NAME like concat('%',#{tCompleteMonitor.deptName},'%')
                    </if>
                    <if test="tCompleteMonitor.deptNo != null and tCompleteMonitor.deptNo.trim() != ''">
                        AND a.DEPT_NO = #{tCompleteMonitor.deptNo}
                    </if>
                    <if test="tCompleteMonitor.businessThirdType != null and tCompleteMonitor.businessThirdType.trim() != ''">
                        AND a.BUSINESS_THIRD_TYPE like concat('%',#{tCompleteMonitor.businessThirdType},'%')
                    </if>
                    <if test="tCompleteMonitor.isComplete != null and tCompleteMonitor.isComplete.trim() != ''">
                        AND a.IS_COMPLETE = #{tCompleteMonitor.isComplete}
                    </if>
                    <if test="tCompleteMonitor.afterIsComplete != null and tCompleteMonitor.afterIsComplete.trim() != ''">
                        AND a.AFTER_IS_COMPLETE = #{tCompleteMonitor.afterIsComplete}
                    </if>
huyuchen's avatar
huyuchen committed
88 89 90
					<if test="tCompleteMonitor.authSql != null and tCompleteMonitor.authSql.trim() != ''">
						${tCompleteMonitor.authSql}
					</if>
huyuchen's avatar
huyuchen committed
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
        </if>
    </sql>
    <!--tCompleteMonitor简单分页查询-->
    <select id="getTCompleteMonitorPage" resultMap="tCompleteMonitorMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_complete_monitor a
        <where>
            1=1
            <include refid="tCompleteMonitor_where"/>
        </where>
    </select>

	<!--tCompleteMonitor简单分页查询-->
	<select id="getExportCount" resultType="java.lang.Long">
		SELECT
		count(1)
		FROM t_complete_monitor a
		<where>
			1=1
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>

	<!--tCompleteMonitor简单分页查询-->
	<select id="getTCompleteMonitorExportList" resultMap="tCompleteMonitorExport">
		SELECT
		a.UNIT_NAME,
		a.UNIT_NO,
		a.DEPT_NAME,
		a.DEPT_NO,
		concat(BUSINESS_PRIMARY_TYPE,'-',BUSINESS_SECOND_TYPE,'-',BUSINESS_THIRD_TYPE) as BUSINESS_PRIMARY_TYPE,
		a.INUSE_PERSON_NUM,
		a.IS_COMPLETE,
		a.INCOMPLETE_NUM,
		a.COMPLETE_PER,
		a.AFTER_EMPLOYMENT,
		a.AFTER_IS_COMPLETE,
		a.AFTER_INCOMPLETE_NUM,
		a.ALERT_USER
		FROM t_complete_monitor a
		<where>
			1=1
			<include refid="tCompleteMonitor_where"/>
		</where>
		<if test="tCompleteMonitor.limitStart != null">
			limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
		</if>
	</select>

	<!--获取详情人员列表-->
	<select id="getMonitorEmpInfoList" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TCompleteMonitorInfoVo">
		select
			a.EMP_NAME empName,
			a.EMP_IDCARD empIdCard,
			b.EMP_PHONE phone,
			a.CREATE_TIME inTime,
			if(a.IS_COMPLETE = '0','是','否') isComplete,
huyuchen's avatar
huyuchen committed
149
			a.EMP_ID empInfoId
huyuchen's avatar
huyuchen committed
150 151 152 153 154 155 156 157 158
		from
			t_employee_project a
			left join t_employee_info b on a.EMP_ID = b.id
		where a.DELETE_FLAG = '0' and a.dept_no = #{deptNo}
	</select>

	<!--生成数据封装-->
	<select id="getAllMonitorEmpList" resultMap="tCompleteMonitorMap">
		select
huyuchen's avatar
huyuchen committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
		b.CUSTOMER_NAME UNIT_NAME,
		b.CUSTOMER_NO UNIT_NO,
		b.DEPART_NAME DEPT_NAME,
		b.DEPART_NO DEPT_NO,
		b.id DEPT_ID,
		b.BUSINESS_PRIMARY_TYPE,
		b.BUSINESS_SECOND_TYPE,
		b.BUSINESS_THIRD_TYPE,
		ifnull(a.INUSE_PERSON_NUM,0) INUSE_PERSON_NUM,
		ifnull(a.IS_COMPLETE,'0') IS_COMPLETE,
		ifnull(a.INCOMPLETE_NUM,0) INCOMPLETE_NUM,
		ifnull(a.COMPLETE_PER,'0.00%') COMPLETE_PER,
		ifnull(a.AFTER_EMPLOYMENT,0) AFTER_EMPLOYMENT,
		ifnull(a.AFTER_IS_COMPLETE,'0') AFTER_IS_COMPLETE,
		ifnull(a.AFTER_INCOMPLETE_NUM,0) AFTER_INCOMPLETE_NUM,
huyuchen's avatar
huyuchen committed
174
		b.CREATE_USER_NAME as ALERT_USER
huyuchen's avatar
huyuchen committed
175
		from
huyuchen's avatar
huyuchen committed
176 177 178 179 180 181 182 183 184 185 186
		t_settle_domain b
		left join (select DEPT_NO,
		sum(if(PROJECT_STATUS = 0,1,0)) as INUSE_PERSON_NUM,
		if(sum(if((PROJECT_STATUS = 0 and IS_COMPLETE = '0') or PROJECT_STATUS = 1,0,1)) > 0,1,0) as IS_COMPLETE,
		sum(if((PROJECT_STATUS = 0 and IS_COMPLETE = '0') or PROJECT_STATUS = 1,0,1)) as INCOMPLETE_NUM,
		concat(ROUND((sum(if(PROJECT_STATUS = 0,1,0)) - sum(if((PROJECT_STATUS = 0 and IS_COMPLETE = '0') or PROJECT_STATUS = 1,0,1)))*100/sum(if(PROJECT_STATUS = 0,1,0)),2),'%') as COMPLETE_PER,
		sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-05-01',1,0)) as AFTER_EMPLOYMENT,
		if(sum(if((PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-05-01' and IS_COMPLETE = '0') or '2024-05-01' > DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') or PROJECT_STATUS = 1,0,1)) > 0,1,0) AFTER_IS_COMPLETE,
		sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-05-01' and IS_COMPLETE = '1',1,0)) as AFTER_INCOMPLETE_NUM
		from t_employee_project where DELETE_FLAG = '0' and PROJECT_STATUS = 0 group by DEPT_NO) a on a.DEPT_NO = b.DEPART_NO
		where b.DELETE_FLAG = '0'
huyuchen's avatar
huyuchen committed
187
		<if test="deptNo != null and deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
188
			and b.DEPART_NO = #{deptNo}
huyuchen's avatar
huyuchen committed
189
		</if>
huyuchen's avatar
huyuchen committed
190
		group by b.DEPART_NO
huyuchen's avatar
huyuchen committed
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
	</select>


	<!--判断项目档案的完整状态-->
	<select id="checkEmpProjectCompleteFlag" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TCompleteMonitorFlagVo">
		select
			e.EMP_SEX empSex,
			e.VALIDITY_START validityStart,
			e.VALIDITY_END validityEnd,
			e.EMP_BIRTHDAY empBirthday,
			e.EMP_AGE empAge,
			e.EMP_MARRI_STATUS empMarriStatus,
			e.EMP_NATIONAL empNational,
			e.POLITICAL_STATUS politicalStatus,
			e.EMP_PHONE empPhone,
			e.EMP_REGIS_TYPE empRegisType,
			e.FILE_PROVINCE fileProvince,
			e.FILE_CITY fileCity,
			e.IS_COLLEGE isCollege,
			e.HIGN_EDUCATION hignEducation,
			e.SCHOOL,
			e.MAJOR,
			e.ADMISSION_DATE admissionDate,
			e.GRADUTION_DATE gradutionDate,
			e.CONTACT_ADDRESS contactAddress,
			e.FIRST_WORK_FLAG firstWorkFlag,
			e.HAVE_QUALIFICATION haveQualification,

			a.DEPT_NAME deptName,
			a.UNIT_NAME unitName,
			a.BUSINESS_PRIMARY_TYPE businessPrimaryType,
			a.BUSINESS_SECOND_TYPE businessSecondType,
			a.BUSINESS_THIRD_TYPE businessThirdType,
			a.WORKING_HOURS workingHours,
			a.TRY_PERIOD tryPeriod,
			a.ENJOIN_DATE enjoinDate,
			a.POST,
			a.id as empProjectId,

			d.id as contactInfoId,

			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
huyuchen's avatar
huyuchen committed
273
				left join (select EMP_ID,sum(if(ifnull(HIGH_IDENTIFICATION,-1) != -1 and ifnull(SCHOOL,-1) != -1 and ifnull(MAJOR,-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
huyuchen's avatar
huyuchen committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293
				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
		<if test="deptNo != null and deptNo.trim() != ''">
			and a.DEPT_NO = #{deptNo}
		</if>
		group by a.ID
	</select>

	<!--删除所有监控数据-->
	<update id="deleteAllMonitorInfo">
		TRUNCATE t_complete_monitor
	</update>

	<!--根据项目编码删除监控数据-->
	<delete id="deleteMonitorInfoByDeptNo">
		delete from t_complete_monitor WHERE DEPT_NO = #{deptNo}
	</delete>

294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311

	<!-- 导出详情 -->
	<select id="getTEmpMainAllCount" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
		<where>
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>

	<!--导出统计list-->
	<select id="getTEmpMainAllList" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
		if(a.IS_COMPLETE=0,'是','否') field1
312
		,DATE_FORMAT(p.create_time,'%Y-%m-%d') field2,e.EMP_CODE field3,emp_natrue.label field4,e.emp_name field5,e.emp_idcard field6
313
		,if(e.EMP_SEX='2','女',if(e.EMP_SEX='1','男','-')) field7
314
		,if(e.VALIDITY_END is null,'-',if(e.VALIDITY_END > '2999-12-30','长期','固定')) field8	,e.VALIDITY_END field9
315 316 317
		,e.VALIDITY_END field10,e.EMP_BIRTHDAY field11,e.EMP_AGE field12	,emp_married.label field13,nation.label field14
		,politicalStatus.label field15,e.EMP_PHONE field16,e.EMP_EMAIL field17
		,concat(ifnull(pi.AREA_NAME,''),ifnull(ci.AREA_NAME,''),ifnull(ti.AREA_NAME,'')) field18	,registype.label field19
318
		,concat(ifnull(pf.AREA_NAME,''),ifnull(cf.AREA_NAME,''),ifnull(tf.AREA_NAME,'')) field20	,if(e.status=0,'草稿','已审核') field21
319 320
		,e.CONTACT_ADDRESS field22,p.UNIT_NAME field23,p.DEPT_NAME field24
		,concat(p.BUSINESS_PRIMARY_TYPE,'-',ifnull(p.BUSINESS_SECOND_TYPE,''),'-',ifnull(p.BUSINESS_THIRD_TYPE,'')) field25
321 322
		,eci.contract_name field26	,workingHours.label field27,eci.POST field28,eci.CONTRACT_START field29
		,eci.TRY_PERIOD field30,p.EMP_LABEL field31
323 324
		,ec.EMP_NAME field32,ec.RELATION_TYPE field33,ec.ADDRESS field34,ec.TEL field35
		,ee.SCHOOL field36,ee.MAJOR field37,education.label field38,if(e.IS_COLLEGE=0,'否','是') field39
325 326
		,educationEmp.label field40	,ee.ENTRY_DATE field41,ee.GRADUTION_DATE field42

327 328 329 330
		,if(e.FIRST_WORK_FLAG is null,'',if(e.FIRST_WORK_FLAG=0,'是','否')) field43,ew.WORK_UNIT field44,ew.WORK_JOB field45,ew.START_DATE field46,ew.END_DATE field47
		,ef.FAMILY_NAME field48,ef.RELATIONSHIP_SELF field49,ef.CONTRACT_TEL field50
		,if(e.HAVE_QUALIFICATION is null,'',if(e.HAVE_QUALIFICATION=0,'是','否')) field51,ep.DECLARE_YEAR field52,qualification_type.label field53

331 332 333 334 335
		,if(ed.INJURY_IDENTIFICATION=0,'是','否') field54,if(ed.OCCUPATIONAL_DISEASE_FLAG=0,'是','否') field55	,ed.OCCUPATIONAL_DISEASE field56
		,if(ed.INFECTIOUS_DISEASE_FLAG=0,'是','否') field57	,ed.INFECTIOUS_NAME field58	,if(ed.DISABILITY_FLAG=0,'是','否') field59
		,ed.DISABILITY_NAME field60,ed.DISABILITY_LEVEL field61,if(ed.OTHER_FLAG=0,'是','否') field62,eb.REMARK field63
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
336 337 338 339 340 341 342 343 344 345 346
		left join (
		select
		SUBSTRING_INDEX(GROUP_CONCAT(c.contract_name ORDER BY c.audit_time_last desc),',',1) contract_name
		,c.EMP_IDCARD,c.DEPT_NO
		,SUBSTRING_INDEX(GROUP_CONCAT(c.CONTRACT_START ORDER BY c.audit_time_last desc),',',1) CONTRACT_START
		,SUBSTRING_INDEX(GROUP_CONCAT(c.WORKING_HOURS ORDER BY c.audit_time_last desc),',',1) WORKING_HOURS
		,SUBSTRING_INDEX(GROUP_CONCAT(c.POST ORDER BY c.audit_time_last desc),',',1) POST
		,SUBSTRING_INDEX(GROUP_CONCAT(c.TRY_PERIOD ORDER BY c.audit_time_last desc),',',1) TRY_PERIOD
		from t_employee_contract_info c where c.IN_USE='0' and c.delete_flag = '0' and c.audit_status = '2' GROUP BY c.EMP_IDCARD,c.DEPT_NO
		) eci on p.EMP_IDCARD=eci.EMP_IDCARD and p.dept_no=eci.dept_no

347 348
		left join t_employee_info e on p.EMP_ID=e.id
		left join view_sys_dict_item emp_natrue on emp_natrue.value=e.EMP_NATRUE and emp_natrue.type='emp_natrue'
349
		left join view_sys_dict_item educationEmp on educationEmp.value=e.HIGN_EDUCATION and educationEmp.type='education'
350 351 352 353 354 355 356 357 358 359
		left join view_sys_dict_item emp_married on emp_married.value=e.EMP_MARRI_STATUS and emp_married.type='emp_married'
		left join view_sys_dict_item nation on nation.value=e.EMP_NATIONAL and nation.type='emp_national'
		left join view_sys_dict_item registype on registype.value=e.EMP_REGIS_TYPE and registype.type='emp_registype'
		left join view_sys_dict_item politicalStatus on politicalStatus.value=e.POLITICAL_STATUS and politicalStatus.type='emp_political'
		left join sys_area pi on pi.id=e.ID_PROVINCE
		left join sys_area ci on ci.id=e.ID_CITY
		left join sys_area ti on ti.id=e.ID_TOWN
		left join sys_area pf on pf.id=e.FILE_PROVINCE
		left join sys_area cf on cf.id=e.FILE_CITY
		left join sys_area tf on tf.id=e.FILE_TOWN
360
		left join view_sys_dict_item workingHours on workingHours.value=eci.WORKING_HOURS and workingHours.type='working_hours'
361
		left join t_emp_contact_info ec on e.id=ec.EMP_ID
362
		left join t_emp_education ee on e.id=ee.EMP_ID and ee.DELETE_FLAG = '0'
363
		left join view_sys_dict_item education on education.value=ee.EDUCATION_NAME and education.type='education'
364 365
		left join t_emp_disability_info ed on e.id=ed.EMP_ID and ed.DELETE_FLAG = '0'
		left join t_emp_bad_record eb on e.id=eb.EMP_ID
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393
		left join (
		select
		SUBSTRING_INDEX(GROUP_CONCAT(ee.EMP_ID ORDER BY ee.create_time desc),',',1) EMP_ID
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.WORK_UNIT ORDER BY ee.create_time desc),',',1) WORK_UNIT
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.WORK_JOB ORDER BY ee.create_time desc),',',1) WORK_JOB
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.START_DATE ORDER BY ee.create_time desc),',',1) START_DATE
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.END_DATE ORDER BY ee.create_time desc),',',1) END_DATE
		from t_emp_work_recording ee
		GROUP BY ee.EMP_ID
		) ew on e.id=ew.EMP_ID
		left join (
		select
		SUBSTRING_INDEX(GROUP_CONCAT(ee.EMP_ID ORDER BY ee.create_time desc),',',1) EMP_ID
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.FAMILY_NAME ORDER BY ee.create_time desc),',',1) FAMILY_NAME
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.RELATIONSHIP_SELF ORDER BY ee.create_time desc),',',1) RELATIONSHIP_SELF
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.CONTRACT_TEL ORDER BY ee.create_time desc),',',1) CONTRACT_TEL
		from t_emp_family ee
		GROUP BY ee.EMP_ID
		) ef on e.id=ef.EMP_ID
		left join (
		select
		SUBSTRING_INDEX(GROUP_CONCAT(ee.EMP_ID ORDER BY ee.create_time desc),',',1) EMP_ID
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.DECLARE_YEAR ORDER BY ee.create_time desc),',',1) DECLARE_YEAR
		,SUBSTRING_INDEX(GROUP_CONCAT(ee.QUALIFICATION_TYPE ORDER BY ee.create_time desc),',',1) QUALIFICATION_TYPE
		from t_emp_professional_qualification ee
		GROUP BY ee.EMP_ID
		) ep on e.id=ep.EMP_ID
		left join view_sys_dict_item qualification_type on qualification_type.value=ep.QUALIFICATION_TYPE and qualification_type.type='qualification_type'
394 395 396 397 398 399 400 401 402 403 404
		<where>
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0
			<include refid="tCompleteMonitor_where"/>
		</where>
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>

405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420
	<!-- 数量 -->
	<select id="getTEmpMainAllCountOneWork" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
		left join t_emp_work_recording ew on e.id=ew.EMP_ID
		<where>
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0 and ew.id is not null and ew.DELETE_FLAG = '0' and EXISTS (
			select 1 from (select a.emp_id from t_emp_work_recording a GROUP BY a.EMP_ID HAVING count(1)>1) ea where ea.emp_id=ew.emp_id
			)
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>

421 422 423 424 425 426 427 428
	<!--导出统计list1主要工作经历-->
	<select id="getTEmpMainAllListOneWork" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
		e.emp_idcard field6
		,if(e.FIRST_WORK_FLAG is null,'',if(e.FIRST_WORK_FLAG=0,'是','否')) field43,ew.WORK_UNIT field44,ew.WORK_JOB field45,ew.START_DATE field46,ew.END_DATE field47
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
429
		left join t_emp_work_recording ew on e.id=ew.EMP_ID
430
		<where>
431 432 433
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0 and ew.id is not null and ew.DELETE_FLAG = '0' and EXISTS (
			select 1 from (select a.emp_id from t_emp_work_recording a GROUP BY a.EMP_ID HAVING count(1)>1) ea where ea.emp_id=ew.emp_id
			)
434 435 436 437 438 439 440 441 442
			<include refid="tCompleteMonitor_where"/>
		</where>
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>

443 444 445 446 447 448 449 450 451 452 453 454 455 456 457
	<!-- 数量 -->
	<select id="getTEmpMainAllCountTwoFamily" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
		left join t_emp_family ef on e.id=ef.EMP_ID
		<where>
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0 and ef.id is not null and ef.DELETE_FLAG = '0' and EXISTS (
			select 1 from (select a.emp_id from t_emp_family a GROUP BY a.EMP_ID HAVING count(1)>1) ea where ea.emp_id=ef.emp_id
			)
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>
458 459 460 461 462 463 464 465
	<!--导出统计list2主要家庭成员信息-->
	<select id="getTEmpMainAllListTwoFamily" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
		e.emp_idcard field6
		,ef.FAMILY_NAME field48,ef.RELATIONSHIP_SELF field49,ef.CONTRACT_TEL field50
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
466
		left join t_emp_family ef on e.id=ef.EMP_ID
467
		<where>
468 469 470
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0 and ef.id is not null and ef.DELETE_FLAG = '0' and EXISTS (
			select 1 from (select a.emp_id from t_emp_family a GROUP BY a.EMP_ID HAVING count(1)>1) ea where ea.emp_id=ef.emp_id
			)
471 472 473 474 475 476 477 478
			<include refid="tCompleteMonitor_where"/>
		</where>
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494

	<!-- 数量 -->
	<select id="getTEmpMainAllCountThreeProfessional" resultType="java.lang.Integer">
		SELECT
		count(1)
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
		left join t_emp_professional_qualification ep on e.id=ep.EMP_ID
		<where>
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0 and ep.id is not null and ep.DELETE_FLAG = '0' and EXISTS (
			select 1 from (select a.emp_id from t_emp_professional_qualification a GROUP BY a.EMP_ID HAVING count(1)>1) ea where ea.emp_id=ep.emp_id
			)
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>
495 496 497 498 499 500 501 502
	<!--导出统计list3职业资格信息-->
	<select id="getTEmpMainAllListThreeProfessional" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
		e.emp_idcard field6
		,if(e.HAVE_QUALIFICATION is null,'',if(e.HAVE_QUALIFICATION=0,'是','否')) field51,ep.DECLARE_YEAR field52,qualification_type.label field53
		FROM t_complete_monitor a
		left join t_employee_project p on a.DEPT_NO=p.DEPT_NO
		left join t_employee_info e on p.EMP_ID=e.id
503 504 505
		left join t_emp_professional_qualification ep on e.id=ep.EMP_ID
		left join view_sys_dict_item qualification_type on qualification_type.value=ep.QUALIFICATION_TYPE and qualification_type.type='qualification_type'
		<where>
506 507 508
			p.DELETE_FLAG = '0' and p.PROJECT_STATUS = 0 and ep.id is not null and ep.DELETE_FLAG = '0' and EXISTS (
			select 1 from (select a.emp_id from t_emp_professional_qualification a GROUP BY a.EMP_ID HAVING count(1)>1) ea where ea.emp_id=ep.emp_id
			)
509 510 511 512 513 514 515 516 517
			<include refid="tCompleteMonitor_where"/>
		</where>
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>

huyuchen's avatar
huyuchen committed
518
</mapper>