feat: 调度任务支持是否进行日志记录

This commit is contained in:
TsMask
2023-10-23 18:01:50 +08:00
parent d45e171e96
commit ad586a992f
4 changed files with 93 additions and 51 deletions

View File

@@ -20,6 +20,8 @@ type SysJob struct {
Concurrent string `json:"concurrent"`
// 任务状态0暂停 1正常
Status string `json:"status"`
// 是否记录任务日志
SaveLog string `json:"saveLog"`
// 创建者
CreateBy string `json:"createBy"`
// 创建时间

View File

@@ -15,7 +15,7 @@ import (
// 实例化数据层 SysJobImpl 结构体
var NewSysJobImpl = &SysJobImpl{
selectSql: `select job_id, job_name, job_group, invoke_target, target_params, cron_expression,
misfire_policy, concurrent, status, create_by, create_time, remark from sys_job`,
misfire_policy, concurrent, status, save_log, create_by, create_time, remark from sys_job`,
resultMap: map[string]string{
"job_id": "JobID",
@@ -27,6 +27,7 @@ var NewSysJobImpl = &SysJobImpl{
"misfire_policy": "MisfirePolicy",
"concurrent": "Concurrent",
"status": "Status",
"save_log": "SaveLog",
"create_by": "CreateBy",
"create_time": "CreateTime",
"update_by": "UpdateBy",
@@ -245,6 +246,9 @@ func (r *SysJobImpl) InsertJob(sysJob model.SysJob) string {
if sysJob.Status != "" {
params["status"] = sysJob.Status
}
if sysJob.SaveLog != "" {
params["save_log"] = sysJob.SaveLog
}
if sysJob.Remark != "" {
params["remark"] = sysJob.Remark
}
@@ -308,6 +312,9 @@ func (r *SysJobImpl) UpdateJob(sysJob model.SysJob) int64 {
if sysJob.Status != "" {
params["status"] = sysJob.Status
}
if sysJob.SaveLog != "" {
params["save_log"] = sysJob.SaveLog
}
if sysJob.Remark != "" {
params["remark"] = sysJob.Remark
}