package cn.iocoder.yudao.server.dal.mysql;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.server.controller.admin.vo.crm.CrmNoticePageReqVO;
import cn.iocoder.yudao.server.dal.dataobject.CrmNoticeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * CRM消息通知 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface CrmNoticeMapper extends BaseMapperX<CrmNoticeDO> {

    default PageResult<CrmNoticeDO> selectPage(CrmNoticePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CrmNoticeDO>()
                .eqIfPresent(CrmNoticeDO::getSourceId, reqVO.getSourceId())
                .eqIfPresent(CrmNoticeDO::getTypeFlg, reqVO.getTypeFlg())
                .eqIfPresent(CrmNoticeDO::getTargetId, reqVO.getTargetId())
                .eqIfPresent(CrmNoticeDO::getOperateId, reqVO.getOperateId())
                .eqIfPresent(CrmNoticeDO::getNoticeType, reqVO.getNoticeType())
                .eqIfPresent(CrmNoticeDO::getContent, reqVO.getContent())
                .eqIfPresent(CrmNoticeDO::getContentMajor, reqVO.getContentMajor())
                .eqIfPresent(CrmNoticeDO::getCreatedAt, reqVO.getCreatedAt())
                .eqIfPresent(CrmNoticeDO::getAppType, reqVO.getAppType())
                .eqIfPresent(CrmNoticeDO::getBelongId, reqVO.getBelongId())
                .eqIfPresent(CrmNoticeDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(CrmNoticeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CrmNoticeDO::getId));
    }

}