前后端交互
Posted bockpecehhe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了前后端交互相关的知识,希望对你有一定的参考价值。
前端传JSON 此JSON有上下级关系 每一个有孩子节点 此节点有数据
{ "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "children": [{ "standardspeciallistid": "10340", "standardcostid": "0", "costcode": "(A.01)", "costcodelevel": "2", "costcodename": "土地费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": [{ "standardspeciallistid": "10341", "standardcostid": "0", "costcode": "(A.01.01)", "costcodelevel": "3", "costcodename": "111", "costcodeparentid": "(A.01)", "haschild": "1", "budgetvariable": "1111", "specialunit": "111", "bugetrule": "1111", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "1111", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "", "cityid": "238", "referenceunitprice": "1111", "children": "", "cellStyles": [{ "col": 2, "type": "format-input", "precision": 2, "readOnly": false }, { "col": 5, "type": "format-input", "precision": 2, "readOnly": false }, { "col": 7, "type": "input" }], "_level": 3, "_expanded": false, "_rowIndex": "0.0.0", "_id": "0.0.0_182", "parent": { "standardspeciallistid": "10340", "standardcostid": "0", "costcode": "(A.01)", "costcodelevel": "2", "costcodename": "土地费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.0", "_id": "0.0_87", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null, "isOver2": true, "isOver5": true, "isOver7": true }], "_level": 2, "_expanded": true, "_rowIndex": "0.0", "_id": "0.0_87", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10342", "standardcostid": "0", "costcode": "(A.02)", "costcodelevel": "2", "costcodename": "前期工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "children": [{ "standardspeciallistid": "10343", "standardcostid": "0", "costcode": "(A.02.01)", "costcodelevel": "3", "costcodename": "勘测、设计费", "costcodeparentid": "(A.02)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.1.0", "_id": "0.1.0_136", "parent": { "standardspeciallistid": "10342", "standardcostid": "0", "costcode": "(A.02)", "costcodelevel": "2", "costcodename": "前期工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.1", "_id": "0.1_852", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10344", "standardcostid": "0", "costcode": "(A.02.02)", "costcodelevel": "3", "costcodename": "三通一平工程费", "costcodeparentid": "(A.02)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.1.1", "_id": "0.1.1_709", "parent": { "standardspeciallistid": "10342", "standardcostid": "0", "costcode": "(A.02)", "costcodelevel": "2", "costcodename": "前期工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.1", "_id": "0.1_852", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10345", "standardcostid": "0", "costcode": "(A.02.03)", "costcodelevel": "3", "costcodename": "行政及经营性收费", "costcodeparentid": "(A.02)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.1.2", "_id": "0.1.2_81", "parent": { "standardspeciallistid": "10342", "standardcostid": "0", "costcode": "(A.02)", "costcodelevel": "2", "costcodename": "前期工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.1", "_id": "0.1_852", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }], "_level": 2, "_expanded": true, "_rowIndex": "0.1", "_id": "0.1_852", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10346", "standardcostid": "0", "costcode": "(A.03)", "costcodelevel": "2", "costcodename": "配套设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 2, "_expanded": true, "_rowIndex": "0.2", "_id": "0.2_862", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "children": [{ "standardspeciallistid": "10348", "standardcostid": "0", "costcode": "(A.04.01)", "costcodelevel": "3", "costcodename": "供电工程费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.0", "_id": "0.3.0_568", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10349", "standardcostid": "0", "costcode": "(A.04.02)", "costcodelevel": "3", "costcodename": "供水工程费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.1", "_id": "0.3.1_287", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10350", "standardcostid": "0", "costcode": "(A.04.03)", "costcodelevel": "3", "costcodename": "天然气工程费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.2", "_id": "0.3.2_244", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10351", "standardcostid": "0", "costcode": "(A.04.04)", "costcodelevel": "3", "costcodename": "排水工程费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.3", "_id": "0.3.3_714", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10352", "standardcostid": "0", "costcode": "(A.04.05)", "costcodelevel": "3", "costcodename": "中水系统费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.4", "_id": "0.3.4_127", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10353", "standardcostid": "0", "costcode": "(A.04.06)", "costcodelevel": "3", "costcodename": "集中供暖", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.5", "_id": "0.3.5_818", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10354", "standardcostid": "0", "costcode": "(A.04.07)", "costcodelevel": "3", "costcodename": "区内道路工程费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.6", "_id": "0.3.6_47", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10355", "standardcostid": "0", "costcode": "(A.04.08)", "costcodelevel": "3", "costcodename": "弱电工程费", "costcodeparentid": "(A.04)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.3.7", "_id": "0.3.7_667", "parent": { "standardspeciallistid": "10347", "standardcostid": "0", "costcode": "(A.04)", "costcodelevel": "2", "costcodename": "基础设施费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }], "_level": 2, "_expanded": true, "_rowIndex": "0.3", "_id": "0.3_927", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10356", "standardcostid": "0", "costcode": "(A.05)", "costcodelevel": "2", "costcodename": "建安及装修工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "children": [{ "standardspeciallistid": "10357", "standardcostid": "0", "costcode": "(A.05.01)", "costcodelevel": "3", "costcodename": "建筑工程", "costcodeparentid": "(A.05)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.4.0", "_id": "0.4.0_740", "parent": { "standardspeciallistid": "10356", "standardcostid": "0", "costcode": "(A.05)", "costcodelevel": "2", "costcodename": "建安及装修工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.4", "_id": "0.4_163", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10358", "standardcostid": "0", "costcode": "(A.05.02)", "costcodelevel": "3", "costcodename": "安装工程", "costcodeparentid": "(A.05)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.4.1", "_id": "0.4.1_447", "parent": { "standardspeciallistid": "10356", "standardcostid": "0", "costcode": "(A.05)", "costcodelevel": "2", "costcodename": "建安及装修工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.4", "_id": "0.4_163", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10359", "standardcostid": "0", "costcode": "(A.05.03)", "costcodelevel": "3", "costcodename": "户内精装修", "costcodeparentid": "(A.05)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.4.2", "_id": "0.4.2_209", "parent": { "standardspeciallistid": "10356", "standardcostid": "0", "costcode": "(A.05)", "costcodelevel": "2", "costcodename": "建安及装修工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.4", "_id": "0.4_163", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10360", "standardcostid": "0", "costcode": "(A.05.04)", "costcodelevel": "3", "costcodename": "持有商业调改费", "costcodeparentid": "(A.05)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.4.3", "_id": "0.4.3_552", "parent": { "standardspeciallistid": "10356", "standardcostid": "0", "costcode": "(A.05)", "costcodelevel": "2", "costcodename": "建安及装修工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.4", "_id": "0.4_163", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10361", "standardcostid": "0", "costcode": "(A.05.05)", "costcodelevel": "3", "costcodename": "酒店专属服务及设备设施费用", "costcodeparentid": "(A.05)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 3, "_expanded": false, "_rowIndex": "0.4.4", "_id": "0.4.4_890", "parent": { "standardspeciallistid": "10356", "standardcostid": "0", "costcode": "(A.05)", "costcodelevel": "2", "costcodename": "建安及装修工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 2, "_expanded": true, "_rowIndex": "0.4", "_id": "0.4_163", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, "_marginLeft": 0, "_width": null }], "_level": 2, "_expanded": true, "_rowIndex": "0.4", "_id": "0.4_163", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10362", "standardcostid": "0", "costcode": "(A.06)", "costcodelevel": "2", "costcodename": "环境景观工程费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 2, "_expanded": true, "_rowIndex": "0.5", "_id": "0.5_552", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }, { "standardspeciallistid": "10363", "standardcostid": "0", "costcode": "(A.07)", "costcodelevel": "2", "costcodename": "工程相关费", "costcodeparentid": "(A)", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "0.00", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "1", "cityid": "238", "referenceunitprice": "0", "children": "", "_level": 2, "_expanded": true, "_rowIndex": "0.6", "_id": "0.6_302", "parent": { "standardspeciallistid": "10339", "standardcostid": "0", "costcode": "(A)", "costcodelevel": "1", "costcodename": "开发成本", "costcodeparentid": "0", "haschild": "", "budgetvariable": "0", "specialunit": "", "bugetrule": "", "budgetunitprice": "0", "budgetcost": "1234321", "actualcost": "0", "remark": "", "createdate": "2018-06-25 00:00:00", "modifydate": "2018-06-25 00:00:00", "flag": "0", "cityid": "238", "referenceunitprice": "0", "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }, "_marginLeft": 0, "_width": null }], "_level": 1, "_expanded": true, "_rowIndex": "0", "_id": "0_566", "_marginLeft": 0, "_width": 1 }
后台接收数据
public class MailController { @RequestMapping("save") public resultDto getMap(@RequestBody Map saveMap){ saveVo savevo = new saveVo(); resultDto result = new resultDto(); result.setErrorcode("000"); result.setErrormsg("成功"); List<saveVo> saveVos = new ArrayList<saveVo>(); //把map转换为了树形结构 jsonMapToObject(saveVos,saveMap); BigDecimal cityid = saveVos.get(0).getCityid(); //删除以前的数据 List<save> saveList = new ArrayList<save>(); List<save> saveList1 = Utils.populateList(saveVos, saveList, save.class); for (save c: saveList1) { System.out.println(c.toString()); } return result; } public static void jsonMapToObject(List<saveVo> CmStandardSpecialListVos,Map saveMap){ saveVo cmStandardSpecialListVo = new saveVo(); cmStandardSpecialListVo.setCityid(new BigDecimal(saveMap.get("cityid").toString())); cmStandardSpecialListVo.setCostcode(saveMap.get("costcode")==null?"":saveMap.get("costcode").toString()); cmStandardSpecialListVo.setCostcodelevel(saveMap.get("costcodelevel").toString()); cmStandardSpecialListVo.setBudgetcost(new BigDecimal((saveMap.get("budgetcost")==null||"".equals(saveMap.get("budgetcost").toString().trim()))?"0":saveMap.get("budgetcost").toString().trim())); cmStandardSpecialListVo.setBudgetunitprice(new BigDecimal((saveMap.get("budgetunitprice")==null||"".equals(saveMap.get("budgetunitprice").toString().trim()))?"0":saveMap.get("budgetunitprice").toString().trim())); cmStandardSpecialListVo.setBudgetvariable(new BigDecimal((saveMap.get("budgetvariable")==null||"".equals(saveMap.get("budgetvariable").toString().trim()))?"0":saveMap.get("budgetvariable").toString().trim())); cmStandardSpecialListVo.setCostcodename(saveMap.get("costcodename").toString()); cmStandardSpecialListVo.setCostcodeparentid(saveMap.get("costcodeparentid")==""?"0":saveMap.get("costcodeparentid").toString()); cmStandardSpecialListVo.setCreatedate(new Date()); cmStandardSpecialListVo.setBugetrule(saveMap.get("bugetrule")==""?"":saveMap.get("bugetrule").toString()); cmStandardSpecialListVo.setActualcost(new BigDecimal(( saveMap.get("actualcost")==null||"".equals(saveMap.get("actualcost").toString().trim()))?"0":saveMap.get("actualcost").toString().trim())); cmStandardSpecialListVo.setFlag(saveMap.get("flag")==null?"":saveMap.get("flag").toString()); cmStandardSpecialListVo.setHaschild(saveMap.get("haschild")==""?"":saveMap.get("haschild").toString()); cmStandardSpecialListVo.setModifydate(new Date()); cmStandardSpecialListVo.setReferenceunitprice(new BigDecimal((saveMap.get("referenceunitprice")==null||"".equals(saveMap.get("referenceunitprice")))?"0":saveMap.get("referenceunitprice").toString().trim())); cmStandardSpecialListVo.setRemark(saveMap.get("remark")==""?"":saveMap.get("remark").toString()); cmStandardSpecialListVo.setSpecialunit(saveMap.get("specialunit")==""?"":saveMap.get("specialunit").toString()); cmStandardSpecialListVo.setStandardcostid(new BigDecimal((saveMap.get("standardcostid")==null||"".equals(saveMap.get("standardcostid")))?"0":saveMap.get("standardcostid").toString().trim())); CmStandardSpecialListVos.add(cmStandardSpecialListVo); //增加了一个VO 但是还没有设置children if(null != saveMap.get("children") && !"".equals(saveMap.get("children"))){ for(Object object:(List)saveMap.get("children")){ Map resultMap = (Map)object; jsonMapToObject(CmStandardSpecialListVos,resultMap); } } } }
DTO和实体类的转换工具类
package org.spring.springboot.utils; import java.lang.reflect.Method; import java.util.List; public class Utils { /** * 将dto和entity之间的属性互相转换,dto中属性一般为String等基本类型, * 但是entity中可能有复合主键等复杂类型,需要注意同名问题 * @param src * @param target */ public static Object populate(Object src, Object target) { Method[] srcMethods = src.getClass().getMethods(); Method[] targetMethods = target.getClass().getMethods(); for (Method m : srcMethods) { String srcName = m.getName(); if (srcName.startsWith("get")) { try { Object result = m.invoke(src); for (Method mm : targetMethods) { String targetName = mm.getName(); if (targetName.startsWith("set") && targetName.substring(3, targetName.length()) .equals(srcName.substring(3, srcName.length()))) { mm.invoke(target, result); } } } catch (Exception e) { } } } return target; } /** * dto集合和实体类集合间的互相属性映射 * @param src * @param target * @param targetClass * @return */ @SuppressWarnings("unchecked") public static <S,T> List<T> populateList(List<S> src, List<T> target, Class<?> targetClass){ for(int i = 0;i<src.size();i++){ try { Object object = targetClass.newInstance(); target.add((T) object); populate(src.get(i),object); } catch (Exception e) { continue;//某个方法反射异常 } } return target; } }
VO类
package org.spring.springboot; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; import java.util.List; /** * @author hechao * @date create in 17:42 2018/2/28/028 */ public class saveVo implements Serializable{ private BigDecimal standardspeciallistid; private BigDecimal standardcostid; private String costcode; private String costcodelevel; private String costcodename; private String costcodeparentid; private String haschild; private BigDecimal budgetvariable; private String specialunit; private String bugetrule; private BigDecimal budgetunitprice; private BigDecimal budgetcost; private BigDecimal actualcost; private String remark; private Date createdate; private Date modifydate; private String flag; private BigDecimal cityid; private BigDecimal referenceunitprice; private List<saveVo> children; public BigDecimal getStandardspeciallistid() { return standardspeciallistid; } public void setStandardspeciallistid(BigDecimal standardspeciallistid) { this.standardspeciallistid = standardspeciallistid; } public BigDecimal getStandardcostid() { return standardcostid; } public void setStandardcostid(BigDecimal standardcostid) { this.standardcostid = standardcostid; } public String getCostcode() { return costcode; } public void setCostcode(String costcode) { this.costcode = costcode; } public String getCostcodelevel() { return costcodelevel; } public void setCostcodelevel(String costcodelevel) { this.costcodelevel = costcodelevel; } public String getCostcodename() { return costcodename; } public void setCostcodename(String costcodename) { this.costcodename = costcodename; } public String getCostcodeparentid() { return costcodeparentid; } public void setCostcodeparentid(String costcodeparentid) { this.costcodeparentid = costcodeparentid; } public String getHaschild() { return haschild; } public void setHaschild(String haschild) { this.haschild = haschild; } public BigDecimal getBudgetvariable() { return budgetvariable; } public void setBudgetvariable(BigDecimal budgetvariable) { this.budgetvariable = budgetvariable; } public String getSpecialunit() { return specialunit; } public void setSpecialunit(String specialunit) { this.specialunit = specialunit; } public String getBugetrule() { return bugetrule; } public void setBugetrule(String bugetrule) { this.bugetrule = bugetrule; } public BigDecimal getBudgetunitprice() { return budgetunitprice; } public void setBudgetunitprice(BigDecimal budgetunitprice) { this.budgetunitprice = budgetunitprice; } public BigDecimal getBudgetcost() { return budgetcost; } public void setBudgetcost(BigDecimal budgetcost) { this.budgetcost = budgetcost; } public BigDecimal getActualcost() { return actualcost; } public void setActualcost(BigDecimal actualcost) { this.actualcost = actualcost; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public Date getCreatedate() { return createdate; } public void setCreatedate(Date createdate) { this.createdate = createdate; } public Date getModifydate() { return modifydate; } public void setModifydate(Date modifydate) { this.modifydate = modifydate; } public String getFlag() { return flag; } public void setFlag(String flag) { this.flag = flag; } public BigDecimal getCityid() { return cityid; } public void setCityid(BigDecimal cityid) { this.cityid = cityid; } public BigDecimal getReferenceunitprice() { return referenceunitprice; } public void setReferenceunitprice(BigDecimal referenceunitprice) { this.referenceunitprice = referenceunitprice; } public List<saveVo> getChildren() { return children; } public void setChildren(List<saveVo> children) { this.children = children; } }
以上是关于前后端交互的主要内容,如果未能解决你的问题,请参考以下文章