package com.hzya.frame.seeyon.zxbank.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.zxbank.dao.IZxBankDao;
import com.hzya.frame.seeyon.zxbank.entity.ZxBankEntity;
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 = "ZxBankDaoImpl")
public class ZxBankDaoImpl extends MybatisGenericDao<ZxBankEntity,String> implements IZxBankDao {

    @Autowired
    private IExecSqlService execSqlService;

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

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

    @DS("#entity.dataSourceCode")
    @Override
    public Integer updatePushStatusZX(ZxBankEntity entity) {
        return super.update("updatePushStatusZX",entity);
    }

    @DS("#entity.dataSourceCode")
    @Override
    public List<ZxBankEntity> queryResultIsNullZX(ZxBankEntity entity) {
        return super.queryList(entity,"queryResultIsNullZX");
    }

    @DS("#entity.dataSourceCode")
    @Override
    public Integer updateResultStatus(ZxBankEntity entity) {
        return super.update("updateResultStatus",entity);
    }

    @DS("#entity.dataSourceCode")
    @Override
    public List<ZxBankEntity> queryElecIsNullZX(ZxBankEntity entity) {
        return super.queryList(entity,"queryElecIsNullZX");
    }

    @DS("#entity.dataSourceCode")
    @Override
    public Integer updateElecStatusZX(ZxBankEntity entity) {
        return super.update("updateElecStatusZX",entity);
    }
}
