ly 3 жил өмнө
parent
commit
c83670e8ce

+ 13 - 0
master/src/main/java/com/ruoyi/project/system/controller/SysNoticeController.java

@@ -40,11 +40,24 @@ public class SysNoticeController extends BaseController
     @GetMapping("/list")
     public TableDataInfo list(SysNotice notice)
     {
+        notice.setUserId(getUserId());
         startPage();
         List<SysNotice> list = noticeService.selectNoticeList(notice);
         return getDataTable(list);
     }
 
+    /**
+     * 获取通知公告列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:notice:list')")
+    @GetMapping("/unList")
+    public List<SysNotice> unlist(SysNotice notice)
+    {
+        notice.setUserId(getUserId());
+        List<SysNotice> list = noticeService.selectNoticeUnList(notice);
+        return list;
+    }
+
     /**
      * 根据通知公告编号获取详细信息
      */

+ 3 - 11
master/src/main/java/com/ruoyi/project/system/controller/SysUserNoticeController.java

@@ -4,14 +4,7 @@ import java.util.Date;
 import java.util.List;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
 import com.ruoyi.project.system.domain.SysUserNotice;
@@ -72,10 +65,9 @@ public class SysUserNoticeController extends BaseController
     /**
      * 新增用户通知关联
      */
-    @PreAuthorize("@ss.hasPermi('system:userNotice:add')")
     @Log(title = "用户通知关联", businessType = BusinessType.INSERT)
-    @GetMapping
-    public AjaxResult add(@RequestBody Long noticeId)
+    @GetMapping(value = "/insertReadHis/{noticeId}")
+    public AjaxResult add(@PathVariable Long noticeId)
     {
         SysUserNotice sysUserNotice = new SysUserNotice();
         sysUserNotice.setNoticeId(noticeId);

+ 10 - 0
master/src/main/java/com/ruoyi/project/system/domain/SysNotice.java

@@ -30,6 +30,8 @@ public class SysNotice extends BaseEntity
     /** 公告状态(0正常 1关闭) */
     private String status;
 
+    private Long userId;
+
     public Long getNoticeId()
     {
         return noticeId;
@@ -82,6 +84,14 @@ public class SysNotice extends BaseEntity
         return status;
     }
 
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

+ 12 - 1
master/src/main/java/com/ruoyi/project/system/mapper/SysNoticeMapper.java

@@ -1,6 +1,8 @@
 package com.ruoyi.project.system.mapper;
 
 import java.util.List;
+
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
 import com.ruoyi.project.system.domain.SysNotice;
 
 /**
@@ -24,8 +26,15 @@ public interface SysNoticeMapper
      * @param notice 公告信息
      * @return 公告集合
      */
+    @DataScope(deptAlias = "d")
     public List<SysNotice> selectNoticeList(SysNotice notice);
-
+    /**
+     * 查询未读公告列表
+     *
+     * @param notice 公告信息
+     * @return 公告集合
+     */
+    List<SysNotice> selectNoticeUnList(SysNotice notice);
     /**
      * 新增公告
      *
@@ -57,4 +66,6 @@ public interface SysNoticeMapper
      * @return 结果
      */
     public int deleteNoticeByIds(Long[] noticeIds);
+
+
 }

+ 9 - 1
master/src/main/java/com/ruoyi/project/system/service/ISysNoticeService.java

@@ -25,7 +25,13 @@ public interface ISysNoticeService
      * @return 公告集合
      */
     public List<SysNotice> selectNoticeList(SysNotice notice);
-
+    /**
+     * 查询未读公告列表
+     *
+     * @param notice 公告信息
+     * @return 公告集合
+     */
+    List<SysNotice> selectNoticeUnList(SysNotice notice);
     /**
      * 新增公告
      *
@@ -57,4 +63,6 @@ public interface ISysNoticeService
      * @return 结果
      */
     public int deleteNoticeByIds(Long[] noticeIds);
