Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
lifenlong committed Jun 29, 2021
2 parents fcfa140 + 707c4db commit d35eb29
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cn.lili.controller.member;

import cn.lili.common.enums.ResultUtil;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.PageVO;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.message.entity.enums.MessageStatusEnum;
Expand Down Expand Up @@ -34,21 +35,23 @@ public class MemberMessageBuyerController {
@ApiOperation(value = "分页获取会员站内消息")
@GetMapping
public ResultMessage<IPage<MemberMessage>> page(MemberMessageQueryVO memberMessageQueryVO, PageVO page) {
memberMessageQueryVO.setMemberId(UserContext.getCurrentUser().getId());
return ResultUtil.data(memberMessageService.getPage(memberMessageQueryVO, page));
}

@ApiOperation(value = "消息已读")
@ApiImplicitParam(name = "messageId", value = "会员消息id", required = true, paramType = "path")
@PutMapping
public ResultMessage<Boolean> read(@PathVariable String messageId) {
@PutMapping("/{message_id}")
public ResultMessage<Boolean> read(@PathVariable("message_id") String messageId) {
return ResultUtil.data(memberMessageService.editStatus(MessageStatusEnum.ALREADY_READY.name(), messageId));
}

@ApiOperation(value = "消息删除")
@ApiOperation(value = "消息放入回收站")
@ApiImplicitParam(name = "messageId", value = "会员消息id", required = true, paramType = "path")
@DeleteMapping
public ResultMessage<Boolean> deleteMessage(@PathVariable String messageId) {
return ResultUtil.data(memberMessageService.deleteMessage(messageId));
@DeleteMapping("/{message_id}")
public ResultMessage<Boolean> deleteMessage(@PathVariable("message_id") String messageId) {
return ResultUtil.data(memberMessageService.editStatus(MessageStatusEnum.ALREADY_REMOVE.name(), messageId));

}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private void saveMemberMessage(Message message) {
Integer memberNum = memberService.getMemberNum(memberSearchVO);
//构建分页查询参数
//100条查一次
Integer pageSize = 200;
Integer pageSize = 100;
Integer pageCount = 0;
pageCount = memberNum / pageSize;
pageCount = memberNum % pageSize > 0 ? pageCount + 1 : pageCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class MemberMessage extends BaseEntity {
/**
* @see MessageStatusEnum
*/
@ApiModelProperty(value = "状态 0默认未读 1已读 2回收站")
@ApiModelProperty(value = "状态")
private String status = MessageStatusEnum.UN_READY.name();

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ public class MemberMessageServiceImpl extends ServiceImpl<MemberMessageMapper, M
public IPage<MemberMessage> getPage(MemberMessageQueryVO memberMessageQueryVO, PageVO pageVO) {
QueryWrapper<MemberMessage> queryWrapper = new QueryWrapper<>();
//消息id
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId());
queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getMessageId()), "message_id", memberMessageQueryVO.getMessageId());
//消息标题
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getTitle()), "title", memberMessageQueryVO.getTitle());
//会员id
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getMemberId()), "member_id", memberMessageQueryVO.getMemberId());
queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getMemberId()), "member_id", memberMessageQueryVO.getMemberId());
//消息状态
queryWrapper.like(StringUtils.isNotEmpty(memberMessageQueryVO.getStatus()), "status", memberMessageQueryVO.getStatus());
queryWrapper.eq(StringUtils.isNotEmpty(memberMessageQueryVO.getStatus()), "status", memberMessageQueryVO.getStatus());
//倒序
queryWrapper.orderByDesc("create_time");
//构建查询
return this.page(PageUtil.initPage(pageVO), queryWrapper);
}
Expand Down

0 comments on commit d35eb29

Please sign in to comment.