diff --git a/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecCombopOpType.java b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecCombopOpType.java new file mode 100644 index 0000000000000000000000000000000000000000..fe9ebc9c1e7d7927ddb05476ce9a917c89df6491 --- /dev/null +++ b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecCombopOpType.java @@ -0,0 +1,80 @@ +/* + * Copyright(c) 2023 NeatLogic Co., Ltd. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package neatlogic.framework.autoexec.constvalue; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.common.constvalue.IEnum; +import neatlogic.framework.util.$; + +import java.util.List; + +public enum AutoexecCombopOpType implements IEnum { + READONLY("readonly", "查询类"), + AUTOEXEC("autoexec", "操作类"); + private final String value; + private final String text; + + AutoexecCombopOpType(String _value, String _name) { + this.value = _value; + this.text = _name; + } + + public String getValue() { + return value; + } + + @Override + public String getEnumName() { + return IEnum.super.getEnumName(); + } + + public String getText() { + return $.t(text); + } + + public static String getValue(String _value) { + for (AutoexecCombopOpType s : AutoexecCombopOpType.values()) { + if (s.getValue().equals(_value)) { + return s.getValue(); + } + } + return null; + } + + public static String getText(String _value) { + for (AutoexecCombopOpType s : AutoexecCombopOpType.values()) { + if (s.getValue().equals(_value)) { + return s.getText(); + } + } + return ""; + } + + @Override + public List getValueTextList() { + JSONArray resultList = new JSONArray(); + for (AutoexecCombopOpType e : values()) { + JSONObject jsonObj = new JSONObject(); + jsonObj.put("value", e.getValue()); + jsonObj.put("text", e.getText()); + resultList.add(jsonObj); + } + return resultList; + } + +} diff --git a/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecCombopMapper.xml b/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecCombopMapper.xml index b66a924db09dc0c6ef667590b8bfb2bba98c0d49..3b9e70a6cd123436266b00a05328c6e974b69f3a 100644 --- a/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecCombopMapper.xml +++ b/src/main/java/neatlogic/framework/autoexec/dao/mapper/AutoexecCombopMapper.xml @@ -42,11 +42,12 @@ limitations under the License. SELECT `id`, `name`, `description`, - `type_id` AS typeId, - `is_active` AS isActive, - `operation_type` AS operationType, + `op_type` AS opType, + `type_id` AS typeId, + `is_active` AS isActive, + `operation_type` AS operationType, `owner`, - `config` AS configStr, + `config` AS configStr, `fcd`, `fcu` FROM `autoexec_combop` @@ -320,6 +321,7 @@ limitations under the License. `name`, `description`, `type_id`, + `op_type`, `is_active`, `operation_type`, `owner`, @@ -332,6 +334,7 @@ limitations under the License. #{name}, #{description}, #{typeId}, + #{opType}, #{isActive}, #{operationType}, #{owner}, @@ -375,6 +378,7 @@ limitations under the License. SET `name` = #{name}, `description` = #{description}, `type_id` = #{typeId}, + `op_type` = #{opType}, `owner` = #{owner}, `config` = #{configStr}, `lcu` = #{lcu}, diff --git a/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopVo.java b/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopVo.java index 8c30aba83fd9b85f3229c4e95e7b136d94d6c0f0..f228ef710596c9a8a535063e5863ad34f393af74 100644 --- a/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopVo.java +++ b/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopVo.java @@ -18,12 +18,16 @@ package neatlogic.framework.autoexec.dto.combop; import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; +import neatlogic.framework.autoexec.constvalue.AutoexecCombopOpType; import neatlogic.framework.autoexec.dto.AutoexecOperationVo; import neatlogic.framework.autoexec.dto.AutoexecParamVo; +import neatlogic.framework.cmdb.enums.CmdbTenantConfig; import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.common.dto.BaseEditorVo; +import neatlogic.framework.config.ConfigManager; import neatlogic.framework.restful.annotation.EntityField; import neatlogic.framework.util.SnowflakeUtil; +import org.apache.commons.lang3.StringUtils; import java.io.Serializable; import java.util.List; @@ -44,6 +48,8 @@ public class AutoexecCombopVo extends BaseEditorVo implements Serializable { private String description; @EntityField(name = "common.typeid", type = ApiParamType.LONG) private Long typeId; + @EntityField(name = "操作类型", type = ApiParamType.STRING) + private String opType; @EntityField(name = "common.typename", type = ApiParamType.STRING) private String typeName; @EntityField(name = "common.isactive", type = ApiParamType.INTEGER) @@ -379,4 +385,27 @@ public class AutoexecCombopVo extends BaseEditorVo implements Serializable { public void setConfigExpiredReason(JSONObject configExpiredReason) { this.configExpiredReason = configExpiredReason; } + + public String getOpType() { + if (StringUtils.isBlank(opType)) { + return AutoexecCombopOpType.READONLY.getValue(); + } + return opType; + } + + public void setOpType(String opType) { + this.opType = opType; + } + + public String getOpTypeName() { + if (StringUtils.isNotBlank(opType)) { + return AutoexecCombopOpType.getText(opType); + } + return AutoexecCombopOpType.READONLY.getText(); + } + + public String getIsResourcecenterAuth() { + return ConfigManager.getConfig(CmdbTenantConfig.IS_RESOURCECENTER_AUTH); + } + }