package com.hxhq.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hxhq.domain.Sj;
import com.hxhq.domain.Yq;
import com.hxhq.mapper.SjMapper;
import com.hxhq.mapper.YqMapper;
import com.hxhq.service.SjService;
import com.hxhq.service.YqService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

/**
 * @author zhangjing
 * @date 2026/01/28 15:50
 * @description
 */
@Service
public class YqServiceImpl extends ServiceImpl<YqMapper, Yq> implements YqService {

    @DS("hxhq")
    @Override
    public void saveList(List<Yq> yqList) {
        saveYqList(yqList);
    }

    @DS("hxhq")
    @Override
    public List<Yq> listByBh(Set<String> incomingBhSet) {
        LambdaQueryWrapper<Yq> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.in(Yq::getBh, incomingBhSet);
        return list(queryWrapper);
    }
    @DS("hxhq")
    @Override
    public void updateList(List<Yq> recordsToUpdate) {
        updateBatchById(recordsToUpdate);
    }


    @Transactional
    public void saveYqList(List<Yq> yqList) {
        this.saveBatch(yqList);
    }
}
