use of com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder in project dal by ctripcorp.
the class DaoOfDatabaseSet method getAllDatabaseSetByGroupIdAndModeType.
public List<DatabaseSet> getAllDatabaseSetByGroupIdAndModeType(Integer groupId, String modeType) throws SQLException {
FreeSelectSqlBuilder<List<DatabaseSet>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, provider, shardingStrategy, groupId, update_user_no, update_time, mode_type FROM databaseset WHERE groupId = ? and mode_type = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "groupId", Types.INTEGER, groupId);
parameters.set(i++, "mode_type", Types.VARCHAR, modeType);
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.dao.sqlbuilder.FreeSelectSqlBuilder in project dal by ctripcorp.
the class DaoOfProject method getProjectByConfigname.
public List<Project> getProjectByConfigname(String dal_config_name) throws SQLException {
FreeSelectSqlBuilder<List<Project>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, namespace,dal_group_id,dal_config_name,update_user_no,update_time FROM project WHERE dal_config_name = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "dal_config_name", Types.VARCHAR, dal_config_name);
builder.mapWith(projectRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<Project> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder in project dal by ctripcorp.
the class DaoOfProject method getProjectByGroupId.
public List<Project> getProjectByGroupId(int groupId) throws SQLException {
FreeSelectSqlBuilder<List<Project>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, namespace,dal_group_id,dal_config_name,update_user_no,update_time FROM project WHERE dal_group_id = ? order by id desc");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "dal_group_id", Types.INTEGER, groupId);
builder.mapWith(projectRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<Project> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder in project dal by ctripcorp.
the class ApproveTaskDao method getAllApproveTaskByApproverId.
public List<ApproveTask> getAllApproveTaskByApproverId(Integer approverId) throws SQLException {
FreeSelectSqlBuilder<List<ApproveTask>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, task_id, task_type, create_time, create_user_id, approve_user_id FROM approve_task WHERE approve_user_id=?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "approve_user_id", Types.INTEGER, approverId);
builder.mapWith(approveTaskRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<ApproveTask> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder in project dal by ctripcorp.
the class DalGroupDBDao method getDbAllinOneNamesByModeType.
public List<String> getDbAllinOneNamesByModeType(String modeType) throws SQLException {
FreeSelectSqlBuilder<List<String>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT dbname FROM alldbs where mode_type = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "mode_type", Types.VARCHAR, modeType);
builder.mapWith(dalGroupDBRowMapper).simpleType();
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
return queryDao.query(builder, parameters, hints);
}
Aggregations