
com.gitee.qdbp.jdbc.biz.QdbcBootImpl Maven / Gradle / Ivy
package com.gitee.qdbp.jdbc.biz;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcOperations;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import com.gitee.qdbp.jdbc.api.QdbcBoot;
import com.gitee.qdbp.jdbc.api.SqlBufferJdbcOperations;
import com.gitee.qdbp.jdbc.plugins.DbPluginContainer;
/**
* 基础增删改查对象的构造器
*
* @author 赵卉华
* @version 190601
*/
public class QdbcBootImpl extends QdbcBaseImpl implements QdbcBoot {
public QdbcBootImpl(SqlBufferJdbcOperations sqlJdbc) {
super(sqlJdbc);
}
/**
* 根据数据库构造QdbcBoot
*
* @param datasource 数据源
* @param plugins 插件容器
* @return QdbcBoot
* @since 3.1.1
*/
public static QdbcBootImpl buildWith(DataSource datasource, DbPluginContainer plugins) {
JdbcTemplate jdbcOperations = new JdbcTemplate(datasource);
return buildWith(jdbcOperations, plugins);
}
/**
* 根据JdbcOperations构造QdbcBoot
*
* @param jdbcOperations JdbcOperations
* @param plugins 插件容器
* @return QdbcBoot
* @since 3.1.1
*/
public static QdbcBootImpl buildWith(JdbcOperations jdbcOperations, DbPluginContainer plugins) {
NamedParameterJdbcOperations operations = new NamedParameterJdbcTemplate(jdbcOperations);
return buildWith(operations, plugins);
}
/**
* 根据JdbcOperations构造QdbcBoot
*
* @param jdbcOperations NamedParameterJdbcOperations
* @param plugins 插件容器
* @return QdbcBoot
* @since 3.1.1
*/
public static QdbcBootImpl buildWith(NamedParameterJdbcOperations jdbcOperations, DbPluginContainer plugins) {
SqlBufferJdbcOperations options = new SqlBufferJdbcTemplate(jdbcOperations, plugins);
return new QdbcBootImpl(options);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy