package com.openhis.web.pharmacyDispensarymanage.mapper;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryDetailDto;
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryDto;
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensaryMedicationInfoDto;
import com.openhis.web.pharmacyDispensarymanage.dto.PharmacyDispensarySearchParam;

/**
 * 药库共通 mapper
 *
 * @author yuxj
 * @date 2025-07-22
 */
@Repository
public interface PharmacyDispensaryCommonMapper {
    /**
     * 根据供应商获取药品
     *
     * @param page 分页
     * @param queryWrapper 查询条件
     * @param locationId 仓库id
     * @return 药品信息
     */

    Page<PharmacyDispensaryMedicationInfoDto> getMedicationInfo(
        @Param("page") Page<PharmacyDispensaryMedicationInfoDto> page,
        @Param(Constants.WRAPPER) QueryWrapper<PharmacyDispensarySearchParam> queryWrapper,
        @Param("locationId") Long locationId, @Param("supplierId") Long supplierId);

    /**
     * 查询订货单分页列表
     *
     * @param page 分页
     * @param queryWrapper 查询条件
     * @param originalBusNoFlg 再生成单据号flg
     * @param locationFlg 仓库flg
     * @return 订货单分页列表
     */
    Page<PharmacyDispensaryDto> getPage(@Param("page") Page<PharmacyDispensaryDto> page,
        @Param(Constants.WRAPPER) QueryWrapper<PharmacyDispensarySearchParam> queryWrapper,
        @Param("originalBusNoFlg") String originalBusNoFlg, @Param("locationFlg") String locationFlg);

    /**
     * 查询单据详情
     *
     * @param page 分页
     * @param busNo 单据号
     * @return 单据详情
     */
    Page<PharmacyDispensaryDetailDto> getDetailPage(@Param("page") Page<PharmacyDispensaryDetailDto> page,
        @Param("busNo") String busNo);
}
