12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- package com.fdkankan.manage.service.impl;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
- import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
- import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
- import com.fdkankan.manage.common.ResultCode;
- import com.fdkankan.manage.exception.BusinessException;
- import com.fdkankan.manage.common.PageInfo;
- import com.fdkankan.manage.entity.IntercomMessage;
- import com.fdkankan.manage.mapper.IIntercomMessageMapper;
- import com.fdkankan.manage.service.IIntercomMessageService;
- import com.fdkankan.manage.vo.request.IntercomMessageParam;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.stereotype.Service;
- /**
- * <p>
- * 咨询留言表 服务实现类
- * </p>
- *
- * @author
- * @since 2022-06-30
- */
- @Service
- public class IntercomMessageServiceImpl extends ServiceImpl<IIntercomMessageMapper, IntercomMessage> implements IIntercomMessageService {
- @Override
- public PageInfo pageList(IntercomMessageParam param) {
- LambdaQueryWrapper<IntercomMessage> wrapper = new LambdaQueryWrapper<>();
- if(StringUtils.isNotBlank(param.getContent())){
- wrapper.like(IntercomMessage::getContent,param.getContent());
- }
- if(StringUtils.isNotBlank(param.getStartTime())){
- wrapper.ge(IntercomMessage::getCreateTime,param.getStartTime());
- }
- if(StringUtils.isNotBlank(param.getEndTime())){
- wrapper.le(IntercomMessage::getCreateTime,param.getEndTime());
- }
- wrapper.eq(IntercomMessage::getState,param.getState());
- wrapper.orderByDesc(IntercomMessage::getCreateTime);
- return PageInfo.PageInfo(this.page(new Page<>(param.getPageNum(),param.getPageSize()),wrapper));
- }
- @Override
- public void handle(IntercomMessageParam param) {
- if(param.getId() == null){
- throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
- }
- LambdaUpdateWrapper<IntercomMessage> wrapper = new LambdaUpdateWrapper<>();
- wrapper.set(IntercomMessage::getState,0);
- if(StringUtils.isNotBlank(param.getNoteContent())){
- wrapper.set(IntercomMessage::getNoteContent,param.getNoteContent());
- }
- wrapper.eq(IntercomMessage::getId,param.getId());
- this.update(wrapper);
- }
- }
|