TCompleteMonitorMapper.xml 24.7 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 91 92 93
					<if test="tCompleteMonitor.inusePersonNumStart != null">
						AND a.INUSE_PERSON_NUM <![CDATA[ >= ]]> #{tCompleteMonitor.inusePersonNumStart}
					</if>
					<if test="tCompleteMonitor.inusePersonNumEnd != null">
						AND a.INUSE_PERSON_NUM <![CDATA[ <= ]]> #{tCompleteMonitor.inusePersonNumEnd}
					</if>
huyuchen's avatar
huyuchen committed
94 95 96
					<if test="tCompleteMonitor.authSql != null and tCompleteMonitor.authSql.trim() != ''">
						${tCompleteMonitor.authSql}
					</if>
huyuchen's avatar
huyuchen committed
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 149 150 151 152 153 154
        </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,
hongguangwu's avatar
hongguangwu committed
155 156
			a.EMP_ID empInfoId,
			a.ID empProjectId
huyuchen's avatar
huyuchen committed
157 158 159
		from
			t_employee_project a
			left join t_employee_info b on a.EMP_ID = b.id
160 161 162 163 164 165 166 167 168
		where a.DELETE_FLAG = '0'
		  and a.project_status = 0
		<if test="completeMonitorInfoVo.deptNo != null and completeMonitorInfoVo.deptNo.trim() != ''">
			and a.dept_no = #{completeMonitorInfoVo.deptNo}
		</if>
		<if test="completeMonitorInfoVo.empName != null and completeMonitorInfoVo.empName.trim() != ''">
			and a.EMP_NAME = #{completeMonitorInfoVo.empName}
		</if>
		<if test="completeMonitorInfoVo.phone != null and completeMonitorInfoVo.phone.trim() != ''">
huyuchen's avatar
huyuchen committed
169
			and b.EMP_PHONE = #{completeMonitorInfoVo.phone}
170
		</if>
171 172 173
		<if test="completeMonitorInfoVo.empIdCard != null and completeMonitorInfoVo.empIdCard.trim() != ''">
			and a.EMP_IDCARD = #{completeMonitorInfoVo.empIdCard}
		</if>
174 175 176 177 178 179 180 181 182 183
		<if test="completeMonitorInfoVo.isComplete != null and completeMonitorInfoVo.isComplete.trim() != ''">
			and a.IS_COMPLETE = #{completeMonitorInfoVo.isComplete}
		</if>
		<if test="completeMonitorInfoVo.inTimeStart != null">
			AND a.CREATE_TIME <![CDATA[ >= ]]> #{completeMonitorInfoVo.inTimeStart}
		</if>
		<if test="completeMonitorInfoVo.inTimeEnd != null">
			AND a.CREATE_TIME <![CDATA[ <= ]]> #{completeMonitorInfoVo.inTimeEnd}
		</if>
		order by a.CREATE_TIME desc
huyuchen's avatar
huyuchen committed
184 185 186 187 188
	</select>

	<!--生成数据封装-->
	<select id="getAllMonitorEmpList" resultMap="tCompleteMonitorMap">
		select
huyuchen's avatar
huyuchen committed
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
		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
204
		b.CREATE_USER_NAME as ALERT_USER
huyuchen's avatar
huyuchen committed
205
		from
huyuchen's avatar
huyuchen committed
206 207 208 209 210 211
		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,
