From c1145bee8177d6c6177288ed67c874855eda9489 Mon Sep 17 00:00:00 2001 From: qiaozhanwei Date: Fri, 10 May 2019 17:21:59 +0800 Subject: [PATCH] project process define count and process instance running count --- .../escheduler/dao/mapper/ProjectMapper.java | 4 +++ .../dao/mapper/ProjectMapperProvider.java | 6 +++-- .../java/cn/escheduler/dao/model/Project.java | 26 +++++++++++++++++++ .../projects/pages/list/_source/list.vue | 14 +++++++++- .../src/js/module/i18n/locale/en_US.js | 2 ++ .../src/js/module/i18n/locale/zh_CN.js | 2 ++ 6 files changed, 51 insertions(+), 3 deletions(-) diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapper.java b/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapper.java index 0b044781a9..9428899c09 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapper.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapper.java @@ -115,6 +115,8 @@ public interface ProjectMapper { @Result(property = "perm", column = "perm", javaType = Integer.class, jdbcType = JdbcType.INTEGER), @Result(property = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), @Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), + @Result(property = "defCount", column = "def_count", javaType = Integer.class, jdbcType = JdbcType.INTEGER), + @Result(property = "instRunningCount", column = "inst_running_count", javaType = Integer.class, jdbcType = JdbcType.INTEGER), }) @SelectProvider(type = ProjectMapperProvider.class, method = "queryProjectListPaging") List queryProjectListPaging(@Param("userId") Integer userId, @@ -145,6 +147,8 @@ public interface ProjectMapper { @Result(property = "perm", column = "perm", javaType = Integer.class, jdbcType = JdbcType.INTEGER), @Result(property = "createTime", column = "create_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), @Result(property = "updateTime", column = "update_time", javaType = Timestamp.class, jdbcType = JdbcType.DATE), + @Result(property = "defCount", column = "def_count", javaType = Integer.class, jdbcType = JdbcType.INTEGER), + @Result(property = "instRunningCount", column = "inst_running_count", javaType = Integer.class, jdbcType = JdbcType.INTEGER), }) @SelectProvider(type = ProjectMapperProvider.class, method = "queryAllProjectListPaging") List queryAllProjectListPaging( diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapperProvider.java b/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapperProvider.java index 6de271e59c..1a701ec76a 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapperProvider.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/mapper/ProjectMapperProvider.java @@ -157,7 +157,8 @@ public class ProjectMapperProvider { return new SQL() {{ SELECT("p.*"); SELECT("u.user_name as user_name"); - + SELECT("(SELECT COUNT(*) FROM t_escheduler_process_definition AS def WHERE def.project_id = p.id) AS def_count"); + SELECT("(SELECT COUNT(*) FROM t_escheduler_process_definition def, t_escheduler_process_instance inst WHERE def.id = inst.process_definition_id AND def.project_id = p.id AND inst.state=1 ) as inst_running_count"); FROM(TABLE_NAME + " p"); JOIN("t_escheduler_user u on u.id=p.user_id"); WHERE("p.id in " + @@ -199,7 +200,8 @@ public class ProjectMapperProvider { return new SQL() {{ SELECT("p.*"); SELECT("u.user_name as user_name"); - + SELECT("(SELECT COUNT(*) FROM t_escheduler_process_definition AS def WHERE def.project_id = p.id) AS def_count"); + SELECT("(SELECT COUNT(*) FROM t_escheduler_process_definition def, t_escheduler_process_instance inst WHERE def.id = inst.process_definition_id AND def.project_id = p.id AND inst.state=1 ) as inst_running_count"); FROM(TABLE_NAME + " p"); JOIN("t_escheduler_user u on p.user_id = u.id"); diff --git a/escheduler-dao/src/main/java/cn/escheduler/dao/model/Project.java b/escheduler-dao/src/main/java/cn/escheduler/dao/model/Project.java index 6d0a9bbdb7..e835c9b97b 100644 --- a/escheduler-dao/src/main/java/cn/escheduler/dao/model/Project.java +++ b/escheduler-dao/src/main/java/cn/escheduler/dao/model/Project.java @@ -63,6 +63,32 @@ public class Project { */ private int perm; + /** + * process define count + */ + private int defCount; + + /** + * process instance running count + */ + private int instRunningCount; + + public int getDefCount() { + return defCount; + } + + public void setDefCount(int defCount) { + this.defCount = defCount; + } + + public int getInstRunningCount() { + return instRunningCount; + } + + public void setInstRunningCount(int instRunningCount) { + this.instRunningCount = instRunningCount; + } + public int getId() { return id; } diff --git a/escheduler-ui/src/js/conf/home/pages/projects/pages/list/_source/list.vue b/escheduler-ui/src/js/conf/home/pages/projects/pages/list/_source/list.vue index 890c25b80b..087b50032a 100644 --- a/escheduler-ui/src/js/conf/home/pages/projects/pages/list/_source/list.vue +++ b/escheduler-ui/src/js/conf/home/pages/projects/pages/list/_source/list.vue @@ -12,6 +12,12 @@ {{$t('Owned Users')}} + + {{$t('Process Define Count')}} + + + {{$t('Process Instance Running Count')}} + {{$t('Description')}} @@ -37,6 +43,12 @@ {{item.userName || '-'}} + + {{item.defCount}} + + + {{item.instRunningCount}} + {{item.desc}} @@ -150,4 +162,4 @@ }, components: { } } - \ No newline at end of file + diff --git a/escheduler-ui/src/js/module/i18n/locale/en_US.js b/escheduler-ui/src/js/module/i18n/locale/en_US.js index a31e2b5e8d..0a3ba357f4 100644 --- a/escheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/escheduler-ui/src/js/module/i18n/locale/en_US.js @@ -452,4 +452,6 @@ export default { 'Pre Statement': 'Pre Statement', 'Post Statement': 'Post Statement', 'Statement cannot be empty': 'Statement cannot be empty', + 'Process Define Count':'Process Define Count', + 'Process Instance Running Count':'Process Instance Running Count', } diff --git a/escheduler-ui/src/js/module/i18n/locale/zh_CN.js b/escheduler-ui/src/js/module/i18n/locale/zh_CN.js index 87aa0e44e8..e47aa84ec4 100644 --- a/escheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/escheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -452,4 +452,6 @@ export default { 'Pre Statement': '前置sql', 'Post Statement': '后置sql', 'Statement cannot be empty': '语句不能为空', + 'Process Define Count':'流程定义个数', + 'Process Instance Running Count':'运行流程实例个数', }