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

/**
 * 长者照护计划 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface ElderlyCareServiceRecordMapper extends BaseMapperX<ElderlyCareServiceRecordDO> {

    default PageResult<ElderlyCareServiceRecordDO> selectPage(ElderlyCareServiceRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ElderlyCareServiceRecordDO>()
                .likeIfPresent(ElderlyCareServiceRecordDO::getElderName, reqVO.getElderName())
                .betweenIfPresent(ElderlyCareServiceRecordDO::getRecordTime, reqVO.getRecordTime())
                .eqIfPresent(ElderlyCareServiceRecordDO::getElderId, reqVO.getElderId())
                .eqIfPresent(ElderlyCareServiceRecordDO::getType, reqVO.getType())
                .eqIfPresent(ElderlyCareServiceRecordDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(ElderlyCareServiceRecordDO::getId));
    }
}
