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

@Mapper
public interface ElderlyAssessDepressionMapper extends BaseMapperX<ElderlyAssessDepressionDO> {

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