From d90db860b7ea15a6d6c58a3e77b649966f3ab6bf Mon Sep 17 00:00:00 2001
From: yubo <autumnal_wind@yeah.net>
Date: 星期三, 08 四月 2026 21:05:26 +0800
Subject: [PATCH] fix(hr): 修正合同信息查询条件中的员工状态过滤

---
 febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml |  431 ++++++++++++++++++++++++++++++++---------------------
 1 files changed, 263 insertions(+), 168 deletions(-)

diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml
index 3d84ba8..a4c970c 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/mapper/EmpBaseInfoMapper.xml
@@ -7,39 +7,43 @@
     </select>
     
     <select id="selectPageVo" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
-        select a.* from t_emp_baseInfo a 
+        select a.* from t_emp_baseinfo a
         inner join t_dept c on a.deptId = c.DEPT_ID
         ${ew.customSqlSegment}
     </select>
-
+    <select id="listAll" 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
         count(
-        IF (t.dimissionType = '1', 1, NULL)
+        IF (t2.dimissionType = '6', 1, NULL)
         ) zclz,
         count(
-        IF (t.dimissionType = '2', 1, NULL)
+        IF (t2.dimissionType = '4', 1, NULL)
         ) zdlz,
         count(
-        IF (t.dimissionType = '4', 1, NULL)
+        IF (t2.dimissionType = '3', 1, NULL)
         ) gsct
-        FROM
-        t_emp_baseinfo t where 1=1 and t.delFlag=0 and t.empStatus='1'
+        FROM t_emp_dimissionlog t2 inner join
+        t_emp_baseinfo t on t2.empId=t.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t2.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}
+                and date_format(t2.dimissionDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.dimissionDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t.createTime) = TO_DAYS(NOW())
+                and TO_DAYS(t2.dimissionDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t.createTime,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.dimissionDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t.createTime)=YEAR(NOW())
+                and YEAR(t2.dimissionDate)=YEAR(NOW())
             </otherwise>
         </choose>
 
@@ -47,11 +51,12 @@
     <select id="countBaseInfoList" resultType="java.util.Map">
         SELECT
             count(1) zzyg,
