class TableEntityDao extends BaseDao {

    public List<TaskTableView> getTasksByProjectId(Long projectId) throws SQLException {
        String sql = "select t1.id, t1.project_id,t1.dbset_id, t1.table_names,t1.custom_table_name,t1.view_names,t1.prefix,suffix, t1.cud_by_sp,t1.pagination,t1.generated,t1.version,t1.update_user_no,t1.update_time,t1.comment,t1.sql_style,t1.api_list,t1.approved,t1.approveMsg,t1.field_type " +
                ",t2.name as dbset_name,t3.db_name, t3.id as alldbs_id " +
                "from (select t1.id task_id, t1.project_id,t1.dbset_id, min(t2.id) as dbsetentry_id " +
                "from task_table t1 " +
                "inner join  databasesetentry t2 on t1.dbset_id = t2.dbset_id " +
                "where t1.project_id = " + projectId + " and t2.database_type = 1 " +
                "group by t1.id ) t0 " +
                "inner join task_table t1 on t0.task_id = t1.id " +
                "inner join  databasesetentry t2 on t0.dbsetentry_id = t2.id " +
                "inner join alldbs t3 on t2.db_Id = t3.id ";
        log.info("getTasksByProjectId --->" + sql);
        return this.queryBySql(sql, TaskTableView.class);
    }

}