package com.gree.mall.manager.commonmapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gree.mall.manager.bean.engin.EnginPayManageGatherVO;
import com.gree.mall.manager.bean.engin.EnginPayManageVO;
import com.gree.mall.manager.bean.material.base.*;
import com.gree.mall.manager.bean.material.manage.*;
import com.gree.mall.manager.bean.material.report.*;
import com.gree.mall.manager.bean.material.stock.WebsitSalesCategoryVO;
import com.gree.mall.manager.bean.material.stock.WebsitSalesGoodsVO;
import com.gree.mall.manager.bean.material.vender.WebsitPurchaseCheckVO;
import com.gree.mall.manager.bean.material.vender.WebsitVenderGoodsRelaVO;
import com.gree.mall.manager.bean.material.vender.WebsitVenderGoodsVO;
import com.gree.mall.manager.bean.material.vender.WebsitVenderVO;
import com.gree.mall.manager.bean.material.worker.NewRefundManageVO;
import com.gree.mall.manager.bean.material.worker.OldRefundManageRecordBean;
import com.gree.mall.manager.bean.material.worker.OldRefundManageVO;
import com.gree.mall.manager.zfire.bean.PartsParamBean;
import com.gree.mall.manager.zfire.bean.WebsitGoodsParamBean;
import com.gree.mall.manager.zfire.bean.ZfireParamBean;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MaterialMapper {

    /**
     * 配件基础
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<PartsBaseVO> partsBasePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 辅材分类
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<MaterialCategoryVO> materialCategoryPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 辅材列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitGoodsMVO> mPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 配件列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitGoodsPVO> pPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 师傅辅材列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WorkerGoodsVO> workGoodsPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点商品价格列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitGoodsPriceVO> websitGoodsPricePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点商品调价列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPriceUpdVO> websitPriceUpdPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 采购入库列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPurchaseVO> websitPurchasePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 采购退货列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPurchaseRetVO> websitPurchaseRetPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 供应商列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitVenderVO> websitVenderPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 收费标准列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitNormChargeVO> websitNormChargePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 销售订单列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitSalesVO> websitSalesPage(Page page,
                                         @Param("ex") ZfireParamBean zfireParamBean,
                                         @Param("goodsName") String goodsName,
                                         @Param("goodsSpecification") String goodsSpecification,
                                         @Param("isFilter") Boolean isFilter);

    /**
     * 根据存在的库存查询分类
     * @param companyWechatId
     * @param websitId
     * @return
     */
    List<WebsitSalesCategoryVO> existStockCategory(@Param("companyWechatId") String companyWechatId,
                                                   @Param("websitId") String websitId,
                                                   @Param("storageId") String storageId);

    /**
     * 根据存在的库存查询商品
     * @param companyWechatId
     * @param websitId
     * @param goodsType
     * @param categoryId
     * @param goodsName
     * @param goodsSpecification
     * @param partType
     * @return
     */
    List<WebsitSalesGoodsVO> existStockGoods(@Param("companyWechatId") String companyWechatId,
                                             @Param("websitId") String websitId,
                                             @Param("goodsType") String goodsType,
                                             @Param("categoryId") String categoryId,
                                             @Param("goodsName") String goodsName,
                                             @Param("goodsSpecification") String goodsSpecification,
                                             @Param("partType") String partType,
                                             @Param("storageId") String storageId);

    /**
     * 查询配件
     * @param companyWechatId
     * @param websitId
     * @param goodsType
     * @param goodsName
     * @return
     */
    List<WebsitSalesGoodsVO> notStockGoods(@Param("companyWechatId") String companyWechatId,
                                             @Param("websitId") String websitId,
                                             @Param("goodsType") String goodsType,
                                             @Param("goodsName") String goodsName);

    /**
     * 交易列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitTradeVO> websitTradePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 工程开单辅材列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitGoodsAloneMVO> mAlonePage(Page page, @Param("ex") WebsitGoodsParamBean zfireParamBean);

    /**
     * 工程开单配件列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitGoodsAlonePVO> pAlonePage(Page page, @Param("ex") WebsitGoodsParamBean zfireParamBean);

    /**
     * 工程收款管理列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<EnginPayManageVO> enginPayManageList(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 工程收款管理汇总列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<EnginPayManageGatherVO> enginPayManageGatherList(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    List<EnginPayManageGatherVO> enginPayManageGatherLastUpdate(@Param("companyWechatId") String companyWechatId, @Param("projectList") List<String> projectList);

    List<WorkerGoodsRelaExportBean> exportWorkerMaterialRela(@Param("companyWechatId") String companyWechatId);

    /**
     * 供应商供应商品列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitVenderGoodsVO> websitVenderGoodsPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 供应商商品关系列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitVenderGoodsRelaVO> websitVenderGoodsRalaPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点申请单列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPurchaseApplyVO> websitPurchaseApplyPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 核实采购列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPurchaseCheckVO> websitPurchaseCheckPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 采购订单列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPurchaseOrderVO> websitPurchaseOrderPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 采购调整单列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPurchaseAdjustmentVO> websitPurchaseAdjustmentPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 配件入库列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsNewInVO> websitPartsNewInPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 旧配件出库列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsOldOutVO> websitPartsOldOutPage(Page page, @Param("ex") PartsParamBean zfireParamBean);

    /**
     * 网点师傅结算记录列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitWorkSettlementVO> websitWorkSettlementPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点配件配置列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsConfigVO> websitPartsConfigPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点销售单列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsSalesVO> websitPartsSalesPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点销售单列表(网点查看)
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsSalesWVO> websitPartsSalesWPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 根据配件销售单id查询配件明细
     * @param id
     * @return
     */
    List<WebsitPartsSalesItemBean> selectItemBySalesOrderId(@Param("id") String id);

    List<OldRefundManageRecordBean> queryOldRefundRecordById(@Param("id") String id);

    /**
     * 新件返还列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<NewRefundManageVO> newRefundManagePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 旧件返还列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<OldRefundManageVO> oldRefundManagePage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 新件转销列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsChangeSalesVO> websitPurchaseChangeSalesPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    void updateItemPushFlag(@Param("id") String id, @Param("pushFlag") String pushFlag);

    /**
     * 退款记录列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsRefundRecordVO> websitPartsRefundRecordPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 按师傅手机号汇总辅材销售单
     * @param companyWechatId
     * @param startDate
     * @param endDate
     * @param websits
     * @param websitId
     * @param workerMobile
     * @param workerId
     * @param workerName
     * @return
     */
    List<MaterialSalesSumBean> workerBuySum(@Param("companyWechatId") String companyWechatId,
                                            @Param("startTime") String startDate,
                                            @Param("endTime") String endDate,
                                            @Param("websits") List<String> websits,
                                            @Param("websitId") String websitId,
                                            @Param("workerMobile") String workerMobile,
                                            @Param("workerId") String workerId,
                                            @Param("workerName") String workerName);

    /**
     * 根据手机号和时间获取销售单明细
     * @param companyWechatId
     * @param startDate
     * @param endDate
     * @param websits
     * @param websitId
     * @param workerMobile
     * @return
     */
    List<MaterialSalesSumDetailBean> workerBuyDetail(@Param("companyWechatId") String companyWechatId,
                                                        @Param("startTime") String startDate,
                                                        @Param("endTime") String endDate,
                                                        @Param("websits") List<String> websits,
                                                        @Param("websitId") String websitId,
                                                        @Param("workerMobile") String workerMobile);

    /**
     * 按师傅手机号汇总销售明细
     * @param companyWechatId
     * @param startDate
     * @param endDate
     * @param websits
     * @param websitId
     * @param workerMobile
     * @param workerId
     * @param workerName
     * @return
     */
    List<MaterialSalesSumDetailBean> workerBuySumDetail(@Param("companyWechatId") String companyWechatId,
                                                        @Param("startTime") String startDate,
                                                        @Param("endTime") String endDate,
                                                        @Param("websits") List<String> websits,
                                                        @Param("websitId") String websitId,
                                                        @Param("workerMobile") String workerMobile,
                                                        @Param("workerId") String workerId,
                                                        @Param("workerName") String workerName);

    /**
     * 汇总销售明细
     * @param companyWechatId
     * @param startDate
     * @param endDate
     * @param websits
     * @param websitId
     * @param workerMobile
     * @param workerId
     * @param workerName
     * @return
     */
    List<MaterialSalesSumDetailBean> sumBuyDetail(@Param("companyWechatId") String companyWechatId,
                                                  @Param("startTime") String startDate,
                                                  @Param("endTime") String endDate,
                                                  @Param("websits") List<String> websits,
                                                  @Param("websitId") String websitId,
                                                  @Param("workerMobile") String workerMobile,
                                                  @Param("workerId") String workerId,
                                                  @Param("workerName") String workerName);

    /**
     * 采购商品汇总
     * @param companyWechatId
     * @param startTime
     * @param endTime
     * @param websits
     * @param websitId
     * @param isSum
     * @return
     */
    List<PurchaseDetailBean> purchaseGoodsSum(@Param("companyWechatId") String companyWechatId,
                                              @Param("startTime") String startTime,
                                              @Param("endTime") String endTime,
                                              @Param("websits") List<String> websits,
                                              @Param("websitId") String websitId,
                                              @Param("isSum") boolean isSum);

    /**
     * 查询网点采购汇总数据
     * @param companyWechatId
     * @param websits
     * @param websitId
     * @param startDate
     * @param endDate
     * @return
     */
    List<PurchaseCategoryBean> getMonthSummaryData(@Param("companyWechatId") String companyWechatId,
                                                   @Param("websits") List<String> websits,
                                                   @Param("websitId") String websitId,
                                                   @Param("startDate") String startDate,
                                                   @Param("endDate") String endDate);

    /**
     * 查询网点上个月结存金额
     * @param companyWechatId
     * @param websits
     * @param websitId
     * @param startDate
     * @return
     */
    List<WebsiteStockValSumBean> getLastMonthStockSumVal(@Param("companyWechatId") String companyWechatId,
                                                         @Param("websits") List<String> websits,
                                                         @Param("websitId") String websitId,
                                                         @Param("startDate") String startDate);

    List<WorkerPurchaseCategoryBean> getWorkerMonthSummaryData(@Param("companyWechatId") String companyWechatId,
                                                               @Param("startDate") String startDate,
                                                               @Param("endDate") String endDate);

    /**
     * 网点汇总记账列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsCreditVO> websitPartsCreditPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);

    /**
     * 网点记账列表
     * @param page
     * @param zfireParamBean
     * @return
     */
    IPage<WebsitPartsCreditItemVO> websitPartsCreditItemPage(Page page, @Param("ex") ZfireParamBean zfireParamBean);
}
