Browse Source

notify 代码 userId

tags/24080901
PoffyZhang 1 year ago
parent
commit
db036f2bd4
4 changed files with 25 additions and 4 deletions
  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 View File

@@ -51,6 +51,18 @@ public enum MsgTypeEnum {
return StringUtils.EMPTY; 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) { public boolean eq(String val) {
return this.name().equals(val); return this.name().equals(val);
} }


+ 3
- 1
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/NotifyManage.java View File

@@ -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.req.NotifyListReq;
import com.ningdatech.pmapi.sys.model.vo.NotifyVO; import com.ningdatech.pmapi.sys.model.vo.NotifyVO;
import com.ningdatech.pmapi.sys.service.INotifyService; import com.ningdatech.pmapi.sys.service.INotifyService;
import com.ningdatech.pmapi.user.util.LoginUserUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;


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


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


+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/req/NotifyListReq.java View File

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


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

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




+ 10
- 0
pmapi/src/main/java/com/ningdatech/pmapi/sys/model/vo/NotifyVO.java View File

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


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

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


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


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

Loading…
Cancel
Save