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

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.biz.vo.TrainingRecordsPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.TrainingRecordsDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 康复训练记录 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface TrainingRecordsMapper extends BaseMapperX<TrainingRecordsDO> {

    default PageResult<TrainingRecordsDO> selectPage(TrainingRecordsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<TrainingRecordsDO>()
                .eqIfPresent(TrainingRecordsDO::getElderId, reqVO.getElderId())
                .betweenIfPresent(TrainingRecordsDO::getTrainingTime, reqVO.getTrainingTime())
                .eqIfPresent(TrainingRecordsDO::getTherapist, reqVO.getTherapist())
                .eqIfPresent(TrainingRecordsDO::getRecordContent, reqVO.getRecordContent())
                .eqIfPresent(TrainingRecordsDO::getTenantId,reqVO.getTenantId())
                .likeIfPresent(TrainingRecordsDO::getElderName,reqVO.getElderName())
                .orderByDesc(TrainingRecordsDO::getCreateTime));
    }

}