package com.dxhy.core.job.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dxhy.common.constant.DbConstant;
import com.dxhy.common.datasource.config.DynamicContextHolder;
import com.dxhy.core.job.dao.TDxViolationTaxnoDao;
import com.dxhy.core.job.entity.SysDept;
import com.dxhy.core.job.entity.TDxViolationTaxno;
import com.dxhy.core.job.service.ViolationTaxnoService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author user
 */
@Service
public class ViolationTaxnoServiceImpl extends ServiceImpl<TDxViolationTaxnoDao, TDxViolationTaxno>
    implements ViolationTaxnoService {
    @Override
    public List<SysDept> selectCompanyByViolationStatus() {
        DynamicContextHolder.push(DbConstant.BASICS_READ);
        return this.baseMapper.selectCompanyByViolationStatus();
    }

    @Override
    public List<String> selectTaxnoByCompany(String company) {
        DynamicContextHolder.push(DbConstant.BASICS_READ);
        return this.baseMapper.selectTaxnoByCompany(company);
    }

    @Override
    public List<TDxViolationTaxno> selectViolationTaxno(String company, String createDate, List<String> gfshList,
        String dbName) {
        DynamicContextHolder.push(dbName + DbConstant.BUSINESS_READ);
        return this.baseMapper.selectViolationTaxno(company, createDate, gfshList);
    }

    @Override
    public void insertTaxno(List<TDxViolationTaxno> taxnoList, String company) {
        this.baseMapper.deleteTaxno(company);
        this.saveBatch(taxnoList);
    }

    @Override
    public List<TDxViolationTaxno> selectViolationTaxnoByXf() {
        return this.baseMapper.selectViolationTaxnoByXf();
    }

}
