package com.openhis.web.pharmacyWarehousemanage.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.pharmacyWarehousemanage.dto.PharmacyWarehouseDetailDto;
import com.openhis.web.pharmacyWarehousemanage.dto.PharmacyWarehouseDto;
import com.openhis.web.pharmacyWarehousemanage.dto.PharmacyWarehouseMedicationInfoDto;
import com.openhis.web.pharmacyWarehousemanage.dto.PharmacyWarehouseSearchParam;

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

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

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

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