From ac544c1d85c53e7f51e4ea76aa2489a14aef03d9 Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期五, 20 六月 2025 18:57:45 +0800
Subject: [PATCH] zjh20250620

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjDwGroupingController.java |   25 ++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjDwGroupingServiceImpl.java     |    5 
 ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java              |    2 
 ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysNoticeUser.java                     |   34 +++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjDwGroupingMapper.java                |    3 
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysNoticeUserServiceImpl.java    |   22 +++
 ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml                      |   13 ++
 ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java                 |    3 
 ltkj-system/src/main/java/com/ltkj/system/mapper/SysNoticeMapper.java               |   14 ++
 ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysNoticeUserMapper.java               |   18 +++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjDwGroupingService.java             |    2 
 ltkj-hosp/src/main/resources/mapper/hosp/TjDwGroupingMapper.xml                     |   16 ++
 ltkj-system/src/main/java/com/ltkj/system/service/impl/SysNoticeServiceImpl.java    |   14 ++
 ltkj-system/src/main/java/com/ltkj/system/domain/SysNotice.java                     |   31 +++++
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysUserController.java      |   11 +
 ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java      |    5 
 ltkj-system/src/main/resources/mapper/system/SysNoticeMapper.xml                    |    8 +
 ltkj-system/src/main/java/com/ltkj/system/service/ISysNoticeService.java            |    8 +
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysNoticeController.java    |   86 +++++++++++++
 ltkj-hosp/src/main/java/com/ltkj/hosp/service/SysNoticeUserService.java             |   13 ++
 20 files changed, 324 insertions(+), 9 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysNoticeController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysNoticeController.java
index 5345e45..4acc06a 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysNoticeController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysNoticeController.java
@@ -1,9 +1,20 @@
 package com.ltkj.web.controller.system;
 
 import java.util.List;
+import java.util.stream.Collectors;
 
