use of com.ctrip.platform.dal.daogen.entity.GenTaskByTableViewSp in project dal by ctripcorp.
the class DaoByTableViewSp method getTasksByProjectId.
/**
* 根据项目主键查询所有任务
*
* @param projectId
* @return
*/
public List<GenTaskByTableViewSp> getTasksByProjectId(int projectId) throws SQLException {
FreeSelectSqlBuilder<List<GenTaskByTableViewSp>> builder = new FreeSelectSqlBuilder<>(dbCategory);
StringBuilder sb = new StringBuilder();
sb.append("SELECT id, project_id,db_name,table_names,view_names,sp_names,prefix,suffix, cud_by_sp,pagination,`generated`,version,update_user_no,update_time,comment,sql_style,api_list,approved,approveMsg ");
sb.append("FROM task_table WHERE project_id=? order by id");
builder.setTemplate(sb.toString());
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "project_id", Types.INTEGER, projectId);
builder.mapWith(genTaskByTableViewSpRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<GenTaskByTableViewSp> list = queryDao.query(builder, parameters, hints);
processList(list);
return list;
}
use of com.ctrip.platform.dal.daogen.entity.GenTaskByTableViewSp in project dal by ctripcorp.
the class DaoByTableViewSp method updateAndGetAllTasks.
public List<GenTaskByTableViewSp> updateAndGetAllTasks(int projectId) throws SQLException {
List<GenTaskByTableViewSp> result = new ArrayList<>();
List<GenTaskByTableViewSp> list = getTasksByProjectId(projectId);
if (list == null || list.size() == 0)
return result;
for (GenTaskByTableViewSp entity : list) {
entity.setGenerated(true);
if (updateTask(entity) > 0) {
result.add(entity);
}
}
return result;
}
use of com.ctrip.platform.dal.daogen.entity.GenTaskByTableViewSp in project dal by ctripcorp.
the class DaoByTableViewSp method getVersionById.
public int getVersionById(int id) throws SQLException {
DalHints hints = DalHints.createIfAbsent(null);
GenTaskByTableViewSp entity = client.queryByPk(id, hints);
if (entity == null)
return 0;
return entity.getVersion();
}
use of com.ctrip.platform.dal.daogen.entity.GenTaskByTableViewSp in project dal by ctripcorp.
the class DaoByTableViewSp method updateAndGetTasks.
public List<GenTaskByTableViewSp> updateAndGetTasks(int projectId) throws SQLException {
FreeSelectSqlBuilder<List<GenTaskByTableViewSp>> builder = new FreeSelectSqlBuilder<>(dbCategory);
StringBuilder sb = new StringBuilder();
sb.append("SELECT id, project_id,db_name,table_names,view_names,sp_names,prefix,suffix,cud_by_sp,pagination,`generated`,version,update_user_no,update_time,comment,sql_style,api_list,approved,approveMsg ");
sb.append("FROM task_table WHERE project_id=? AND `generated`=FALSE");
builder.setTemplate(sb.toString());
StatementParameters parameters = new StatementParameters();
int i = 1;
parameters.set(i++, "project_id", Types.INTEGER, projectId);
builder.mapWith(genTaskByTableViewSpRowMapper);
DalHints hints = DalHints.createIfAbsent(null).allowPartial();
List<GenTaskByTableViewSp> list = queryDao.query(builder, parameters, hints);
List<GenTaskByTableViewSp> result = new ArrayList<>();
if (list == null || list.size() == 0)
return result;
processList(list);
for (GenTaskByTableViewSp entity : list) {
entity.setGenerated(true);
if (updateTask(entity) > 0) {
result.add(entity);
}
}
return result;
}
Aggregations