-            count(IF(t.empType = '1', 1, NULL)) zsyg,
-            count(IF(t.empType = '2', 1, NULL)) lsyg,
+            count(IF(t.empType = '01', 1, NULL)) zsyg,
+            count(IF(t.empType = '02', 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 and t.empStatus = 0
+            t_emp_baseinfo t inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t.empStatus = 0
+
     </select>
 
 
@@ -59,7 +64,7 @@
         SELECT
         count(1) xjyg
         FROM
-        t_emp_baseinfo t where 1=1 and t.delFlag=0
+        t_emp_baseinfo t inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0
         <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}
@@ -68,7 +73,7 @@
                 and TO_DAYS(t.entryDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t.entryDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t.entryDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t.entryDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -80,10 +85,10 @@
     </select>
     <select id="countLzygBaseInfoList" resultType="java.util.Map">
         SELECT
-        count(IF(t1.contractStatus = 3, 1, NULL)) jcht
+        count(IF(t2.contractStatus = 3, 1, NULL)) jcht
 
         FROM
-        t_emp_baseinfo t left JOIN t_emp_contractinfo t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t left JOIN t_emp_contractinfo t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
@@ -92,7 +97,7 @@
                 and TO_DAYS(t.dimissionDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -106,73 +111,73 @@
         SELECT
         count(1) czyg
         FROM
-        t_emp_baseinfo t INNER JOIN t_emp_resign t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t INNER JOIN t_emp_resign t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.applayDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.applayDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.applayDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.applayDate)=YEAR(NOW())
+                and YEAR(t2.applayDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
 
     <select id="countXqhtBaseInfoList" resultType="java.util.Map">
         SELECT
-        count(IF(t1.contractStatus = 1, 1, NULL)) xinqht,
-        count(IF(t1.contractStatus = 2, 1, NULL)) xqht
+        count(IF(t2.contractStatus = 1, 1, NULL)) xinqht,
+        count(IF(t2.contractStatus = 2, 1, NULL)) xqht
 
         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
+        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.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}
+                and date_format(t2.signingDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.signingDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.signingDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.signingDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.signingDate)=YEAR(NOW())
+                and YEAR(t2.signingDate)=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(t2.contractStatus = 1 or t2.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
+        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.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}
+                and date_format(t2.signingDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.signingDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.signingDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.signingDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.signingDate)=YEAR(NOW())
+                and YEAR(t2.signingDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -180,24 +185,24 @@
 
     <select id="countDqhtBaseInfoList" resultType="java.lang.Integer">
         SELECT
-        count(IF(t1.contractStatus = 4, 1, NULL)) dqht
+        count(IF(t2.contractStatus in('1','2'), 1, NULL)) dqht
         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
+        t_emp_baseinfo t INNER JOIN t_emp_contractinfo t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.endDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.endDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.endDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.endDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.endDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.endDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.endDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.endDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.endDate)=YEAR(NOW())
+                and YEAR(t2.endDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -205,20 +210,20 @@
 
     <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
+        count(1) cqrs,count(IF(t2.overtimeDay!=0 or t2.overtimeHour!=0, 1, NULL)) ygjb
+        ,count(IF(t2.absenteeism !=0 , 1, NULL)) ygkg
 
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_dimissionattend t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_dimissionattend t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <choose>
             <when test="btime!=null and btime!='' and etime!=null and etime!=''">
-                and t1.attendMonth &gt;= #{btime}  and t1.attendMonth &lt;= #{etime}
+                and t2.attendMonth &gt;= #{btime}  and t2.attendMonth &lt;= #{etime}
             </when>
             <when test="index==2">
-                and t1.attendMonth = date_format(now(),'%Y-%m')
+                and t2.attendMonth = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and t1.attendMonth=YEAR(NOW())
+                and t2.attendMonth=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -228,22 +233,22 @@
         SELECT
         count(1) ygqj
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_leaveinfo t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_leaveinfo t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.returnDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.returnDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.returnDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.returnDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.returnDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.returnDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.returnDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.returnDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.returnDate)=YEAR(NOW())
+                and YEAR(t2.returnDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -261,22 +266,22 @@
         SELECT
         count(1) lzaj
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_labortrouble t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_labortrouble t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.arbitrationDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.arbitrationDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.arbitrationDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.arbitrationDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.arbitrationDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.arbitrationDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.arbitrationDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.arbitrationDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.arbitrationDate)=YEAR(NOW())
+                and YEAR(t2.arbitrationDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -285,43 +290,43 @@
     <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 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_accidentcases t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.injuredTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.injuredTime,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
+                and TO_DAYS(t2.injuredTime) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.injuredTime,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.injuredTime)=YEAR(NOW())
+                and YEAR(t2.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 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_occupational t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.injuredTime,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.injuredTime,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
+                and TO_DAYS(t2.injuredTime) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.injuredTime,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.injuredTime)=YEAR(NOW())
+                and YEAR(t2.injuredTime)=YEAR(NOW())
             </otherwise>
         </choose>) gsaj
 
@@ -333,22 +338,22 @@
         SELECT
         count(1) sbsq
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_insurance t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_insurance t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.applayDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.applayDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.applayDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.applayDate)=YEAR(NOW())
+                and YEAR(t2.applayDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -356,22 +361,22 @@
         SELECT
         count(1) syj
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_unemployment t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_unemployment t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.applayDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.applayDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.applayDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.applayDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.applayDate)=YEAR(NOW())
+                and YEAR(t2.applayDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -379,22 +384,22 @@
         SELECT
         count(1) ygtj
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_physicalexam t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_physicalexam t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.physicalExamDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.physicalExamDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.physicalExamDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.physicalExamDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.physicalExamDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.physicalExamDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.physicalExamDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.physicalExamDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.physicalExamDate)=YEAR(NOW())
+                and YEAR(t2.physicalExamDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -402,7 +407,7 @@
         SELECT
         count(1) sfz
         FROM
-        t_emp_baseinfo t  where 1=1 and t.delFlag=0 and t.empStatus=0
+        t_emp_baseinfo t  inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} 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}
@@ -411,7 +416,7 @@
                 and TO_DAYS(t.certificateValidity) &lt;= TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t.certificateValidity,'%Y-%m-%d')) &lt;= YEARWEEK(now())