212 213 214
		sum(if(PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-10-01',1,0)) as AFTER_EMPLOYMENT,
		if(sum(if((PROJECT_STATUS = 0 and DATE_FORMAT(CREATE_TIME,'%Y-%m-%d') >= '2024-10-01' and IS_COMPLETE = '0') or '2024-10-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-10-01' and IS_COMPLETE = '1',1,0)) as AFTER_INCOMPLETE_NUM
huyuchen's avatar
huyuchen committed
215 216
		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
217
		<if test="deptNo != null and deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
218
			and b.DEPART_NO = #{deptNo}
huyuchen's avatar
huyuchen committed
219
		</if>
huyuchen's avatar
huyuchen committed
220
		group by b.DEPART_NO
huyuchen's avatar
huyuchen committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
	</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.IS_COLLEGE isCollege,
			e.HIGN_EDUCATION hignEducation,
240 241
			if(e.HIGN_EDUCATION != '5' and e.HIGN_EDUCATION != '6' and e.HIGN_EDUCATION != '7' and e.HIGN_EDUCATION != '8','1',e.SCHOOL) SCHOOL,
		    if(e.HIGN_EDUCATION != '5' and e.HIGN_EDUCATION != '6' and e.HIGN_EDUCATION != '7' and e.HIGN_EDUCATION != '8','1',e.MAJOR) MAJOR,
242 243
			if(e.HIGN_EDUCATION != '5' and e.HIGN_EDUCATION != '6' and e.HIGN_EDUCATION != '7' and e.HIGN_EDUCATION != '8','2022-05-13',e.ADMISSION_DATE) admissionDate,
			if(e.HIGN_EDUCATION != '5' and e.HIGN_EDUCATION != '6' and e.HIGN_EDUCATION != '7' and e.HIGN_EDUCATION != '8','2022-05-13',e.GRADUTION_DATE) gradutionDate,
huyuchen's avatar
huyuchen committed
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
			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,

huyuchen's avatar
huyuchen committed
261
			if(ifnull(f.OCCUPATIONAL_DISEASE_FLAG,'6') != '6' and ifnull(f.INFECTIOUS_DISEASE_FLAG,'6') != '6' and ifnull(f.DISABILITY_FLAG,'6') != '6' and ifnull(f.OTHER_FLAG,'6') != '6','1',null) as disabilityFlag,
huyuchen's avatar
huyuchen committed
262 263 264

			if(ifnull(b.REMARK,1) != 1,'1',null) as badRecordFlag,

265
			if(e.HIGN_EDUCATION != '5' and e.HIGN_EDUCATION != '6' and e.HIGN_EDUCATION != '7' and e.HIGN_EDUCATION != '8','1',if(c.count >0,'1',null)) as educationFlag,
huyuchen's avatar
huyuchen committed
266 267

			if(g.count >0,'1',null) as familyFlag
268

hongguangwu's avatar
hongguangwu committed
269 270 271 272
			,if(e.BANK_NAME='',null,e.BANK_NAME) bankName
			,if(e.BANK_NO='',null,e.BANK_NO) bankNo
			,if(e.BANK_PROVINCE='',null,e.BANK_PROVINCE) bankProvince
			,if(e.BANK_CITY='',null,e.BANK_CITY) bankCity
huyuchen's avatar
huyuchen committed
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
		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.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
298 299 300 301
					,ee.BANK_NAME
					,ee.BANK_NO
					,ee.BANK_PROVINCE
					,ee.BANK_CITY
huyuchen's avatar
huyuchen committed
302 303
				from t_employee_info ee
						 left join t_atta_info tt on ee.id = tt.DOMAIN_ID and tt.RELATION_TYPE = '9'
huyuchen's avatar
huyuchen committed
304
				where ee.DELETE_FLAG = '0' and ee.FILE_STATUS = 0 and tt.id is not null
huyuchen's avatar
huyuchen committed
305 306 307 308
				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
309
				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
310
				left join t_emp_contact_info d on a.EMP_IDCARD  = d.EMP_IDCARD
huyuchen's avatar
huyuchen committed
311 312
				left join t_emp_disability_info f on a.EMP_ID = f.EMP_ID and f.DELETE_FLAG = '0'
				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 = '0' group by EMP_ID) g on a.EMP_ID = g.EMP_ID
huyuchen's avatar
huyuchen committed
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
		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>

330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346

	<!-- 导出详情 -->
	<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
hongguangwu's avatar
hongguangwu committed
347 348
		p.EMP_ID mainId,if(p.IS_COMPLETE=0,'是','否') field1
		,DATE_FORMAT(p.create_time,'%Y-%m-%d') field2,e.EMP_CODE field3,e.EMP_NATRUE field4,e.emp_name field5,e.emp_idcard field6
349
		,if(e.EMP_SEX='2','女',if(e.EMP_SEX='1','男','-')) field7
350
		,if(e.VALIDITY_END is null,'-',if(e.VALIDITY_END > '2999-12-30','长期','固定')) field8	,e.VALIDITY_START field9
hongguangwu's avatar
hongguangwu committed
351 352 353 354
		,if(e.VALIDITY_END > '2999-12-30','长期',e.VALIDITY_END) field10,e.EMP_BIRTHDAY field11,e.EMP_AGE field12,e.EMP_MARRI_STATUS field13,e.EMP_NATIONAL field14
		,e.POLITICAL_STATUS field15,e.EMP_PHONE field16,e.EMP_EMAIL field17
		,e.ID_PROVINCE field18,e.ID_CITY field69,e.ID_TOWN field70,e.ID_PROVINCE field18,e.EMP_REGIS_TYPE field19
		,e.FILE_PROVINCE field20,e.FILE_CITY field71,e.FILE_TOWN field72,if(e.status=0,'草稿','已审核') field21
355
		,e.CONTACT_ADDRESS field22,p.UNIT_NAME field23,p.DEPT_NAME field24,p.DEPT_NO field64
356
		,concat(p.BUSINESS_PRIMARY_TYPE,'-',ifnull(p.BUSINESS_SECOND_TYPE,''),'-',ifnull(p.BUSINESS_THIRD_TYPE,'')) field25
huyuchen's avatar
huyuchen committed
357
		,p.CONTRACT_TYPE field26,p.WORKING_HOURS field27,p.POST field28,p.ENJOIN_DATE field29,p.TRY_PERIOD field30
hongguangwu's avatar
hongguangwu committed
358
		,p.EMP_LABEL field31
359
		,ec.EMP_NAME field32,ec.RELATION_TYPE field33,ec.ADDRESS field34,ec.TEL field35
hongguangwu's avatar
hongguangwu committed
360 361 362 363
		,if(e.IS_COLLEGE=0,'否','是') field39
		,e.HIGN_EDUCATION field40
		,if(e.FIRST_WORK_FLAG is null,'',if(e.FIRST_WORK_FLAG=0,'是','否')) field43
		,if(e.HAVE_QUALIFICATION is null,'',if(e.HAVE_QUALIFICATION=0,'是','否')) field51
364 365 366
		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
huyuchen's avatar
huyuchen committed
367 368
		left join (select contact.EMP_NAME ,contact.RELATION_TYPE,contact.ADDRESS,contact.TEL,contact.EMP_ID from
		t_emp_contact_info contact group by contact.EMP_ID) ec on e.id=ec.EMP_ID
hongguangwu's avatar
hongguangwu committed
369 370 371 372 373 374 375 376 377 378 379 380 381
		<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>

	<select id="getTEmpMainAllListByContract" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
382 383 384 385 386 387
			ee.EMP_ID mainId,ee.contract_name field26,ee.WORKING_HOURS field27,ee.POST field28,ee.CONTRACT_START field29,ee.TRY_PERIOD field30
		from t_employee_contract_info ee
		where ee.IN_USE='0' and ee.delete_flag = '0' and ee.audit_status = '2' and ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
388 389 390 391 392
		ORDER BY ee.create_time desc
	</select>

	<select id="getTEmpMainAllListByEducation" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
393 394 395 396 397 398
			ee.EMP_ID mainId,ee.SCHOOL field36,ee.MAJOR field37,ee.EDUCATION_NAME field38,ee.ENTRY_DATE field41,ee.GRADUTION_DATE field42
		from t_emp_education ee
		where ee.DELETE_FLAG = '0' and ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
399 400 401 402 403
		ORDER BY ee.create_time desc
	</select>

	<select id="getTEmpMainAllListByBad" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
404 405 406 407 408 409
			ee.EMP_ID mainId,ee.REMARK field63
		from t_emp_bad_record ee
		where ee.REMARK is not null  and ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
410 411 412 413 414
		ORDER BY ee.create_time desc
	</select>

	<select id="getTEmpMainAllListByDisability" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
415
			ee.EMP_ID mainId,if(ee.INJURY_IDENTIFICATION=0,'是','否') field54,if(ee.OCCUPATIONAL_DISEASE_FLAG=0,'是','否') field55	,ee.OCCUPATIONAL_DISEASE field56
hongguangwu's avatar
hongguangwu committed
416 417
		,if(ee.INFECTIOUS_DISEASE_FLAG=0,'是','否') field57	,ee.INFECTIOUS_NAME field58	,if(ee.DISABILITY_FLAG=0,'是','否') field59
		,ee.DISABILITY_NAME field60,ee.DISABILITY_LEVEL field61,if(ee.OTHER_FLAG=0,'是','否') field62
hongguangwu's avatar
hongguangwu committed
418 419 420 421 422
		from t_emp_disability_info ee
		where ee.DELETE_FLAG = '0'  and ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
423 424 425 426 427
		ORDER BY ee.create_time desc
	</select>

	<select id="getTEmpMainAllListByWork" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
428 429 430 431 432 433
			ee.EMP_ID mainId,ee.WORK_UNIT field44,ee.WORK_JOB field45,ee.START_DATE field46,ee.END_DATE field47
		from t_emp_work_recording ee
		where ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
434 435 436 437 438
		ORDER BY ee.create_time desc
	</select>

	<select id="getTEmpMainAllListByFamily" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
439 440 441 442 443 444
			ee.EMP_ID mainId,ee.FAMILY_NAME field48,ee.RELATIONSHIP_SELF field49,ee.CONTRACT_TEL field50
		FROM t_emp_family ee
		where ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
445 446 447 448 449
		ORDER BY ee.create_time desc
	</select>

	<select id="getTEmpMainAllListByProfessional" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
hongguangwu's avatar
hongguangwu committed
450 451 452 453 454 455
			ee.EMP_ID mainId,ee.DECLARE_YEAR field52,ee.QUALIFICATION_TYPE field53
		FROM t_emp_professional_qualification ee
		where ee.EMP_ID in
		<foreach collection="empIdList" item="ids" open="(" separator="," close=")">
			#{ids}
		</foreach>
hongguangwu's avatar
hongguangwu committed
456
		ORDER BY ee.create_time desc
457 458
	</select>

459 460 461
	<!-- 数量 -->
	<select id="getTEmpMainAllCountOneWork" resultType="java.lang.Integer">
		SELECT
hongguangwu's avatar
hongguangwu committed
462
		count(DISTINCT ew.id)
463 464 465 466 467 468
		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 (
469 470
			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
471 472 473 474 475
			)
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>

476 477 478 479 480 481 482 483
	<!--导出统计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
484
		left join t_emp_work_recording ew on e.id=ew.EMP_ID
485
		<where>
486 487 488
			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
			)
489 490
			<include refid="tCompleteMonitor_where"/>
		</where>
491
		group  by ew.id ORDER BY e.emp_idcard DESC
492 493 494 495 496 497 498
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>

499 500 501
	<!-- 数量 -->
	<select id="getTEmpMainAllCountTwoFamily" resultType="java.lang.Integer">
		SELECT
hongguangwu's avatar
hongguangwu committed
502
		count(DISTINCT ef.id)
503 504 505 506 507 508 509 510 511 512 513
		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>
514 515 516 517
	<!--导出统计list2主要家庭成员信息-->
	<select id="getTEmpMainAllListTwoFamily" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
		e.emp_idcard field6
hongguangwu's avatar
hongguangwu committed
518
		,ef.FAMILY_NAME field48,ef.RELATIONSHIP_SELF field49,ef.CONTRACT_TEL field50
519 520 521
		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
522
		left join t_emp_family ef on e.id=ef.EMP_ID
523
		<where>
524 525 526
			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
			)
