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

@Mapper
public interface ElderlyAssessSimpleMentalStateMapper extends BaseMapperX<ElderlyAssessSimpleMentalStateDO> {

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