company.entity.ts 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import { Entity, Column, PrimaryGeneratedColumn, ManyToOne, JoinColumn, Index } from 'typeorm';
  2. import { Platform } from '@d8d/allin-platform-module/entities';
  3. @Entity('employer_company')
  4. @Index('idx_company_name_platform', ['companyName', 'platformId'], { unique: true })
  5. export class Company {
  6. @PrimaryGeneratedColumn({
  7. name: 'company_id',
  8. type: 'int',
  9. unsigned: true,
  10. comment: '公司ID'
  11. })
  12. id!: number;
  13. @Column({
  14. name: 'platform_id',
  15. type: 'int',
  16. unsigned: true,
  17. nullable: true,
  18. comment: '平台ID'
  19. })
  20. platformId!: number | null;
  21. @Column({
  22. name: 'company_name',
  23. type: 'varchar',
  24. length: 100,
  25. nullable: false,
  26. comment: '公司名称'
  27. })
  28. companyName!: string;
  29. @Column({
  30. name: 'contact_person',
  31. type: 'varchar',
  32. length: 50,
  33. nullable: true,
  34. comment: '联系人'
  35. })
  36. contactPerson!: string | null;
  37. @Column({
  38. name: 'contact_phone',
  39. type: 'varchar',
  40. length: 20,
  41. nullable: true,
  42. comment: '联系电话'
  43. })
  44. contactPhone!: string | null;
  45. @Column({
  46. name: 'contact_email',
  47. type: 'varchar',
  48. length: 100,
  49. nullable: true,
  50. comment: '联系邮箱'
  51. })
  52. contactEmail!: string | null;
  53. @Column({
  54. name: 'address',
  55. type: 'varchar',
  56. length: 200,
  57. nullable: true,
  58. comment: '地址'
  59. })
  60. address!: string | null;
  61. @Column({
  62. name: 'status',
  63. type: 'int',
  64. default: 1,
  65. comment: '状态:1-正常,0-禁用'
  66. })
  67. status!: number;
  68. @Column({
  69. name: 'create_time',
  70. type: 'timestamp',
  71. default: () => 'CURRENT_TIMESTAMP',
  72. comment: '创建时间'
  73. })
  74. createTime!: Date;
  75. @Column({
  76. name: 'update_time',
  77. type: 'timestamp',
  78. default: () => 'CURRENT_TIMESTAMP',
  79. onUpdate: 'CURRENT_TIMESTAMP',
  80. comment: '更新时间'
  81. })
  82. updateTime!: Date;
  83. @ManyToOne(() => Platform, { eager: true })
  84. @JoinColumn({ name: 'platform_id' })
  85. platform?: Platform;
  86. }