| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { Entity, PrimaryGeneratedColumn, Column, ManyToMany, JoinTable, CreateDateColumn, UpdateDateColumn } from 'typeorm';
- import { Role } from '../../src/entities/role.entity';
- import { DeleteStatus, DisabledStatus } from '@d8d/shared-types';
- @Entity({ name: 'users_mt' })
- export class TestUserEntity {
- @PrimaryGeneratedColumn({ unsigned: true, comment: '用户ID' })
- id!: number;
- @Column({ name: 'tenant_id', type: 'int', unsigned: true, comment: '租户ID' })
- tenantId!: number;
- @Column({ name: 'username', type: 'varchar', length: 255, comment: '用户名' })
- username!: string;
- @Column({ name: 'password', type: 'varchar', length: 255, comment: '密码' })
- password!: string;
- @Column({ name: 'phone', type: 'varchar', length: 255, nullable: true, comment: '手机号' })
- phone!: string | null;
- @Column({ name: 'email', type: 'varchar', length: 255, nullable: true, comment: '邮箱' })
- email!: string | null;
- @Column({ name: 'nickname', type: 'varchar', length: 255, nullable: true, comment: '昵称' })
- nickname!: string | null;
- @Column({ name: 'name', type: 'varchar', length: 255, nullable: true, comment: '真实姓名' })
- name!: string | null;
- @Column({ name: 'is_disabled', type: 'int', default: DisabledStatus.ENABLED, comment: '是否禁用(0:启用,1:禁用)' })
- isDisabled!: DisabledStatus;
- @Column({ name: 'is_deleted', type: 'int', default: DeleteStatus.NOT_DELETED, comment: '是否删除(0:未删除,1:已删除)' })
- isDeleted!: DeleteStatus;
- @Column({ name: 'openid', type: 'varchar', length: 255, nullable: true, unique: true, comment: '微信小程序openid' })
- openid!: string | null;
- @Column({ name: 'unionid', type: 'varchar', length: 255, nullable: true, comment: '微信unionid' })
- unionid!: string | null;
- @Column({ name: 'registration_source', type: 'varchar', length: 20, default: 'web', comment: '注册来源: web, miniapp' })
- registrationSource!: string;
- @ManyToMany(() => Role)
- @JoinTable()
- roles!: Role[];
- @CreateDateColumn({ name: 'created_at', type: 'timestamp' })
- createdAt!: Date;
- @UpdateDateColumn({ name: 'updated_at', type: 'timestamp' })
- updatedAt!: Date;
- constructor(partial?: Partial<TestUserEntity>) {
- Object.assign(this, partial);
- }
- }
|