feat(portal): 优化门户查询 SQL 并添加新功能

- 为 BaseParam 类添加 tenantKey 默认值
- 新增 EteamsBaseMapper 接口和对应 XML 文件,实现表 ID 和字段信息查询
- 更新 HrbpPortalMapper XML,为多个查询添加部门 ID 列表过滤条件
- 优化 HrbpPortalServiceImpl 和 SscPortalServiceImpl 中的代码注释和默认值设置
This commit is contained in:
dxfeng 2025-07-18 13:27:20 +08:00
parent a66e1b9073
commit de622f0b18
6 changed files with 141 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package com.weaver.seconddev.portal.entity.param;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
/**
* @author:dxfeng
@ -17,4 +18,12 @@ public class BaseParam {
private String table_dept_cus = "ft_1154218872715993098";
private String tenantKey;
public String getTenantKey() {
if (StringUtils.isBlank(tenantKey)) {
// 租户默认值
return "t024j0gfn0";
}
return tenantKey;
}
}

View File

@ -0,0 +1,33 @@
package com.weaver.seconddev.portal.mapper;
import com.weaver.common.form.metadata.field.FormField;
import com.weaver.seconddev.portal.entity.param.BaseParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @author:dxfeng
* @createTime: 2025/07/18
* @version: 1.0
*/
@Mapper
public interface EteamsBaseMapper {
/**
* 根据表名获取表ID
*
* @param param
* @param tableName
* @return
*/
long getFormIdByTableName(@Param("param") BaseParam param, @Param("tableName") String tableName);
/**
* 根据表ID和字段名获取字段信息
*
* @param param
* @param formId
* @param fieldName
* @return
*/
FormField getFormFieldByFieldName(@Param("param") BaseParam param, @Param("formId") long formId, @Param("fieldName") String fieldName);
}

View File

@ -60,10 +60,10 @@ public class HrbpPortalServiceImpl implements HrbpPortalService {
// 待离职
map.put("leave", toLeaveCount);
map.put("leaveUrl", urlMap.get("leave"));
//TODO 待签订
// 待签订
map.put("sign", toSignCount);
map.put("signUrl", urlMap.get("sign"));
//TODO 代理期转正
// 代理期转正
map.put("proxy", toProxyCount);
map.put("proxyUrl", urlMap.get("proxy"));
return WeaResult.success(map);

View File

@ -47,7 +47,7 @@ public class SscPortalServiceImpl implements SscPortalService {
expirationReminderPo.setHealthCertificateExpiration(sscPortalMapper.getHealthCertificateExpirationCount(sscParam));
expirationReminderPo.setEmploymentAnniversary(sscPortalMapper.getEmploymentAnniversaryCount(sscParam));
// TODO
expirationReminderPo.setBirthdayNum(-1);
expirationReminderPo.setBirthdayNum(0);
// 设置穿透地址

View File

@ -0,0 +1,18 @@
<?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="com.weaver.seconddev.portal.mapper.EteamsBaseMapper">
<select id="getFormIdByTableName" resultType="java.lang.Long">
select t.form_id from ${param.eteams}.form_table t where
t.tenant_key = #{param.tenantKey} and t.delete_type = 0
and t.table_name = #{tableName}
</select>
<select id="getFormFieldByFieldName" resultType="com.weaver.common.form.metadata.field.FormField">
select t.* from ${param.eteams}.form_field t
where t.tenant_key = #{param.tenantKey} and t.delete_type = 0
and t.form_id = #{formId} and t.data_key = #{fieldName}
</select>
</mapper>

View File

@ -30,29 +30,61 @@
<select id="getToLeaveCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_lzsq t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.lzqbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.flow_status in (1, 2, 3)
and (t.zhgzr is null or t.zhgzr = '' or zhgzr >current_date())
</select>
<select id="getToSignCount" resultType="java.lang.Integer">
<!--TODO-->
select -1
select count(t.id) from ${e10_common}.uf_jcl_rshtgl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.ssbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.htzt = 1
</select>
<select id="getToProxyCount" resultType="java.lang.Integer">
<!--TODO-->
select -1
select count(t.id) from ${e10_common}.uf_dlqgl t
where t.delete_type = 0 and t.tenant_key = #{tenantKey}
<if test="departmentIdList != null and departmentIdList.size() > 0">
AND t.ssbm IN
<foreach collection="departmentIdList" item="departmentId" open="(" close=")" separator=",">
#{departmentId}
</foreach>
</if>
and t.dlqzt = 2
</select>
<select id="getAllEmployeeCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status not in (5,6)
</select>
<select id="getFormalEmployeeCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status not in (5,6)
and t.yglx=1109770887364624394
</select>
@ -60,6 +92,12 @@
<select id="getInternEmployeeCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status not in (5,6)
and t.yglx=1109772927499255817
</select>
@ -67,6 +105,12 @@
<select id="getOutsourcingCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status not in (5,6)
and t.yglx=1109775968260603906
</select>
@ -74,6 +118,12 @@
<select id="getLaborCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status not in (5,6)
and t.yglx=1109776092848209920
</select>
@ -81,23 +131,47 @@
<select id="getProbationCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status = 1
</select>
<select id="getFormalCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status = 2
</select>
<select id="getInternCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status = 4
</select>
<select id="getLeaveCount" resultType="java.lang.Integer">
select count(t.id) from ${e10_common}.uf_jcl_employee_information t
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 t.personnel_status = 5
</select>