- 重构勘察业务:移除SOP相关表,新增勘察明细表支持建筑/楼层/房间/照片管理 - 新增定时任务人性化频率配置,支持分钟/小时/天/周/月/自定义六种模式 - 新增频率预览接口,支持配置转换为cron表达式与执行时间预览 - 更新系统品牌名称为鑫潼智电,修改全局标题与登录页文案
50 lines
1.8 KiB
TypeScript
50 lines
1.8 KiB
TypeScript
import { Column, Model, Table, DataType, CreatedAt, UpdatedAt, ForeignKey, BelongsTo } from "sequelize-typescript";
|
||
import SurveyOrder from "./survey_order.entity";
|
||
|
||
@Table({
|
||
tableName: "survey_detail",
|
||
comment: "勘察工单明细表(建筑/楼层/房间 + 现场照片)",
|
||
timestamps: true,
|
||
createdAt: "created_at",
|
||
updatedAt: "updated_at",
|
||
indexes: [{ name: "idx_survey_detail_order", fields: ["survey_order_id"] }]
|
||
})
|
||
export default class SurveyDetail extends Model {
|
||
@Column({ type: DataType.BIGINT, autoIncrement: true, primaryKey: true })
|
||
id!: number;
|
||
|
||
@ForeignKey(() => SurveyOrder)
|
||
@Column({ type: DataType.BIGINT, allowNull: false, field: "survey_order_id", comment: "勘察工单ID(→ survey_order)" })
|
||
surveyOrderId!: number;
|
||
|
||
@Column({ type: DataType.BIGINT, field: "building_id", comment: "建筑ID(→ customer_building)" })
|
||
buildingId!: number;
|
||
|
||
@Column({ type: DataType.STRING(128), field: "building_name", comment: "建筑名称(冗余,客户拓扑变更后仍可读)" })
|
||
buildingName!: string;
|
||
|
||
@Column({ type: DataType.STRING(16), field: "floor_no", comment: "所在楼层:正数为地上、负数为地下,如 1 / -1" })
|
||
floorNo!: string;
|
||
|
||
@Column({ type: DataType.BIGINT, field: "room_id", comment: "房间ID(→ customer_room,可空)" })
|
||
roomId!: number;
|
||
|
||
@Column({ type: DataType.STRING(128), field: "room_name", comment: "房间名称(冗余,可空)" })
|
||
roomName!: string;
|
||
|
||
@Column({ type: DataType.TEXT, field: "photos", comment: "现场照片对象key(JSON数组字符串)" })
|
||
photos!: string;
|
||
|
||
@Column({ type: DataType.STRING(255), comment: "备注" })
|
||
remark!: string;
|
||
|
||
@BelongsTo(() => SurveyOrder, { foreignKey: "surveyOrderId", as: "surveyOrder" })
|
||
surveyOrder!: SurveyOrder;
|
||
|
||
@CreatedAt
|
||
created_at!: Date;
|
||
|
||
@UpdatedAt
|
||
updated_at!: Date;
|
||
}
|