+import cn.hutool.core.util.IdUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ltkj.common.core.domain.entity.SysUser;
+import com.ltkj.common.core.domain.model.LoginUser;
+import com.ltkj.common.utils.SecurityUtils;
+import com.ltkj.hosp.domain.SysNoticeUser;
+import com.ltkj.hosp.service.SysNoticeUserService;
+import com.ltkj.system.service.ISysUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -31,6 +42,10 @@
 public class SysNoticeController extends BaseController {
     @Autowired
     private ISysNoticeService noticeService;
+    @Autowired
+    private SysNoticeUserService sysNoticeUserService;
+    @Autowired
+    private ISysUserService userService;
 
     /**
      * 鑾峰彇閫氱煡鍏憡鍒楄〃
@@ -40,6 +55,15 @@
     public TableDataInfo list(SysNotice notice) {
         startPage();
         List<SysNotice> list = noticeService.selectNoticeList(notice);
+        for (SysNotice sysNotice : list) {
+            LambdaQueryWrapper<SysNoticeUser> wq = new LambdaQueryWrapper<>();
+            wq.eq(SysNoticeUser::getNoticeId, sysNotice.getNoticeId());
+            List<SysNoticeUser> sysNoticeUsers = sysNoticeUserService.list(wq);
+            if(null != sysNoticeUsers && !sysNoticeUsers.isEmpty()){
+                List<String> longList = sysNoticeUsers.stream().map(i -> i.getUserId().toString()).collect(Collectors.toList());
+                sysNotice.setUserIds(longList);
+            }
+        }
         return getDataTable(list);
     }
 
@@ -49,7 +73,15 @@
 //    @PreAuthorize("@ss.hasPermi('system:notice:query')")
     @GetMapping(value = "/{noticeId}")
     public AjaxResult getInfo(@PathVariable Long noticeId) {
-        return success(noticeService.selectNoticeById(noticeId));
+        SysNotice byId = noticeService.getById(noticeId);
+        LambdaQueryWrapper<SysNoticeUser> wq = new LambdaQueryWrapper<>();
+        wq.eq(SysNoticeUser::getNoticeId, noticeId);
+        List<SysNoticeUser> sysNoticeUsers = sysNoticeUserService.list(wq);
+        if(null != sysNoticeUsers && !sysNoticeUsers.isEmpty()){
+            List<String> longList = sysNoticeUsers.stream().map(i -> i.getUserId().toString()).collect(Collectors.toList());
+            byId.setUserIds(longList);
+        }
+        return success(byId);
     }
 
     /**
@@ -58,9 +90,30 @@
 //    @PreAuthorize("@ss.hasPermi('system:notice:add')")
     @Log(title = "閫氱煡鍏憡", businessType = BusinessType.INSERT)
     @PostMapping
+    @Transactional
     public AjaxResult add(@Validated @RequestBody SysNotice notice) {
         notice.setCreateBy(getUsername());
-        return toAjax(noticeService.insertNotice(notice));
+        notice.setNoticeId(IdUtil.getSnowflake().nextId());
+        boolean insertNotice = noticeService.save(notice);
+        if (insertNotice){
+            if (notice.getUserIds() == null || notice.getUserIds().isEmpty()){
+                if (StrUtil.isBlank(notice.getDeptId())){
+                    notice.setUserIds(userService.list().stream().map(i -> String.valueOf(i.getUserId())).collect(Collectors.toList()));
+                }else {
+                    LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
+                    wrapper.eq(SysUser::getDeptId, notice.getDeptId());
+                    notice.setUserIds(userService.list(wrapper).stream().map(i -> String.valueOf(i.getUserId())).collect(Collectors.toList()));
+                }
+            }
+            for (String userId : notice.getUserIds()) {
+                SysNoticeUser user = new SysNoticeUser();
+                user.setId(IdUtil.getSnowflake().nextId());
+                user.setNoticeId(notice.getNoticeId());
+                user.setUserId(Long.valueOf(userId));
+                sysNoticeUserService.save(user);
+            }
+        }else return AjaxResult.error();
+        return AjaxResult.success();
     }
 
     /**
@@ -71,7 +124,24 @@
     @PutMapping
     public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
         notice.setUpdateBy(getUsername());
-        return toAjax(noticeService.updateNotice(notice));
+        List<String> userIds = notice.getUserIds();
+        if (noticeService.updateById(notice)) {
+            if(null !=userIds && !userIds.isEmpty()){
+                LambdaQueryWrapper<SysNoticeUser> wq = new LambdaQueryWrapper<>();
+                wq.eq(SysNoticeUser::getNoticeId, notice.getNoticeId());
+                sysNoticeUserService.remove(wq);
+                for (String userId : userIds) {
+                    SysNoticeUser user = new SysNoticeUser();
+                    user.setId(IdUtil.getSnowflake().nextId());
+                    user.setNoticeId(notice.getNoticeId());
+                    user.setUserId(Long.valueOf(userId));
+                    sysNoticeUserService.save(user);
+                }
+            }
+            return AjaxResult.success();
+        }
+
+        return AjaxResult.error();
     }
 
     /**
@@ -83,4 +153,14 @@
     public AjaxResult remove(@PathVariable Long[] noticeIds) {
         return toAjax(noticeService.deleteNoticeByIds(noticeIds));
     }
+
+    @GetMapping("/noticeToday")
+    public AjaxResult noticeToday(){
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (loginUser.getUserId().equalsIgnoreCase("1")){
+            return AjaxResult.success(noticeService.selectAllByAdmin());
+        }else {
+            return AjaxResult.success(noticeService.selectAll(loginUser.getUserId()));
+        }
+    }
 }
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysUserController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysUserController.java
index 269d29a..a884300 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysUserController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysUserController.java
@@ -20,6 +20,7 @@
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
+import jodd.util.StringUtil;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -324,6 +325,16 @@
         return ajax;
     }
 
+    @GetMapping("/userListByDeptId")
+    public AjaxResult userListByDeptId(@RequestParam(required = false) String deptId){
+
+        LambdaQueryWrapper<SysUser> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtil.isNotBlank(deptId)){
+            List<Long> deptIds = deptService.getDeptTreeById(deptId);
+            wrapper.in(SysUser::getDeptId,deptIds);
+        }
+        return AjaxResult.success(userService.list(wrapper));
+    }
     /**
      * 鐢ㄦ埛鎺堟潈瑙掕壊
      */
diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjDwGroupingController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjDwGroupingController.java
index 19cdbb1..90cb9dd 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjDwGroupingController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjDwGroupingController.java
@@ -290,4 +290,29 @@
         List<TjProject> tjProjectList = projectService.list(wq);
         return success(tjProjectList);
     }