+                and YEARWEEK(date_format(t.certificateValidity,'%Y-%m-%d'),1) &lt;= YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t.certificateValidity,'%Y-%m') &lt;= date_format(now(),'%Y-%m')
@@ -426,19 +431,19 @@
         SELECT
         count(1) ygtg
         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
+        t_emp_baseinfo t right  JOIN t_emp_jobchange t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <choose>
             <when test="index==0">
-                and TO_DAYS(t1.changeDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.changeDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.changeDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.changeDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.changeDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.changeDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.changeDate)=YEAR(NOW())
+                and YEAR(t2.changeDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
@@ -447,30 +452,40 @@
         SELECT
         count(1) bljl
         FROM
-        t_emp_baseinfo t right  JOIN t_emp_badrecord t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right  JOIN t_emp_badrecord t2 on t.empId=t2.empId inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment} and t.delFlag=0 and t2.delFlag=0
         <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}
+                and date_format(t2.badDate,'%Y-%m-%d') &gt;= #{btime}  and date_format(t2.badDate,'%Y-%m-%d') &lt;= #{etime}
             </when>
             <when test="index==0">
-                and TO_DAYS(t1.badDate) = TO_DAYS(NOW())
+                and TO_DAYS(t2.badDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.badDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t2.badDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.badDate,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t2.badDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.badDate)=YEAR(NOW())
+                and YEAR(t2.badDate)=YEAR(NOW())
             </otherwise>
         </choose>
     </select>
 
 
+    <select id="selectCountlz" resultType="java.lang.Integer">
+        SELECT
+        count(1)
+        FROM
+        t_emp_baseinfo t inner  join t_dept t1 on t.deptId=t1.DEPT_ID  ${ew.customSqlSegment}
+    </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 t1.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 1=1 and t1.empStatus=0 and t1.delFlag=0
+         and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+        #{item}
+       </foreach>
         <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},'%'))
@@ -482,13 +497,19 @@
                 SELECT
                 t.*
                 FROM
-                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}
+                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}  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
                 UNION
 
                 SELECT
                 t.*
                 FROM
-                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}
+                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}  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
         ) 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
@@ -500,6 +521,10 @@
 
     <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 and t1.empStatus=0
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
         <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},'%'))
@@ -512,7 +537,7 @@
                 and TO_DAYS(t1.certificateValidity) &lt;= TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.certificateValidity,'%Y-%m-%d')) &lt;= YEARWEEK(now())
+                and YEARWEEK(date_format(t1.certificateValidity,'%Y-%m-%d'),1) &lt;= YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.certificateValidity,'%Y-%m') &lt;= date_format(now(),'%Y-%m')
@@ -525,6 +550,10 @@
     </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 and t1.delFlag=0
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
         <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},'%'))
@@ -537,7 +566,7 @@
                 and TO_DAYS(t1.entryDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.entryDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.entryDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.entryDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -552,7 +581,11 @@
 
 
     <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 t1.empType='1' and t1.delFlag=0 and t1.empStatus=0
+        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where t1.empType='01' and t1.delFlag=0 and t1.empStatus=0
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
         <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},'%'))
@@ -560,7 +593,11 @@
     </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 t1.empType='2' and t1.delFlag=0 and t1.empStatus=0
+        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where t1.empType='02'
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> 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},'%'))
@@ -570,7 +607,11 @@
 
 
     <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 t1.empStatus=1
+        select t1.* from t_emp_baseinfo t1 left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> 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},'%'))
@@ -583,7 +624,11 @@
         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 and t.delFlag=0 and t1.delFlag=0
+        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
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=0 and t1.delFlag=0
         <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},'%'))
@@ -596,7 +641,7 @@
                 and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -610,16 +655,20 @@
 
 
     <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 and t1.empStatus='1'
