package com.sckw.transport.repository;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sckw.transport.dao.KwtParkingChangeStrategyUnitMapper;
import com.sckw.transport.model.KwtParkingChargeStrategyUnit;
import org.springframework.stereotype.Repository;

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

/**
 * @Author: 门卫车辆订单
 * @CreateTime: 2025-10-12
 * @Description:
 * @Version: 1.0
 */

@Repository
public class KwtParkingChangeStrategyUnitRepository extends ServiceImpl<KwtParkingChangeStrategyUnitMapper, KwtParkingChargeStrategyUnit> {


    public List<KwtParkingChargeStrategyUnit> queryByStrategyId(Long id) {
        return list(
                Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
                        .eq(KwtParkingChargeStrategyUnit::getStrategyId, id)
                        .orderByDesc(KwtParkingChargeStrategyUnit::getId));
    }

    public void deleteByStrategyId(Long id) {
        remove(
                Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
                        .eq(KwtParkingChargeStrategyUnit::getStrategyId, id));
    }


    public void deleteByEntId(Set<Long> entIds) {
        remove(
                Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
                        .in(KwtParkingChargeStrategyUnit::getEntId, entIds));
    }


    public List<KwtParkingChargeStrategyUnit> queryByStrategyIdAndEnt(Long strategyId, List<Long> entId) {
        return list(
                Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
                        .ne(KwtParkingChargeStrategyUnit::getStrategyId, strategyId)
                        .in(KwtParkingChargeStrategyUnit::getEntId, entId)
                        .orderByDesc(KwtParkingChargeStrategyUnit::getId));
    }

    public List<KwtParkingChargeStrategyUnit> queryByEntIds(Set<Long> entId) {
        return list(
                Wrappers.<KwtParkingChargeStrategyUnit>lambdaQuery()
                        .in(KwtParkingChargeStrategyUnit::getEntId, entId)
                        .orderByDesc(KwtParkingChargeStrategyUnit::getId));
    }





}