考勤明细查询多组织导出

This commit is contained in:
fl 2025-02-26 11:17:19 +08:00
parent 6cb067babd
commit 427dcf8e63
2 changed files with 21 additions and 5 deletions

View File

@ -1295,7 +1295,7 @@ public class ExportFileController {
} }
/** /**
* 异常排名导出 * 考勤明细异常排名导出
* *
* @param response * @param response
* @param bean * @param bean
@ -1350,8 +1350,9 @@ public class ExportFileController {
dayTable.setStartDate(bean.getStartDate()); dayTable.setStartDate(bean.getStartDate());
dayTable.setEndDate(bean.getEndDate()); dayTable.setEndDate(bean.getEndDate());
dayTable.setName(bean.getUserName()); dayTable.setName(bean.getUserName());
if (bean.getOrgId() != null) { if (bean.getOrgId() != null || bean.getOrgIds() != null) {
dayTable.setOrgId(bean.getOrgId()); dayTable.setOrgId(bean.getOrgId());
dayTable.setOrgList(bean.getOrgIds());
}else{ }else{
//受限于当前登录人 //受限于当前登录人
if(bean.getOrgList() != null && !bean.getOrgList().isEmpty()){ if(bean.getOrgList() != null && !bean.getOrgList().isEmpty()){
@ -1364,8 +1365,9 @@ public class ExportFileController {
AttDataDetailsBean att = new AttDataDetailsBean(); AttDataDetailsBean att = new AttDataDetailsBean();
att.setStartDate(bean.getStartDate()); att.setStartDate(bean.getStartDate());
att.setEndDate(bean.getEndDate()); att.setEndDate(bean.getEndDate());
if (bean.getOrgId() != null) { if (bean.getOrgId() != null || bean.getOrgIds() != null) {
att.setOrgId(bean.getOrgId()); att.setOrgId(bean.getOrgId());
att.setOrgList(bean.getOrgIds());
}else{ }else{
//受限于当前登录人 //受限于当前登录人
if(bean.getOrgList() != null && !bean.getOrgList().isEmpty()){ if(bean.getOrgList() != null && !bean.getOrgList().isEmpty()){

View File

@ -23,7 +23,7 @@
) )
</foreach> </foreach>
</insert> </insert>
<!--orgList与orgIds不同一个是权限获取的一个是前端选择的不放在一起是防止下拉全权限错误导致查询范围变大 -->
<select id="selectAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean"> <select id="selectAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
select su.user_name, so.org_name,IF(awa.outCount is null,0,awa.outCount) as outCount, select su.user_name, so.org_name,IF(awa.outCount is null,0,awa.outCount) as outCount,
COUNT(DISTINCT asd.att_current_time ) AS attCount, COUNT(DISTINCT asd.att_current_time ) AS attCount,
@ -37,6 +37,13 @@
<if test="bean.orgId != null and bean.orgId != ''"> <if test="bean.orgId != null and bean.orgId != ''">
AND v.org_id = #{bean.orgId} AND v.org_id = #{bean.orgId}
</if> </if>
<if test='bean.orgIds != null and bean.orgIds.size() > 0'>
and v.org_id in (
<foreach collection="bean.orgIds" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="bean.userId != null and bean.userId != ''"> <if test="bean.userId != null and bean.userId != ''">
AND v.user_id = #{bean.userId} AND v.user_id = #{bean.userId}
</if> </if>
@ -74,7 +81,6 @@
</foreach> </foreach>
) )
</if> </if>
GROUP BY GROUP BY
v.att_current_day, v.att_current_day,
v.user_id v.user_id
@ -82,6 +88,7 @@
v.att_current_day DESC v.att_current_day DESC
</select> </select>
<!--orgList与orgIds不同一个是权限获取的一个是前端选择的不放在一起是防止下拉全权限错误导致查询范围变大 -->
<select id="exportAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean"> <select id="exportAttDetailsList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
SELECT SELECT
v.user_id, v.user_id,
@ -107,6 +114,13 @@
<if test="bean.orgId != null and bean.orgId != ''"> <if test="bean.orgId != null and bean.orgId != ''">
AND v.org_id = #{bean.orgId} AND v.org_id = #{bean.orgId}
</if> </if>
<if test='bean.orgIds != null and bean.orgIds.size() > 0'>
and v.org_id in (
<foreach collection="bean.orgIds" item="item" separator=",">
#{item}
</foreach>
)
</if>
<if test="bean.userName != null and bean.userName != ''"> <if test="bean.userName != null and bean.userName != ''">
AND su.user_name like concat('%', #{bean.userName}, '%') AND su.user_name like concat('%', #{bean.userName}, '%')
</if> </if>