| | |
| | | import com.vci.ubcs.ddl.mapper.DllOracleMapper; |
| | | import com.vci.ubcs.ddl.mapper.DllSqlLiteMapper; |
| | | import com.vci.ubcs.starter.util.VciSpringUtil; |
| | | import org.springframework.beans.factory.InitializingBean; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | |
| | |
| | | * @author LiHang |
| | | * @date 2023/4/24 |
| | | */ |
| | | @Component |
| | | public class DllMapperProcessorStrategy { |
| | | |
| | | @Value("${spring.datasource.driver-class-name}") |
| | | private static final String DATABASE_DRIVER = ""; |
| | | private String DATABASE_DRIVER; |
| | | |
| | | public static List<DllMapperProcessor> processors = Lists.newArrayList(); |
| | | |
| | |
| | | processors.add(VciSpringUtil.getBean(DllSqlLiteMapperProcessor.class)); |
| | | processors.add(VciSpringUtil.getBean(DllMySqlMapperProcessor.class)); |
| | | processors.add(VciSpringUtil.getBean(DllOracleMapperProcessor.class)); |
| | | processors.add(VciSpringUtil.getBean(DllDmMapperProcessor.class)); |
| | | } |
| | | |
| | | public static DllMapperProcessor getProcessor(){ |
| | | @Bean("dllMapper") |
| | | public DllMapperProcessor getProcessor(){ |
| | | for (DllMapperProcessor processor : processors) { |
| | | if (processor.support(DATABASE_DRIVER)){ |
| | | System.out.println("==========================================="); |
| | | System.out.println("获取DLL操作类成功:" + processor.getClass().getName()); |
| | | return processor; |
| | | } |
| | | } |