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.api.bpm.vo.ElderlyRetreatRecordPageReqApiVO;
import cn.iocoder.yudao.module.system.api.bpm.vo.ElderlyRetreatRecordRespVO;
import cn.iocoder.yudao.module.system.controller.admin.biz.vo.RetreatPrintRespVO;
import cn.iocoder.yudao.module.system.dal.dataobject.biz.ElderlyRetreatRecordDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author: jinyd
 * @CreateTime: 2024/8/13  9:24
 * @Description:
 * @Version: 4.0
 */

@Mapper
public interface ElderlyRetreatRecordMapper extends BaseMapperX<ElderlyRetreatRecordDO> {

    default PageResult<ElderlyRetreatRecordDO> selectPage(ElderlyRetreatRecordPageReqApiVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<ElderlyRetreatRecordDO>()
                .eqIfPresent(ElderlyRetreatRecordDO::getElderlyId, reqVO.getElderlyId())
                .betweenIfPresent(ElderlyRetreatRecordDO::getRetreatDate, reqVO.getRetreatDate())
                .betweenIfPresent(ElderlyRetreatRecordDO::getCostDeadlineDate, reqVO.getCostDeadlineDate())
                .eqIfPresent(ElderlyRetreatRecordDO::getReason, reqVO.getReason())
                .eqIfPresent(ElderlyRetreatRecordDO::getDescription, reqVO.getDescription())
                .eqIfPresent(ElderlyRetreatRecordDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(ElderlyRetreatRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(ElderlyRetreatRecordDO::getId));
    }

    List<ElderlyRetreatRecordRespVO> selectListPage(Page<ElderlyRetreatRecordRespVO> page,
                                                    @Param("pageVO") ElderlyRetreatRecordPageReqApiVO pageReqVO);

    RetreatPrintRespVO selectPrintById(Long id);

}