527 528
			<include refid="tCompleteMonitor_where"/>
		</where>
529
		group  by ef.id ORDER BY e.emp_idcard DESC
530 531 532 533 534 535
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>
536 537 538 539

	<!-- 数量 -->
	<select id="getTEmpMainAllCountThreeProfessional" resultType="java.lang.Integer">
		SELECT
hongguangwu's avatar
hongguangwu committed
540
		count(DISTINCT ep.id)
541 542 543 544 545 546 547 548 549 550 551
		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>
552 553 554 555
	<!--导出统计list3职业资格信息-->
	<select id="getTEmpMainAllListThreeProfessional" resultType="com.yifu.cloud.plus.v1.yifu.archives.vo.TMainExportAllVO">
		SELECT
		e.emp_idcard field6
hongguangwu's avatar
hongguangwu committed
556
		,if(e.HAVE_QUALIFICATION is null,'',if(e.HAVE_QUALIFICATION=0,'是','否')) field51,ep.DECLARE_YEAR field52,ep.QUALIFICATION_TYPE field53
557 558 559
		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
560 561
		left join t_emp_professional_qualification ep on e.id=ep.EMP_ID
		<where>
562 563 564
			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
			)
565 566
			<include refid="tCompleteMonitor_where"/>
		</where>
567
		group  by ep.id ORDER BY e.emp_idcard DESC
568 569 570 571 572 573 574
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>

huyuchen's avatar
huyuchen committed
575
</mapper>