import {BaseEntity,Entity,Column,Id,JoinColumn,ManyToOne,OneToMany,EntityProxy, ManyToMany, JoinTable} from 'relaen'; import {AmCompany} from './amcompany'; import {AmAlgorithm} from './amalgorithm'; import {AmAlgorithmUseLog} from './amalgorithmuselog'; import {AmDataDownloadLog} from './amdatadownloadlog'; import {AmDataImport} from './amdataimport'; import {AmDataVisitLog} from './amdatavisitlog'; import {AmGroupUser} from './amgroupuser'; import {AmImportTemplate} from './amimporttemplate'; import {AmTarget} from './amtarget'; import {AmTemplateUseLog} from './amtemplateuselog'; import { AmGroup } from './amgroup'; @Entity("AM_USER") export class AmUser extends BaseEntity{ @Id() @Column({ name:'USER_ID', type:'int', nullable:false }) public userId:number; @ManyToOne({entity:'AmCompany'}) @JoinColumn({ name:'COMPANY_ID', refName:'COMPANY_ID', nullable:true }) public amCompany:AmCompany; @Column({ name:'PWD', type:'string', nullable:false, length:32 }) public pwd:string; @Column({ name:'USER_NAME', type:'string', nullable:false, length:64 }) public userName:string; @Column({ name:'REAL_NAME', type:'string', nullable:false, length:64 }) public realName:string; @Column({ name:'TEL', type:'string', nullable:true, length:15 }) public tel:string; @Column({ name:'MOBILE', type:'string', nullable:true, length:11 }) public mobile:string; @Column({ name:'EMAIL', type:'string', nullable:true, length:50 }) public email:string; @Column({ name:'ENABLED', type:'int', nullable:true }) public enabled:number; @Column({ name:'REMARKS', type:'string', nullable:true, length:256 }) public remarks:string; @OneToMany({ entity:'AmAlgorithm', mappedBy:'amUser' }) public amAlgorithms:Array; @OneToMany({ entity:'AmAlgorithmUseLog', mappedBy:'amUser' }) public amAlgorithmUseLogs:Array; @OneToMany({ entity:'AmDataDownloadLog', mappedBy:'amUser' }) public amDataDownloadLogs:Array; @OneToMany({ entity:'AmDataImport', mappedBy:'amUser' }) public amDataImports:Array; @OneToMany({ entity:'AmDataVisitLog', mappedBy:'amUser' }) public amDataVisitLogs:Array; @ManyToMany({entity:'AmGroup'}) @JoinTable({ //中间表名 table:'AM_GROUP_USER', //中间表字段名(本表在中间表的字段名,默认为主键) columnName:'USER_ID', //关联字段名 refName:'GROUP_ID' }) public amGroups:Array; @OneToMany({ entity:'AmImportTemplate', mappedBy:'amUser' }) public amImportTemplates:Array; @OneToMany({ entity:'AmTarget', mappedBy:'amUser' }) public amTargets:Array; @OneToMany({ entity:'AmTemplateUseLog', mappedBy:'amUser' }) public amTemplateUseLogs:Array; constructor(idValue?:number){ super(); this.userId = idValue; } public async getAmCompany():Promise{ return this['amCompany']?this['amCompany']:await EntityProxy.get(this,'amCompany'); } public async getAmAlgorithms():Promise>{ return this['amAlgorithms']?this['amAlgorithms']:await EntityProxy.get(this,'amAlgorithms'); } public async getAmAlgorithmUseLogs():Promise>{ return this['amAlgorithmUseLogs']?this['amAlgorithmUseLogs']:await EntityProxy.get(this,'amAlgorithmUseLogs'); } public async getAmDataDownloadLogs():Promise>{ return this['amDataDownloadLogs']?this['amDataDownloadLogs']:await EntityProxy.get(this,'amDataDownloadLogs'); } public async getAmDataImports():Promise>{ return this['amDataImports']?this['amDataImports']:await EntityProxy.get(this,'amDataImports'); } public async getAmDataVisitLogs():Promise>{ return this['amDataVisitLogs']?this['amDataVisitLogs']:await EntityProxy.get(this,'amDataVisitLogs'); } public async getAmGroups():Promise>{ return this['amGroups']?this['amGroups']:await EntityProxy.get(this,'amGroups'); } public async getAmImportTemplates():Promise>{ return this['amImportTemplates']?this['amImportTemplates']:await EntityProxy.get(this,'amImportTemplates'); } public async getAmTargets():Promise>{ return this['amTargets']?this['amTargets']:await EntityProxy.get(this,'amTargets'); } public async getAmTemplateUseLogs():Promise>{ return this['amTemplateUseLogs']?this['amTemplateUseLogs']:await EntityProxy.get(this,'amTemplateUseLogs'); } }