本帖最后由 Ah.Dragon 于 2021-8-27 10:19 编辑
求一个思路
拖拉拽表单存入哪个数据库会方便存储并取出
使用的后端语言是Java
目前思路:
生成json格式存入MongoDB,但是由于是拖拉拽表单,json格式每次的字段key都不一致,该如何映射到实体类
或者用最蠢的方法,string存储json,全部堆一起,由前端渲染(实验过,可行)
以下为json数据
[Java] 纯文本查看 复制代码 {
"formDataList": [{
"fieldId": "Password_1629423281596",
"name": "Password",
"label": "密码",
"placeholder": "请输入密码",
"value": "",
"rules": {},
"makeStyle": {
"active": true
},
"style": {},
"setting": {
"prefixIcon": "el-icon-lock",
"suffixIcon": ""
}
}, {
"fieldId": "Input_1629423347125",
"name": "Input",
"label": "单行文本",
"placeholder": "请输入",
"value": "",
"rules": {},
"makeStyle": {
"active": false
},
"style": {},
"setting": {
"prefixIcon": "",
"suffixIcon": ""
}
}, {
"name": "Divider",
"label": "分割线",
"makeStyle": {
"active": false
},
"style": {
"hideLabel": true
},
"setting": {
"direction": "horizontal",
"contentPosition": "center",
"content": "这里是分割线",
"icon": ""
},
"fieldId": "Divider_1630026701208"
}],
"formStyle": {
"hideLabel": false,
"labelWidth": "85px",
"labelPosition": "right",
"showRequiredAsterisk": true,
"showVerificationMessage": true,
"size": "medium",
"labelSuffix": ":"
},
"model": {
"Password_1629423281596": "",
"Input_1629423347125": ""
}
}
model的key就是表单的id,表单通过model的key获取到表单的value,所以model的key每次都不一样
如何在不修改json的情况下完成,或者有更好的方法或思路,有好的拖拉拽也可以推荐一下,求
补一张MongoDB存储的json结构的数据
|