• JSON序列——主从表查询


    JSON序列——主从表查询

    客户端代码:

    procedure TForm1.Button4Click(Sender: TObject);
    // 主从表 查询
    begin
      var url: TynUrl := TynUrl.Create;
      var serial: TynJsonCross := TynJsonCross.Create;
      var send: TMemoryStream := TMemoryStream.Create;
      try
        url.url := Edit1.Text;
        url.command := 'query92';                      // 命令
        url.params.Add('count=2');                     // 查询几个表的数据
        url.params.Add('accountno=1');                 // 帐套号
        url.params.Add('sql=select * from tgoods');    // 查询SQL
        url.params.Add('sql2=select * from tunit');    // 查询SQL2
        serial.Text := IdHTTP1.Post(url.text, send);
        Memo1.Text := serial.Text;
    //    serial.ReadFDMemTable(0, FDMemTable1);
    //    serial.ReadFDMemTable(1, FDMemTable2);
      finally
        serial.DisposeOf;
        send.DisposeOf;
        url.DisposeOf;
      end;
    end;
    

      服务端返回JSON:

    {
    	"tables": [
    		{
    			"cols": [
    				{
    					"name": "goodsid",
    					"size": 8,
    					"type": "string"
    				},
    				{
    					"name": "barcode",
    					"size": 18,
    					"type": "string"
    				},
    				{
    					"name": "goodsname",
    					"size": 50,
    					"type": "string"
    				},
    				{
    					"name": "pyjm",
    					"size": 50,
    					"type": "string"
    				},
    				{
    					"name": "gg",
    					"size": 30,
    					"type": "string"
    				},
    				{
    					"name": "kindid",
    					"size": 8,
    					"type": "string"
    				},
    				{
    					"name": "jj",
    					"size": 4,
    					"type": "float"
    				},
    				{
    					"name": "lsj",
    					"size": 4,
    					"type": "float"
    				},
    				{
    					"name": "kcxx",
    					"size": 4,
    					"type": "float"
    				},
    				{
    					"name": "kcsx",
    					"size": 4,
    					"type": "float"
    				},
    				{
    					"name": "unitid",
    					"size": 8,
    					"type": "string"
    				},
    				{
    					"name": "unitname",
    					"size": 10,
    					"type": "string"
    				},
    				{
    					"name": "kindname",
    					"size": 30,
    					"type": "string"
    				}
    			],
    			"rows": [
    				{
    					"goodsid": "100036",
    					"barcode": "100036",
    					"goodsname": "秋冬四件套哦",
    					"pyjm": "",
    					"gg": "",
    					"kindid": "12002",
    					"jj": 100,
    					"lsj": 430,
    					"kcxx": 50,
    					"kcsx": 5,
    					"unitid": "15",
    					"unitname": "箱套",
    					"kindname": "床上用品"
    				},
    				{
    					"goodsid": "100050",
    					"barcode": "100050",
    					"goodsname": "天堂伞",
    					"pyjm": "wrth",
    					"gg": "",
    					"kindid": "1",
    					"jj": 10,
    					"lsj": 0,
    					"kcxx": 0,
    					"kcsx": 0,
    					"unitid": "15",
    					"unitname": "箱套",
    					"kindname": "1111"
    				},
    				{
    					"goodsid": "100054",
    					"barcode": "100054",
    					"goodsname": "我们的 哎",
    					"pyjm": "WMD D7",
    					"gg": "",
    					"kindid": "11002",
    					"jj": 0,
    					"lsj": 0,
    					"kcxx": 0,
    					"kcsx": 0,
    					"unitid": "18",
    					"unitname": "公斤",
    					"kindname": "饮料"
    				},
    				{
    					"goodsid": "100055",
    					"barcode": "100055",
    					"goodsname": "娃哈哈纯净水500ML",
    					"pyjm": "WHHCJS500ML",
    					"gg": "",
    					"kindid": "11001",
    					"jj": 0,
    					"lsj": 0,
    					"kcxx": 0,
    					"kcsx": 0,
    					"unitid": "18",
    					"unitname": "公斤",
    					"kindname": "奶粉"
    				}
    			]
    		},
    		{
    			"cols": [
    				{
    					"name": "unitid",
    					"size": 4,
    					"type": "string"
    				},
    				{
    					"name": "unitname",
    					"size": 6,
    					"type": "string"
    				}
    			],
    			"rows": [
    				{
    					"unitid": "11",
    					"unitname": "个"
    				},
    				{
    					"unitid": "12",
    					"unitname": "双"
    				}
    			]
    		}
    	]
    }
    

      

  • 相关阅读:
    as
    留言板
    HEOI2020游记
    min_25筛学习笔记
    计算几何初步
    「狗屁不会」exlucas
    GCD of Sequence
    做题记录
    一些奇怪的坑+好东西
    关于我
  • 原文地址:https://www.cnblogs.com/hnxxcxg/p/10656990.html
Copyright © 2020-2023  润新知