TCompleteMonitorMapper.xml 24.2 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,
hongguangwu's avatar
hongguangwu committed
149 150
			a.EMP_ID empInfoId,
			a.ID empProjectId
huyuchen's avatar
huyuchen committed
151 152 153
		from
			t_employee_project a
			left join t_employee_info b on a.EMP_ID = b.id
154 155 156 157 158 159 160 161 162
		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
163
			and b.EMP_PHONE = #{completeMonitorInfoVo.phone}
164
		</if>
165 166 167
		<if test="completeMonitorInfoVo.empIdCard != null and completeMonitorInfoVo.empIdCard.trim() != ''">
			and a.EMP_IDCARD = #{completeMonitorInfoVo.empIdCard}
		</if>
168 169 170 171 172 173 174 175 176 177
		<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
178 179 180 181 182
	</select>

	<!--生成数据封装-->
	<select id="getAllMonitorEmpList" resultMap="tCompleteMonitorMap">
		select
huyuchen's avatar
huyuchen committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
		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
198
		b.CREATE_USER_NAME as ALERT_USER
huyuchen's avatar
huyuchen committed
199
		from
huyuchen's avatar
huyuchen committed
200 201 202 203 204 205
		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,
wangpeng's avatar
wangpeng committed
206 207 208
		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
209 210
		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
211
		<if test="deptNo != null and deptNo.trim() != ''">
huyuchen's avatar
huyuchen committed
212
			and b.DEPART_NO = #{deptNo}
huyuchen's avatar
huyuchen committed
213
		</if>
huyuchen's avatar
huyuchen committed
214
		group by b.DEPART_NO
huyuchen's avatar
huyuchen committed
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233
	</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,
234 235
			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,
236 237
			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
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
			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
255
			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
256 257 258

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

259
			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
260 261

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

hongguangwu's avatar
hongguangwu committed
263 264 265 266
			,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
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
		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
292 293 294 295
					,ee.BANK_NAME
					,ee.BANK_NO
					,ee.BANK_PROVINCE
					,ee.BANK_CITY
huyuchen's avatar
huyuchen committed
296 297
				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
298
				where ee.DELETE_FLAG = '0' and ee.FILE_STATUS = 0 and tt.id is not null
huyuchen's avatar
huyuchen committed
299 300 301 302
				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
303
				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
304
				left join t_emp_contact_info d on a.EMP_IDCARD  = d.EMP_IDCARD
huyuchen's avatar
huyuchen committed
305 306
				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
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323
		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>

324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340

	<!-- 导出详情 -->
	<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
341 342
		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
343
		,if(e.EMP_SEX='2','女',if(e.EMP_SEX='1','男','-')) field7
344
		,if(e.VALIDITY_END is null,'-',if(e.VALIDITY_END > '2999-12-30','长期','固定')) field8	,e.VALIDITY_START field9
hongguangwu's avatar
hongguangwu committed
345 346 347 348
		,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
349 350
		,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
hongguangwu's avatar
hongguangwu committed
351
		,p.EMP_LABEL field31
352
		,ec.EMP_NAME field32,ec.RELATION_TYPE field33,ec.ADDRESS field34,ec.TEL field35
hongguangwu's avatar
hongguangwu committed
353 354 355 356
		,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
357 358 359 360
		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_contact_info ec on e.id=ec.EMP_ID
hongguangwu's avatar
hongguangwu committed
361 362 363 364 365 366 367 368 369 370 371 372 373
		<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
374 375 376 377 378 379
			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
380 381 382 383 384
		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
385 386 387 388 389 390
			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
391 392 393 394 395
		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
396 397 398 399 400 401
			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
402 403 404 405 406
		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
407
			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
408 409
		,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
410 411 412 413 414
		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
415 416 417 418 419
		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
420 421 422 423 424 425
			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
426 427 428 429 430
		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
431 432 433 434 435 436
			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
437 438 439 440 441
		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
442 443 444 445 446 447
			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
448
		ORDER BY ee.create_time desc
449 450
	</select>

451 452 453
	<!-- 数量 -->
	<select id="getTEmpMainAllCountOneWork" resultType="java.lang.Integer">
		SELECT
hongguangwu's avatar
hongguangwu committed
454
		count(DISTINCT ew.id)
455 456 457 458 459 460
		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 (
461 462
			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
463 464 465 466 467
			)
			<include refid="tCompleteMonitor_where"/>
		</where>
	</select>

468 469 470 471 472 473 474 475
	<!--导出统计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
476
		left join t_emp_work_recording ew on e.id=ew.EMP_ID
477
		<where>
478 479 480
			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
			)
481 482
			<include refid="tCompleteMonitor_where"/>
		</where>
483
		group  by ew.id ORDER BY e.emp_idcard DESC
484 485 486 487 488 489 490
		<if test="tCompleteMonitor != null">
			<if test="tCompleteMonitor.limitStart != null">
				limit #{tCompleteMonitor.limitStart},#{tCompleteMonitor.limitEnd}
			</if>
		</if>
	</select>

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

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

huyuchen's avatar
huyuchen committed
567
</mapper>