Files
smart_grid_iot/server/src/entity/sys_job.entity.ts
T
andyesfly 22d27a940d feat: 重构勘察业务为明细模式并新增定时任务人性化配置
- 重构勘察业务:移除SOP相关表,新增勘察明细表支持建筑/楼层/房间/照片管理
- 新增定时任务人性化频率配置,支持分钟/小时/天/周/月/自定义六种模式
- 新增频率预览接口,支持配置转换为cron表达式与执行时间预览
- 更新系统品牌名称为鑫潼智电,修改全局标题与登录页文案
2026-10-17 10:08:42 +08:00

120 lines
2.2 KiB
TypeScript

import { Column, Model, Table, DataType, CreatedAt, UpdatedAt } from "sequelize-typescript";
@Table({
tableName: "sys_job",
comment: "定时任务定义与调度配置表",
timestamps: true,
createdAt: "created_at",
updatedAt: "updated_at"
})
export default class SysJob extends Model {
@Column({
type: DataType.BIGINT,
autoIncrement: true,
primaryKey: true
})
id!: number;
@Column({
type: DataType.STRING(64),
field: "job_key",
comment: "任务键(唯一标识)"
})
jobKey!: string;
@Column({
type: DataType.STRING(64),
field: "job_name",
comment: "任务名称"
})
jobName!: string;
@Column({
type: DataType.STRING(64),
field: "cron_expression",
comment: "cron 表达式"
})
cronExpression!: string;
@Column({
type: DataType.STRING(16),
field: "freq_type",
comment: "频率类型: minute/hour/day/week/month/custom"
})
freqType!: string;
@Column({
type: DataType.JSONB,
field: "freq_config",
comment: "频率配置(人性化配置表单回填用)"
})
freqConfig!: Record<string, any>;
@Column({
type: DataType.JSONB,
field: "params",
comment: "任务参数(JSONB)"
})
params!: Record<string, any>;
@Column({
type: DataType.SMALLINT,
field: "retry_times",
comment: "重试次数"
})
retryTimes!: number;
@Column({
type: DataType.INTEGER,
field: "retry_interval",
comment: "重试间隔(秒)"
})
retryInterval!: number;
@Column({
type: DataType.SMALLINT,
comment: "状态: 1-启用 0-停用"
})
status!: number;
@Column({
type: DataType.STRING(255),
comment: "备注"
})
remark!: string | null;
@Column({
type: DataType.DATE,
field: "last_run_at",
comment: "上次执行时间"
})
lastRunAt!: Date | null;
@Column({
type: DataType.SMALLINT,
field: "last_run_status",
comment: "上次执行状态: 1-成功 2-失败 3-跳过"
})
lastRunStatus!: number | null;
@Column({
type: DataType.INTEGER,
field: "last_run_cost_ms",
comment: "上次执行耗时(毫秒)"
})
lastRunCostMs!: number | null;
@Column({
type: DataType.TEXT,
field: "last_error",
comment: "上次失败原因"
})
lastError!: string | null;
@CreatedAt
created_at!: Date;
@UpdatedAt
updated_at!: Date;
}