luoyb
2021-02-19 f52362127751004c996ca9ee2f6f87d7e010b424
febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml
New file
@@ -0,0 +1,1032 @@
<?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="cc.mrbird.febs.server.hr.mapper.EmpBaseInfoMapper">
    <select id="countBaseInfoList" resultType="java.util.Map">
        SELECT
            count(IF(t.empStatus = 0, 1, NULL)) zzyg,
            count(IF(t.empType = '1', 1, NULL)) zsyg,
            count(IF(t.empType = '2', 1, NULL)) lsyg,
            count(
                IF (t.dimissionType = '1', 1, NULL)
            ) zclz,
            count(
                IF (t.dimissionType = '2', 1, NULL)
            ) zdlz,
            count(
                IF (t.dimissionType = '4', 1, NULL)
            ) gsct
        FROM
            t_emp_baseinfo t where 1=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}
            </when>
            <when test="index==0">
                and TO_DAYS(t.createTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t.createTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t.createTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countXjygBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) xjyg
        FROM
        t_emp_baseinfo t where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t.entryDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t.entryDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t.entryDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t.entryDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t.entryDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t.entryDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countLzygBaseInfoList" resultType="java.util.Map">
        SELECT
        count(1) lzyg,count(IF(t1.contractStatus = 3, 1, NULL)) jcht
        FROM
        t_emp_baseinfo t left JOIN t_emp_contractinfo t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t.dimissionDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t.dimissionDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t.dimissionDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t.dimissionDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countCzygBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) czyg
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_resign t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.applayDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.applayDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countYxhtBaseInfoList" resultType="java.util.Map">
        SELECT
        count(IF(t1.contractStatus = 1 or t1.contractStatus = 2, 1, NULL)) yxht,
        count(IF(t1.contractStatus = 1, 1, NULL)) xinqht,
        count(IF(t1.contractStatus = 2, 1, NULL)) xqht
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t1 on t.empId=t1.empId where 1=1
        <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>
    <select id="countDqhtBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(IF(t1.contractStatus = 4, 1, NULL)) dqht
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.endDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.endDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.endDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.endDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.endDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.endDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countCqrsBaseInfoList" resultType="java.util.Map">
        SELECT
        count(1) cqrs,count(IF(t1.overtimeDay!=0 or t1.overtimeHour!=0, 1, NULL)) ygjb
        ,count(IF(t1.absenteeism !=0 , 1, NULL)) ygkg
        FROM
        t_emp_baseinfo t right  JOIN t_emp_dimissionattend t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and t1.attendMonth &gt;= #{btime}  and t1.attendMonth &lt;= #{etime}
            </when>
            <when test="index==2">
                and t1.attendMonth = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and t1.attendMonth=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countYgqjBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) ygqj
        FROM
        t_emp_baseinfo t right  JOIN t_emp_leaveinfo t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.returnDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.returnDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.returnDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.returnDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.returnDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.returnDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countLzajBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) lzaj
        FROM
        t_emp_baseinfo t right  JOIN t_emp_labortrouble t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.arbitrationDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.arbitrationDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.arbitrationDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.arbitrationDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.arbitrationDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.arbitrationDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countGsajBaseInfoList" resultType="java.util.Map">
        SELECT (SELECT  count(1)
        FROM
        t_emp_baseinfo t right  JOIN t_emp_accidentcases t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.injuredTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.injuredTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.injuredTime)=YEAR(NOW())
            </otherwise>
        </choose>) ywxaj,(
        SELECT
        count(1)
        FROM
        t_emp_baseinfo t right  JOIN t_emp_occupational t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.injuredTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.injuredTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.injuredTime)=YEAR(NOW())
            </otherwise>
        </choose>) gsaj
    </select>
    <select id="countSbsqBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) sbsq
        FROM
        t_emp_baseinfo t right  JOIN t_emp_insurance t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.applayDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.applayDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countSyjBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) syj
        FROM
        t_emp_baseinfo t right  JOIN t_emp_unemployment t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.applayDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.applayDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countYgtjBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) ygtj
        FROM
        t_emp_baseinfo t right  JOIN t_emp_physicalexam t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.physicalExamDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.physicalExamDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.physicalExamDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.physicalExamDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.physicalExamDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.physicalExamDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countSfzBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) sfz
        FROM
        t_emp_baseinfo t  where 1=1
        <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())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t.certificateValidity,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t.certificateValidity,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t.certificateValidity)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countYgtgBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) ygtg
        FROM
        t_emp_baseinfo t right  JOIN t_emp_jobChange t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="index==0">
                and TO_DAYS(t1.changeDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.changeDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.changeDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.changeDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="countBljlBaseInfoList" resultType="java.lang.Integer">
        SELECT
        count(1) bljl
        FROM
        t_emp_baseinfo t right  JOIN t_emp_badrecord t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="btime!=null and btime!='' and etime!=null and etime!=''">
                and date_format(t1.badDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.badDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.badDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.badDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.badDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.badDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <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
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.createTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.createTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.createTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.createTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.createTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <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
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                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())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.certificateValidity,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.certificateValidity,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.certificateValidity)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="xjbaseInfoList" 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
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.entryDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.entryDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.entryDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.entryDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.entryDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.entryDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <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'
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.createTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.createTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.createTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.createTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.createTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </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'
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.createTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.createTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.createTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.createTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.createTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <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
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.dimissionDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.dimissionDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.dimissionDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.dimissionDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.dimissionDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="cjbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        SELECT
        t.*,t1.applayDate,t1.reason,t1.reporter
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_resign t1 on t.empId=t1.empId left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t.empNumb like CONCAT('%',#{name},'%') or t.empName like CONCAT('%',#{name},'%') or
            t.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.applayDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.applayDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <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
        <choose>
            <when test="number==8">
               and t1.dimissionType = '1'
            </when>
            <when test="number==9">
                and t1.dimissionType = '2'
            </when>
            <when test="number==10">
                and t1.dimissionType = '4'
            </when>
            <otherwise>
            </otherwise>
        </choose>
        <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},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.createTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.createTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.createTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.createTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.createTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="yxbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        select t1.* from t_emp_baseinfo t left join t_dept t2 on t.deptId=t2.DEPT_ID INNER JOIN t_emp_contractinfo t1 on t.empId=t1.empId where 1=1
        <choose>
            <when test="number==14">
                and t1.contractStatus = '2'
            </when>
            <when test="number==13">
                and t1.contractStatus = '1'
            </when>
            <otherwise>
                and (t1.contractStatus = '1' or t1.contractStatus = '2')
            </otherwise>
        </choose>
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t.empNumb like CONCAT('%',#{name},'%') or t.empName like CONCAT('%',#{name},'%') or
            t.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
        </if>
        <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>
    </select>
    <select id="dqbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t1 on t.empId=t1.empId left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t1.contractStatus = '4'
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t.empNumb like CONCAT('%',#{name},'%') or t.empName like CONCAT('%',#{name},'%') or
            t.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.endDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.endDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.endDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.endDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.endDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.endDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="jcseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t1 on t.empId=t1.empId left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1 and t1.contractStatus = '3'
        <if test="name!= 'undefined' and name!=null and name!=''">
            and (t.empNumb like CONCAT('%',#{name},'%') or t.empName like CONCAT('%',#{name},'%') or
            t.certificateNumb like CONCAT('%',#{name},'%') or t2.DEPT_NAME like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t.dimissionDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t.dimissionDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t.dimissionDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t.dimissionDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoCqList" resultType="cc.mrbird.febs.server.hr.entity.EmpDimissionAttend">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_dimissionattend t1 on t.empId=t1.empId left join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1
        <choose>
            <when test="number==3">
              and  t1.absenteeism !=0
            </when>
            <when test="number==2">
              and  (t1.overtimeDay!=0 or t1.overtimeHour!=0)
            </when>
            <otherwise>
            </otherwise>
        </choose>
        <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 t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                  and t1.attendMonth &gt;= #{btime}  and t1.attendMonth &lt;= #{etime}
            </when>
            <when test="index==2">
                and t1.attendMonth = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and t1.attendMonth=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoQjList" resultType="cc.mrbird.febs.server.hr.entity.EmpLeaveInfo">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_leaveinfo t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.returnDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.returnDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.returnDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.returnDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.returnDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.returnDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoTjList" resultType="cc.mrbird.febs.server.hr.entity.EmpPhysicalExam">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_physicalexam t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.physicalExamDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.physicalExamDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.physicalExamDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.physicalExamDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.physicalExamDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.physicalExamDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoLzList" resultType="cc.mrbird.febs.server.hr.entity.EmpLaborTrouble">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_labortrouble t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.arbitrationDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.arbitrationDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.arbitrationDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.arbitrationDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.arbitrationDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.arbitrationDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoGsList" resultType="cc.mrbird.febs.server.hr.entity.EmpOccupational">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_occupational t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.injuredTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.injuredTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.injuredTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoYwList" resultType="cc.mrbird.febs.server.hr.entity.EmpAccidentCases">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_accidentcases t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.injuredTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.injuredTime,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.injuredTime)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoSbList" resultType="cc.mrbird.febs.server.hr.entity.EmpInsurance">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_insurance t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.applayDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.applayDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoSyjList" resultType="cc.mrbird.febs.server.hr.entity.EmpUnemployment">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_unemployment t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.applayDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.applayDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
    <select id="empBaseInfoBlList" resultType="cc.mrbird.febs.server.hr.entity.EmpBadRecord">
        SELECT
        t1.*
        FROM
        t_emp_baseinfo t right JOIN t_emp_badrecord t1 on t.empId=t1.empId 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
            t1.certificateNumb like CONCAT('%',#{name},'%') or t1.deptName like CONCAT('%',#{name},'%'))
        </if>
        <choose>
            <when test="btime!='undefined' and btime!=null and btime!='' and etime!='undefined' and etime!=null and etime!=''">
                and date_format(t1.badDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t1.badDate,'%Y-%m-%d') &lt;= #{etime}
            </when>
            <when test="index==0">
                and TO_DAYS(t1.badDate) = TO_DAYS(NOW())
            </when>
            <when test="index==1">
                and YEARWEEK(date_format(t1.badDate,'%Y-%m-%d')) = YEARWEEK(now())
            </when>
            <when test="index==2">
                and date_format(t1.badDate,'%Y-%m') = date_format(now(),'%Y-%m')
            </when>
            <otherwise>
                and YEAR(t1.badDate)=YEAR(NOW())
            </otherwise>
        </choose>
    </select>
</mapper>