IntercomMessageServiceImpl.java 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package com.fdkankan.manage.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
  4. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  5. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  6. import com.fdkankan.manage.common.ResultCode;
  7. import com.fdkankan.manage.exception.BusinessException;
  8. import com.fdkankan.manage.common.PageInfo;
  9. import com.fdkankan.manage.entity.IntercomMessage;
  10. import com.fdkankan.manage.mapper.IIntercomMessageMapper;
  11. import com.fdkankan.manage.service.IIntercomMessageService;
  12. import com.fdkankan.manage.vo.request.IntercomMessageParam;
  13. import org.apache.commons.lang3.StringUtils;
  14. import org.springframework.stereotype.Service;
  15. /**
  16. * <p>
  17. * 咨询留言表 服务实现类
  18. * </p>
  19. *
  20. * @author
  21. * @since 2022-06-30
  22. */
  23. @Service
  24. public class IntercomMessageServiceImpl extends ServiceImpl<IIntercomMessageMapper, IntercomMessage> implements IIntercomMessageService {
  25. @Override
  26. public PageInfo pageList(IntercomMessageParam param) {
  27. LambdaQueryWrapper<IntercomMessage> wrapper = new LambdaQueryWrapper<>();
  28. if(StringUtils.isNotBlank(param.getContent())){
  29. wrapper.like(IntercomMessage::getContent,param.getContent());
  30. }
  31. if(StringUtils.isNotBlank(param.getStartTime())){
  32. wrapper.ge(IntercomMessage::getCreateTime,param.getStartTime());
  33. }
  34. if(StringUtils.isNotBlank(param.getEndTime())){
  35. wrapper.le(IntercomMessage::getCreateTime,param.getEndTime());
  36. }
  37. wrapper.eq(IntercomMessage::getState,param.getState());
  38. wrapper.orderByDesc(IntercomMessage::getCreateTime);
  39. return PageInfo.PageInfo(this.page(new Page<>(param.getPageNum(),param.getPageSize()),wrapper));
  40. }
  41. @Override
  42. public void handle(IntercomMessageParam param) {
  43. if(param.getId() == null){
  44. throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
  45. }
  46. LambdaUpdateWrapper<IntercomMessage> wrapper = new LambdaUpdateWrapper<>();
  47. wrapper.set(IntercomMessage::getState,0);
  48. if(StringUtils.isNotBlank(param.getNoteContent())){
  49. wrapper.set(IntercomMessage::getNoteContent,param.getNoteContent());
  50. }
  51. wrapper.eq(IntercomMessage::getId,param.getId());
  52. this.update(wrapper);
  53. }
  54. }