fix: PDmanReader 读取json未判断是否存在domain

master
old-tom 2 years ago
parent bfbb104199
commit 49ec70ea02

@ -97,7 +97,7 @@ class PDmanReader(object):
def _fields_convert(self, fields):
rt = []
for f in fields:
if len(f['domain']) > 0:
if 'domain' in f.keys() and len(f['domain']) > 0:
f['type'] = self.domains[f['domain']]
elif len(str(f['len'])) > 0 and len(str(f['scale'])) == 0:
f['type'] = f['type'] + '(' + str(f['len']) + ')'
@ -111,7 +111,7 @@ class PDmanReader(object):
#
if __name__ == '__main__':
pdfile = r'D:\文档\工作\ATD\2023上半年\项目\昭通OA\表结构\昭通OA.pdma.json'
pdfile = r'C:\Users\89295\Desktop\昭通OA.pdma.json'
reader = PDmanReader(pdfile)
all_table = reader.read_by_module('TEST')
print(all_table['test'])
all_table = reader.read_by_module('OA_CAR')
print(all_table)

Loading…
Cancel
Save