agent.entity.ts 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';
  2. @Entity('agent')
  3. export class Agent {
  4. @PrimaryGeneratedColumn({ unsigned: true })
  5. id!: number;
  6. @Column({ name: 'name', type: 'varchar', length: 255, nullable: true, comment: '代理商名称' })
  7. name!: string | null;
  8. @Column({ name: 'username', type: 'varchar', length: 20, unique: true, comment: '用户名' })
  9. username!: string;
  10. @Column({ name: 'password', type: 'varchar', length: 255, comment: '密码' })
  11. password!: string;
  12. @Column({ name: 'phone', type: 'char', length: 11, nullable: true, comment: '手机号码' })
  13. phone!: string | null;
  14. @Column({ name: 'realname', type: 'varchar', length: 20, nullable: true, comment: '姓名' })
  15. realname!: string | null;
  16. @Column({ name: 'login_num', type: 'int', unsigned: true, default: 0, comment: '登录次数' })
  17. loginNum!: number;
  18. @Column({ name: 'login_time', type: 'int', unsigned: true, default: 0, comment: '登录时间' })
  19. loginTime!: number;
  20. @Column({ name: 'login_ip', type: 'varchar', length: 15, nullable: true, comment: '登录IP' })
  21. loginIp!: string | null;
  22. @Column({ name: 'last_login_time', type: 'int', unsigned: true, default: 0, comment: '上次登录时间' })
  23. lastLoginTime!: number;
  24. @Column({ name: 'last_login_ip', type: 'varchar', length: 15, nullable: true, comment: '上次登录IP' })
  25. lastLoginIp!: string | null;
  26. @Column({ name: 'state', type: 'smallint', unsigned: true, default: 2, comment: '状态 1启用 2禁用' })
  27. state!: number;
  28. @CreateDateColumn({ name: 'created_at', type: 'timestamp', comment: '创建时间' })
  29. createdAt!: Date;
  30. @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
  31. updatedAt!: Date;
  32. @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
  33. createdBy!: number | null;
  34. @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
  35. updatedBy!: number | null;
  36. }