瀏覽代碼

解决报错

dzx 1 年之前
父節點
當前提交
73c16328c3

+ 1 - 8
src/main/java/com/xjrsoft/module/system/controller/SystemUpdateMessageController.java

@@ -10,7 +10,6 @@ import com.xjrsoft.common.enums.DeleteMark;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
 import com.xjrsoft.common.page.PageOutput;
-import com.xjrsoft.module.student.entity.BaseStudentCadre;
 import com.xjrsoft.module.system.dto.AddSystemUpdateMessageDto;
 import com.xjrsoft.module.system.dto.SystemUpdateMessagePageDto;
 import com.xjrsoft.module.system.dto.SystemUpdateMessageReleaseDto;
@@ -37,7 +36,6 @@ import javax.validation.Valid;
 import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Date;
 import java.util.List;
 
 /**
@@ -176,12 +174,7 @@ public class SystemUpdateMessageController {
     @ApiOperation(value = "阅读系统消息")
     @SaCheckPermission("systemupdatemessage:read-msg")
     public RT<Boolean> readMsg(@Valid SystemUpdateMessageReleaseDto dto) {
-
-        SystemUpdateMessageNotice messageNotice = systemUpdateMessageNoticeService.getById(dto.getId());
-        messageNotice.setStatus(1);
-        messageNotice.setModifyDate(new Date());
-        messageNotice.setModifyUserId(StpUtil.getLoginIdAsLong());
-        return RT.ok(systemUpdateMessageNoticeService.updateById(messageNotice));
+        return RT.ok(systemUpdateMessageNoticeService.updateStatus(dto.getId(), StpUtil.getLoginIdAsLong()));
     }
 
 }

+ 4 - 0
src/main/java/com/xjrsoft/module/system/mapper/SystemUpdateMessageNoticeMapper.java

@@ -5,6 +5,7 @@ import com.xjrsoft.module.system.entity.SystemUpdateMessageNotice;
 import com.xjrsoft.module.system.vo.SystemUpdateMessagePageTempVo;
 import com.xjrsoft.module.system.vo.SystemUpdateMessagePageVo;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -20,4 +21,7 @@ public interface SystemUpdateMessageNoticeMapper extends MPJBaseMapper<SystemUpd
     List<SystemUpdateMessagePageTempVo> GetTeacherUserID();
 
     List<SystemUpdateMessagePageTempVo> GetStudentUserID();
+
+    @Update("UPDATE system_update_message_notice SET STATUS = 1 WHERE system_update_message_id = #{messageId} AND user_id = #{userId}")
+    Boolean updateStatus(Long messageId, Long userId);
 }

+ 2 - 0
src/main/java/com/xjrsoft/module/system/service/ISystemUpdateMessageNoticeService.java

@@ -17,4 +17,6 @@ public interface ISystemUpdateMessageNoticeService extends MPJBaseService<System
     String[] getTeacherUserId();
 
     String[] getStudentUserId();
+
+    Boolean updateStatus(Long messageId, Long userId);
 }

+ 5 - 0
src/main/java/com/xjrsoft/module/system/service/impl/SystemUpdateMessageNoticeServiceImpl.java

@@ -45,4 +45,9 @@ public class SystemUpdateMessageNoticeServiceImpl extends MPJBaseServiceImpl<Sys
         String[] studentTeacherIds = temp.stream().map(SystemUpdateMessagePageTempVo::getUserId).toArray(String[]::new);
         return studentTeacherIds;
     }
+
+    @Override
+    public Boolean updateStatus(Long messageId, Long userId) {
+        return systemUpdateMessageNoticeMapper.updateStatus(messageId, userId);
+    }
 }