package org.jeecg.modules.tax.xxgx.kpzdgl.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.tax.xxgx.kpzdgl.entity.CsXxKpzd;
import org.jeecg.modules.tax.xxgx.kpzdgl.mapper.CsXxKpzdMapper;
import org.jeecg.modules.tax.xxgx.kpzdgl.service.CsXxKpzdService;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@RequiredArgsConstructor
@Service
public class CsXxKpzdServiceImpl extends ServiceImpl<CsXxKpzdMapper, CsXxKpzd> implements CsXxKpzdService {

    @Override
    @DS(CommonConstant.DS_CWGX)
    public void syncData(CsXxKpzd kpzd) {
        List<CsXxKpzd> list = this.lambdaQuery()
                .eq(CsXxKpzd::getNsrsbh, kpzd.getNsrsbh())
                .list();
        for (CsXxKpzd item : list) {
            kpzd.setId(item.getId());
            this.updateById(kpzd);
        }
    }
}
