فهرست منبع

✨ feat(entity): add creator and updater tracking fields to multiple entities

- 添加created_by字段用于记录创建用户ID
- 添加updated_by字段用于记录更新用户ID
- 涉及实体包括: card, goods-category, goods, express-company, organization, supplier, city, config
yourname 4 ماه پیش
والد
کامیت
4782fdc5b7

+ 6 - 0
src/server/modules/card/card.entity.ts

@@ -30,6 +30,12 @@ export class Card {
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
 
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
+
   @ManyToOne(() => User, { nullable: true })
   @JoinColumn({ name: 'agent_id', referencedColumnName: 'id' })
   agent!: User | null;

+ 6 - 0
src/server/modules/goods/goods-category.entity.ts

@@ -27,6 +27,12 @@ export class GoodsCategory {
   @Column({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', comment: '更新时间' })
   updatedAt!: Date;
 
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
+
   @ManyToOne(() => File, { nullable: true })
   @JoinColumn({ name: 'image_file_id', referencedColumnName: 'id' })
   imageFile!: File | null;

+ 6 - 0
src/server/modules/goods/goods.entity.ts

@@ -74,6 +74,12 @@ export class Goods {
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
 
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
+
   @ManyToOne(() => GoodsCategory, { nullable: true })
   @JoinColumn({ name: 'category_id1', referencedColumnName: 'id' })
   category1!: GoodsCategory | null;

+ 6 - 0
src/server/modules/logistics/express-company.entity.ts

@@ -22,4 +22,10 @@ export class ExpressCompany {
 
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
+
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
 }

+ 6 - 0
src/server/modules/organization/organization.entity.ts

@@ -22,4 +22,10 @@ export class Organization {
 
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
+
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
 }

+ 6 - 0
src/server/modules/supplier/supplier.entity.ts

@@ -46,4 +46,10 @@ export class Supplier {
 
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
+
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
 }

+ 6 - 0
src/server/modules/system/city.entity.ts

@@ -25,4 +25,10 @@ export class City {
 
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
+
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
 }

+ 6 - 0
src/server/modules/system/config.entity.ts

@@ -19,4 +19,10 @@ export class Config {
 
   @UpdateDateColumn({ name: 'updated_at', type: 'timestamp', comment: '更新时间' })
   updatedAt!: Date;
+
+  @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
+  createdBy!: number | null;
+
+  @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
+  updatedBy!: number | null;
 }