Commit 292f86a2 authored by 33's avatar 33

update

parent 09032228
...@@ -43,7 +43,14 @@ public class NotifyServiceImpl implements NotifyService { ...@@ -43,7 +43,14 @@ public class NotifyServiceImpl implements NotifyService {
@Override @Override
public NotifyState selectByUid(Integer uid) { public NotifyState selectByUid(Integer uid) {
return notifyStateMapper.selectByUid(uid); NotifyState notifyState = notifyStateMapper.selectByUid(uid);
if (notifyState == null) {
notifyState = new NotifyState();
notifyState.setUid(uid);
notifyState.setNumber(0);
notifyState.setNids("[]");
}
return notifyState;
} }
@Override @Override
......
...@@ -63,7 +63,7 @@ public class NotifyController { ...@@ -63,7 +63,7 @@ public class NotifyController {
if (vo != null) { if (vo != null) {
Integer userId = LoginUserInfo.getLoginUser().getUserId(); Integer userId = LoginUserInfo.getLoginUser().getUserId();
NotifyState notifyState = notifyService.selectByUid(userId); NotifyState notifyState = notifyService.selectByUid(userId);
if (notifyState != null) { if (notifyState.getNumber() != 0) {
val nids = notifyState.getNids(); val nids = notifyState.getNids();
val nidArray = JSON.parseArray(nids, Integer.class); val nidArray = JSON.parseArray(nids, Integer.class);
if (nidArray.contains(id)) { if (nidArray.contains(id)) {
...@@ -83,7 +83,7 @@ public class NotifyController { ...@@ -83,7 +83,7 @@ public class NotifyController {
public ResponseModel<Boolean> allRead() { public ResponseModel<Boolean> allRead() {
Integer userId = LoginUserInfo.getLoginUser().getUserId(); Integer userId = LoginUserInfo.getLoginUser().getUserId();
NotifyState notifyState = notifyService.selectByUid(userId); NotifyState notifyState = notifyService.selectByUid(userId);
if (notifyState != null) { if (notifyState.getNumber() != 0) {
notifyState.setNumber(0); notifyState.setNumber(0);
notifyState.setNids("[]"); notifyState.setNids("[]");
notifyService.updateState(notifyState); notifyService.updateState(notifyState);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment