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.module.system.controller.admin.biz.vo.riskdisclosurestatement.ElderlyRiskDisclosureStatementPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.riskdisclosurestatement.ElderlyRiskDisclosureStatementRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.ElderlyRiskDisclosureStatementDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface ElderlyRiskDisclosureStatementMapper extends BaseMapperX<ElderlyRiskDisclosureStatementDO> {

    List<ElderlyRiskDisclosureStatementRespVO> selectPageWithElderInfo(Page<ElderlyRiskDisclosureStatementRespVO> page,
                                                                      @Param("reqVO") ElderlyRiskDisclosureStatementPageReqVO reqVO);

    ElderlyRiskDisclosureStatementRespVO selectByIdWithElderInfo(@Param("id") Long id);

    default PageResult<ElderlyRiskDisclosureStatementRespVO> selectPageWithElderInfo(ElderlyRiskDisclosureStatementPageReqVO reqVO) {
        Page<ElderlyRiskDisclosureStatementRespVO> page = new Page<>(reqVO.getPageNo(), reqVO.getPageSize());
        List<ElderlyRiskDisclosureStatementRespVO> list = selectPageWithElderInfo(page, reqVO);
        return new PageResult<>(list, page.getTotal());
    }
}

