🐛 消息标记为已读问题修复
This commit is contained in:
parent
1774637e28
commit
22979810e5
@ -48,5 +48,5 @@ public interface NotificationService extends Service<Notification> {
|
||||
* 标记消息已读
|
||||
* @param id
|
||||
*/
|
||||
void readNotification(Integer id);
|
||||
Integer readNotification(Integer id);
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import com.rymcu.vertical.entity.Notification;
|
||||
import com.rymcu.vertical.mapper.NotificationMapper;
|
||||
import com.rymcu.vertical.service.NotificationService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
@ -36,12 +37,14 @@ public class NotificationServiceImpl extends AbstractService<Notification> imple
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer save(Integer idUser, Integer dataId, String dataType, String dataSummary) {
|
||||
return notificationMapper.insertNotification(idUser,dataId,dataType,dataSummary);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readNotification(Integer id) {
|
||||
notificationMapper.readNotification(id);
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer readNotification(Integer id) {
|
||||
return notificationMapper.readNotification(id);
|
||||
}
|
||||
}
|
||||
|
@ -48,8 +48,12 @@ public class NotificationController {
|
||||
}
|
||||
|
||||
@PutMapping("/read/{id}")
|
||||
public void read(@PathVariable Integer id) {
|
||||
notificationService.readNotification(id);
|
||||
public GlobalResult read(@PathVariable Integer id) {
|
||||
Integer result = notificationService.readNotification(id);
|
||||
if (result == 0) {
|
||||
return GlobalResultGenerator.genErrorResult("标记已读失败");
|
||||
}
|
||||
return GlobalResultGenerator.genSuccessResult("标记已读成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user