+        select t1.* from t_emp_dimissionlog t inner join  t_emp_baseinfo t1 on t.empId=t1.empId left join t_dept t2 on t1.deptId=t2.DEPT_ID where 1=1 and t.delFlag=0 and t1.empStatus='1'
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
         <choose>
             <when test="number==8">
-               and t1.dimissionType = '1'
+               and t.dimissionType = '6'
             </when>
             <when test="number==9">
-                and t1.dimissionType = '2'
+                and t.dimissionType = '4'
             </when>
             <when test="number==10">
-                and t1.dimissionType = '4'
+                and t.dimissionType = '3'
             </when>
             <otherwise>
 
@@ -631,19 +680,19 @@
         </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}
+                and date_format(t.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.createTime) = TO_DAYS(NOW())
+                and TO_DAYS(t.dimissionDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.createTime,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
-                and date_format(t1.createTime,'%Y-%m') = date_format(now(),'%Y-%m')
+                and date_format(t.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
             </when>
             <otherwise>
-                and YEAR(t1.createTime)=YEAR(NOW())
+                and YEAR(t.dimissionDate)=YEAR(NOW())
             </otherwise>
         </choose>
 
@@ -651,7 +700,11 @@
 
 
     <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 and t.delFlag=0 and t1.delFlag=0
+        select t1.*,t.allDeptName 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 and t.delFlag=0 and t1.delFlag=0
+        and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach>
         <choose>
             <when test="number==14">
                 and t1.contractStatus = '2'
@@ -663,7 +716,7 @@
                         and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
                     </when>
                     <when test="index==1">
-                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
+                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d'),1) = YEARWEEK(now())
                     </when>
                     <when test="index==2">
                         and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -683,7 +736,7 @@
                         and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
                     </when>
                     <when test="index==1">
-                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
+                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d'),1) = YEARWEEK(now())
                     </when>
                     <when test="index==2">
                         and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -703,7 +756,7 @@
                         and TO_DAYS(t1.signingDate) = TO_DAYS(NOW())
                     </when>
                     <when test="index==1">
-                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d')) = YEARWEEK(now())
+                        and YEARWEEK(date_format(t1.signingDate,'%Y-%m-%d'),1) = YEARWEEK(now())
                     </when>
                     <when test="index==2">
                         and date_format(t1.signingDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -726,9 +779,13 @@
 
     <select id="dqbaseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         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 t.delFlag=0 and t1.delFlag=0 and t1.contractStatus = '4'
+        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 t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=0 and t1.delFlag=0 and t1.contractStatus in( '1','2')  and t1.empStatus=0
         <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},'%'))
