领导驾驶舱

1、部门查询逻辑调整
2、台账展示内容调整
This commit is contained in:
dxfeng 2025-07-09 15:29:26 +08:00
parent cb7118d315
commit 7def695962
6 changed files with 199 additions and 92 deletions

View File

@ -2,6 +2,8 @@ package com.weaver.seconddev.portal.entity.param;
import lombok.Data;
import java.util.Set;
/**
* @author:dxfeng
* @createTime: 2025/07/07
@ -11,9 +13,12 @@ import lombok.Data;
public class SearchConditionParam {
private String tenantKey;
private String departmentId;
private Set<Long> departmentIdList;
private String searchDate;
private String startDate;
private String endDate;
private Set<Long> selectDepartmentId;
/**
* 是否关键人员
*/

View File

@ -15,4 +15,6 @@ public class PortalData {
private String posi;
private String leader;
private String count;
private Integer all;
private Integer key;
}

View File

@ -6,7 +6,9 @@ import com.weaver.seconddev.portal.entity.po.Position;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* @author:dxfeng
@ -31,72 +33,83 @@ public interface LeaderCockpitMapper {
* @return
*/
int getOnJobCount(SearchConditionParam conditionParam);
/**
* 查询入职人数
*
* @param tenantKey
* @param departmentId
* @param departmentIdList
* @param startDate
* @param endDate
* @return
*/
int getEmploymentCount(@Param("tenantKey") String tenantKey, @Param("departmentId") String departmentId, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getEmploymentCount(@Param("tenantKey") String tenantKey, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询入职人数列表
*
* @param tenantKey
* @param departmentId
* @param departmentIdList
* @param startDate
* @param endDate
* @return
*/
List<PortalPO> getEmploymentListByPosition(@Param("tenantKey") String tenantKey, @Param("departmentId") String departmentId, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<PortalPO> getEmploymentListByPosition(@Param("tenantKey") String tenantKey, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询关键入职人数
*
* @param tenantKey
* @param departmentId
* @param departmentIdList
* @param startDate
* @param endDate
* @return
*/
int getKeyEmploymentCount(@Param("tenantKey") String tenantKey, @Param("departmentId") String departmentId, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getKeyEmploymentCount(@Param("tenantKey") String tenantKey, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询离职人数
*
* @param tenantKey
* @param departmentId
* @param departmentIdList
* @param startDate
* @param endDate
* @return
*/
int getResignCount(@Param("tenantKey") String tenantKey, @Param("departmentId") String departmentId, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getResignCount(@Param("tenantKey") String tenantKey, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询关键离职人数
*
* @param tenantKey
* @param departmentId
* @param departmentIdList
* @param startDate
* @param endDate
* @return
*/
int getKeyResignCount(@Param("tenantKey") String tenantKey, @Param("departmentId") String departmentId, @Param("startDate") String startDate, @Param("endDate") String endDate);
int getKeyResignCount(@Param("tenantKey") String tenantKey, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
/**
* 查询离职人数列表
*
* @param tenantKey
* @param departmentId
* @param departmentIdList
* @param startDate
* @param endDate
* @return
*/
List<PortalPO> getResignListByPosition(@Param("tenantKey") String tenantKey, @Param("departmentId") String departmentId, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<PortalPO> getResignListByPosition(@Param("tenantKey") String tenantKey, @Param("departmentIdList") Collection<Long> departmentIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);
Position getPositionById(@Param("tenantKey") String tenantKey, @Param("positionId") String positionId);
/**
* 获取顶级部门id列表
*
* @param tenantKey
* @return
*/
Set<Long> getTopDepartmentIds(@Param("tenantKey") String tenantKey);
}

View File

@ -6,12 +6,13 @@ import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
import com.weaver.seconddev.portal.entity.param.SearchConditionParam;
import com.weaver.seconddev.portal.entity.po.PortalData;
import com.weaver.seconddev.portal.entity.po.PortalPO;
import com.weaver.seconddev.portal.entity.po.Position;
import com.weaver.seconddev.portal.mapper.LeaderCockpitMapper;
import com.weaver.seconddev.portal.service.LeaderCockpitService;
import com.weaver.seconddev.portal.util.DateUtil;
import com.weaver.teams.security.StringUtils;
import com.weaver.teams.security.context.UserContext;
import com.weaver.workflow.common.cfg.org.service.DepartMentService;
import com.weaver.workflow.common.entity.org.WeaDepartMent;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -36,6 +37,9 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
@Autowired
HrmCommonEmployeeDao hrmCommonEmployeeDao;
@Autowired
DepartMentService departMentService;
@Override
public WeaResult<List<PortalPO>> getOnJobNumber(Map<String, String> params) {
SearchConditionParam searchConditionParam = new SearchConditionParam();
@ -58,9 +62,9 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
// 查询范围内在职人员
int onJobCount = leaderCockpitMapper.getOnJobCount(searchConditionParam);
// 查询范围内离职人员
int resignCount = leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
int resignCount = leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
// 查询关键离职率
int keyResignCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
int keyResignCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
// 计算离职率
double turnoverRate = calculateRate(keyResignCount, onJobCount);
//TODO 计算关键离职率
@ -97,47 +101,51 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
String month = DateUtil.formatToYearMonth_ZH(localDate);
Map<String, Integer> allDataMap = new LinkedHashMap<>(3);
Map<String, Integer> keyDataMap = new LinkedHashMap<>(3);
allDataMap.put(month, leaderCockpitMapper.getEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
keyDataMap.put(month, leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
allDataMap.put(month, leaderCockpitMapper.getEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
keyDataMap.put(month, leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
String firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate());
String lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate());
// 前面5个月
for (int i = 1; i < 7; i++) {
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), firstDayOfMonthStr, lastDayOfMonthStr));
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), firstDayOfMonthStr, lastDayOfMonthStr));
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate(), i);
lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate(), i);
}
// 查询台账
String currentMonth = DateUtil.formatToYearMonth(searchConditionParam.getStartDate());
List<PortalPO> employmentListByPosition = leaderCockpitMapper.getEmploymentListByPosition(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
List<PortalData> portalList = new ArrayList<>();
for (PortalPO portal : employmentListByPosition) {
PortalData portalData = new PortalData();
portalData.setDate(currentMonth);
portalData.setCount(portal.getName());
String positionId = portal.getValue();
// 获取岗位名称
Position positionById = leaderCockpitMapper.getPositionById(searchConditionParam.getTenantKey(), positionId);
log.error("positionById==" + JSON.toJSONString(positionById));
portalData.setPosi(positionById.getPositionName());
portalData.setDepart(positionById.getDepartmentName());
portalData.setLeader(positionById.getGradeName());
portalList.add(portalData);
Set<Long> selectDepartmentId = searchConditionParam.getSelectDepartmentId();
log.error("selectDepartmentId===" + JSON.toJSONString(selectDepartmentId));
if (CollectionUtils.isEmpty(selectDepartmentId)) {
// 未选择部门查询所有一级部门数据
selectDepartmentId = leaderCockpitMapper.getTopDepartmentIds(searchConditionParam.getTenantKey());
log.error("topDepartmentId===" + JSON.toJSONString(selectDepartmentId));
}
// TODO
if (CollectionUtils.isEmpty(portalList)) {
// 查询每个部门 时间范围内的入职人数
List<PortalData> portalList = new ArrayList<>();
for (Long topDepartmentId : selectDepartmentId) {
List<Long> beLongDeps = departMentService.getBeLongDeps(topDepartmentId, searchConditionParam.getTenantKey(), false);
beLongDeps.add(topDepartmentId);
WeaDepartMent departMentById = departMentService.getDepartMentById(topDepartmentId);
PortalData portalData = new PortalData();
portalData.setDate(currentMonth);
portalData.setLeader("M1");
portalData.setPosi("人事经理");
portalData.setDepart("薪酬绩效组");
portalData.setDepart(departMentById.getDepartMentName());
// 关键
int keyEmploymentCount = leaderCockpitMapper.getKeyEmploymentCount(searchConditionParam.getTenantKey(), beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
// 非关键
int employmentCount = leaderCockpitMapper.getEmploymentCount(searchConditionParam.getTenantKey(), beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
portalData.setKey(keyEmploymentCount);
portalData.setAll(employmentCount);
portalList.add(portalData);
}
// portalList按照all排序
portalList.sort((o1, o2) -> o2.getAll().compareTo(o1.getAll()));
Map<String, Object> returnMap = new HashMap<>(3);
returnMap.put("dataSource", portalList);
returnMap.put("all", allDataMap);
@ -160,48 +168,49 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
String month = DateUtil.formatToYearMonth_ZH(localDate);
Map<String, Integer> allDataMap = new LinkedHashMap<>(3);
Map<String, Integer> keyDataMap = new LinkedHashMap<>(3);
allDataMap.put(month, leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
keyDataMap.put(month, leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
allDataMap.put(month, leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
keyDataMap.put(month, leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate()));
String firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate());
String lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate());
// 前两个月
for (int i = 1; i < 4; i++) {
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), firstDayOfMonthStr, lastDayOfMonthStr));
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), firstDayOfMonthStr, lastDayOfMonthStr));
allDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
keyDataMap.put(DateUtil.formatToYearMonth_ZH(firstDayOfMonthStr), leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentIdList(), firstDayOfMonthStr, lastDayOfMonthStr));
firstDayOfMonthStr = DateUtil.getFirstDayOfPreviousMonthStr(searchConditionParam.getStartDate(), i);
lastDayOfMonthStr = DateUtil.getLastDayOfPreviousMonthStr(searchConditionParam.getEndDate(), i);
}
// 查询
String currentMonth = DateUtil.formatToYearMonth(searchConditionParam.getStartDate());
List<PortalPO> resignListByPosition = leaderCockpitMapper.getResignListByPosition(searchConditionParam.getTenantKey(), searchConditionParam.getDepartmentId(), searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
Set<Long> selectDepartmentId = searchConditionParam.getSelectDepartmentId();
log.error("selectDepartmentId===" + JSON.toJSONString(selectDepartmentId));
if (CollectionUtils.isEmpty(selectDepartmentId)) {
// 未选择部门查询所有一级部门数据
selectDepartmentId = leaderCockpitMapper.getTopDepartmentIds(searchConditionParam.getTenantKey());
log.error("topDepartmentId===" + JSON.toJSONString(selectDepartmentId));
}
// 查询每个部门 时间范围内的离职人数
List<PortalData> portalList = new ArrayList<>();
for (PortalPO portal : resignListByPosition) {
for (Long topDepartmentId : selectDepartmentId) {
List<Long> beLongDeps = departMentService.getBeLongDeps(topDepartmentId, searchConditionParam.getTenantKey(), false);
beLongDeps.add(topDepartmentId);
WeaDepartMent departMentById = departMentService.getDepartMentById(topDepartmentId);
PortalData portalData = new PortalData();
portalData.setDate(currentMonth);
portalData.setCount(portal.getName());
String positionId = portal.getValue();
// 获取岗位名称
Position positionById = leaderCockpitMapper.getPositionById(searchConditionParam.getTenantKey(), positionId);
log.error("positionById==" + JSON.toJSONString(positionById));
portalData.setDepart(departMentById.getDepartMentName());
// 关键
int keyEmploymentCount = leaderCockpitMapper.getKeyResignCount(searchConditionParam.getTenantKey(), beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
// 非关键
int employmentCount = leaderCockpitMapper.getResignCount(searchConditionParam.getTenantKey(), beLongDeps, searchConditionParam.getStartDate(), searchConditionParam.getEndDate());
portalData.setKey(keyEmploymentCount);
portalData.setAll(employmentCount);
portalList.add(portalData);
}
portalData.setPosi(positionById.getPositionName());
portalData.setDepart(positionById.getDepartmentName());
portalData.setLeader(positionById.getGradeName());
portalList.add(portalData);
}
// TODO
if (CollectionUtils.isEmpty(portalList)) {
PortalData portalData = new PortalData();
portalData.setDate(currentMonth);
portalData.setLeader("M1");
portalData.setPosi("人事经理");
portalData.setDepart("薪酬绩效组");
portalList.add(portalData);
}
// portalList按照all排序
portalList.sort((o1, o2) -> o2.getAll().compareTo(o1.getAll()));
Map<String, Object> returnMap = new HashMap<>(3);
@ -235,14 +244,35 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
* @param params
* @param beforeMonth
*/
private static void initSearchConditionParam(SearchConditionParam searchConditionParam, Map<String, String> params, Integer beforeMonth) {
private void initSearchConditionParam(SearchConditionParam searchConditionParam, Map<String, String> params, Integer beforeMonth) {
String searchDate = params.get("searchDate");
String departmentId = params.get("departmentId");
// 租户
searchConditionParam.setTenantKey(UserContext.getCurrentUser().getTenantKey());
// 部门
searchConditionParam.setDepartmentId(departmentId);
//searchConditionParam.setDepartmentId(departmentId);
// 获取部门下的所有子部门
if (StringUtils.isNotBlank(departmentId)) {
Set<Long> deptIdSet = new HashSet<>();
Set<Long> selectDepartmentId = new HashSet<>();
String[] split = departmentId.split(",");
for (String s : split) {
if (StringUtils.isBlank(s)) {
continue;
}
long parseLong = Long.parseLong(s);
log.error("parseLong===" + parseLong);
selectDepartmentId.add(parseLong);
List<Long> beLongDeps = departMentService.getBeLongDeps(parseLong, searchConditionParam.getTenantKey(), false);
beLongDeps.add(parseLong);
log.error("beLongDeps===" + JSON.toJSONString(beLongDeps));
deptIdSet.addAll(beLongDeps);
}
searchConditionParam.setDepartmentIdList(deptIdSet);
searchConditionParam.setSelectDepartmentId(selectDepartmentId);
}
// 处理截止日期
String endDateStr;
@ -262,7 +292,7 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
// 处理开始日期
if (beforeMonth == null) {
// 查询当前年度数据
searchConditionParam.setStartDate(DateUtil.getFirstDayOfYearStr());
searchConditionParam.setStartDate(DateUtil.getFirstDayOfYearStr(searchConditionParam.getEndDate()));
} else {
// 查询前N个月数据
try {
@ -270,8 +300,8 @@ public class LeaderCockpitServiceImpl implements LeaderCockpitService {
LocalDate startDate = endDate.minusMonths(beforeMonth);
searchConditionParam.setStartDate(DateUtil.getFirstDayOfMonthStr(DateUtil.formatDate(startDate)));
} catch (Exception e) {
log.error("计算开始日期失败,使用当前年度第一天", e);
searchConditionParam.setStartDate(DateUtil.getFirstDayOfYearStr());
log.error("计算开始日期失败,使用所选日期年度第一天", e);
searchConditionParam.setStartDate(searchConditionParam.getEndDate());
}
}
}

View File

@ -14,6 +14,8 @@ import java.util.Date;
public class DateUtil {
private static final DateTimeFormatter DEFAULT_YEAR_FORMATTER = DateTimeFormatter.ofPattern("yyyy");
private static final DateTimeFormatter DEFAULT_MONTH_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM");
private static final DateTimeFormatter DEFAULT_DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
private static final DateTimeFormatter DEFAULT_DATETIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@ -23,6 +25,12 @@ public class DateUtil {
public static String getCurrentDateStr() {
return LocalDate.now().format(DEFAULT_DATE_FORMATTER);
}
public static String getCurrentYearStr() {
return LocalDate.now().format(DEFAULT_YEAR_FORMATTER);
}
public static String getCurrentMonthStr() {
return LocalDate.now().format(DEFAULT_MONTH_FORMATTER);
}
/**
* 获取当前日期时间字符串 (yyyy-MM-dd HH:mm:ss)
@ -78,6 +86,14 @@ public class DateUtil {
return LocalDate.now().withMonth(1).withDayOfMonth(1).format(DEFAULT_DATE_FORMATTER);
}
public static String getFirstDayOfYearStr(String dateStr) {
LocalDate date = parseDate(dateStr);
if (date == null) {
return null;
}
return date.withMonth(1).withDayOfMonth(1).format(DEFAULT_DATE_FORMATTER);
}
/**
* 获取当前年度最后一天的字符串

View File

@ -4,30 +4,45 @@
<select id="getOnJobNumber" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(a.id) as value ,b.yglxmc as name from e10_common.uf_jcl_employee_information a
inner join e10_common.uf_jcl_yglx b on a.yglx = b.id
where a.personnel_status in(1,2,3) and a.delete_type = 0 and a.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and a.department = #{departmentId}
select count(t.id) as value ,b.yglxmc as name from e10_common.uf_jcl_employee_information t
inner join e10_common.uf_jcl_yglx b on t.yglx = b.id
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and (a.zhgzr ='' or zhgzr is null or zhgzr &lt; #{endDate})
<!--开始日期 <= 结束查询日期-->
AND t.hiredate &lt;= #{endDate}
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &gt; #{endDate})
group by b.yglxmc
</select>
<select id="getOnJobCount" resultType="java.lang.Integer">
select count(t.id) as value from e10_common.uf_jcl_employee_information t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &lt; #{endDate})
<!--开始日期 <= 结束查询日期-->
AND t.hiredate &lt;= #{endDate}
<!--最后工作日期 > 开始查询日期 OR 最后工作日期为空-->
and (t.zhgzr ='' or t.zhgzr is null or t.zhgzr &gt; #{endDate})
</select>
<select id="getResignCount" resultType="java.lang.Integer">
select count(id) as value from e10_common.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
@ -36,8 +51,11 @@
<select id="getKeyResignCount" resultType="java.lang.Integer">
select count(id) as value from e10_common.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.sfgjrc = 1
and t.zhgzr &gt;= #{startDate}
@ -46,8 +64,11 @@
<select id="getEmploymentCount" resultType="java.lang.Integer">
select count(id) as value from e10_common.uf_jcl_rzgl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
@ -55,8 +76,11 @@
<select id="getKeyEmploymentCount" resultType="java.lang.Integer">
select count(id) as value from e10_common.uf_jcl_rzgl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.sfgjrc = 1
and t.hiredate &gt;= #{startDate}
@ -66,8 +90,11 @@
<select id="getEmploymentListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(id) as name,position as value from e10_common.uf_jcl_rzgl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.hiredate &gt;= #{startDate}
and t.hiredate &lt;= #{endDate}
@ -88,14 +115,28 @@
<select id="getResignListByPosition" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
select count(id) as name,lzqgw as value from e10_common.uf_jcl_lzxxjl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentId != null and departmentId !=''">
and t.department = #{departmentId}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.department IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.zhgzr &gt;= #{startDate}
and t.zhgzr &lt;= #{endDate}
and t.lzqgw !='' and t.lzqgw is not null
group by t.lzqgw order by value limit 3
</select>
<select id="getTopDepartmentIds" resultType="java.lang.Long">
select t.id
from eteams.department t
inner join eteams.department t1 on t.parent = t1.id
where t.type = 'department'
and t1.type = 'subcompany'
and t.delete_type = 0
and t.status = 1
and t.tenant_key = #{tenantKey}
and t1.delete_type = 0
and t1.status = 1
and t1.tenant_key = #{tenantKey}
</select>
</mapper>