通过TCustomAttribute和反射实现动态查询(三)
最后,我实现了一个基本信息(商品信息)的查询类。
type /// <summary> /// 商品动态模糊查询类 /// </summary> [TBIQueryMain('product', smtRight)] TBIGoodsSearchClass = class(TBISearchBaseClass) private FName: string; FFullID: string; FCostMethod: Integer; FCode: string; FProdSpec: string; FSonCount: Integer; FBack8: string; FBack9: string; FBack10: string; FRemark: string; FBarCode: string; FID: Integer; FBack2: string; FBack3: string; FFastCode: string; FBack1: string; FAlias: string; FBack6: string; FBack7: string; FBack4: string; FBack5: string; FProdType: string; FProdArea: string; procedure SetAlias(const Value: string); procedure SetBack1(const Value: string); procedure SetBack10(const Value: string); procedure SetBack2(const Value: string); procedure SetBack3(const Value: string); procedure SetBack4(const Value: string); procedure SetBack5(const Value: string); procedure SetBack6(const Value: string); procedure SetBack7(const Value: string); procedure SetBack8(const Value: string); procedure SetBack9(const Value: string); procedure SetBarCode(const Value: string); procedure SetCode(const Value: string); procedure SetCostMethod(const Value: Integer); procedure SetFastCode(const Value: string); procedure SetFullID(const Value: string); procedure SetID(const Value: Integer); procedure SetName(const Value: string); procedure SetProdArea(const Value: string); procedure SetProdSpec(const Value: string); procedure SetProdType(const Value: string); procedure SetRemark(const Value: string); procedure SetSonCount(const Value: Integer); public [TBIQuerySelect('product','s_id','ID','s_id',False,True)] property ID : Integer read FID write SetID; [TBIQuerySelect('product','s_fullid','fullid','s_fullid',False,True)] property FullID : string read FFullID write SetFullID; [TBIQuerySelect('product','s_soncount','儿子数','s_soncount',False,True)] property SonCount : Integer read FSonCount write SetSonCount; [TBIQueryWhere('product','u_name','全名','',True)] [TBIQuerySelect('product','u_name','全名')] property Name : string read FName write SetName; [TBIQueryWhere('product','u_code','编码','',True)] [TBIQuerySelect('product','u_code','编码')] property Code : string read FCode write SetCode; [TBIQueryWhere('product', 'u_alias','别名','',True)] [TBIQuerySelect('product','u_alias','别名')] property Alias : string read FAlias write SetAlias; [TBIQueryWhere('product','u_fastCode','助记码','',True)] [TBIQuerySelect('product','u_fastCode','助记码')] property FastCode : string read FFastCode write SetFastCode; [TBIQueryWhere('product','u_remark','备注')] [TBIQuerySelect('product','u_remark','备注')] property Remark : string read FRemark write SetRemark; [TBIQueryWhere('product','prodspec','规格')] [TBIQuerySelect('product','prodspec','规格')] property ProdSpec : string read FProdSpec write SetProdSpec; [TBIQueryWhere('product','prodtype','型号')] [TBIQuerySelect('product','prodtype','型号')] property ProdType : string read FProdType write SetProdType; [TBIQueryWhere('product','prodarea','产地')] [TBIQuerySelect('product','prodarea','产地')] property ProdArea : string read FProdArea write SetProdArea; [TBIQueryWhere('product','barcode','条码')] [TBIQuerySelect('product','barcode','条码')] property BarCode : string read FBarCode write SetBarCode; [TBIQueryWhere('product','costmethod','成本算法ID')] [TBIQuerySelect('product','costmethod','成本算法ID')] property CostMethod : Integer read FCostMethod write SetCostMethod; [TBIQueryWhere('product','back1','自定义1')] [TBIQuerySelect('product','back1','自定义1')] property Back1 : string read FBack1 write SetBack1; [TBIQueryWhere('product','back2','自定义2')] [TBIQuerySelect('product','back2','自定义2')] property Back2 : string read FBack2 write SetBack2; [TBIQueryWhere('product','back3','自定义3')] [TBIQuerySelect('product','back3','自定义3')] property Back3 : string read FBack3 write SetBack3; [TBIQueryWhere('product','back4','自定义4')] [TBIQuerySelect('product','back4','自定义4')] property Back4 : string read FBack4 write SetBack4; [TBIQueryWhere('product','back5','自定义5')] [TBIQuerySelect('product','back5','自定义5')] property Back5 : string read FBack5 write SetBack5; [TBIQueryWhere('product','back6','自定义6')] [TBIQuerySelect('product','back6','自定义6')] property Back6 : string read FBack6 write SetBack6; [TBIQueryWhere('product','back7','自定义7')] [TBIQuerySelect('product','back7','自定义7')] property Back7 : string read FBack7 write SetBack7; [TBIQueryWhere('product','back8','自定义8')] [TBIQuerySelect('product','back8','自定义8')] property Back8 : string read FBack8 write SetBack8; [TBIQueryWhere('product','back9','自定义9')] [TBIQuerySelect('product','back9','自定义9')] property Back9 : string read FBack9 write SetBack9; [TBIQueryWhere('product','back10','自定义10')] [TBIQuerySelect('product','back10','自定义10')] property Back10 : string read FBack10 write SetBack10; end;
Demo界面