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

@Mapper
public interface ElderlyAssessAttackRiskFactorsMapper extends BaseMapperX<ElderlyAssessAttackRiskFactorsDO> {

    default PageResult<ElderlyAssessAttackRiskFactorsDO> selectPage(ElderlyAssessAttackRiskFactorsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ElderlyAssessAttackRiskFactorsDO>()
                .likeIfPresent(ElderlyAssessAttackRiskFactorsDO::getElderName, reqVO.getElderName())
                .likeIfPresent(ElderlyAssessAttackRiskFactorsDO::getAssessor, reqVO.getAssessor())
                .betweenIfPresent(ElderlyAssessAttackRiskFactorsDO::getAssessDate, reqVO.getAssessDate())
                .inIfPresent(ElderlyAssessAttackRiskFactorsDO::getTenantId, reqVO.getTenantIds())
                .orderByDesc(ElderlyAssessAttackRiskFactorsDO::getAssessDate, ElderlyAssessAttackRiskFactorsDO::getId));
    }
}