@@ -741,7 +798,7 @@
                 and TO_DAYS(t1.endDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.endDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.endDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.endDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -754,9 +811,13 @@
     </select>
     <select id="jcseInfoList" resultType="cc.mrbird.febs.server.hr.entity.EmpBaseInfo">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         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 t.delFlag=0 and t1.delFlag=0 and t1.contractStatus = '3'
+        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 t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=0 and t1.delFlag=0 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},'%'))
@@ -769,7 +830,7 @@
                 and TO_DAYS(t.dimissionDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t.dimissionDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t.dimissionDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -782,9 +843,12 @@
     </select>
     <select id="empBaseInfoCqList" resultType="cc.mrbird.febs.server.hr.entity.EmpDimissionAttend">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         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 and t.delFlag=0 and t1.delFlag=0
+        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  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=0 and t1.delFlag=0
         <choose>
             <when test="number==3">
               and  t1.absenteeism !=0
@@ -818,9 +882,12 @@
 
     <select id="empBaseInfoQjList" resultType="cc.mrbird.febs.server.hr.entity.EmpLeaveInfo">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_leaveinfo t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_leaveinfo t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -833,7 +900,7 @@
                 and TO_DAYS(t1.returnDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.returnDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.returnDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.returnDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -847,9 +914,12 @@
 
     <select id="empBaseInfoTjList" resultType="cc.mrbird.febs.server.hr.entity.EmpPhysicalExam">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_physicalexam t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_physicalexam t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -862,7 +932,7 @@
                 and TO_DAYS(t1.physicalExamDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.physicalExamDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.physicalExamDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.physicalExamDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -879,9 +949,12 @@
 
     <select id="empBaseInfoLzList" resultType="cc.mrbird.febs.server.hr.entity.EmpLaborTrouble">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_labortrouble t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_labortrouble t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -894,7 +967,7 @@
                 and TO_DAYS(t1.arbitrationDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.arbitrationDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.arbitrationDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.arbitrationDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -910,9 +983,12 @@
 
     <select id="empBaseInfoGsList" resultType="cc.mrbird.febs.server.hr.entity.EmpOccupational">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_occupational t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_occupational t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -925,7 +1001,7 @@
                 and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -939,9 +1015,12 @@
 
     <select id="empBaseInfoYwList" resultType="cc.mrbird.febs.server.hr.entity.EmpAccidentCases">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_accidentcases t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_accidentcases t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -954,7 +1033,7 @@
                 and TO_DAYS(t1.injuredTime) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.injuredTime,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.injuredTime,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -969,9 +1048,12 @@
 
     <select id="empBaseInfoSbList" resultType="cc.mrbird.febs.server.hr.entity.EmpInsurance">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_insurance t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_insurance t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -984,7 +1066,7 @@
                 and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -999,9 +1081,12 @@
 
     <select id="empBaseInfoSyjList" resultType="cc.mrbird.febs.server.hr.entity.EmpUnemployment">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_unemployment t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_unemployment t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -1014,7 +1099,7 @@
                 and TO_DAYS(t1.applayDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.applayDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.applayDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -1028,9 +1113,12 @@
 
     <select id="empBaseInfoBlList" resultType="cc.mrbird.febs.server.hr.entity.EmpBadRecord">
         SELECT
-        t1.*
+        t1.*,t.allDeptName
         FROM
-        t_emp_baseinfo t right JOIN t_emp_badrecord t1 on t.empId=t1.empId where 1=1 and t.delFlag=0 and t1.delFlag=0
+        t_emp_baseinfo t right JOIN t_emp_badrecord t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=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 t1.deptName like CONCAT('%',#{name},'%'))
@@ -1043,7 +1131,7 @@
                 and TO_DAYS(t1.badDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.badDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.badDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.badDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -1058,11 +1146,14 @@
 
     <select id="empBaseInfoTgList" resultType="cc.mrbird.febs.server.hr.entity.EmpJobChange">
         SELECT
-        t1.*,t.empNumb,t.deptName,t.certificateNumb
+        t1.*,t.empNumb,t.deptName,t.certificateNumb,t.allDeptName
         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
+        t_emp_baseinfo t right JOIN t_emp_jobchange t1 on t.empId=t1.empId inner  join t_dept t2 on t.deptId=t2.DEPT_ID where 1=1  and t2.DEPT_ID in
+        <foreach item="item" index="index" collection="list" open="(" separator="," close=")">
+            #{item}
+        </foreach> and t.delFlag=0 and t1.delFlag=0
         <if test="name!= 'undefined' and name!=null and name!=''">
-            and (t.empNumb like CONCAT('%',#{name},'%') or t.empName like CONCAT('%',#{name},'%') or
+            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>
@@ -1073,7 +1164,7 @@
                 and TO_DAYS(t1.changeDate) = TO_DAYS(NOW())
             </when>
             <when test="index==1">
-                and YEARWEEK(date_format(t1.changeDate,'%Y-%m-%d')) = YEARWEEK(now())
+                and YEARWEEK(date_format(t1.changeDate,'%Y-%m-%d'),1) = YEARWEEK(now())
             </when>
             <when test="index==2">
                 and date_format(t1.changeDate,'%Y-%m') = date_format(now(),'%Y-%m')
@@ -1084,4 +1175,8 @@
         </choose>
 
     </select>
+    <select id="selectAlertCount" resultType="java.lang.Long">
+        SELECT COUNT(*) FROM t_emp_baseinfo a
+            ${ew.customSqlSegment}
+    </select>
 </mapper>

--
Gitblit v1.8.0