+
+
+    @GetMapping("/huoqutuantitaocanxiangmuList")
+    @ApiOperation(value = "鑾峰彇鎵�鏈夊崟浣嶅洟浣撳椁愰」鐩�")
+    public AjaxResult huoqutuantitaocanxiangmuList(@RequestParam(required = false) String dwId) {
+        List<TjPackage> list=  tjDwGroupingService.huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList(dwId);
+        if (null !=list && !list.isEmpty()){
+            for (TjPackage tjPackage : list) {
+                List<TjProject> res=new ArrayList<>();
+                LambdaQueryWrapper<TjGroupingPro> wqq=new LambdaQueryWrapper<>();
+                wqq.eq(TjGroupingPro::getGroupingId,tjPackage.getPacId());
+                final List<TjGroupingPro> groupingProList = groupingProService.list(wqq);
+                if (null !=groupingProList && !groupingProList.isEmpty()){
+                    for (TjGroupingPro pro : groupingProList) {
+                        final TjProject byId = projectService.getById(pro.getProId());
+                        if(null !=byId){
+                            res.add(byId);
+                        }
+                    }
+                    tjPackage.setTjProjectList(res);
+                }
+            }
+        }
+        return AjaxResult.success(list);
+    }
 }
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysNoticeUser.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysNoticeUser.java
new file mode 100644
index 0000000..04020b2
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/domain/SysNoticeUser.java
@@ -0,0 +1,34 @@
+package com.ltkj.hosp.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import lombok.Data;
+
+/**
+ *
+ * @TableName sys_notice_user
+ */
+@TableName(value ="sys_notice_user")
+@Data
+public class SysNoticeUser implements Serializable {
+    /**
+     *
+     */
+    @TableId
+    private Long id;
+
+    /**
+     *
+     */
+    private Long noticeId;
+
+    /**
+     *
+     */
+    private Long userId;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysNoticeUserMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysNoticeUserMapper.java
new file mode 100644
index 0000000..4bbe6f4
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/SysNoticeUserMapper.java
@@ -0,0 +1,18 @@
+package com.ltkj.hosp.mapper;
+
+import com.ltkj.hosp.domain.SysNoticeUser;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+* @author w
+* @description 閽堝琛ㄣ�恠ys_notice_user銆戠殑鏁版嵁搴撴搷浣淢apper
+* @createDate 2025-06-13 16:07:05
+* @Entity com.ltkj.hosp.domain.SysNoticeUser
+*/
+public interface SysNoticeUserMapper extends BaseMapper<SysNoticeUser> {
+
+}
+
+
+
+
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjDwGroupingMapper.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjDwGroupingMapper.java
index ffda0fd..58a7764 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjDwGroupingMapper.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/mapper/TjDwGroupingMapper.java
@@ -111,4 +111,7 @@
             " tj_dw_grouping a  JOIN tj_grouping_pro b ON b.grouping_id=a.id \n" +
             "WHERE a.deleted=0 and a.dw_id=#{dwId} AND (a.sex=#{sex} or a.sex=2) GROUP BY b.grouping_id")
     List<TjPackage> huoqutuantitaocanxiangmu(@Param("dwId") String dwId,@Param("sex") Long sex);
+
+
+    List<TjPackage> huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList(@Param("dwId") String dwId);
 }
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjDwGroupingService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjDwGroupingService.java
index 6514682..ceb1706 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjDwGroupingService.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/ITjDwGroupingService.java
@@ -69,4 +69,6 @@
     public int selectTjDwGroupingByDwId(String dwId);
 
     List<TjPackage> huoqutuantitaocanxiangmu(String dwId, Long sex);
