package com.xindazhou.business.dal.mysql.message;

import com.xindazhou.framework.common.pojo.PageResult;
import com.xindazhou.framework.mybatis.core.mapper.BaseMapperX;
import com.xindazhou.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xindazhou.business.controller.admin.message.vo.ServiceMessagePageReqVO;
import com.xindazhou.business.dal.dataobject.message.ServiceMessageDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface ServiceMessageMapper extends BaseMapperX<ServiceMessageDO> {

    default PageResult<ServiceMessageDO> selectPage(ServiceMessagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ServiceMessageDO>()
                .likeIfPresent(ServiceMessageDO::getTitle, reqVO.getTitle())
                .eqIfPresent(ServiceMessageDO::getMessageType, reqVO.getMessageType())
                .eqIfPresent(ServiceMessageDO::getStatus, reqVO.getStatus())
                .orderByDesc(ServiceMessageDO::getCreateTime));
    }

}

