ソースを参照

notify 代码 userId

master
PoffyZhang 1年前
コミット
db036f2bd4
4個のファイルの変更25行の追加4行の削除
  1. +12
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java
  2. +3
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java
  3. +0
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java
  4. +10
    -0
      pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java

+ 12
- 0
pmapi/src/main/java/com/ningdatech/pmapi/staging/enums/MsgTypeEnum.java ファイルの表示

@@ -51,6 +51,18 @@ public enum MsgTypeEnum {
return StringUtils.EMPTY;
}

public static String getDescByName(String name) {
if (StringUtils.isBlank(name)) {
return StringUtils.EMPTY;
}
for (MsgTypeEnum t : MsgTypeEnum.values()) {
if (name.equals(t.name())) {
return t.desc;
}
}
return StringUtils.EMPTY;
}

public boolean eq(String val) {
return this.name().equals(val);
}


+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java ファイルの表示

@@ -10,6 +10,7 @@ import com.ningdatech.pmapi.sys.model.entity.Notify;
import com.ningdatech.pmapi.sys.model.req.NotifyListReq;
import com.ningdatech.pmapi.sys.model.vo.NotifyVO;
import com.ningdatech.pmapi.sys.service.INotifyService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

@@ -32,10 +33,11 @@ public class NotifyManage {
private final INotifyService notifyService;

public PageVo<NotifyVO> page(NotifyListReq notifyListReq) {
Long userId = LoginUserUtil.getUserId();
Page<Notify> page = notifyListReq.page();
LambdaQueryWrapper<Notify> wrapper = Wrappers.lambdaQuery(Notify.class)
.eq(Objects.nonNull(notifyListReq.getReaded()), Notify::getReaded, notifyListReq.getReaded())
.eq(Objects.nonNull(notifyListReq.getUserId()), Notify::getUserId, notifyListReq.getUserId())
.eq(Notify::getUserId, userId)
.like(Objects.nonNull(notifyListReq.getTitle()), Notify::getTitle, notifyListReq.getTitle())
.eq(Objects.nonNull(notifyListReq.getType()), Notify::getType, notifyListReq.getType());
notifyService.page(page,wrapper);


+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java ファイルの表示

@@ -19,9 +19,6 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
public class NotifyListReq extends PagePo {

@ApiModelProperty("用户ID")
private Integer userId;

@ApiModelProperty("是否已读")
private Boolean readed;



+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java ファイルの表示

@@ -2,11 +2,15 @@ package com.ningdatech.pmapi.sys.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ningdatech.pmapi.staging.enums.MsgTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Objects;

/**
* <p>
@@ -50,4 +54,10 @@ public class NotifyVO implements Serializable {
@ApiModelProperty("创建时间")
private LocalDateTime createTime;

public String getTypeName(){
if(Objects.nonNull(this.type)){
return MsgTypeEnum.getDescByName(this.type);
}
return StringUtils.EMPTY;
}
}

読み込み中…
キャンセル
保存