+
+    List<TjPackage> huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList(String dwId);
 }
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/SysNoticeUserService.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/SysNoticeUserService.java
new file mode 100644
index 0000000..4fe58aa
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/SysNoticeUserService.java
@@ -0,0 +1,13 @@
+package com.ltkj.hosp.service;
+
+import com.ltkj.hosp.domain.SysNoticeUser;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+* @author w
+* @description 閽堝琛ㄣ�恠ys_notice_user銆戠殑鏁版嵁搴撴搷浣淪ervice
+* @createDate 2025-06-13 16:07:05
+*/
+public interface SysNoticeUserService extends IService<SysNoticeUser> {
+
+}
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysNoticeUserServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysNoticeUserServiceImpl.java
new file mode 100644
index 0000000..c718bcb
--- /dev/null
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/SysNoticeUserServiceImpl.java
@@ -0,0 +1,22 @@
+package com.ltkj.hosp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ltkj.hosp.domain.SysNoticeUser;
+import com.ltkj.hosp.service.SysNoticeUserService;
+import com.ltkj.hosp.mapper.SysNoticeUserMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author w
+* @description 閽堝琛ㄣ�恠ys_notice_user銆戠殑鏁版嵁搴撴搷浣淪ervice瀹炵幇
+* @createDate 2025-06-13 16:07:05
+*/
+@Service
+public class SysNoticeUserServiceImpl extends ServiceImpl<SysNoticeUserMapper, SysNoticeUser>
+    implements SysNoticeUserService{
+
+}
+
+
+
+
diff --git a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjDwGroupingServiceImpl.java b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjDwGroupingServiceImpl.java
index 1402cfb..2252fc2 100644
--- a/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjDwGroupingServiceImpl.java
+++ b/ltkj-hosp/src/main/java/com/ltkj/hosp/service/impl/TjDwGroupingServiceImpl.java
@@ -111,4 +111,9 @@
     public List<TjPackage> huoqutuantitaocanxiangmu(String dwId, Long sex) {
         return tjDwGroupingMapper.huoqutuantitaocanxiangmu(dwId,sex);
     }
+
+    @Override
+    public List<TjPackage> huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList(String dwId) {
+        return tjDwGroupingMapper.huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList(dwId);
+    }
 }
diff --git a/ltkj-hosp/src/main/resources/mapper/hosp/TjDwGroupingMapper.xml b/ltkj-hosp/src/main/resources/mapper/hosp/TjDwGroupingMapper.xml
index d18f3c4..8bda29a 100644
--- a/ltkj-hosp/src/main/resources/mapper/hosp/TjDwGroupingMapper.xml
+++ b/ltkj-hosp/src/main/resources/mapper/hosp/TjDwGroupingMapper.xml
@@ -211,4 +211,18 @@
             #{id}
         </foreach>
     </delete>
-</mapper>
\ No newline at end of file
+
+    <select id="huoqutuantitaocanxiangmuhuoqutuantitaocanxiangmuList" parameterType="string"
+            resultType="com.ltkj.hosp.domain.TjPackage">
+        SELECT a.id pac_id,grouping_name pac_name,a.ys_price price , GROUP_CONCAT(b.pro_name ORDER BY b.pro_name)
+        allProName FROM
+        tj_dw_grouping a JOIN tj_grouping_pro b ON b.grouping_id=a.id
+        <where>
+            <if test="dwId != null" >
+                and a.dw_id = #{dwId}
+            </if>
+            and a.deleted=0 GROUP BY b.grouping_id
+        </where>
+
+    </select>
+</mapper>
diff --git a/ltkj-system/src/main/java/com/ltkj/system/domain/SysNotice.java b/ltkj-system/src/main/java/com/ltkj/system/domain/SysNotice.java
index 7ac7691..e438eaf 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/domain/SysNotice.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/domain/SysNotice.java
@@ -3,10 +3,17 @@
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.Size;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.ltkj.tduck.handler.LongToStringSerializer;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ltkj.common.core.domain.BaseEntity;
 import com.ltkj.common.xss.Xss;
