Search in sources :

Example 16 with GenTaskBySqlBuilder

use of com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder in project dal by ctripcorp.

the class DaoBySqlBuilder method updateAndGetAllTasks.

public List<GenTaskBySqlBuilder> updateAndGetAllTasks(int projectId) throws SQLException {
    List<GenTaskBySqlBuilder> result = new ArrayList<>();
    List<GenTaskBySqlBuilder> list = getTasksByProjectId(projectId);
    if (list == null || list.isEmpty())
        return result;
    for (GenTaskBySqlBuilder entity : list) {
        entity.setGenerated(true);
        result.add(entity);
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) GenTaskBySqlBuilder(com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)

Example 17 with GenTaskBySqlBuilder

use of com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder in project dal by ctripcorp.

the class DaoBySqlBuilder method getAllTasks.

public List<GenTaskBySqlBuilder> getAllTasks() throws SQLException {
    DalHints hints = DalHints.createIfAbsent(null);
    SelectSqlBuilder builder = new SelectSqlBuilder().selectAll();
    List<GenTaskBySqlBuilder> list = client.query(builder, hints);
    processList(list);
    return list;
}
Also used : DalHints(com.ctrip.platform.dal.dao.DalHints) FreeSelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder) SelectSqlBuilder(com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder) GenTaskBySqlBuilder(com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)

Example 18 with GenTaskBySqlBuilder

use of com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder in project dal by ctripcorp.

the class DaoBySqlBuilder method getTasksByProjectId.

public List<GenTaskBySqlBuilder> getTasksByProjectId(int projectId) throws SQLException {
    FreeSelectSqlBuilder<List<GenTaskBySqlBuilder>> builder = new FreeSelectSqlBuilder<>(dbCategory);
    StringBuilder sb = new StringBuilder();
    sb.append("SELECT id, project_id,db_name, table_name,class_name,method_name,sql_style,crud_type,fields,where_condition,sql_content,`generated`,version,update_user_no,update_time,comment,scalarType,pagination,orderby,approved,approveMsg,hints ");
    sb.append("FROM task_auto 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(genTaskBySqlBuilderRowMapper);
    DalHints hints = DalHints.createIfAbsent(null).allowPartial();
    List<GenTaskBySqlBuilder> 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) StatementParameters(com.ctrip.platform.dal.dao.StatementParameters) ArrayList(java.util.ArrayList) List(java.util.List) GenTaskBySqlBuilder(com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)

Aggregations

GenTaskBySqlBuilder (com.ctrip.platform.dal.daogen.entity.GenTaskBySqlBuilder)18 DalHints (com.ctrip.platform.dal.dao.DalHints)5 FreeSelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeSelectSqlBuilder)4 Progress (com.ctrip.platform.dal.daogen.entity.Progress)4 CSharpCodeGenContext (com.ctrip.platform.dal.daogen.generator.csharp.CSharpCodeGenContext)4 Callable (java.util.concurrent.Callable)4 StatementParameters (com.ctrip.platform.dal.dao.StatementParameters)3 GenTaskByTableViewSp (com.ctrip.platform.dal.daogen.entity.GenTaskByTableViewSp)3 ArrayList (java.util.ArrayList)3 ExecuteResult (com.ctrip.platform.dal.daogen.entity.ExecuteResult)2 DatabaseCategory (com.ctrip.platform.dal.daogen.enums.DatabaseCategory)2 JavaCodeGenContext (com.ctrip.platform.dal.daogen.generator.java.JavaCodeGenContext)2 AbstractParameterHost (com.ctrip.platform.dal.daogen.host.AbstractParameterHost)2 List (java.util.List)2 Matcher (java.util.regex.Matcher)2 FreeUpdateSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.FreeUpdateSqlBuilder)1 SelectSqlBuilder (com.ctrip.platform.dal.dao.sqlbuilder.SelectSqlBuilder)1 StoredProcedure (com.ctrip.platform.dal.daogen.domain.StoredProcedure)1 CSharpTableHost (com.ctrip.platform.dal.daogen.host.csharp.CSharpTableHost)1 JavaParameterHost (com.ctrip.platform.dal.daogen.host.java.JavaParameterHost)1