package com.sckw.contract.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sckw.contract.dao.KwcContractTradeGoodsMapper;
import com.sckw.contract.model.entity.KwcContractTradeGoods;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Set;

/**
 * @author :chenXiaoFei
 * @version :1.0
 * @description :贸易合同接口
 * @create :2025-11-04 09:52:00
 */
@Repository
public class KwcContractTradeGoodsRepository extends ServiceImpl<KwcContractTradeGoodsMapper, KwcContractTradeGoods> {
    public List<KwcContractTradeGoods> queryByConTractIdGoodsIds(Long pid,List<Long> goodsIds) {
        return list(Wrappers.<KwcContractTradeGoods>lambdaQuery()
                .eq(KwcContractTradeGoods::getDelFlag,0)
                .eq(KwcContractTradeGoods::getContractId, pid)
                .in(KwcContractTradeGoods::getGoodsId, goodsIds));
    }

    public List<KwcContractTradeGoods> queryByContractIds(Set<Long> contractIds) {
        return list(Wrappers.<KwcContractTradeGoods>lambdaQuery()
                .eq(KwcContractTradeGoods::getDelFlag,0)
                .in(KwcContractTradeGoods::getContractId, contractIds));
    }

    public List<KwcContractTradeGoods> queryByConTractIdsGoodsIds(Set<Long> pids,List<Long> goodsIds) {
        return list(Wrappers.<KwcContractTradeGoods>lambdaQuery()
                .eq(KwcContractTradeGoods::getDelFlag,0)
                .in(KwcContractTradeGoods::getContractId, pids)
                .in(KwcContractTradeGoods::getGoodsId, goodsIds));
    }

    public List<KwcContractTradeGoods> queryByContractId(Long contractId) {
        return list(Wrappers.<KwcContractTradeGoods>lambdaQuery()
                .eq(KwcContractTradeGoods::getDelFlag,0)
                .eq(KwcContractTradeGoods::getContractId, contractId));
    }
}
