import {BaseEntity,Entity,Column,Id,JoinColumn,ManyToOne,OneToMany,EntityProxy} from 'relaen'; import {AmUser} from './amuser'; import {TestCond} from '../app/testcond'; import {TestModel} from '../app/testmodel'; @Entity("AM_TARGET") export class AmTarget extends BaseEntity{ @Id() @Column({ name:'TARGET_ID', type:'int', nullable:false }) public targetId:number; @Column({ name:'TARGET_NAME', type:'string', nullable:false, length:128 }) public targetName:string; @Column({ name:'TARGET_CODE', type:'string', nullable:true, length:128 }) public targetCode:string; @ManyToOne({entity:'AmUser'}) @JoinColumn({ name:'USER_ID', refName:'USER_ID', nullable:true }) public amUser:AmUser; @ManyToOne({entity:'AmTarget'}) @JoinColumn({ name:'PARENT_ID', refName:'TARGET_ID', nullable:true }) public amTarget:AmTarget; @Column({ name:'CREATE_TIME', type:'int', nullable:true }) public createTime:number; @Column({ name:'ENTITY_NAME', type:'string', nullable:true }) public entityName:string; @Column({ name:'SHOW_NAME', type:'string', nullable:true }) public showName:string; @Column({ name:'REMARKS', type:'string', nullable:true, length:512 }) public remarks:string; @OneToMany({ entity:'AmTarget', mappedBy:'amTarget' }) public amTargets:Array; @OneToMany({ entity:'TestCond', mappedBy:'amTarget' }) public testConds:Array; @OneToMany({ entity:'TestModel', mappedBy:'amTarget' }) public testModels:Array; constructor(idValue?:number){ super(); this.targetId = idValue; } public async getAmUser():Promise{ return this['amUser']?this['amUser']:await EntityProxy.get(this,'amUser'); } public async getAmTarget():Promise{ return this['amTarget']?this['amTarget']:await EntityProxy.get(this,'amTarget'); } public async getAmTargets():Promise>{ return this['amTargets']?this['amTargets']:await EntityProxy.get(this,'amTargets'); } public async getTestConds():Promise>{ return this['testConds']?this['testConds']:await EntityProxy.get(this,'testConds'); } public async getTestModels():Promise>{ return this['testModels']?this['testModels']:await EntityProxy.get(this,'testModels'); } }