Prechádzať zdrojové kódy

全部已读功能调整

dzx 3 dní pred
rodič
commit
f7e77891d3

+ 4 - 1
src/main/java/com/xjrsoft/module/oa/mapper/NewsMapper.java

@@ -29,6 +29,9 @@ public interface NewsMapper extends MPJBaseMapper<News> {
     List<DeptIdOrClassIdVo> getDeptIdOrClassId(@Param("personalIdList") List<Long> personalIdList);
 
 
-    @Update("UPDATE xjr_oa_news_relation SET read_mark = 1 WHERE user_id = #{userId}")
+    @Update("UPDATE xjr_oa_news_relation t1" +
+            " INNER JOIN xjr_oa_news t2 ON t1.news_id = t2.id" +
+            " SET t1.read_mark = 1,t1.read_date = NOW() WHERE t1.user_id = #{userId}" +
+            " AND t2.status = 2")
     void allRead(Long userId);
 }

+ 4 - 4
src/main/java/com/xjrsoft/module/oa/service/impl/NewsServiceImpl.java

@@ -479,7 +479,7 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
 
             //对人员进行筛选,避免重复添加
             List<Long> userIdList = new ArrayList<>();
-            if (personalIdList.size() > 0) {
+            if (!personalIdList.isEmpty()) {
                 //获取人员的班级或者部门
                 List<DeptIdOrClassIdVo> deptIdOrClassIdVoList = newsMapper.getDeptIdOrClassId(personalIdList);
                 for (DeptIdOrClassIdVo deptIdOrClassIdVo : deptIdOrClassIdVoList) {
@@ -495,17 +495,17 @@ public class NewsServiceImpl extends MPJBaseServiceImpl<NewsMapper, News> implem
                 }
             }
             //添加部门人员
-            if (deptIdList.size() > 0) {
+            if (!deptIdList.isEmpty()) {
                 newsRelationMapper.insertDeptUser(xjrNews.getId(), deptIdList);
             }
 
             //添加部门人员
-            if (classIdList.size() > 0) {
+            if (!classIdList.isEmpty()) {
                 newsRelationMapper.insertClassUser(xjrNews.getId(), classIdList);
             }
 
             //添加部门人员
-            if (userIdList.size() > 0) {
+            if (!userIdList.isEmpty()) {
                 newsRelationMapper.insertPersonl(xjrNews.getId(), userIdList);
             }