from Utils.ObjUtil import SpecObject from Utils.ValidateUtil import ValidateAttr, Validate class BranchList(SpecObject): """分支列表""" cid = ValidateAttr(field='cid', type=str, default=None) cname = ValidateAttr(field='cname', type=str) leader = ValidateAttr(field='leader', type=str) establishment_date = ValidateAttr(field='establishment_date', fun=Validate.date_format) status = ValidateAttr(field='status', type=str) province = ValidateAttr(field='province', type=str) city = ValidateAttr(field='city', type=str, default=None) fields_map = { "cid": "企业ID", "cname": "企业名称", "leader": "负责人", "establishment_date": "成立日期", "status": "企业状态", "province": "所属省份", "city": "所属地市" } class BranchObj(SpecObject): """分支列表""" cid = ValidateAttr(field='cid', type=str, length=8) cname = ValidateAttr(field='cname', type=str) branch_list = ValidateAttr(field='branch_list', instance_list=BranchList) update_time = ValidateAttr(field='update_time', func=Validate.time_format) fields_map = { "cid": "企业ID", "cname": "企业名称", "branch_list": "分支列表", "update_time": "更新时间" }