use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class ApproveTaskDao method deleteApproveTaskByTaskIdAndType.
public int deleteApproveTaskByTaskIdAndType(Integer id, String taskType) throws SQLException {
FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
builder.setTemplate("DELETE FROM approve_task WHERE task_id=? AND task_type=?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "id", Types.INTEGER, id);
parameters.set(i++, "task_type", Types.VARCHAR, taskType);
DalHints hints = DalHints.createIfAbsent(null);
return queryDao.update(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.StatementParameters 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.StatementParameters in project dal by ctripcorp.
the class DalGroupDBDao method getAllDbAllinOneNames.
public List<String> getAllDbAllinOneNames() throws SQLException {
FreeSelectSqlBuilder<List<String>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT dbname FROM alldbs");
StatementParameters parameters = new StatementParameters();
builder.mapWith(dalGroupDBRowMapper).simpleType();
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
return queryDao.query(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalGroupDBDao method getGroupDBsByGroup.
public List<DalGroupDB> getGroupDBsByGroup(int groupId) throws SQLException {
FreeSelectSqlBuilder<List<DalGroupDB>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, dbname, comment,dal_group_id, db_address, db_port, db_user, db_password, db_catalog, db_providerName FROM alldbs WHERE dal_group_id=?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "dal_group_id", Types.INTEGER, groupId);
builder.mapWith(dalGroupDBRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
return queryDao.query(builder, parameters, hints);
}
use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DalGroupDBDao method getAllGroupDbs.
public List<DalGroupDB> getAllGroupDbs() throws SQLException {
FreeSelectSqlBuilder<List<DalGroupDB>> builder = new FreeSelectSqlBuilder<>(dbCategory);
StringBuilder sb = new StringBuilder();
sb.append("SELECT a.id,a.dbname,a.dal_group_id,a.db_address,a.db_port,a.db_user,a.db_password,a.db_catalog,a.db_providerName,b.group_name as comment ");
sb.append("FROM alldbs a LEFT JOIN dal_group b ON b.id = a.dal_group_id ");
builder.setTemplate(sb.toString());
StatementParameters parameters = new StatementParameters();
builder.mapWith(dalGroupDBRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
return queryDao.query(builder, parameters, hints);
}
Aggregations