package com.hzya.frame.seeyon.invoice.dao.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.hzya.frame.basedao.dao.MybatisGenericDao;
import com.hzya.frame.execsql.service.IExecSqlService;
import com.hzya.frame.mdm.mdmModuleSource.entity.MdmModuleSourceEntity;
import com.hzya.frame.seeyon.invoice.dao.IInvoiceDetailsDao;
import com.hzya.frame.seeyon.invoice.entity.InvoiceDetailsEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;

@Repository(value ="InvoiceDetailsDaoImpl")
public class InvoiceDetailsDaoImpl extends MybatisGenericDao<InvoiceDetailsEntity,String> implements IInvoiceDetailsDao {
    @Autowired
    private IExecSqlService execSqlService;

    private Logger logger = LogManager.getLogger(super.getClass());

    @DS("#entity.dataSourceCode")
    @Override
    public List<HashMap<String, Object>> queryInvoiceDetails(String str, MdmModuleSourceEntity entity) {
        try {
            List<HashMap<String, Object>> hashMaps = execSqlService.execSelectSql(str, "");
            return hashMaps;
        }catch (Exception e){
            logger.info("没有需要推送税务的明细数据");
            return null;
        }
    }
}