+
+
 }

+ 10 - 0
master/src/main/java/com/ruoyi/project/system/service/impl/SysNoticeServiceImpl.java

@@ -41,6 +41,16 @@ public class SysNoticeServiceImpl implements ISysNoticeService
     {
         return noticeMapper.selectNoticeList(notice);
     }
+    /**
+     * 查询未读公告列表
+     *
+     * @param notice 公告信息
+     * @return 公告集合
+     */
+    @Override
+    public List<SysNotice> selectNoticeUnList(SysNotice notice) {
+        return noticeMapper.selectNoticeUnList(notice);
+    }
 
     /**
      * 新增公告

+ 23 - 23
master/src/main/resources/freeMaker/measureFMaker.ftl

@@ -45,7 +45,7 @@
 				</a>
 			</p>
 			<table cellspacing="0" cellpadding="0" style="border-collapse:collapse; margin-left:0pt; width:100.34%">
-				<tr style="height:17.05pt">
+				<tr style="height:17.05pt;page-break-inside:avoid; page-break-after:auto;">
 					<td style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; width:9.26%">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">装置</span>
@@ -99,7 +99,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:17.05pt">
+				<tr style="height:17.05pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="3" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">记录人</span>
@@ -127,7 +127,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:13.85pt">
+				<tr style="height:13.85pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="4" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">设备/管线名称</span>
@@ -168,7 +168,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:10pt">
+				<tr style="height:10pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">原始壁厚 / mm</span>
@@ -209,7 +209,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:12.6pt">
+				<tr style="height:12.6pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">规格</span>
@@ -250,7 +250,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:63.85pt">
+				<tr style="height:63.85pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="3" rowspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; height:63.85pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; writing-mode:tb-rl">
 						<p style="margin:0pt 5.65pt; text-align:center">
 							<span style="font-family:SimSun; font-size:10pt">腐蚀状况描述</span>
@@ -296,7 +296,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:9.65pt">
+				<tr style="height:9.65pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">腐蚀类型</span>
@@ -311,7 +311,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:9.65pt">
+				<tr style="height:9.65pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">检测方法</span>
@@ -380,7 +380,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:76pt">
+				<tr style="height:76pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">腐蚀照片</span>
@@ -403,7 +403,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:49pt">
+				<tr style="height:49pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">原因分析</span>
@@ -418,7 +418,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:22.45pt">
+				<tr style="height:22.45pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="11" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt; font-weight:bold">测厚记录</span>
@@ -455,7 +455,7 @@
 					</td>
 				</tr>
 				<#list result as records>
-					<tr style="height:22.45pt">
+					<tr style="height:22.45pt;page-break-inside:avoid; page-break-after:auto;">
 						<td colspan="2" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 							<p style="margin:0pt">
 								<span style="font-family:SimSun; font-size:10pt">日期</span>
@@ -528,7 +528,7 @@
 							</#if>
 						</#list>
 					</tr>
-					<tr style="height:22.45pt">
+					<tr style="height:22.45pt;page-break-inside:avoid; page-break-after:auto;">
 						<td colspan="2" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 							<p style="margin:0pt">
 								<span style="font-family:SimSun; font-size:10pt">数值</span>
@@ -602,7 +602,7 @@
 						</#list>
 					</tr>
 				</#list>
-				<tr style="height:22.9pt">
+				<tr style="height:22.9pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="20" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">趋势图</span>
@@ -610,14 +610,14 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:42.25pt">
+				<tr style="height:42.25pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="20" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt; text-align:center">
 							<img src='${chartUrl}' style="width: 300pt; height: 150pt"/>
 						</p>
 					</td>
 				</tr>
-				<tr style="height:30.1pt">
+				<tr style="height:30.1pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="6" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt; text-align:center">
 							<span style="font-family:SimSun; font-size:10pt">短期腐蚀速率</span>
@@ -667,21 +667,21 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:14.8pt">
+				<tr style="height:14.8pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="20" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt; font-weight:bold">附件(失效分析报告或检测报告)</span>
 						</p>
 					</td>
 				</tr>
-				<tr style="height:33.25pt">
+				<tr style="height:33.25pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="20" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">&#xa0;</span>
 						</p>
 					</td>
 				</tr>
-				<tr style="height:52.6pt">
+				<tr style="height:52.6pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="3" rowspan="3" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; height:52.6pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle; writing-mode:tb-rl">
 						<p style="margin:0pt 5.65pt; text-align:center">
 							<span style="font-family:SimSun; font-size:10pt">腐蚀治理</span>
@@ -707,7 +707,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:9.65pt">
+				<tr style="height:9.65pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">效果跟踪</span>
@@ -722,7 +722,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:23.85pt">
+				<tr style="height:23.85pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="5" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">提出人和时间</span>
@@ -740,7 +740,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:78.75pt">
+				<tr style="height:78.75pt;page-break-inside:avoid; page-break-after:auto;">
 					<td colspan="3" style="border-bottom-color:#000000; border-bottom-style:solid; border-bottom-width:0.75pt; border-left-color:#000000; border-left-style:solid; border-left-width:0.75pt; border-right-color:#000000; border-right-style:solid; border-right-width:0.75pt; border-top-color:#000000; border-top-style:solid; border-top-width:0.75pt; padding-left:5.03pt; padding-right:5.03pt; vertical-align:middle">
 						<p style="margin:0pt">
 							<span style="font-family:SimSun; font-size:10pt">说明</span>
@@ -864,7 +864,7 @@
 						</p>
 					</td>
 				</tr>
-				<tr style="height:0pt">
+				<tr style="height:0pt;page-break-inside:avoid; page-break-after:auto;">
 					<td style="width:45.75pt; border:none">
 					</td>
 					<td style="width:10.7pt; border:none">

+ 23 - 6
master/src/main/resources/mybatis/system/SysNoticeMapper.xml

@@ -15,12 +15,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="updateBy"       column="update_by"       />
         <result property="updateTime"     column="update_time"     />
         <result property="remark"         column="remark"          />
+        <result property="userId"         column="user_id"          />
         <!--<result property="readFlag"       column="read_flag"       />-->
     </resultMap>
 
     <sql id="selectNoticeVo">
-        select notice_id, notice_title, notice_type, notice_content, status, create_by, create_time, update_by, update_time, remark
-		from sys_notice
+        select d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark
+		from sys_notice d
     </sql>
 
     <select id="selectNoticeById" parameterType="Long" resultMap="SysNoticeResult">
@@ -29,18 +30,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectNoticeList" parameterType="SysNotice" resultMap="SysNoticeResult">
-        <include refid="selectNoticeVo"/>
+        select n.user_id, d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark
+        from sys_notice d
+        LEFT JOIN SYS_USER_NOTICE n on d.NOTICE_ID = n.NOTICE_ID
+        <if test="userId != null and userId != ''">
+            and n.USER_ID = #{userId}
+        </if>
         <where>
 			<if test="noticeTitle != null and noticeTitle != ''">
-				AND notice_title like concat(concat('%',#{noticeTitle}),'%')
+				AND d.notice_title like concat(concat('%',#{noticeTitle}),'%')
 			</if>
 			<if test="noticeType != null and noticeType != ''">
-				AND notice_type = #{noticeType}
+				AND d.notice_type = #{noticeType}
 			</if>
 			<if test="createBy != null and createBy != ''">
-				AND create_by like concat(concat('%',#{createBy}),'%')
+				AND d.create_by like concat(concat('%',#{createBy}),'%')
 			</if>
 		</where>
+         order by n.user_id
+    </select>
+
+    <select id="selectNoticeUnList" parameterType="SysNotice" resultMap="SysNoticeResult">
+        select n.user_id, d.notice_id, d.notice_title, d.notice_type, d.notice_content, d.status, d.create_by, d.create_time, d.update_by, d.update_time, d.remark
+        from sys_notice d
+        LEFT JOIN SYS_USER_NOTICE n on d.NOTICE_ID = n.NOTICE_ID
+        <if test="userId != null and userId != ''">
+            and n.USER_ID = #{userId}
+        </if>
+        where n.user_id is null
     </select>
 
     <insert id="insertNotice" parameterType="SysNotice">

+ 0 - 23
master/src/main/resources/mybatis/system/SysUserNoticeMapper.xml

@@ -34,40 +34,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
 
-
-
     <insert id="insertSysUserNotice" parameterType="SysUserNotice">
         insert into sys_user_notice
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="userId != null">user_id,</if>
             <if test="noticeId != null">notice_id,</if>
-            <if test="createtime != null">createtime,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},</if>
             <if test="noticeId != null">#{noticeId},</if>
-            <if test="createtime != null">#{createtime},</if>
          </trim>
     </insert>
 
-    <!--<update id="updateSysUserNotice" parameterType="SysUserNotice">
-        update sys_user_notice
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="noticeId != null">notice_id = #{noticeId},</if>
-            <if test="createtime != null">createtime = #{createtime},</if>
-        </trim>
-        where user_id = #{userId}
-    </update>-->
-
-   <!-- <update id="deleteSysUserNoticeById" parameterType="Long">
-        update sys_user_notice set del_flag = 2 where user_id = #{userId}
-    </update>
-
-    <update id="deleteSysUserNoticeByIds" parameterType="String">
-        update sys_user_notice set del_flag = 2 where user_id in
-        <foreach item="userId" collection="array" open="(" separator="," close=")">
-            #{userId}
-        </foreach>
-    </update>-->
     
 </mapper>

+ 10 - 1
ui/src/api/system/notice.js

@@ -9,6 +9,15 @@ export function listNotice(query) {
   })
 }
 
+// 查询未读公告列表
+export function listUnNotice(query) {
+  return request({
+    url: '/system/notice/unList',
+    method: 'get',
+    params: query
+  })
+}
+
 // 查询公告详细
 export function getNotice(noticeId) {
   return request({
@@ -20,7 +29,7 @@ export function getNotice(noticeId) {
 // 新增已读记录
 export function insertReadHis(noticeId) {
   return request({
-    url: '/system/userNotice/' +noticeId,
+    url: '/system/userNotice/insertReadHis/'+ noticeId,
     method: 'get',
   })
 }

+ 3 - 0
ui/src/lang/en.js

@@ -186,6 +186,9 @@ export default {
   '是否确认复职?': 'Confirm Reinstated?',
   '是否更新已经存在的用户数据': 'Whether update existing user data',
   至: 'to',
+  暂没有新消息: 'No New Messages',
+  查看全部: 'View all',
+  未读消息: 'Unread Message ',
   //上传附件
   文件: 'File',
   文件名: 'File Name',

+ 3 - 0
ui/src/lang/zh.js

@@ -186,6 +186,9 @@ export default {
   '是否确认复职?': '是否确认复职?',
   '是否更新已经存在的用户数据': '是否更新已经存在的用户数据',
   至: '至',
+  暂没有新消息: '暂没有新消息',
+  查看全部: '查看全部',
+  未读消息: '未读消息',
   //上传附件
   文件: '文件',
   文件名: '文件名',

+ 20 - 10
ui/src/layout/components/Navbar.vue

@@ -10,17 +10,18 @@
         <search id="header-search" class="right-menu-item" />
 
 <!--          <router-link class="right-menu-item" to="/notice/details">-->
-        <div class="right-menu-item">
+        <div class="right-menu-item" style="cursor:pointer" @click="getNotice" >
             <el-popover
               placement="bottom"
               width="320"
               trigger="click">
+              <h3 style="text-align: center">未读消息</h3>
                 <el-table :data="gridData" max-height="500px" :show-header="false"
-                          empty-text="暂没有新消息"
+                          :empty-text="$t('暂没有新消息')"
                 >
-                  <el-table-column width="280" property="address" >
+                  <el-table-column width="280" property="noticeTitle" >
                     <template slot-scope="scope">
-                      <router-link  to="/notice/details">{{ scope.row.address}}</router-link>
+                      <router-link  to="/notice/details">{{ scope.row.noticeTitle}}</router-link>
                     </template>
                   </el-table-column>
                 </el-table>
@@ -28,7 +29,7 @@
                 <el-button type="text" size="mini" style="float: right">{{ $t('查看全部') }}</el-button>
               </router-link>
               <div slot="reference">
-                <el-badge is-dot>
+                <el-badge :is-dot="dotFlag">
                   <i class="el-icon-bell"  style=" font-size:20px;"></i>
                 </el-badge>
               </div>
@@ -82,7 +83,7 @@ import Search from '@/components/HeaderSearch'
 import RuoYiGit from '@/components/RuoYi/Git'
 import RuoYiDoc from '@/components/RuoYi/Doc'
 import LangSelect from '@/components/LangSelect'
-
+import {listUnNotice} from "@/api/system/notice";
 export default {
   components: {
     Breadcrumb,
@@ -96,7 +97,8 @@ export default {
   },
     data() {
       return {
-        gridData: []
+        gridData: [],
+        dotFlag: false,
       };
     },
   computed: {
@@ -118,14 +120,22 @@ export default {
     }
   },
   mounted() {
+    this.getNotice()
     //定时器
     const timer = setInterval(() => {
-        console.log("111")
+      this.getNotice()
     }, 100000)
   },
   methods: {
-    rowClick(){
-        console.log("!!!")
+    getNotice(){
+      listUnNotice().then(response => {
+        this.gridData = response;
+        if (this.gridData.length > 0) {
+          this.dotFlag = true
+        }else {
+          this.dotFlag = false
+        }
+      });
     },
     toggleSideBar() {
       this.$store.dispatch('app/toggleSideBar')

+ 11 - 10
ui/src/views/system/notice/index.vue

@@ -78,7 +78,11 @@
         align="center"
         prop="noticeTitle"
         :show-overflow-tooltip="true"
-      />
+      >
+        <template slot-scope="scope">
+         <i v-if="scope.row.userId == null" style="width:5px;height:5px;border-radius:50%;background-color:red;display: inline-block;margin-right: 2px;margin-bottom: 2px;"></i>{{scope.row.noticeTitle}}
+        </template>
+      </el-table-column>
       <el-table-column
         :label="$t('公告类型')"
         align="center"
@@ -93,9 +97,6 @@
         :formatter="statusFormat"
         width="100"
       />
-
-      <el-table-column :label="$t('阅览状态')" align="center" prop="" width="100" />
-
       <el-table-column :label="$t('创建人')" align="center" prop="createBy" width="100" />
       <el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="100">
         <template slot-scope="scope">
@@ -103,7 +104,6 @@
         </template>
       </el-table-column>
 
-
       <el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
           <el-button
@@ -386,11 +386,12 @@ export default {
         this.check= true;
         this.title = this.$t('查看') + " " + this.$t('公告');
       });
-      //点击查询,判断是否已有该条数据若已有则不添加,没有则向关联表添加一条数据
-      insertReadHis(row.noticeId).then(response => {
-        this.msgSuccess(this.$t('已读'));
-        this.getList();
-      });
+      if (row.userId == null) {
+        //点击查询,判断是否已有该条数据若已有则不添加,没有则向关联表添加一条数据
+        insertReadHis(row.noticeId).then(response => {
+          this.getList();
+        });
+      }
     },
     /** 提交按钮 */
     submitForm: function() {