+
+import java.util.List;
 
 /**
  * 閫氱煡鍏憡琛� sys_notice
@@ -19,6 +26,8 @@
     /**
      * 鍏憡ID
      */
+    @TableId
+    @JsonSerialize(using = LongToStringSerializer.class)
     private Long noticeId;
 
     /**
@@ -41,6 +50,28 @@
      */
     private String status;
 
+    //    @TableField(exist = false)
+    private String deptId;
+
+    @TableField(exist = false)
+    private List<String> userIds;
+
+    public String getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(String deptId) {
+        this.deptId = deptId;
+    }
+
+    public List<String> getUserIds() {
+        return userIds;
+    }
+
+    public void setUserIds(List<String> userIds) {
+        this.userIds = userIds;
+    }
+
     public Long getNoticeId() {
         return noticeId;
     }
diff --git a/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java b/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java
index 13a5a50..f258368 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/mapper/SysDeptMapper.java
@@ -163,4 +163,7 @@
 
      @Select("SELECT e.dept_name FROM sys_dept e WHERE e.dept_id=#{deptId}")
     String getprentks(String deptId);
+
+
+    List<Long> getDeptTreeById(@Param("deptId") String deptId);
 }
diff --git a/ltkj-system/src/main/java/com/ltkj/system/mapper/SysNoticeMapper.java b/ltkj-system/src/main/java/com/ltkj/system/mapper/SysNoticeMapper.java
index 4f08775..4860800 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/mapper/SysNoticeMapper.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/mapper/SysNoticeMapper.java
@@ -2,14 +2,17 @@
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ltkj.system.domain.SysNotice;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
 
 /**
  * 閫氱煡鍏憡琛� 鏁版嵁灞�
  *
  * @author ltkj
  */
-public interface SysNoticeMapper {
+public interface SysNoticeMapper extends BaseMapper<SysNotice> {
     /**
      * 鏌ヨ鍏憡淇℃伅
      *
@@ -57,4 +60,13 @@
      * @return 缁撴灉
      */
     public int deleteNoticeByIds(Long[] noticeIds);
+
+    @Select("SELECT s.* FROM sys_notice s\n" +
+            "  JOIN sys_notice_user n ON s.notice_id = n.notice_id\n" +
+            " WHERE DATE(s.create_time) = CURDATE() AND n.user_id = #{userId}")
+    List<SysNotice> selectAll(@Param("userId") String userId);
+
+    @Select("SELECT s.* FROM sys_notice s\n" +
+            " WHERE DATE(s.create_time) = CURDATE()")
+    List<SysNotice> selectAllByAdmin();
 }
diff --git a/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java b/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java
index 422695e..e8a6d6f 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/service/ISysDeptService.java
@@ -162,4 +162,6 @@
     List<String> getCzDeptIds();
 
     String getprentks(String deptId);
+
+    List<Long> getDeptTreeById(String deptId);
 }
diff --git a/ltkj-system/src/main/java/com/ltkj/system/service/ISysNoticeService.java b/ltkj-system/src/main/java/com/ltkj/system/service/ISysNoticeService.java
index 8427807..fdd6353 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/service/ISysNoticeService.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/service/ISysNoticeService.java
@@ -2,6 +2,8 @@
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ltkj.common.core.domain.AjaxResult;
 import com.ltkj.system.domain.SysNotice;
 
 /**
@@ -9,7 +11,7 @@
  *
  * @author ltkj
  */
