Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
王蔡翾
operation_platform
Commits
ce9b66ae
Commit
ce9b66ae
authored
Apr 03, 2025
by
王蔡翾
Browse files
更新
parent
ce478de4
Changes
20
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/example/operation_platform/controller/OperationDoController.java
View file @
ce9b66ae
...
...
@@ -5,6 +5,7 @@ import com.example.operation_platform.model.dto.OperationDoDTO;
import
com.example.operation_platform.model.entity.OperationDoEntity
;
import
com.example.operation_platform.model.entity.OperationItem
;
import
com.example.operation_platform.model.vo.AllCountVO
;
import
com.example.operation_platform.model.vo.OperationDoVO
;
import
com.example.operation_platform.service.OperationDoService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
...
...
@@ -12,6 +13,7 @@ import com.platform.page.TableDataInfo;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
//接口方法返回对象,转换成json文本
@RequestMapping
(
"/Operation"
)
...
...
@@ -54,7 +56,10 @@ public class OperationDoController extends BaseController {
public
Result
<
AllCountVO
>
count
()
{
return
Result
.
data
(
operationDoService
.
querycount
());
}
@GetMapping
(
"/equipment"
)
public
Result
<
List
<
OperationDoVO
>>
equipment
()
{
return
Result
.
data
(
operationDoService
.
queryEquipment
());
}
}
src/main/java/com/example/operation_platform/controller/OperationJobController.java
View file @
ce9b66ae
...
...
@@ -3,6 +3,7 @@ package com.example.operation_platform.controller;
import
com.example.operation_platform.model.dto.MessageDTO
;
import
com.example.operation_platform.model.dto.OperationJobDTO
;
import
com.example.operation_platform.model.vo.OperationJobVO
;
import
com.example.operation_platform.service.OperationJobService
;
import
com.platform.controller.BaseController
;
import
com.platform.model.resp.Result
;
...
...
@@ -10,6 +11,8 @@ import com.platform.page.TableDataInfo;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.util.List
;
@RestController
@RequestMapping
(
"/job"
)
public
class
OperationJobController
extends
BaseController
{
...
...
@@ -46,7 +49,7 @@ public class OperationJobController extends BaseController {
}
@GetMapping
(
"/warn"
)
//首页轮播告警信息
public
Result
queryWarn
()
{
public
Result
<
List
<
OperationJobVO
>>
queryWarn
()
{
return
Result
.
data
(
operationJobService
.
queryWarn
());
}
...
...
src/main/java/com/example/operation_platform/mapper/OperationDoMapper.java
View file @
ce9b66ae
...
...
@@ -34,6 +34,8 @@ public interface OperationDoMapper extends BaseMapper<OperationDoEntity> {
List
<
Integer
>
queryRunLogIdList
();
AllCountVO
querycount
();
List
<
Integer
>
queryNeedMessageRunLogId
();
List
<
OperationDoVO
>
queryEquipment
();
//获取设备和id
}
src/main/java/com/example/operation_platform/mapper/OperationJobMapper.java
View file @
ce9b66ae
...
...
@@ -51,6 +51,9 @@ public interface OperationJobMapper extends BaseMapper<OperationJob> {
*/
void
updateRunLogStatus
(
Integer
id
);
//首页轮播告警信息
OperationJobVO
queryWarn
();
List
<
OperationJobVO
>
queryWarn
();
// 定时任务所需信息
List
<
OperationJobVO
>
queryRunJobList
(
OperationJobDTO
operationJobDTO
);
}
src/main/java/com/example/operation_platform/model/dto/OperationJobDTO.java
View file @
ce9b66ae
...
...
@@ -22,5 +22,7 @@ public class OperationJobDTO extends OperationJob {
private
Integer
year
;
private
Integer
month
;
private
Integer
stationId
;
private
Integer
robotId
;
private
Integer
droneId
;
}
src/main/java/com/example/operation_platform/model/dto/OperationRecordDTO.java
View file @
ce9b66ae
...
...
@@ -16,4 +16,5 @@ public class OperationRecordDTO extends TbOperationRecordEntity {
private
Integer
droneId
;
private
String
username
;
private
String
stationName
;
private
Integer
run_log_id
;
}
src/main/java/com/example/operation_platform/model/vo/OperationJobVO.java
View file @
ce9b66ae
...
...
@@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.time.LocalDate
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
public
class
OperationJobVO
extends
OperationJob
{
...
...
@@ -14,4 +16,9 @@ public class OperationJobVO extends OperationJob {
private
Integer
id
;
private
Integer
robotId
;
private
Integer
droneId
;
private
LocalDate
startTime
;
private
String
warnMessage
;
private
Integer
runLogId
;
private
String
stationId
;
private
Integer
operationId
;
}
src/main/java/com/example/operation_platform/model/vo/OperationRecordVO.java
View file @
ce9b66ae
...
...
@@ -8,7 +8,7 @@ import java.util.Date;
@Data
public
class
OperationRecordVO
{
public
class
OperationRecordVO
{
private
String
robotName
;
private
String
stationName
;
private
String
content
;
...
...
@@ -19,8 +19,7 @@ public class OperationRecordVO {
private
Integer
id
;
private
String
note
;
private
String
warnMessage
;
private
Integer
tb_run_log_id
;
private
Integer
runLogId
;
}
src/main/java/com/example/operation_platform/service/OperationDoService.java
View file @
ce9b66ae
...
...
@@ -28,5 +28,7 @@ public interface OperationDoService extends IService<OperationDoEntity> {
List
<
Integer
>
queryRunLogIdList
();
//首页统计
AllCountVO
querycount
();
List
<
Integer
>
queryNeedMessageRunLogId
();
List
<
OperationDoVO
>
queryEquipment
();
//获取设备和id
}
src/main/java/com/example/operation_platform/service/OperationJobService.java
View file @
ce9b66ae
...
...
@@ -51,5 +51,5 @@ public interface OperationJobService extends IService<OperationJob> {
*/
void
updateRunLogStatus
(
Integer
id
);
//首页轮播告警信息
OperationJobVO
queryWarn
();
List
<
OperationJobVO
>
queryWarn
();
}
src/main/java/com/example/operation_platform/service/RunLogService.java
View file @
ce9b66ae
...
...
@@ -22,4 +22,6 @@ public interface RunLogService extends IService<RunLogEntity> {
List
<
Map
<
String
,
Object
>>
getAlertAndFailureLogs
();
String
getMergedContentForRunLogId
(
String
id
);
List
<
Map
<
String
,
Object
>>
getAlertLogs
();
}
src/main/java/com/example/operation_platform/service/WorkerService.java
View file @
ce9b66ae
...
...
@@ -24,7 +24,7 @@ public interface WorkerService extends IService<WorkerEntity> {
* @param
* @return WorkerEntity
*/
WorkerVO
queryMyMessage
(
String
user
n
ame
);
WorkerVO
queryMyMessage
(
String
user
N
ame
);
/*
* 登录验证
* @param WorkerDTO WorkerDTO
...
...
src/main/java/com/example/operation_platform/service/impl/OperationDoServiceImpl.java
View file @
ce9b66ae
...
...
@@ -78,4 +78,12 @@ public class OperationDoServiceImpl extends ServiceImpl<OperationDoMapper, Opera
public
AllCountVO
querycount
()
{
return
this
.
baseMapper
.
querycount
();
}
@Override
public
List
<
Integer
>
queryNeedMessageRunLogId
()
{
return
this
.
baseMapper
.
queryNeedMessageRunLogId
();
}
@Override
public
List
<
OperationDoVO
>
queryEquipment
()
{
return
this
.
baseMapper
.
queryEquipment
();
}
}
\ No newline at end of file
src/main/java/com/example/operation_platform/service/impl/OperationJobServiceImpl.java
View file @
ce9b66ae
...
...
@@ -47,8 +47,9 @@ public class OperationJobServiceImpl extends ServiceImpl<OperationJobMapper, Ope
baseMapper
.
updateRunLogStatus
(
id
);
}
@Override
public
OperationJobVO
queryWarn
()
{
OperationJobVO
operationJobVO
=
baseMapper
.
queryWarn
();
public
List
<
OperationJobVO
>
queryWarn
()
{
List
<
OperationJobVO
>
operationJobVO
=
baseMapper
.
queryWarn
();
return
operationJobVO
;
}
}
src/main/java/com/example/operation_platform/service/impl/RunLogServiceImpl.java
View file @
ce9b66ae
...
...
@@ -97,6 +97,7 @@ public class RunLogServiceImpl extends ServiceImpl<RunLogMapper, RunLogEntity> i
for
(
UavOperateLogEntity
log
:
logs
)
{
if
(
log
.
getContent
().
contains
(
"告警"
)
||
log
.
getContent
().
contains
(
"失败"
))
{
Map
<
String
,
Object
>
entry
=
new
HashMap
<>();
entry
.
put
(
"run_log_id"
,
runLogId
);
entry
.
put
(
"content"
,
log
.
getContent
());
entry
.
put
(
"dateTime"
,
log
.
getDataTime
());
result
.
add
(
entry
);
...
...
@@ -113,5 +114,22 @@ public String getMergedContentForRunLogId(String id) {
.
map
(
UavOperateLogEntity:
:
getContent
)
.
collect
(
Collectors
.
joining
(
", "
));
}
@Override
public
List
<
Map
<
String
,
Object
>>
getAlertLogs
()
{
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
List
<
Integer
>
runLogIds
=
operationDoService
.
queryNeedMessageRunLogId
();
for
(
Integer
runLogId
:
runLogIds
)
{
List
<
UavOperateLogEntity
>
logs
=
getInfoById
(
runLogId
.
toString
());
for
(
UavOperateLogEntity
log
:
logs
)
{
if
(
log
.
getContent
().
contains
(
"告警"
)
||
log
.
getContent
().
contains
(
"失败"
))
{
Map
<
String
,
Object
>
entry
=
new
HashMap
<>();
entry
.
put
(
"run_log_id"
,
runLogId
);
entry
.
put
(
"content"
,
log
.
getContent
());
entry
.
put
(
"dateTime"
,
log
.
getDataTime
());
result
.
add
(
entry
);
}
}
}
return
result
;
}
}
src/main/java/com/example/operation_platform/service/impl/TbOperationRecordServiceImpl.java
View file @
ce9b66ae
...
...
@@ -36,24 +36,22 @@ public class TbOperationRecordServiceImpl extends ServiceImpl<TbOperationRecordM
public
List
<
OperationRecordVO
>
queryRunLogRecordListAndWarnMessage
(
OperationRecordDTO
operationRecordDTO
)
{
List
<
OperationRecordVO
>
operationRecordVOList
=
baseMapper
.
queryRunLogRecordList
(
operationRecordDTO
);
List
<
Map
<
String
,
Object
>>
alertAndFailureLogs
=
runLogService
.
getAlertAndFailureLogs
();
// 创建一个Map来存储日志ID和日志内容的映射
Map
<
Integer
,
String
>
logMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
log
:
alertAndFailureLogs
)
{
Integer
logId
=
(
Integer
)
log
.
get
(
"run_log_id"
);
String
content
=
(
String
)
log
.
get
(
"content"
);
if
(
logId
!=
null
&&
content
!=
null
&&
!
content
.
isEmpty
())
{
logMap
.
put
(
logId
,
content
);
}
}
// 由于getAlertAndFailureLogs()返回的Map中没有runLogId,我们需要调整匹配逻辑
// 这里假设OperationRecordVO中的tb_run_log_id对应的是日志的ID
// 遍历每个操作记录,根据run_log_id获取对应的告警信息
for
(
OperationRecordVO
operationRecordVO
:
operationRecordVOList
)
{
StringBuilder
warnMessage
=
new
StringBuilder
();
// 遍历所有告警和失败日志
for
(
Map
<
String
,
Object
>
log
:
alertAndFailureLogs
)
{
String
content
=
(
String
)
log
.
get
(
"content"
);
if
(
content
!=
null
&&
!
content
.
isEmpty
())
{
if
(
warnMessage
.
length
()
>
0
)
{
warnMessage
.
append
(
"\n"
);
}
warnMessage
.
append
(
content
);
}
Integer
tbRunLogId
=
operationRecordVO
.
getRunLogId
();
if
(
tbRunLogId
!=
null
&&
logMap
.
containsKey
(
tbRunLogId
))
{
operationRecordVO
.
setWarnMessage
(
logMap
.
get
(
tbRunLogId
));
}
operationRecordVO
.
setWarnMessage
(
warnMessage
.
toString
());
}
return
operationRecordVOList
;
...
...
src/main/java/com/example/operation_platform/task/RunLogTask.java
View file @
ce9b66ae
package
com.example.operation_platform.task
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.example.operation_platform.mapper.MessageMapper
;
import
com.example.operation_platform.mapper.OperationDoMapper
;
import
com.example.operation_platform.mapper.OperationJobMapper
;
import
com.example.operation_platform.mapper.WorkerMapper
;
import
com.example.operation_platform.model.entity.MessageEntity
;
import
com.example.operation_platform.model.entity.OperationDoEntity
;
import
com.example.operation_platform.model.entity.OperationJob
;
import
com.example.operation_platform.model.entity.WorkerEntity
;
import
com.example.operation_platform.model.vo.OperationJobVO
;
import
com.example.operation_platform.service.RunLogService
;
import
com.platform.utils.AliSmsUtil
;
import
org.json.JSONObject
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Component
public
class
RunLogTask
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
RunLogTask
.
class
);
@Autowired
private
RunLogService
runLogService
;
@Autowired
private
OperationDoMapper
operationDoMapper
;
@Autowired
private
AliSmsUtil
aliSmsUtil
;
@Autowired
private
MessageMapper
messageMapper
;
@Autowired
private
WorkerMapper
workerMapper
;
@Autowired
private
OperationJobMapper
operationJobMapper
;
/**
* 处理带有告警信息的操作任务
* @param operationJobVOList 操作任务列表
*/
public
void
processOperationsWithWarnings
(
List
<
OperationJobVO
>
operationJobVOList
)
{
// 1. 首先为列表中的任务添加告警信息
List
<
OperationJobVO
>
enrichedList
=
enrichOperationJobListWithWarnMessages
(
operationJobVOList
);
// 2. 对每个带有告警信息的任务进行处理
for
(
OperationJobVO
job
:
enrichedList
)
{
if
(
job
.
getWarnMessage
()
!=
null
&&
!
job
.
getWarnMessage
().
isEmpty
())
{
handleOperationWithWarning
(
job
);
}
}
}
/**
* 处理单个带有告警信息的操作任务
* @param job 操作任务
*/
private
void
handleOperationWithWarning
(
OperationJobVO
job
)
{
Integer
operationId
=
job
.
getOperationId
();
boolean
shouldContinue
=
true
;
while
(
shouldContinue
)
{
try
{
// 1. 检查操作的当前状态
OperationJob
operationjob
=
operationJobMapper
.
selectById
(
operationId
);
if
(
operationjob
==
null
)
{
logger
.
error
(
"未找到ID为{}的操作记录"
,
operationId
);
shouldContinue
=
false
;
continue
;
}
// 2. 如果状态为4,停止处理该任务
if
(
operationjob
.
getFinishStatus
()
==
4
)
{
logger
.
info
(
"操作ID {} 已完成(状态4),停止发送通知"
,
operationId
);
shouldContinue
=
false
;
continue
;
}
// 3. 发送短信通知
sendAlertSms
(
job
);
// 4. 等待5分钟后再次检查(可根据需要调整时间间隔)
Thread
.
sleep
(
300000
);
// 5分钟(300000毫秒)
}
catch
(
InterruptedException
e
)
{
logger
.
error
(
"处理操作ID {} 时线程被中断"
,
operationId
,
e
);
Thread
.
currentThread
().
interrupt
();
shouldContinue
=
false
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"处理操作ID {} 时发生错误"
,
operationId
,
e
);
shouldContinue
=
false
;
}
}
}
/**
* 发送告警短信
* @param job 操作任务
*/
private
void
sendAlertSms
(
OperationJobVO
job
)
{
List
<
String
>
phones
=
getPhoneByOperation
(
job
.
getOperationId
());
if
(
phones
.
isEmpty
())
{
logger
.
warn
(
"操作ID {} 没有关联的手机号码"
,
job
.
getOperationId
());
return
;
}
for
(
String
phone
:
phones
)
{
try
{
// 构建短信模板参数
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"stationName"
,
job
.
getStationName
());
// 站点名称
jsonObject
.
put
(
"device"
,
job
.
getRobotName
());
// 设备名称
jsonObject
.
put
(
"alert"
,
job
.
getWarnMessage
());
// 告警类型
jsonObject
.
put
(
"time"
,
job
.
getStartTime
());
// 开始时间
// 发送短信
aliSmsUtil
.
sendSms
(
phone
,
jsonObject
,
"SMS_481615406"
);
logger
.
info
(
"已向 {} 发送操作ID {} 的告警短信"
,
phone
,
job
.
getOperationId
());
}
catch
(
Exception
e
)
{
logger
.
error
(
"向 {} 发送操作ID {} 的告警短信失败"
,
phone
,
job
.
getOperationId
(),
e
);
}
}
}
/**
* 为操作任务列表添加告警信息
* @param operationJobVOList 原始操作任务列表
* @return 带有告警信息的操作任务列表
*/
public
List
<
OperationJobVO
>
enrichOperationJobListWithWarnMessages
(
List
<
OperationJobVO
>
operationJobVOList
)
{
// 获取告警日志
List
<
Map
<
String
,
Object
>>
alertLogs
=
runLogService
.
getAlertLogs
();
// 创建日志ID和内容的映射
Map
<
Integer
,
String
>
logMap
=
new
HashMap
<>();
for
(
Map
<
String
,
Object
>
log
:
alertLogs
)
{
Integer
logId
=
(
Integer
)
log
.
get
(
"run_log_id"
);
String
content
=
(
String
)
log
.
get
(
"content"
);
if
(
logId
!=
null
&&
content
!=
null
&&
!
content
.
isEmpty
())
{
logMap
.
put
(
logId
,
content
);
}
}
// 为每个操作任务添加告警信息
for
(
OperationJobVO
operationJobVO
:
operationJobVOList
)
{
Integer
runLogId
=
operationJobVO
.
getRunLogId
();
if
(
runLogId
!=
null
&&
logMap
.
containsKey
(
runLogId
))
{
operationJobVO
.
setWarnMessage
(
logMap
.
get
(
runLogId
));
}
}
return
operationJobVOList
;
}
/**
* 获取操作关联的手机号列表
* @param operationId 操作ID
* @return 手机号列表
*/
private
List
<
String
>
getPhoneByOperation
(
Integer
operationId
)
{
// 1. 获取操作记录
OperationDoEntity
operation
=
operationDoMapper
.
selectById
(
operationId
);
if
(
operation
==
null
)
{
logger
.
error
(
"获取手机号失败: 找不到操作ID={}的记录"
,
operationId
);
return
Collections
.
emptyList
();
}
// 2. 获取站点相关的所有消息记录
List
<
MessageEntity
>
messages
=
messageMapper
.
selectList
(
new
LambdaQueryWrapper
<
MessageEntity
>()
.
eq
(
MessageEntity:
:
getStationId
,
operation
.
getStationId
())
);
if
(
messages
==
null
||
messages
.
isEmpty
())
{
logger
.
error
(
"获取手机号失败: 找不到站点ID={}的消息记录"
,
operation
.
getStationId
());
return
Collections
.
emptyList
();
}
// 3. 收集所有有效的workerId
Set
<
Integer
>
workerIds
=
new
HashSet
<>();
for
(
MessageEntity
message
:
messages
)
{
if
(
message
.
getWarnMessage
()
!=
null
&&
!
message
.
getWarnMessage
().
isEmpty
())
{
try
{
Arrays
.
stream
(
message
.
getWarnMessage
().
split
(
","
))
.
map
(
String:
:
trim
)
.
filter
(
s
->
!
s
.
isEmpty
())
.
map
(
Integer:
:
parseInt
)
.
forEach
(
workerIds:
:
add
);
}
catch
(
NumberFormatException
e
)
{
logger
.
error
(
"解析操作消息失败: {}"
,
message
.
getWarnMessage
(),
e
);
continue
;
}
}
}
if
(
workerIds
.
isEmpty
())
{
logger
.
error
(
"获取手机号失败: 站点ID={}的消息记录中没有有效的workerId"
,
operation
.
getStationId
());
return
Collections
.
emptyList
();
}
// 4. 获取所有worker的电话号码
List
<
WorkerEntity
>
workers
=
workerMapper
.
selectList
(
new
LambdaQueryWrapper
<
WorkerEntity
>()
.
in
(
WorkerEntity:
:
getId
,
workerIds
)
.
isNotNull
(
WorkerEntity:
:
getPhoneNumber
)
);
}
// 5. 返回去重后的电话号码列表
return
workers
.
stream
()
.
map
(
WorkerEntity:
:
getPhoneNumber
)
.
filter
(
phone
->
phone
!=
null
&&
!
phone
.
isEmpty
())
.
distinct
()
.
collect
(
Collectors
.
toList
());
}
}
\ No newline at end of file
src/main/resources/mapper/OperationDoMapper.xml
View file @
ce9b66ae
...
...
@@ -159,7 +159,7 @@
</select>
<select
id=
"queryRunLogIdList"
resultType=
"java.lang.Integer"
>
select
top.tb_run_log_id AS
runLogI
d
top.tb_run_log_id AS
tb_run_log_i
d
from tb_operation top
where
top.runlog_or_operation = 1
...
...
@@ -171,5 +171,24 @@
(select count(*) from tb_operation_job tp where tp.runlog_or_operation = 0) as JobCount,
(select count(*) from tb_operation top where top.runlog_or_operation = 1) as warnCount
</select>
<select
id=
"queryNeedMessageRunLogId"
resultType=
"java.lang.Integer"
>
select
top.tb_run_log_id AS runLogId
from tb_operation top
where
top.runlog_or_operation = 1
AND top.finish_status NOT IN (2, 4)
</select>
<select
id=
"queryEquipment"
resultType=
"com.example.operation_platform.model.vo.OperationDoVO"
>
select DISTINCT
COALESCE(br.name, dr.name) AS robotName,
top.robot_id AS robotId,
top.drone_id AS droneId
from tb_operation top
LEFT JOIN bs_robot br ON top.robot_id = br.id
LEFT JOIN bs_station bs ON top.station_id = bs.id
LEFT JOIN uav_drone dr ON top.drone_id = dr.id
</select>
</mapper>
src/main/resources/mapper/OperationJobMapper.xml
View file @
ce9b66ae
...
...
@@ -226,6 +226,15 @@
<if
test=
"stationId != null and stationId != ''"
>
and top.station_id = #{stationId}
</if>
<if
test=
"finishStatus != null and finishStatus != ''"
>
and top.finish_status = #{finishStatus}
</if>
<if
test=
"robotId != null and robotId != ''"
>
and tp.robot_id = #{robotId}
</if>
<if
test=
"droneId != null and droneId != ''"
>
and tp.drone_id = #{droneId}
</if>
</where>
ORDER BY top.start_time DESC
</select>
...
...
@@ -265,5 +274,24 @@
top.runlog_or_operation = 1
and top.finish_status = 1
</select>
<select
id=
"queryRunJobList"
resultType=
"com.example.operation_platform.model.vo.OperationJobVO"
>
SELECT
top.id,
tp.operation_type AS operationType,
bs.name AS stationName,
COALESCE(br.name, dr.name) AS robotName,
tp.run_log_id AS runLogId,
top.start_time AS startTime,
tp.station_id AS stationId,
top.operation_id AS operationId,
from
tb_operation_job top
LEFT JOIN tb_operation tp ON top.operation_id = tp.id
LEFT JOIN bs_station bs ON tp.station_id = bs.id
LEFT JOIN bs_robot br ON tp.robot_id = br.id
LEFT JOIN uav_drone dr ON tp.drone_id = dr.id
</select>
</mapper>
src/main/resources/mapper/OperationRecordMapper.xml
View file @
ce9b66ae
...
...
@@ -98,7 +98,8 @@
tor.img img,
tor.operation_date operationDate,
bs.NAME stationName,
tor.note note
tor.note note,
top.tb_run_log_id runLogId
FROM
tb_operation_record tor
LEFT JOIN tb_operation top ON tor.operation_id = top.id
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment