TElecEmployeeInfoMapper.xml 4.82 KB
Newer Older
fangxinjiang's avatar
fangxinjiang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<?xml version="1.0" encoding="UTF-8"?>

<!--
  ~
  ~      Copyright (c) 2018-2025, lengleng All rights reserved.
  ~
  ~  Redistribution and use in source and binary forms, with or without
  ~  modification, are permitted provided that the following conditions are met:
  ~
  ~ Redistributions of source code must retain the above copyright notice,
  ~  this list of conditions and the following disclaimer.
  ~  Redistributions in binary form must reproduce the above copyright
  ~  notice, this list of conditions and the following disclaimer in the
  ~  documentation and/or other materials provided with the distribution.
  ~  Neither the name of the yifu4cloud.com developer nor the names of its
  ~  contributors may be used to endorse or promote products derived from
  ~  this software without specific prior written permission.
  ~  Author: lengleng (wangiegie@gmail.com)
  ~
  -->

<!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.TElecEmployeeInfoMapper">

  <resultMap id="tElecEmployeeInfoMap" type="com.yifu.cloud.plus.v1.yifu.archives.entity.TElecEmployeeInfo">
    <id property="id" column="ID"/>
    <result property="empName" column="EMP_NAME"/>
    <result property="empIdcard" column="EMP_IDCARD"/>
    <result property="empNo" column="EMP_NO"/>
31 32 33
    <result property="unitName" column="UNIT_NAME"/>
    <result property="deptName" column="DEPT_NAME"/>
    <result property="deptNo" column="DEPT_NO"/>
fangxinjiang's avatar
fangxinjiang committed
34
    <result property="dataType" column="DATA_TYPE"/>
35
    <result property="deleteFlag" column="DELETE_FLAG"/>
fangxinjiang's avatar
fangxinjiang committed
36 37 38 39 40 41
    <result property="createBy" column="CREATE_BY"/>
    <result property="updateBy" column="UPDATE_BY"/>
    <result property="createName" column="CREATE_NAME"/>
    <result property="createTime" column="CREATE_TIME"/>
    <result property="updateTime" column="UPDATE_TIME"/>
  </resultMap>
42 43 44

	<sql id="Base_Column_List">
		a.ID,
45
		a.EMP_NAME,
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
		a.EMP_IDCARD,
		a.DATA_TYPE,
		a.DELETE_FLAG,
		a.UPDATE_BY,
		a.CREATE_BY,
		a.CREATE_NAME,
		a.CREATE_TIME,
		a.UPDATE_TIME
	</sql>

	<sql id="tElecEmployeeInfo_where">
	<if test="tElecEmployeeInfo != null">
		<if test="tElecEmployeeInfo.id != null and tElecEmployeeInfo.id.trim() != ''">
			AND a.ID = #{tElecEmployeeInfo.id}
		</if>
		<if test="tElecEmployeeInfo.empName != null and tElecEmployeeInfo.empName.trim() != ''">
62
			AND a.EMP_NAME = #{tElecEmployeeInfo.empName}
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 88 89
		</if>
		<if test="tElecEmployeeInfo.empIdcard != null and tElecEmployeeInfo.empIdcard.trim() != ''">
			AND a.EMP_IDCARD = #{tElecEmployeeInfo.empIdcard}
		</if>
		<if test="tElecEmployeeInfo.dataType != null and tElecEmployeeInfo.dataType.trim() != ''">
			AND a.DATA_TYPE = #{tElecEmployeeInfo.dataType}
		</if>
		<if test="tElecEmployeeInfo.createBy != null and tElecEmployeeInfo.createBy.trim() != ''">
			AND a.CREATE_BY = #{tElecEmployeeInfo.createBy}
		</if>
		<if test="tElecEmployeeInfo.createName != null and tElecEmployeeInfo.createName.trim() != ''">
			AND a.CREATE_NAME = #{tElecEmployeeInfo.createName}
		</if>
		<if test="tElecEmployeeInfo.createTime != null">
			AND a.CREATE_TIME = #{tElecEmployeeInfo.createTime}
		</if>
		<if test="tElecEmployeeInfo.updateBy != null and tElecEmployeeInfo.updateBy.trim() != ''">
			AND a.UPDATE_BY = #{tElecEmployeeInfo.updateBy}
		</if>
		<if test="tElecEmployeeInfo.updateTime != null">
			AND a.UPDATE_TIME = #{tElecEmployeeInfo.updateTime}
		</if>
	</if>
	</sql>

	<!--tElecEmployeeInfo简单分页查询-->
	<select id="getTElecEmployeeInfoPage" resultMap="tElecEmployeeInfoMap">
huyuchen's avatar
huyuchen committed
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
		SELECT * from (
			SELECT
			<include refid="Base_Column_List"/>,GROUP_CONCAT(distinct c.DEPT_NAME) as DEPT_NAME,GROUP_CONCAT(distinct c.UNIT_NAME) as UNIT_NAME,GROUP_CONCAT(distinct c.DEPT_NO) as DEPT_NO,GROUP_CONCAT(distinct c.EMP_NO) as EMP_NO
			FROM t_elec_employee_info a
			left join t_employee_info b on a.EMP_IDCARD = b.EMP_IDCARD
			left join t_employee_project c on a.EMP_IDCARD = c.EMP_IDCARD AND c.DELETE_FLAG = '0' AND c.PROJECT_STATUS = '0'
			WHERE a.DELETE_FLAG = '0'
				<include refid="tElecEmployeeInfo_where"/>
			GROUP BY a.EMP_IDCARD,a.CREATE_TIME,a.DATA_TYPE
			ORDER BY a.CREATE_TIME desc
		) b
		where 1=1
		<if test="tElecEmployeeInfo.unitName != null and tElecEmployeeInfo.unitName.trim() != ''">
			AND b.UNIT_NAME like concat('%',#{tElecEmployeeInfo.unitName},'%')
		</if>
		<if test="tElecEmployeeInfo.deptName != null and tElecEmployeeInfo.deptName.trim() != ''">
			AND b.DEPT_NAME like concat('%',#{tElecEmployeeInfo.deptName},'%')
		</if>
		<if test="tElecEmployeeInfo.deptNo != null and tElecEmployeeInfo.deptNo.trim() != ''">
			AND b.DEPT_NO like concat('%',#{tElecEmployeeInfo.deptNo},'%')
		</if>
		<if test="tElecEmployeeInfo.empNo != null and tElecEmployeeInfo.empNo.trim() != ''">
			AND b.EMP_NO like concat('%',#{tElecEmployeeInfo.empNo},'%')
		</if>
114
	</select>
fangxinjiang's avatar
fangxinjiang committed
115
</mapper>