-public interface ISysNoticeService {
+public interface ISysNoticeService extends IService<SysNotice> {
     /**
      * 鏌ヨ鍏憡淇℃伅
      *
@@ -57,4 +59,8 @@
      * @return 缁撴灉
      */
     public int deleteNoticeByIds(Long[] noticeIds);
+
+    List<SysNotice> selectAllByAdmin();
+
+    List<SysNotice> selectAll(String userId);
 }
diff --git a/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java b/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java
index b192444..7a0885f 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysDeptServiceImpl.java
@@ -459,4 +459,9 @@
     public String getprentks(String deptId) {
         return deptMapper.getprentks(deptId);
     }
+
+    @Override
+    public List<Long> getDeptTreeById(String deptId) {
+        return deptMapper.getDeptTreeById(deptId);
+    }
 }
diff --git a/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysNoticeServiceImpl.java b/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysNoticeServiceImpl.java
index 3b11a02..01225bf 100644
--- a/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysNoticeServiceImpl.java
+++ b/ltkj-system/src/main/java/com/ltkj/system/service/impl/SysNoticeServiceImpl.java
@@ -2,6 +2,8 @@
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ltkj.common.core.domain.AjaxResult;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.ltkj.system.domain.SysNotice;
@@ -14,7 +16,7 @@
  * @author ltkj
  */
 @Service
-public class SysNoticeServiceImpl implements ISysNoticeService {
+public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeMapper,SysNotice> implements ISysNoticeService {
     @Autowired
     private SysNoticeMapper noticeMapper;
 
@@ -83,4 +85,14 @@
     public int deleteNoticeByIds(Long[] noticeIds) {
         return noticeMapper.deleteNoticeByIds(noticeIds);
     }
+
+    @Override
+    public List<SysNotice> selectAllByAdmin() {
+        return noticeMapper.selectAllByAdmin();
+    }
+
+    @Override
+    public List<SysNotice> selectAll(String userId) {
+        return noticeMapper.selectAll(userId);
+    }
 }
diff --git a/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml b/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml
index 6bf5d4f..28cfbee 100644
--- a/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml
+++ b/ltkj-system/src/main/resources/mapper/system/SysDeptMapper.xml
@@ -396,5 +396,18 @@
               )}
     </select>
 
+    <select id="getDeptTreeById" resultType="java.lang.Long">
+        WITH RECURSIVE dept_tree AS (
+            SELECT dept_id
+            FROM sys_dept
+            WHERE dept_id = #{deptId}
 
+            UNION ALL
+
+            SELECT d.dept_id
+            FROM sys_dept d
+                     INNER JOIN dept_tree dt ON d.parent_id = dt.dept_id
+        )
+        SELECT dept_id FROM dept_tree;
+    </select>
 </mapper>
diff --git a/ltkj-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/ltkj-system/src/main/resources/mapper/system/SysNoticeMapper.xml
index a5358cf..0d95536 100644
--- a/ltkj-system/src/main/resources/mapper/system/SysNoticeMapper.xml
+++ b/ltkj-system/src/main/resources/mapper/system/SysNoticeMapper.xml
@@ -27,7 +27,9 @@
                create_time,
                update_by,
                update_time,
-               remark
+               remark,
+               dept_id
+
         from sys_notice
     </sql>
 
@@ -53,6 +55,7 @@
 
     <insert id="insertNotice" parameterType="SysNotice">
         insert into sys_notice (
+        <if test="noticeId != null and noticeId != '' ">notice_id,</if>
         <if test="noticeTitle != null and noticeTitle != '' ">notice_title,</if>
         <if test="noticeType != null and noticeType != '' ">notice_type,</if>
         <if test="noticeContent != null and noticeContent != '' ">notice_content,</if>
@@ -61,6 +64,7 @@
         <if test="createBy != null and createBy != ''">create_by,</if>
         create_time
         )values(
+        <if test="noticeId != null and noticeId != '' ">#{noticeId},</if>
         <if test="noticeTitle != null and noticeTitle != ''">#{noticeTitle},</if>
         <if test="noticeType != null and noticeType != ''">#{noticeType},</if>
         <if test="noticeContent != null and noticeContent != ''">#{noticeContent},</if>
@@ -97,4 +101,4 @@
         </foreach>
     </delete>
 
-</mapper>
\ No newline at end of file
+</mapper>

--
Gitblit v1.8.0