use of com.ctrip.platform.dal.daogen.entity.DatabaseSet in project dal by ctripcorp.
the class DaoOfDatabaseSet method getAllDatabaseSetByName.
public List<DatabaseSet> getAllDatabaseSetByName(String name) throws SQLException {
FreeSelectSqlBuilder<List<DatabaseSet>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, provider, shardingStrategy, groupId, update_user_no, update_time FROM databaseset WHERE name = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "name", Types.VARCHAR, name);
builder.mapWith(databaseSetRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<DatabaseSet> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.daogen.entity.DatabaseSet in project dal by ctripcorp.
the class DaoOfDatabaseSet method deleteDatabaseSetById.
public int deleteDatabaseSetById(Integer dbsetId) throws SQLException {
DatabaseSet dbset = new DatabaseSet();
dbset.setId(dbsetId);
DalHints hints = DalHints.createIfAbsent(null);
return client.delete(hints, dbset);
}
use of com.ctrip.platform.dal.daogen.entity.DatabaseSet in project dal by ctripcorp.
the class DaoOfDatabaseSet method getAllDatabaseSetByGroupId.
public List<DatabaseSet> getAllDatabaseSetByGroupId(Integer groupId) throws SQLException {
FreeSelectSqlBuilder<List<DatabaseSet>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, provider, shardingStrategy, groupId, update_user_no, update_time FROM databaseset WHERE groupId = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "groupId", Types.INTEGER, groupId);
builder.mapWith(databaseSetRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<DatabaseSet> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.daogen.entity.DatabaseSet in project dal by ctripcorp.
the class AbstractCSharpDataPreparer method addDatabaseSet.
protected void addDatabaseSet(CodeGenContext codeGenCtx, String databaseSetName) throws SQLException {
CSharpCodeGenContext ctx = (CSharpCodeGenContext) codeGenCtx;
List<DatabaseSet> sets = daoOfDatabaseSet.getAllDatabaseSetByName(databaseSetName);
if (null == sets || sets.isEmpty())
return;
DalConfigHost dalConfigHost = ctx.getDalConfigHost();
dalConfigHost.addDatabaseSet(sets);
for (DatabaseSet databaseSet : sets) {
List<DatabaseSetEntry> entries = daoOfDatabaseSet.getAllDatabaseSetEntryByDbsetid(databaseSet.getId());
if (null == entries || entries.isEmpty())
continue;
dalConfigHost.addDatabaseSetEntry(entries);
}
}
use of com.ctrip.platform.dal.daogen.entity.DatabaseSet in project dal by ctripcorp.
the class DaoOfDatabaseSet method getAllDatabaseSetById.
public DatabaseSet getAllDatabaseSetById(Integer id) throws SQLException {
DalHints hints = DalHints.createIfAbsent(null);
DatabaseSet databaseSet = client.queryByPk(id, hints);
processDatabaseSet(databaseSet);
return databaseSet;
}
Aggregations