package com.sckw.contract.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sckw.contract.api.model.vo.TradeContractGoodsDto;
import com.sckw.contract.model.dto.req.QueryListReqDto;
import com.sckw.contract.model.dto.res.QueryContractValidCountResDto;
import com.sckw.contract.model.dto.res.QueryListResDto;
import com.sckw.contract.model.entity.KwcContractTrade;
import com.sckw.contract.model.vo.req.QueryListReqVo;
import com.sckw.contract.api.model.vo.ContractVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.time.LocalDateTime;
import java.util.List;

/**
 * @author PC
 * @description 针对表【kwc_contract_trade(交易合同（采购合同/销售合同）)】的数据库操作Mapper
 * @createDate 2023-07-13 13:36:19
 * @Entity com.sckw.contract.model.entity.KwcContractTrade
 */
@Mapper
public interface KwcContractTradeMapper extends BaseMapper<KwcContractTrade> {


    /**
     * @return QueryListResVo
     * @desc: 查询
     * @param: reqVo
     * @author: sky
     * @date 2023/7/17
     */
    List<QueryListResDto> queryList(QueryListReqDto reqVo);

    List<QueryListResDto> queryList1(QueryListReqDto reqVo);

    /**
     * @param entIdList 企业id
     * @return QueryContractValidCountResDto
     * @desc: 查各个类型的有效合同  贸易和物流写一起算了
     * @author: czh
     * @date: 2023/9/11
     */
    List<QueryContractValidCountResDto> queryContractValidCount(@Param(value = "list") List<Long> entIdList);

    /**
     * @param reqVo 查询
     * @return QueryListResDto
     * @desc: 运营端查贸易合同
     * @author: czh
     * @date: 2023/9/13
     */
    List<QueryListResDto> queryTradeList(@Param("reqVo") QueryListReqVo reqVo, @Param("authEntIdList") List<Long> authEntIdList);

    /**
     * 当前企业，当前商品，最新的签约价
     *
     * @param entId
     * @param goodsId
     * @return
     */
    TradeContractGoodsDto queryNewSignPrice(@Param("entId") Long entId, @Param("goodsId") Long goodsId, @Param("time") LocalDateTime time);

    List<Long> queryNewSignGoods(@Param("entId") Long entId, @Param("time") LocalDateTime time);

    List<Long> querySignTradeContract(@Param("entId") Long entId, @Param("time") LocalDateTime time);

    List<Long> selectByContract(@Param("contractId") Long contractId);

    Long count(@Param("ids") List<Long> ids);

    List<ContractVo> tradeList(@Param("ids") List<Long> ids, @Param("audit")Boolean audit, @Param("all") Boolean all);

    Long selectSignCount(@Param("entId")Long entId,@Param("type") Integer type);
}




