孔祥富
2021-03-07 f337e00700b069f6d3229a9fef1fcd8623e9d69f
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml
@@ -5,6 +5,12 @@
    <select id="sysConfig" resultType="cc.mrbird.febs.common.core.entity.system.SysConfig">
           select * from sys_config where delFlag='0' and config_key in ("manOld","womanOld") ORDER BY config_key asc
    </select>
    <select id="selectPageVo" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select a.* from t_emp_baseInfo a
        inner join t_dept c on a.deptId = c.DEPT_ID
        ${ew.customSqlSegment}
    </select>
    <select id="countZcygBaseInfoList" resultType="java.util.Map">
        SELECT
@@ -18,7 +24,7 @@
        IF (t.dimissionType = '4', 1, NULL)
        ) gsct
        FROM
        t_emp_baseinfo t where 1=1 and t.delFlag=0
        t_emp_baseinfo t where 1=1 and t.delFlag=0 and t.empStatus='1'
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t.createTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t.createTime,'%Y-%m-%d') &lt;= #{etime}
@@ -40,12 +46,12 @@
    </select>
    <select id="countBaseInfoList" resultType="java.util.Map">
        SELECT
            count(IF(t.empStatus = 0, 1, NULL)) zzyg,
            count(IF(t.empStatus = 0 and t.empType = '1', 1, NULL)) zsyg,
            count(IF(t.empStatus = 0 and t.empType = '2', 1, NULL)) lsyg,
            count(1) zzyg,
            count(IF(t.empType = '1', 1, NULL)) zsyg,
            count(IF(t.empType = '2', 1, NULL)) lsyg,
        count( if(t.sex is not null and t.age !=0 and t.sex=1 and t.age&gt;=${manOld},1,null))+count( if(t.sex is not null and t.age !=0 and t.sex=2 and t.age&gt;=${womanOld},1,null)) clyg
        FROM
            t_emp_baseinfo t where 1=1 and t.delFlag=0
            t_emp_baseinfo t where 1=1 and t.delFlag=0 and t.empStatus = 0
    </select>
@@ -151,6 +157,24 @@
        count(IF(t1.contractStatus = 1 or t1.contractStatus = 2, 1, NULL)) yxht
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.signingDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.signingDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.signingDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
@@ -378,22 +402,22 @@
        SELECT
        count(1) sfz
        FROM
        t_emp_baseinfo t  where 1=1 and t.delFlag=0
        t_emp_baseinfo t  where 1=1 and t.delFlag=0 and t.empStatus=0
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t.certificateValidity,'%Y-%m-%d') &gt;= #{btime}  and date_format(t.certificateValidity,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t.certificateValidity) = TO_DAYS(NOW())
                and TO_DAYS(t.certificateValidity) &lt;= TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t.certificateValidity,'%Y-%m-%d')) = YEARWEEK(now())
                and YEARWEEK(date_format(t.certificateValidity,'%Y-%m-%d')) &lt;= YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t.certificateValidity,'%Y-%m') = date_format(now(),'%Y-%m')
                and date_format(t.certificateValidity,'%Y-%m') &lt;= date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t.certificateValidity)=YEAR(NOW())
                and YEAR(t.certificateValidity)&lt;=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
@@ -446,7 +470,7 @@
    <select id="zzbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where empStatus=0 and t1.delFlag=0
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where t1.empStatus=0 and t1.delFlag=0
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
            t1.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
@@ -458,13 +482,13 @@
                SELECT
                t.*
                FROM
                t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t.delFlag=0  and t.sex is not null and t.age !=0 and t.sex=1 and t.age&gt;=${manOld}
                t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t.empStatus = 0 and t.delFlag=0  and t.sex is not null and t.age !=0 and t.sex=1 and t.age&gt;=${manOld}
                UNION
                SELECT
                t.*
                FROM
                t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t.delFlag=0  and t.sex is not null and t.age !=0 and t.sex=2 and t.age&gt;=${womanOld}
                t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t.empStatus = 0 and t.delFlag=0  and t.sex is not null and t.age !=0 and t.sex=2 and t.age&gt;=${womanOld}
        ) t1 where 1=1
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
@@ -475,7 +499,7 @@
    <select id="sfzbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t1.delFlag=0
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t1.delFlag=0 and t1.empStatus=0
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
            t1.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
@@ -485,16 +509,16 @@
                and date_format(t1.certificateValidity,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.certificateValidity,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.certificateValidity) = TO_DAYS(NOW())
                and TO_DAYS(t1.certificateValidity) &lt;= TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.certificateValidity,'%Y-%m-%d')) = YEARWEEK(now())
                and YEARWEEK(date_format(t1.certificateValidity,'%Y-%m-%d')) &lt;= YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.certificateValidity,'%Y-%m') = date_format(now(),'%Y-%m')
                and date_format(t1.certificateValidity,'%Y-%m') &lt;= date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.certificateValidity)=YEAR(NOW())
                and YEAR(t1.certificateValidity)&lt;=YEAR(NOW())
            </otherwise>
        </choose>
@@ -528,7 +552,7 @@
    <select id="zsbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where empType='1' and t1.delFlag=0 and empStatus=0
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where t1.empType='1' and t1.delFlag=0 and t1.empStatus=0
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
            t1.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
@@ -536,7 +560,7 @@
    </select>
    <select id="lsbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where empType='2' and t1.delFlag=0 and empStatus=0
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where t1.empType='2' and t1.delFlag=0 and t1.empStatus=0
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
            t1.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
@@ -546,7 +570,7 @@
    <select id="lzbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t1.delFlag=0 and empStatus=1
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t1.delFlag=0 and t1.empStatus=1
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t1.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
            t1.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
@@ -586,7 +610,7 @@
    <select id="zcbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t1.delFlag=0
        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t1.delFlag=0 and t1.empStatus='1'
        <choose>
            <when test="number==8">
               and t1.dimissionType = '1'
@@ -671,6 +695,23 @@
            </when>
            <otherwise>
                and (t1.contractStatus = '1' or t1.contractStatus = '2')
                <choose>
                    <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                        and date_format(t1.signingDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.signingDate,'%Y-%m-%d') &lt;= #{etime}
                    </when>
                    <when test="index==0">
                        and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
                    </when>
                    <when test="index==1">
                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
                    </when>
                    <when test="index==2">
                        and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
                    </when>
                    <otherwise>
                        and YEAR(t1.signingDate)=YEAR(NOW())
                    </otherwise>
                </choose>
            </otherwise>
        </choose>
        <if test="name!= 'undefined' and name!=null and name!=''">
@@ -1017,11 +1058,12 @@
    <select id="empBaseInfoTgList" resultType="cc.mrbird.febs.server.hr.entity.EmpJobChange">
        SELECT
        t1.*
        t1.*,t.empNumb,t.deptName,t.certificateNumb
        FROM
        t_emp_baseinfo t right JOIN t_emp_jobChange t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
        <if test="name!= 'undefined' and name!=null and name!=''">
            and t1.empName like CONCAT('%',#{name},'%'
            and (t.empNumb like CONCAT('%',#{name},'%') or t1.empName like CONCAT('%',#{name},'%') or
            t.certificateNumb like CONCAT('%',#{name},'%') or t.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">