use of com.ctrip.platform.dal.dao.StatementParameters in project dal by ctripcorp.
the class DaoByTableViewSp method updateTask.
public int updateTask(GenTaskByTableViewSp task) throws SQLException {
FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
StringBuilder sb = new StringBuilder();
sb.append("UPDATE task_table SET project_id=?,db_name=?,table_names=?,view_names=?,sp_names=?,");
sb.append("prefix=?,suffix=?,cud_by_sp=?,pagination=?,`generated`=?,version=version+1,");
sb.append("update_user_no=?,update_time=?,comment=?,sql_style=?,");
sb.append("api_list=?,approved=?,approveMsg=? ");
sb.append("WHERE id=? AND version=?");
builder.setTemplate(sb.toString());
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "project_id", Types.INTEGER, task.getProject_id());
parameters.set(i++, "db_name", Types.VARCHAR, task.getDatabaseSetName());
parameters.set(i++, "table_names", Types.LONGVARCHAR, task.getTable_names());
parameters.set(i++, "view_names", Types.LONGVARCHAR, task.getView_names());
parameters.set(i++, "sp_names", Types.LONGVARCHAR, task.getSp_names());
parameters.set(i++, "prefix", Types.VARCHAR, task.getPrefix());
parameters.set(i++, "suffix", Types.VARCHAR, task.getSuffix());
parameters.set(i++, "cud_by_sp", Types.BIT, task.getCud_by_sp());
parameters.set(i++, "pagination", Types.BIT, task.getPagination());
parameters.set(i++, "generated", Types.BIT, task.getGenerated());
parameters.set(i++, "update_user_no", Types.VARCHAR, task.getUpdate_user_no());
parameters.set(i++, "update_time", Types.TIMESTAMP, task.getUpdate_time());
parameters.set(i++, "comment", Types.LONGVARCHAR, task.getComment());
parameters.set(i++, "sql_style", Types.VARCHAR, task.getSql_style());
parameters.set(i++, "api_list", Types.LONGVARCHAR, task.getApi_list());
parameters.set(i++, "approved", Types.INTEGER, task.getApproved());
parameters.set(i++, "approveMsg", Types.LONGVARCHAR, task.getApproveMsg());
// parameters.set(i++, "length", Types.TINYINT, task.getLength());
parameters.set(i++, "id", Types.INTEGER, task.getId());
parameters.set(i++, "version", Types.INTEGER, task.getVersion());
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 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.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfDatabaseSet method getAllDatabaseSetEntryByDbsetid.
public List<DatabaseSetEntry> getAllDatabaseSetEntryByDbsetid(Integer databaseSet_Id) throws SQLException {
FreeSelectSqlBuilder<List<DatabaseSetEntry>> builder = new FreeSelectSqlBuilder<>(dbCategory);
builder.setTemplate("SELECT id, name, databaseType, sharding, connectionString, databaseSet_Id, update_user_no, update_time FROM databasesetentry WHERE databaseSet_Id = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "databaseSet_Id", Types.INTEGER, databaseSet_Id);
builder.mapWith(databaseSetEntryRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<DatabaseSetEntry> list = queryDao.query(builder, parameters, hints);
processEntryList(list);
return list;
}
use of com.ctrip.platform.dal.dao.StatementParameters 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.dao.StatementParameters in project dal by ctripcorp.
the class DaoOfDatabaseSet method deleteDatabaseSetEntryByDbsetId.
/**
* 依据外键databaseSet_Id删除entry
*
* @param dbsetId
* @return
*/
public int deleteDatabaseSetEntryByDbsetId(Integer dbsetId) throws SQLException {
FreeUpdateSqlBuilder builder = new FreeUpdateSqlBuilder(dbCategory);
builder.setTemplate("DELETE FROM databasesetentry WHERE databaseSet_Id = ?");
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.setSensitive(i++, "databaseSet_Id", Types.INTEGER, dbsetId);
DalHints hints = DalHints.createIfAbsent(null);
return queryDao.update(builder, parameters, hints);
}
Aggregations