package com.eactive.eai.rms.bap.loader.dao;

import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
import com.eactive.eai.rms.common.vo.SchemaIdVO;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;

@Repository("BapInterfaceDeployDao")
public class InterfaceDeployDao extends SqlMapClientTemplateDao {

    public <T extends SchemaIdVO> T selectDeploy(Map<String, Object> paramMap, Class<T> deployClass) {
        return (T) template.queryForObject("BapInterfaceDeploy.select" + deployClass.getSimpleName(), paramMap);
    }

    public <T extends SchemaIdVO> void deleteAllDeploy(Map<String, Object> paramMap, Class<T> deployClass) {
        template.delete("BapInterfaceDeploy.deleteAll" + deployClass.getSimpleName(), paramMap);
    }

    public <T extends SchemaIdVO> void insertDeploy(T deploy) {
        if (deploy == null) {
            logger.info("deploy object is null. skip progress");
            return;
        }
        template.insert("BapInterfaceDeploy.insert" + deploy.getClass().getSimpleName(), deploy);
    }

}
