Merge branch 'feature/REQ-2010' into test

This commit is contained in:
yanglin 2024-02-27 09:14:23 +08:00
commit 54b3ec3fc6
2 changed files with 38 additions and 7 deletions

View File

@ -61,10 +61,6 @@ public class MessageRecordDao extends
public void readMsg(InsideCmsReadMsgReq req,
Long personId, Long identityId) {
lambdaUpdate().set(MessageRecord::getState, MsgStateEnum.HAVE_READ)
.and(i -> i.and(
a -> a.eq(MessageRecord::getPersonId, personId).eq(MessageRecord::getReceiveType,
ReceiveTypeEnum.NOT_IDENTITY)).or()
.eq(MessageRecord::getToId, identityId))
.eq(MessageRecord::getIsDelete, 0L)
.eq(req.getMsgId() != -1L, MessageRecord::getId, req.getMsgId())
.eq(MessageRecord::getType, MsgTypeEnum.GENERAL_MESSAGE)
@ -72,9 +68,9 @@ public class MessageRecordDao extends
}
public void readAllMsg(InsideCmsReadMsgReq req, Long personId, Long identityId) {
List<MessageRecord> list = this.lambdaQuery().and(i -> i.and(
a -> a.eq(MessageRecord::getPersonId, personId).eq(MessageRecord::getReceiveType,
ReceiveTypeEnum.NOT_IDENTITY)).or()
List<MessageRecord> list = this.lambdaQuery()
.and(nested -> nested.eq(MessageRecord::getPersonId, personId)
.or()
.eq(MessageRecord::getToId, identityId))
.eq(MessageRecord::getIsDelete, 0L)
.eq(MessageRecord::getType, MsgTypeEnum.GENERAL_MESSAGE)

View File

@ -0,0 +1,35 @@
package cn.axzo.msg.center.inside.notices.service;
import cn.axzo.msg.center.MsgCenterApplication;
import cn.axzo.msg.center.api.enums.BizTypeEnum;
import cn.axzo.msg.center.api.request.CmsReadMsgReq;
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.annotation.Commit;
import static org.junit.jupiter.api.Assertions.*;
/**
* @author yanglin
*/
@SpringBootTest(classes = MsgCenterApplication.class)
@RequiredArgsConstructor(onConstructor_ = @Autowired)
class MessageRecordServiceTest {
private final MessageRecordService messageRecordService;
@Test
@Commit
void foo() {
// CmsReadMsgReq(msgId=1790536, personId=9000399060, identityId=2004201, bizTypeEnum=CONSTRUCTION)
CmsReadMsgReq req = new CmsReadMsgReq();
req.setMsgId(1790536L);
req.setPersonId(9000399060L);
req.setPersonId(2004201L);
req.setBizTypeEnum(BizTypeEnum.CONSTRUCTION);
messageRecordService.updateReadMsgStatus(req);
}
}