package com.fjhx.purchase.mapper;

import com.fjhx.entity.purchase.PurchaseContract;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springblade.core.tenant.annotation.TenantIgnore;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 采购合同 Mapper 接口
 * </p>
 *
 * @author ${author}
 * @since 2022-07-14
 */
public interface PurchaseContractMapper extends BaseMapper<PurchaseContract> {

    /**
     * 根据物料编码查询最新得面料
     * @param materialCode
     * @return
     */
    @TenantIgnore
    PurchaseContract getNewDataByMaterialCode(String materialCode);

    /**
     * 合同历史付款记录
     * @return
     */
    @TenantIgnore
    List<Map<String,Object>> historyPayList();

    /**
     * 历史付款列表
     * @param condition
     * @return
     */
    @TenantIgnore
    List<PurchaseContract> getPayList(Map<String,Object> condition);

    /**
     * 历史付款列表-条数
     * @param condition
     * @return
     */
    @TenantIgnore
    Integer getPayListCount(Map<String,Object> condition);

    /**
     * 统计供应商总付款金额
     * @param condition
     * @return
     */
    @TenantIgnore
    List<Map<String,Object>> getPayGroupBySu(Map<String,Object> condition);

    /**
     * 获取总金额
     * @param date
     * @return
     */
    @TenantIgnore
    BigDecimal getSumMoney(@Param("date")String date);
}
