package com.njcn.prepare.harmonic.service.mysql.Impl.day;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import com.njcn.harmonic.pojo.po.day.RStatLimitRateDPO;
import com.njcn.prepare.harmonic.mapper.mysql.day.RStatLimitRateDMapper;
import com.njcn.prepare.harmonic.service.mysql.day.IRStatLimitRateDService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 类的介绍：
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2023/3/24 9:53
 */
@Service
public class RStatLimitRateDServiceImpl extends MppServiceImpl<RStatLimitRateDMapper, RStatLimitRateDPO> implements IRStatLimitRateDService {

    @Override
    public void insert(List<RStatLimitRateDPO> list) {
        this.saveOrUpdateBatchByMultiId(list,50);
    }

    @Override
    public List<RStatLimitRateDPO> findList(List<String> list,String startTime,String endTime) {
        LambdaQueryWrapper<RStatLimitRateDPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.in(CollUtil.isNotEmpty(list),RStatLimitRateDPO::getLineId,list)
                .ge(RStatLimitRateDPO::getTime,startTime)
                .le(RStatLimitRateDPO::getTime,endTime)
                .eq(RStatLimitRateDPO::getPhasicType,"T");
        return this.list(lambdaQueryWrapper);
    }
}
