Search in sources :

Example 1 with DatabaseSet

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;
}
Also used : FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) DalHints(com.ctrip.platform.dal.dao.DalHints) DatabaseSet(com.ctrip.platform.dal.daogen.entity.DatabaseSet) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters) List(java.util.List)

Example 2 with DatabaseSet

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);
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) DatabaseSet(com.ctrip.platform.dal.daogen.entity.DatabaseSet)

Example 3 with DatabaseSet

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;
}
Also used : FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) DalHints(com.ctrip.platform.dal.dao.DalHints) DatabaseSet(com.ctrip.platform.dal.daogen.entity.DatabaseSet) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters) List(java.util.List)

Example 4 with DatabaseSet

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);
    }
}
Also used : DaoOfDatabaseSet(com.ctrip.platform.dal.daogen.dao.DaoOfDatabaseSet) DatabaseSet(com.ctrip.platform.dal.daogen.entity.DatabaseSet) CSharpCodeGenContext(com.ctrip.platform.dal.daogen.generator.csharp.CSharpCodeGenContext) DalConfigHost(com.ctrip.platform.dal.daogen.host.DalConfigHost) DatabaseSetEntry(com.ctrip.platform.dal.daogen.entity.DatabaseSetEntry)

Example 5 with DatabaseSet

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;
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) DatabaseSet(com.ctrip.platform.dal.daogen.entity.DatabaseSet)

Aggregations

DatabaseSet (com.ctrip.platform.dal.daogen.entity.DatabaseSet)5 DalHints (com.ctrip.platform.dal.dao.DalHints)4 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)2 FreeSelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder)2 List (java.util.List)2 DaoOfDatabaseSet (com.ctrip.platform.dal.daogen.dao.DaoOfDatabaseSet)1 DatabaseSetEntry (com.ctrip.platform.dal.daogen.entity.DatabaseSetEntry)1 CSharpCodeGenContext (com.ctrip.platform.dal.daogen.generator.csharp.CSharpCodeGenContext)1 DalConfigHost (com.ctrip.platform.dal.daogen.host.DalConfigHost)1