package cn.iocoder.yudao.module.system.dal.mysql.evaluation;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.system.controller.admin.evaluation.vo.FoodSatisfactionSurveyPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.evaluation.FoodSatisfactionSurveyDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 膳食满意度调查 Mapper
 */
@Mapper
public interface FoodSatisfactionSurveyMapper extends BaseMapperX<FoodSatisfactionSurveyDO> {

    default PageResult<FoodSatisfactionSurveyDO> selectPage(FoodSatisfactionSurveyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FoodSatisfactionSurveyDO>()
                .eqIfPresent(FoodSatisfactionSurveyDO::getTenantId, reqVO.getTenantId())
                .eqIfPresent(FoodSatisfactionSurveyDO::getRole, reqVO.getRole())
                .betweenIfPresent(FoodSatisfactionSurveyDO::getRecordDate, reqVO.getRecordDate())
                .orderByDesc(FoodSatisfactionSurveyDO::getRecordDate)
                .orderByDesc(FoodSatisfactionSurveyDO::getId));
    }
}
