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

@Mapper
public interface ElderlyAssessSuicideRiskMapper extends BaseMapperX<ElderlyAssessSuicideRiskDO> {

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