[manager,web-app] 支持监控参数的输入框提示信息,默认值填充
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
package com.usthe.manager.pojo.entity;
|
||||
|
||||
import com.usthe.common.util.GsonUtil;
|
||||
|
||||
import javax.persistence.AttributeConverter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* json 互转map对象字段为数据String字段
|
||||
* @author tom
|
||||
* @date 2021/12/4 07:54
|
||||
*/
|
||||
public class JsonMapAttributeConverter implements AttributeConverter<Map<String,String>, String> {
|
||||
|
||||
@Override
|
||||
public String convertToDatabaseColumn(Map<String,String> attribute) {
|
||||
return GsonUtil.toJson(attribute);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,String> convertToEntityAttribute(String dbData) {
|
||||
return GsonUtil.fromJson(dbData, Map.class);
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,14 @@ import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Convert;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_ONLY;
|
||||
import static io.swagger.annotations.ApiModelProperty.AccessMode.READ_WRITE;
|
||||
@@ -68,6 +70,18 @@ public class ParamDefine {
|
||||
@ApiModelProperty(value = "是否是必输项 true-必填 false-可选", example = "true", accessMode = READ_WRITE, position = 5)
|
||||
private boolean required = false;
|
||||
|
||||
/**
|
||||
* 参数默认值
|
||||
*/
|
||||
@ApiModelProperty(value = "参数默认值", example = "12", accessMode = READ_WRITE, position = 6)
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* 参数输入框提示信息
|
||||
*/
|
||||
@ApiModelProperty(value = "参数输入框提示信息", example = "请输入密码", accessMode = READ_WRITE, position = 7)
|
||||
private String placeholder;
|
||||
|
||||
/**
|
||||
* 当type为number时,用range表示范围 eg: 0-233
|
||||
*/
|
||||
@@ -83,12 +97,18 @@ public class ParamDefine {
|
||||
private Short limit;
|
||||
|
||||
/**
|
||||
* 当type为radio单选框,checkbox复选框时,option表示可选项值列表
|
||||
* eg: param3,param4,param5
|
||||
* 当type为radio单选框,checkbox复选框时,options表示可选项值列表
|
||||
* eg: {
|
||||
* "key1":"value1",
|
||||
* "key2":"value2"
|
||||
* }
|
||||
* key-值显示标签
|
||||
* value-真正值
|
||||
*/
|
||||
@ApiModelProperty(value = "当type为radio单选框,checkbox复选框时,option表示可选项值列表", example = "10,20,30", accessMode = READ_WRITE, position = 8)
|
||||
@Column(name = "param_option")
|
||||
private String option;
|
||||
@ApiModelProperty(value = "当type为radio单选框,checkbox复选框时,option表示可选项值列表", example = "{key1,value1}", accessMode = READ_WRITE, position = 8)
|
||||
@Column(name = "param_options")
|
||||
@Convert(converter = JsonMapAttributeConverter.class)
|
||||
private Map<String,String> options;
|
||||
|
||||
/**
|
||||
* 此条记录创建者
|
||||
|
||||
@@ -16,6 +16,10 @@ param:
|
||||
# 当type为number时,用range表示范围
|
||||
range: '[0,65535]'
|
||||
required: true
|
||||
# 端口默认值
|
||||
defaultValue: 80
|
||||
# 参数输入框提示信息
|
||||
placeholder: '请输入端口'
|
||||
- field: username
|
||||
name: 用户名
|
||||
type: text
|
||||
|
||||
@@ -16,12 +16,14 @@ param:
|
||||
# 当type为number时,用range表示范围
|
||||
range: '[0,65535]'
|
||||
required: true
|
||||
defaultValue: 80
|
||||
- field: uri
|
||||
name: URI路径
|
||||
type: text
|
||||
# 当type为text时,用limit表示字符串限制大小
|
||||
limit: 100
|
||||
required: true
|
||||
placeholder: 'eg:/index.html'
|
||||
- field: method
|
||||
name: 请求方式
|
||||
type: text
|
||||
|
||||
Reference in New Issue
Block a user