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

@Mapper
public interface ElderlyAssessPsychologySocialMapper extends BaseMapperX<ElderlyAssessPsychologySocialDO> {

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