channel.entity.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { Entity, Column, PrimaryGeneratedColumn, Index } from 'typeorm';
  2. @Entity('channel_info')
  3. export class Channel {
  4. @PrimaryGeneratedColumn({
  5. name: 'channel_id',
  6. type: 'int',
  7. unsigned: true,
  8. comment: '渠道ID'
  9. })
  10. id!: number;
  11. @Column({
  12. name: 'channel_name',
  13. type: 'varchar',
  14. length: 100,
  15. nullable: false,
  16. comment: '渠道名称'
  17. })
  18. @Index('idx_channel_name', { unique: true })
  19. channelName!: string;
  20. @Column({
  21. name: 'channel_type',
  22. type: 'varchar',
  23. length: 50,
  24. nullable: false,
  25. default: '',
  26. comment: '渠道类型'
  27. })
  28. channelType!: string;
  29. @Column({
  30. name: 'contact_person',
  31. type: 'varchar',
  32. length: 50,
  33. nullable: false,
  34. default: '',
  35. comment: '联系人'
  36. })
  37. contactPerson!: string;
  38. @Column({
  39. name: 'contact_phone',
  40. type: 'varchar',
  41. length: 20,
  42. nullable: false,
  43. default: '',
  44. comment: '联系电话'
  45. })
  46. contactPhone!: string;
  47. @Column({
  48. name: 'description',
  49. type: 'text',
  50. nullable: true,
  51. comment: '描述'
  52. })
  53. description?: string;
  54. @Column({
  55. name: 'status',
  56. type: 'int',
  57. default: 1,
  58. comment: '状态:1-正常,0-禁用'
  59. })
  60. status!: number;
  61. @Column({
  62. name: 'create_time',
  63. type: 'timestamp',
  64. default: () => 'CURRENT_TIMESTAMP',
  65. comment: '创建时间'
  66. })
  67. createTime!: Date;
  68. @Column({
  69. name: 'update_time',
  70. type: 'timestamp',
  71. default: () => 'CURRENT_TIMESTAMP',
  72. onUpdate: 'CURRENT_TIMESTAMP',
  73. comment: '更新时间'
  74. })
  75. updateTime!: Date;
  76. }