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


/**
 * 长者用药执行记录 Mapper
 *
 * @author 系统管理员
 */
@Mapper
public interface MedicationExecutionMapper extends BaseMapperX<MedicationExecutionDO> {

    default PageResult<MedicationExecutionDO> selectPage(MedicationExecutionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MedicationExecutionDO>()
                .likeIfPresent(MedicationExecutionDO::getDrugName, reqVO.getDrugName())
                .eqIfPresent(MedicationExecutionDO::getExecutor, reqVO.getExecutor())
                .eqIfPresent(MedicationExecutionDO::getElderId,reqVO.getElderId())
                .betweenIfPresent(MedicationExecutionDO::getExecutionDate, reqVO.getExecutionDate())
                .orderByDesc(MedicationExecutionDO::getExecutionTime));
    }

}