mirror of
https://github.com/lzh-1625/go_process_manager.git
synced 2025-10-05 16:06:51 +08:00
1
This commit is contained in:
@@ -56,24 +56,27 @@ func (t *taskRepository) EditTaskEnable(id int, enable bool) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (t *taskRepository) GetAllTaskWithProcessName() (result []model.TaskVo) {
|
func (t *taskRepository) GetAllTaskWithProcessName() (result []model.TaskVo) {
|
||||||
db.Raw(`SELECT
|
process := query.Process
|
||||||
t.*,
|
task := query.Task
|
||||||
p.name AS process_name,
|
task.Select(
|
||||||
p2.name AS target_name,
|
task.ALL,
|
||||||
p3.name AS trigger_name
|
process.As("p").Name.As("process_name"),
|
||||||
FROM
|
process.As("p2").Name.As("target_name"),
|
||||||
task t
|
process.As("p3").Name.As("trigger_name"),
|
||||||
LEFT JOIN process p ON
|
).
|
||||||
t.process_id = p.uuid
|
LeftJoin(process, process.As("p").Uuid.EqCol(task.ProcessId)).
|
||||||
LEFT JOIN process p2 ON
|
LeftJoin(process, process.As("p2").Uuid.EqCol(task.OperationTarget)).
|
||||||
t.operation_target = p2.uuid
|
LeftJoin(process, process.As("p3").Uuid.EqCol(task.TriggerTarget)).
|
||||||
LEFT JOIN process p3 ON
|
Scan(&result)
|
||||||
t.trigger_target = p3.uuid`).Scan(&result)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *taskRepository) GetTriggerTask(processName string, event constants.ProcessState) []model.Task {
|
func (t *taskRepository) GetTriggerTask(processName string, event constants.ProcessState) []model.Task {
|
||||||
result := []model.Task{}
|
result := []model.Task{}
|
||||||
query.Task.Select(query.Task.ALL).LeftJoin(query.Process, query.Process.Uuid.EqCol(query.Task.TriggerTarget)).Where(query.Process.Name.Eq(processName)).Where(query.Task.TriggerEvent.Eq(int32(event))).Scan(result)
|
query.Task.Select(query.Task.ALL).
|
||||||
|
LeftJoin(query.Process, query.Process.Uuid.EqCol(query.Task.TriggerTarget)).
|
||||||
|
Where(query.Process.Name.Eq(processName)).
|
||||||
|
Where(query.Task.TriggerEvent.Eq(int32(event))).
|
||||||
|
Scan(result)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user