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

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.oa.IotOaNoticePageReqVO;
import cn.iocoder.yudao.server.dal.dataobject.OaNoticeDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * OA消息通知 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface OaNoticeMapper extends BaseMapperX<OaNoticeDO> {

    default PageResult<OaNoticeDO> selectPage(IotOaNoticePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<OaNoticeDO>()
                .eqIfPresent(OaNoticeDO::getOaCreator, reqVO.getOaCreator())
                .betweenIfPresent(OaNoticeDO::getOaCreateTime, reqVO.getOaCreateTime())
                .likeIfPresent(OaNoticeDO::getOaCreateName, reqVO.getOaCreateName())
                .eqIfPresent(OaNoticeDO::getTitle, reqVO.getTitle())
                .betweenIfPresent(OaNoticeDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(OaNoticeDO::getWorkCode, reqVO.getWorkCode())
                .eqIfPresent(OaNoticeDO::getCrmNoticeId, reqVO.getCrmNoticeId())
                .orderByDesc(OaNoticeDO::getId));
    }

}