From 7e8773c06d9391c94b7a0111b63d17cf5bdb6d8e Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 17 九月 2025 14:43:55 +0800
Subject: [PATCH] 发起请假审批

---
 ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java
index 77d6ed2..e581beb 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java
+++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/OaNotificationServiceImpl.java
@@ -1,10 +1,22 @@
 package com.ruoyi.system.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.basic.PageInfo;
+import com.ruoyi.common.core.domain.entity.TDept;
 import com.ruoyi.system.mapper.OaNotificationMapper;
+import com.ruoyi.system.mapper.TDeptMapper;
 import com.ruoyi.system.model.OaNotification;
+import com.ruoyi.system.query.NotificationListQuery;
 import com.ruoyi.system.service.OaNotificationService;
+import com.ruoyi.system.vo.system.NotificationVO;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -17,4 +29,37 @@
 @Service
 public class OaNotificationServiceImpl extends ServiceImpl<OaNotificationMapper, OaNotification> implements OaNotificationService {
 
+    @Autowired
+    private TDeptMapper deptMapper;
+    @Override
+    public PageInfo<NotificationVO> pageList(NotificationListQuery query) {
+        List<TDept> tDepts = deptMapper.selectList(null);
+        Map<Integer, String> deptMap = tDepts.stream().collect(Collectors.toMap(TDept::getId, TDept::getDeptName));
+        if (StringUtils.hasLength(query.getDeptName())){
+            List<Integer> deptIds = deptMapper.selectList(new LambdaQueryWrapper<TDept>().like(TDept::getDeptName, query.getDeptName()))
+                    .stream().map(TDept::getId).collect(Collectors.toList());
+            if (deptIds.isEmpty()){
+                return new PageInfo<>();
+            }
+            query.setDeptIds(deptIds);
+        }
+        PageInfo<NotificationVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
+        List<NotificationVO> list = this.baseMapper.pageList(query,pageInfo);
+        for (NotificationVO notificationVO : list) {
+            StringBuilder deptName = new StringBuilder();
+            if (notificationVO.getType()){
+                for (String deptId : notificationVO.getDeptIds().split(",")) {
+                    String orDefault = deptMap.getOrDefault(Integer.parseInt(deptId), "");
+                    deptName.append(orDefault).append(",");
+                }
+                notificationVO.setDeptName(deptName.substring(0,deptName.length()-1));
+            }else{
+                notificationVO.setDeptName("全部人员");
+
+            }
+
+        }
+        pageInfo.setRecords(list);
+        return null;
+    }
 }

--
Gitblit v1.7.1