|
|
@@ -57,44 +57,52 @@ export class OrderRecord {
|
|
|
|
|
|
@Column({ name: 'updated_at', type: 'timestamp', default: () => 'CURRENT_TIMESTAMP', onUpdate: 'CURRENT_TIMESTAMP', comment: '更新时间' })
|
|
|
updatedAt!: Date;
|
|
|
+
|
|
|
+ @Column({ name: 'created_by', type: 'int', unsigned: true, nullable: true, comment: '创建用户ID' })
|
|
|
+ createdBy?: number;
|
|
|
+
|
|
|
+ @Column({ name: 'updated_by', type: 'int', unsigned: true, nullable: true, comment: '更新用户ID' })
|
|
|
+ updatedBy?: number;
|
|
|
}
|
|
|
|
|
|
// 基础Schema
|
|
|
export const OrderRecordSchema = z.object({
|
|
|
- id: z.number().int().positive().openapi({ description: '记录ID' }),
|
|
|
- orderNumber: z.string().max(50).openapi({ description: '订单编号', example: 'ORD202407150001' }),
|
|
|
- orderDate: z.string().datetime().openapi({ description: '下单日期', example: '2024-07-15' }),
|
|
|
- deliveryDate: z.string().datetime().nullable().openapi({ description: '交单日期', example: '2024-07-20' }),
|
|
|
- advancePayment: z.coerce.number().multipleOf(0.01).openapi({ description: '预付款', example: 1000.00 }),
|
|
|
- orderAmount: z.coerce.number().multipleOf(0.01).openapi({ description: '订单金额', example: 5000.00 }),
|
|
|
- orderStatus: z.coerce.number().int().min(0).max(1).openapi({ description: '订单状态(0-未处理,1-已完成)', example: 0 }),
|
|
|
- clientId: z.number().int().positive().nullable().openapi({ description: '客户ID', example: 1 }),
|
|
|
- linkmanId: z.number().int().positive().nullable().openapi({ description: '联系人ID', example: 1 }),
|
|
|
- userId: z.number().int().positive().nullable().openapi({ description: '业务员用户ID', example: 1 }),
|
|
|
- isDeleted: z.coerce.number().int().min(0).max(1).default(0).openapi({ description: '删除状态', example: 0 }),
|
|
|
- createdAt: z.string().datetime().openapi({ description: '录入时间', example: '2024-07-15T12:00:00Z' }),
|
|
|
- updatedAt: z.string().datetime().openapi({ description: '更新时间', example: '2024-07-15T12:00:00Z' }),
|
|
|
- client: z.object({
|
|
|
- id: z.number(),
|
|
|
- companyName: z.string(),
|
|
|
- contactPerson: z.string().nullable()
|
|
|
- }).nullable().optional().openapi({
|
|
|
- description: '关联客户信息'
|
|
|
- }),
|
|
|
- linkman: z.object({
|
|
|
- id: z.number(),
|
|
|
- name: z.string(),
|
|
|
- mobile: z.string().nullable()
|
|
|
- }).nullable().optional().openapi({
|
|
|
- description: '关联联系人信息'
|
|
|
- }),
|
|
|
- user: z.object({
|
|
|
- id: z.number(),
|
|
|
- username: z.string(),
|
|
|
- name: z.string().nullable()
|
|
|
- }).nullable().optional().openapi({
|
|
|
- description: '关联业务员信息'
|
|
|
- })
|
|
|
+id: z.number().int().positive().openapi({ description: '记录ID' }),
|
|
|
+orderNumber: z.string().max(50).openapi({ description: '订单编号', example: 'ORD202407150001' }),
|
|
|
+orderDate: z.string().datetime().openapi({ description: '下单日期', example: '2024-07-15' }),
|
|
|
+deliveryDate: z.string().datetime().nullable().openapi({ description: '交单日期', example: '2024-07-20' }),
|
|
|
+advancePayment: z.coerce.number().multipleOf(0.01).openapi({ description: '预付款', example: 1000.00 }),
|
|
|
+orderAmount: z.coerce.number().multipleOf(0.01).openapi({ description: '订单金额', example: 5000.00 }),
|
|
|
+orderStatus: z.coerce.number().int().min(0).max(1).openapi({ description: '订单状态(0-未处理,1-已完成)', example: 0 }),
|
|
|
+clientId: z.number().int().positive().nullable().openapi({ description: '客户ID', example: 1 }),
|
|
|
+linkmanId: z.number().int().positive().nullable().openapi({ description: '联系人ID', example: 1 }),
|
|
|
+userId: z.number().int().positive().nullable().openapi({ description: '业务员用户ID', example: 1 }),
|
|
|
+isDeleted: z.coerce.number().int().min(0).max(1).default(0).openapi({ description: '删除状态', example: 0 }),
|
|
|
+createdAt: z.string().datetime().openapi({ description: '录入时间', example: '2024-07-15T12:00:00Z' }),
|
|
|
+updatedAt: z.string().datetime().openapi({ description: '更新时间', example: '2024-07-15T12:00:00Z' }),
|
|
|
+createdBy: z.number().int().positive().nullable().openapi({ description: '创建用户ID', example: 1 }),
|
|
|
+updatedBy: z.number().int().positive().nullable().openapi({ description: '更新用户ID', example: 1 }),
|
|
|
+client: z.object({
|
|
|
+ id: z.number(),
|
|
|
+ companyName: z.string(),
|
|
|
+ contactPerson: z.string().nullable()
|
|
|
+}).nullable().optional().openapi({
|
|
|
+ description: '关联客户信息'
|
|
|
+}),
|
|
|
+linkman: z.object({
|
|
|
+ id: z.number(),
|
|
|
+ name: z.string(),
|
|
|
+ mobile: z.string().nullable()
|
|
|
+}).nullable().optional().openapi({
|
|
|
+ description: '关联联系人信息'
|
|
|
+}),
|
|
|
+user: z.object({
|
|
|
+ id: z.number(),
|
|
|
+ username: z.string(),
|
|
|
+ name: z.string().nullable()
|
|
|
+}).nullable().optional().openapi({
|
|
|
+ description: '关联业务员信息'
|
|
|
+})
|
|
|
});
|
|
|
|
|
|
// 创建DTO
|