From bfb168e2a7eaf2a6564ef72ab9445d30609bf01f Mon Sep 17 00:00:00 2001 From: wangli <274027703@qq.com> Date: Fri, 21 Jul 2023 16:44:21 +0800 Subject: [PATCH] =?UTF-8?q?update=20-=20=E4=BF=AE=E6=94=B9=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E8=A1=A8=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3=E5=92=8C?= =?UTF-8?q?=E5=BA=93=E8=A1=A8=20DDL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/common/enums/BpmErrorCode.java | 17 +- .../{BpmDictDataDO.java => ExtAxDictDO.java} | 32 ++-- .../repository/mapper/BpmDictDataMapper.java | 4 +- .../core/service/BpmCategoryService.java | 9 + .../converter/BpmCategoryConverter.java | 10 +- .../request/model/BpmCategoryCreateDTO.java | 15 +- .../dto/request/model/BpmCategoryDTO.java | 6 + .../dto/response/model/BpmCategoryItemVo.java | 15 +- .../service/impl/BpmCategoryServiceImpl.java | 79 +++++--- .../src/main/resources/sql/bpm-busines.sql | 170 +++++++++--------- .../src/main/resources/sql/change.sql | 9 - .../controller/web/BpmCategoryController.java | 14 ++ 12 files changed, 222 insertions(+), 158 deletions(-) rename workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/{BpmDictDataDO.java => ExtAxDictDO.java} (75%) diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/enums/BpmErrorCode.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/enums/BpmErrorCode.java index dcf3c933e..e6d4e264a 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/enums/BpmErrorCode.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/enums/BpmErrorCode.java @@ -12,10 +12,23 @@ import lombok.Getter; @Getter @AllArgsConstructor public enum BpmErrorCode implements IProjectRespCode { + // ========== category 01-001 ========== + CATEGORY_VALUE_EXISTS("01001", "分类值【{}】已经存在"), + CATEGORY_NOT_EXISTS("01002", "指定分类不存在"), + // ========== convertor 02-001 ========== + // ========== model 03-001 ========== + // ========== processDefinition 04-001 ========== + // ========== processInstance 05-001 ========== + // ========== task 06-001 ========== + // ========== formDefinition 07-001 ========== + // ========== formInstance 08-001 ========== + // ========== flowableEngin 09-001 ========== + + + // ========== 流程模型 01-001 ========== + MODEL_KEY_EXISTS("01001", "已经存在流程标识为【{}】的流程"), - // ========== 流程模型 1-009-002-000 ========== - MODEL_KEY_EXISTS("9002000", "已经存在流程标识为【{}】的流程"), MODEL_KEY_EXISTS2("9002000", "已经存在流程标识为【{}】的流程"), MODEL_NOT_EXISTS("9002001", "流程模型不存在"), MODEL_KEY_VALID("9002002", diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/BpmDictDataDO.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/ExtAxDictDO.java similarity index 75% rename from workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/BpmDictDataDO.java rename to workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/ExtAxDictDO.java index 0f1fd2cab..3630808c8 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/BpmDictDataDO.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/entity/ExtAxDictDO.java @@ -8,10 +8,10 @@ import lombok.EqualsAndHashCode; import lombok.ToString; @EqualsAndHashCode(callSuper = true) -@TableName(value = "bpm_dict_data", autoResultMap = true) +@TableName(value = "ext_ax_dict", autoResultMap = true) @Data @ToString(callSuper = true) -public class BpmDictDataDO extends BaseOwnEntity { +public class ExtAxDictDO extends BaseOwnEntity { /** * 编号,自增 */ @@ -19,9 +19,9 @@ public class BpmDictDataDO extends BaseOwnEntity { private Long id; /** - * 字典排序 + * 字典类型 */ - private Long sort; + private String type; /** * 字典标签 @@ -33,27 +33,23 @@ public class BpmDictDataDO extends BaseOwnEntity { */ private String value; - /** - * 字典类型 - */ - private String dictType; - - /** - * 颜色类型 - */ - private String colorType; - - /** - * css 样式 - */ - private String cssClass; /** * 备注 */ private String remark; + /** + * 字典排序 + */ + private Long sort; + /** * 状态(0正常 1停用) */ private Integer status; + + /** + * 租户 ID + */ + private String tenantId; } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/mapper/BpmDictDataMapper.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/mapper/BpmDictDataMapper.java index 4e26ff796..0d5737792 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/mapper/BpmDictDataMapper.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/repository/mapper/BpmDictDataMapper.java @@ -1,10 +1,10 @@ package cn.axzo.workflow.core.repository.mapper; -import cn.axzo.workflow.core.repository.entity.BpmDictDataDO; +import cn.axzo.workflow.core.repository.entity.ExtAxDictDO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; @Mapper -public interface BpmDictDataMapper extends BaseMapper { +public interface BpmDictDataMapper extends BaseMapper { } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/BpmCategoryService.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/BpmCategoryService.java index fc656300c..01f946d42 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/BpmCategoryService.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/BpmCategoryService.java @@ -43,4 +43,13 @@ public interface BpmCategoryService { * @return {@link BpmCategoryItemVo} */ Page findBpmCategory(BpmCategoryDTO findDTO); + + /** + * 更新字典状态 + * + * @param id 字典 ID + * @param state + * @return + */ + Boolean updateState(Long id, Boolean state); } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/converter/BpmCategoryConverter.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/converter/BpmCategoryConverter.java index e689ec121..e252dbfbe 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/converter/BpmCategoryConverter.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/converter/BpmCategoryConverter.java @@ -1,6 +1,6 @@ package cn.axzo.workflow.core.service.converter; -import cn.axzo.workflow.core.repository.entity.BpmDictDataDO; +import cn.axzo.workflow.core.repository.entity.ExtAxDictDO; import cn.axzo.workflow.core.service.dto.response.model.BpmCategoryItemVo; import org.mapstruct.Mapper; import org.mapstruct.Mapping; @@ -14,11 +14,13 @@ import static org.mapstruct.NullValueCheckStrategy.ALWAYS; nullValueCheckStrategy = ALWAYS, imports = Arrays.class ) -public interface BpmCategoryConverter extends EntityConverter{ +public interface BpmCategoryConverter extends EntityConverter { @Mapping(target = "id", source = "category.id") - @Mapping(target = "dictType", source = "category.dictType") + @Mapping(target = "type", source = "category.type") @Mapping(target = "label", source = "category.label") @Mapping(target = "value", source = "category.value") - BpmCategoryItemVo toVo(BpmDictDataDO category); + @Mapping(target = "remark", source = "category.remark") + @Mapping(target = "status", source = "category.status") + BpmCategoryItemVo toVo(ExtAxDictDO category); } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryCreateDTO.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryCreateDTO.java index 9414cc71d..f5dd3b47f 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryCreateDTO.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryCreateDTO.java @@ -20,22 +20,19 @@ public class BpmCategoryCreateDTO { private String value; @ApiModelProperty(value = "字典类型", example = "字典类型(用于字典分组)") - private String dictType; + private String type; @ApiModelProperty(value = "备注", example = "remark") @Length(max = 250, message = "备注最长只支持250个字符") private String remark; - @ApiModelProperty(value = "字典排序", example = "1", hidden = true) - private Integer sort; + @ApiModelProperty(value = "字典排序", example = "1") + private Long sort; - @ApiModelProperty(value = "状态", example = "true or false", hidden = true) + @ApiModelProperty(value = "状态", example = "true or false") private Boolean status; - @ApiModelProperty(value = "颜色类型", example = "对应到 element-ui 为 default、primary、success、info、warning、danger", hidden = true) - private String colorType; - - @ApiModelProperty(value = "CSS样式", example = "color: red", hidden = true) - private String cssClass; + @ApiModelProperty(value = "租户", example = "1") + private String tenantId; } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryDTO.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryDTO.java index b7cde93af..9c568d8a3 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryDTO.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/request/model/BpmCategoryDTO.java @@ -16,4 +16,10 @@ public class BpmCategoryDTO extends PageQO { @ApiModelProperty(value = "字典值", example = "new_business") private String value; + + @ApiModelProperty(value = "状态", example = "0 or 1") + private Integer status; + + @ApiModelProperty(value = "租户 ID", example = "1") + private String tenantId; } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/response/model/BpmCategoryItemVo.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/response/model/BpmCategoryItemVo.java index 3db78e849..eb2972dd9 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/response/model/BpmCategoryItemVo.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/dto/response/model/BpmCategoryItemVo.java @@ -6,18 +6,21 @@ import lombok.Data; @Data public class BpmCategoryItemVo { - @ApiModelProperty(value = "ID", required = true) + @ApiModelProperty(value = "ID") private Long id; - @ApiModelProperty(value = "字典type", required = true) - private String dictType; + @ApiModelProperty(value = "字典type") + private String type; - @ApiModelProperty(value = "标签名", required = true) + @ApiModelProperty(value = "标签名") private String label; - @ApiModelProperty(value = "值", required = true) + @ApiModelProperty(value = "值") private String value; - @ApiModelProperty(value = "备注", required = true) + @ApiModelProperty(value = "备注") private String remark; + + @ApiModelProperty(value = "状态") + private Integer status; } diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/BpmCategoryServiceImpl.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/BpmCategoryServiceImpl.java index ed3169d78..ca5a9c756 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/BpmCategoryServiceImpl.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/BpmCategoryServiceImpl.java @@ -2,7 +2,7 @@ package cn.axzo.workflow.core.service.impl; import cn.axzo.workflow.core.common.BpmConstants; import cn.axzo.workflow.core.common.exception.WorkflowEngineException; -import cn.axzo.workflow.core.repository.entity.BpmDictDataDO; +import cn.axzo.workflow.core.repository.entity.ExtAxDictDO; import cn.axzo.workflow.core.repository.mapper.BpmDictDataMapper; import cn.axzo.workflow.core.service.BpmCategoryService; import cn.axzo.workflow.core.service.converter.BpmCategoryConverter; @@ -21,43 +21,57 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.stream.Collectors; +import static cn.axzo.workflow.core.common.enums.BpmErrorCode.CATEGORY_NOT_EXISTS; +import static cn.axzo.workflow.core.common.enums.BpmErrorCode.CATEGORY_VALUE_EXISTS; + @Service @RequiredArgsConstructor @Slf4j -public class BpmCategoryServiceImpl extends ServiceImpl implements BpmCategoryService, BpmConstants { +public class BpmCategoryServiceImpl extends ServiceImpl implements BpmCategoryService + , BpmConstants { @Resource private BpmDictDataMapper bpmDictDataMapper; private final BpmCategoryConverter bpmCategoryConverter; @Override - public int createBpmCategory(BpmCategoryCreateDTO createDTO) { - Optional oneOpt = this.lambdaQuery().eq(BpmDictDataDO::getLabel, createDTO.getLabel()) - .eq(BpmDictDataDO::getValue, createDTO.getValue()) + public int createBpmCategory(BpmCategoryCreateDTO dto) { + Optional oneOpt = this.lambdaQuery().eq(ExtAxDictDO::getLabel, dto.getLabel()) + .eq(ExtAxDictDO::getValue, dto.getValue()) .oneOpt(); if (oneOpt.isPresent()) { - throw new WorkflowEngineException("分类已存在"); + throw new WorkflowEngineException(CATEGORY_VALUE_EXISTS); } - BpmDictDataDO bpmDictDataDO = new BpmDictDataDO(); - bpmDictDataDO.setDictType(BPM_MODEL_CATEGORY); - bpmDictDataDO.setLabel(createDTO.getLabel()); - bpmDictDataDO.setValue(createDTO.getValue()); - bpmDictDataDO.setRemark(createDTO.getRemark()); - return bpmDictDataMapper.insert(bpmDictDataDO); + ExtAxDictDO dict = new ExtAxDictDO(); + populateDict(dto, dict); + return bpmDictDataMapper.insert(dict); + } + + private static void populateDict(BpmCategoryCreateDTO dto, ExtAxDictDO dict) { + dict.setType(BPM_MODEL_CATEGORY); + dict.setLabel(dto.getLabel()); + dict.setValue(dto.getValue()); + dict.setRemark(dto.getRemark()); + dict.setSort(dto.getSort()); + dict.setStatus(dto.getStatus() ? 1 : 0); + dict.setTenantId(dto.getTenantId()); } @Override - public int updateBpmCategory(BpmCategoryUpdateDTO updateDTO) { - BpmDictDataDO bpmDictDataDO = new BpmDictDataDO(); - bpmDictDataDO.setId(updateDTO.getId()); - bpmDictDataDO.setDictType(BPM_MODEL_CATEGORY); - bpmDictDataDO.setLabel(updateDTO.getLabel()); - bpmDictDataDO.setValue(updateDTO.getValue()); - bpmDictDataDO.setRemark(updateDTO.getRemark()); - return bpmDictDataMapper.updateById(bpmDictDataDO); + public int updateBpmCategory(BpmCategoryUpdateDTO dto) { + Optional dictDO = this.lambdaQuery().eq(ExtAxDictDO::getId, dto.getId()) + .oneOpt(); + if (!dictDO.isPresent()) { + throw new WorkflowEngineException(CATEGORY_NOT_EXISTS); + } + dictDO.ifPresent(dict -> { + populateDict(dto, dict); + }); + return bpmDictDataMapper.updateById(dictDO.get()); } @Override @@ -68,12 +82,14 @@ public class BpmCategoryServiceImpl extends ServiceImpl findBpmCategory(BpmCategoryDTO findDTO) { - LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(BpmDictDataDO.class) - .eq(StringUtils.isNotBlank(findDTO.getDictType()), BpmDictDataDO::getDictType, findDTO.getDictType()) - .eq(StringUtils.isNotBlank(findDTO.getLabel()), BpmDictDataDO::getLabel, findDTO.getLabel()) - .eq(StringUtils.isNotBlank(findDTO.getValue()), BpmDictDataDO::getValue, findDTO.getValue()); + LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(ExtAxDictDO.class) + .eq(StringUtils.isNotBlank(findDTO.getDictType()), ExtAxDictDO::getType, findDTO.getDictType()) + .eq(StringUtils.isNotBlank(findDTO.getLabel()), ExtAxDictDO::getLabel, findDTO.getLabel()) + .eq(StringUtils.isNotBlank(findDTO.getValue()), ExtAxDictDO::getValue, findDTO.getValue()) + .eq(Objects.nonNull(findDTO.getStatus()), ExtAxDictDO::getStatus, findDTO.getStatus()) + .eq(StringUtils.isNotBlank(findDTO.getTenantId()), ExtAxDictDO::getTenantId, findDTO.getTenantId()); - Page page = bpmDictDataMapper.selectPage(findDTO.toPage(), queryWrapper); + Page page = bpmDictDataMapper.selectPage(findDTO.toPage(), queryWrapper); List categoryVOS = page.getRecords().stream().map(bpmCategoryConverter::toVo).collect(Collectors.toList()); @@ -86,4 +102,17 @@ public class BpmCategoryServiceImpl extends ServiceImpl dictDO = this.lambdaQuery().eq(ExtAxDictDO::getId, id).oneOpt(); + if (!dictDO.isPresent()) { + throw new WorkflowEngineException(CATEGORY_NOT_EXISTS); + } + dictDO.ifPresent(dict -> { + dict.setStatus(state ? 1 : 0); + }); + bpmDictDataMapper.updateById(dictDO.get()); + return true; + } } diff --git a/workflow-engine-core/src/main/resources/sql/bpm-busines.sql b/workflow-engine-core/src/main/resources/sql/bpm-busines.sql index 8f3aa07c9..ba64015ab 100644 --- a/workflow-engine-core/src/main/resources/sql/bpm-busines.sql +++ b/workflow-engine-core/src/main/resources/sql/bpm-busines.sql @@ -15,99 +15,103 @@ */ SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; +SET +FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for ACT_EVT_LOG -- ---------------------------- -DROP TABLE IF EXISTS `bpm_dict_data`; -CREATE TABLE `bpm_dict_data` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码', - `sort` int NOT NULL DEFAULT '0' COMMENT '字典排序', - `label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典标签', - `value` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典键值', - `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '字典类型', - `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)', - `color_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '颜色类型', - `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT 'css 样式', - `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', +DROP TABLE IF EXISTS `ext_ax_dict`; +CREATE TABLE `ext_ax_dict` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '字典编码', + `type` varchar(100) NOT NULL DEFAULT '' COMMENT '字典类型', + `label` varchar(100) NOT NULL DEFAULT '' COMMENT '字典标签', + `value` varchar(100) NOT NULL DEFAULT '' COMMENT '字典键值', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + `sort` int NOT NULL DEFAULT '0' COMMENT '字典排序', + `status` tinyint NOT NULL DEFAULT '0' COMMENT '状态(1正常 0停用)', + `tenant_id` varchar(100) NOT NULL DEFAULT '' COMMENT '租户', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `is_delete` bigint NOT NULL COMMENT '是否删除', PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='字典数据表'; +) ENGINE=InnoDB COMMENT='字典数据表'; -CREATE TABLE `bpm_task_ext` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', - `assignee_user_id` bigint DEFAULT NULL COMMENT '任务的审批人', - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '任务的名字', - `task_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '任务的编号', - `result` tinyint NOT NULL COMMENT '任务的结果', - `comment` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '审批建议', - `end_time` datetime DEFAULT NULL COMMENT '任务的结束时间', - `process_instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '流程实例的编号', - `process_definition_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '流程定义的编号', - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - `tenant_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '租户编号(工作台ID)', - `company_id` bigint DEFAULT NULL COMMENT '审批人用户所在项目部的具体公司', - `identity_id` bigint NOT NULL COMMENT '审批人用户身份ID', - `user_name` varchar(25) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '审批人的用户姓名', - `organizational_structure_info` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '审批人的组织架构信息', - `ext` text, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='工作流的流程任务的拓展表'; +CREATE TABLE `bpm_task_ext` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `assignee_user_id` bigint DEFAULT NULL COMMENT '任务的审批人', + `name` varchar(64) DEFAULT NULL COMMENT '任务的名字', + `task_id` varchar(64) NOT NULL COMMENT '任务的编号', + `result` tinyint NOT NULL COMMENT '任务的结果', + `comment` varchar(255) DEFAULT NULL COMMENT '审批建议', + `end_time` datetime DEFAULT NULL COMMENT '任务的结束时间', + `process_instance_id` varchar(64) NOT NULL COMMENT '流程实例的编号', + `process_definition_id` varchar(64) NOT NULL COMMENT '流程定义的编号', + `creator` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` varchar(64) NOT NULL DEFAULT '' COMMENT '租户编号(工作台ID)', + `company_id` bigint DEFAULT NULL COMMENT '审批人用户所在项目部的具体公司', + `identity_id` bigint NOT NULL COMMENT '审批人用户身份ID', + `user_name` varchar(25) NOT NULL DEFAULT '' COMMENT '审批人的用户姓名', + `organizational_structure_info` varchar(500) NOT NULL DEFAULT '' COMMENT '审批人的组织架构信息', + `ext` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB COMMENT='工作流的流程任务的拓展表'; -CREATE TABLE `bpm_process_instance_ext` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', - `name` varchar(644) DEFAULT NULL COMMENT '流程实例的名字', - `custom_pro_inst_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '自定义流程实例的编号', - `process_instance_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '流程实例的编号', - `process_definition_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '流程定义的编号', - `category` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '流程分类', - `status` tinyint NOT NULL COMMENT '流程实例的状态', - `result` tinyint NOT NULL COMMENT '流程实例的结果', - `end_time` datetime DEFAULT NULL COMMENT '结束时间', - `form_variables` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci COMMENT '表单值', - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '创建者', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT '' COMMENT '更新者', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - `tenant_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '租户编号(工作台ID)', - `start_company_id` bigint DEFAULT NULL COMMENT '发起流程的用户所在项目部的具体公司', - `start_identity_Id` bigint NOT NULL COMMENT '发起流程的用户身份ID', - `start_user_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '发起流程的用户姓名', - `ext` text, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC COMMENT='工作流的流程实例的拓展'; +CREATE TABLE `bpm_process_instance_ext` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `name` varchar(644) DEFAULT NULL COMMENT '流程实例的名字', + `custom_pro_inst_id` varchar(64) NOT NULL DEFAULT '' COMMENT '自定义流程实例的编号', + `process_instance_id` varchar(64) NOT NULL COMMENT '流程实例的编号', + `process_definition_id` varchar(64) NOT NULL COMMENT '流程定义的编号', + `category` varchar(64) DEFAULT NULL COMMENT '流程分类', + `status` tinyint NOT NULL COMMENT '流程实例的状态', + `result` tinyint NOT NULL COMMENT '流程实例的结果', + `end_time` datetime DEFAULT NULL COMMENT '结束时间', + `form_variables` text COMMENT '表单值', + `creator` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` varchar(64) NOT NULL DEFAULT '' COMMENT '租户编号(工作台ID)', + `start_company_id` bigint DEFAULT NULL COMMENT '发起流程的用户所在项目部的具体公司', + `start_identity_Id` bigint NOT NULL COMMENT '发起流程的用户身份ID', + `start_user_name` varchar(30) NOT NULL DEFAULT '' COMMENT '发起流程的用户姓名', + `ext` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB COMMENT='工作流的流程实例的拓展'; -CREATE TABLE `bpm_process_definition_ext` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', - `process_definition_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程定义的编号', - `model_id` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '流程模型的编号', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '描述', - `form_type` tinyint DEFAULT NULL COMMENT '表单类型', - `form_id` bigint DEFAULT NULL COMMENT '表单编号', - `form_conf` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '表单的配置', - `form_fields` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '表单项的数组', - `form_custom_create_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '自定义表单的提交路径', - `form_custom_view_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '自定义表单的查看路径', - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者', - `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者', - `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', - `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='Bpm 流程定义的拓展表\n' \ No newline at end of file +CREATE TABLE `bpm_process_definition_ext` +( + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号', + `process_definition_id` varchar(64) NOT NULL COMMENT '流程定义的编号', + `model_id` varchar(64) NOT NULL COMMENT '流程模型的编号', + `description` varchar(255) DEFAULT NULL COMMENT '描述', + `form_type` tinyint DEFAULT NULL COMMENT '表单类型', + `form_id` bigint DEFAULT NULL COMMENT '表单编号', + `form_conf` varchar(1000) DEFAULT NULL COMMENT '表单的配置', + `form_fields` text COMMENT '表单项的数组', + `form_custom_create_path` varchar(255) DEFAULT NULL COMMENT '自定义表单的提交路径', + `form_custom_view_path` varchar(255) DEFAULT NULL COMMENT '自定义表单的查看路径', + `creator` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updater` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', + `tenant_id` bigint NOT NULL DEFAULT '0' COMMENT '租户编号', + PRIMARY KEY (`id`) +) ENGINE=InnoDB COMMENT='Bpm 流程定义的拓展表' diff --git a/workflow-engine-core/src/main/resources/sql/change.sql b/workflow-engine-core/src/main/resources/sql/change.sql index eb0340842..13be174b5 100644 --- a/workflow-engine-core/src/main/resources/sql/change.sql +++ b/workflow-engine-core/src/main/resources/sql/change.sql @@ -25,15 +25,6 @@ UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `update_by`, CHANGE COLUMN `deleted` `is_delete` bigint NOT NULL DEFAULT b'0' COMMENT '是否删除' AFTER `update_at`; -ALTER TABLE `bpm_task_ext` - CHANGE COLUMN `creator` `create_by` varchar (64) NULL DEFAULT '' COMMENT '创建者' AFTER `process_definition_id`, - CHANGE COLUMN `create_time` `create_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间' AFTER `create_by`, - CHANGE COLUMN `updater` `update_by` varchar (64) NULL DEFAULT '' COMMENT '更新者' AFTER `create_at`, - CHANGE COLUMN `update_time` `update_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON -UPDATE CURRENT_TIMESTAMP COMMENT '更新时间' AFTER `update_by`, - CHANGE COLUMN `deleted` `is_delete` bigint NOT NULL DEFAULT b'0' COMMENT '是否删除' AFTER `update_at`; - - ALTER TABLE `bpm_process_instance_ext` CHANGE COLUMN `start_identity_Id` `start_user_Id` varchar (255) NOT NULL COMMENT '发起流程的用户身份ID' AFTER `start_company_id`; diff --git a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/BpmCategoryController.java b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/BpmCategoryController.java index efd47a380..22e53f7b0 100644 --- a/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/BpmCategoryController.java +++ b/workflow-engine-server/src/main/java/cn/axzo/workflow/server/controller/web/BpmCategoryController.java @@ -10,12 +10,15 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import io.swagger.annotations.ApiParam; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +@Tag(name = "运维管理 - 字典分类") @Slf4j @RequestMapping("/web/v1/api/category") @RestController @@ -24,6 +27,8 @@ public class BpmCategoryController { @Autowired private BpmCategoryService bpmCategoryService; + + @Operation(summary = "创建分类") @PutMapping("/create") public CommonResponse create(@Valid @RequestBody BpmCategoryCreateDTO dto) { log.info("创建Category===>>>参数:{}", JSON.toJSONString(dto)); @@ -32,6 +37,7 @@ public class BpmCategoryController { } + @Operation(summary = "更新分类") @PostMapping("/update") public CommonResponse update(@Valid @RequestBody BpmCategoryUpdateDTO dto) { log.info("更新Category===>>>参数:{}", JSON.toJSONString(dto)); @@ -40,6 +46,7 @@ public class BpmCategoryController { } + @Operation(summary = "分类列表") @GetMapping("/list") public CommonResponse> list(BpmCategoryDTO qo) { log.info("查询Category===>>>列表接口参数,{}", JSON.toJSONString(qo)); @@ -47,7 +54,14 @@ public class BpmCategoryController { return CommonResponse.success(bpmCategory); } + @PutMapping("/state/update") + public CommonResponse updateState(@RequestParam Long id, @RequestParam Boolean state) { + log.info("更新状态Category===>>>参数,{}", JSON.toJSONString(id)); + return CommonResponse.success(bpmCategoryService.updateState(id, state)); + } + + @Operation(summary = "删除分类") @DeleteMapping("/delete/{id}") public CommonResponse delete(@ApiParam(" ID") @PathVariable Long id) { log.info("删除Category===>>>参数,{}", id);