@@ -1,6 +1,7 @@ | |||
DROP TABLE IF EXISTS `th_alarm_log`; | |||
CREATE TABLE `th_alarm_log` ( | |||
`id` int(0) UNSIGNED NOT NULL DEFAULT 1, | |||
`tenant_id` int(0) NULL DEFAULT NULL COMMENT '租户ID', | |||
`airport_id` int(0) NULL DEFAULT NULL COMMENT '机场ID', | |||
`edge_Id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '控制板id', | |||
`timestamp` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '时间戳,日志发送的时间 (单位: S)', |
@@ -39,6 +39,8 @@ public class AirportLogController extends BaseController { | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(@Valid AirportLogQuery airportlogQuery) { | |||
//TODO 获取当前登录用户所在的租户 | |||
airportlogQuery.setTenantId(null); | |||
return iAirportlogService.getList(airportlogQuery); | |||
} | |||
@@ -50,6 +52,8 @@ public class AirportLogController extends BaseController { | |||
*/ | |||
@GetMapping("/exportExcel") | |||
public JsonResult exportExcel(@Valid AirportLogQuery airportlogQuery) { | |||
//TODO 获取当前登录用户所在的租户 | |||
airportlogQuery.setTenantId(null); | |||
JsonResult<IPage<AirportLogVo>> iPageJsonResult = iAirportlogService.getList(airportlogQuery); | |||
if(ObjectUtil.isEmpty(iPageJsonResult) || iPageJsonResult.getCode() != JsonResult.SUCCESS || ObjectUtil.isEmpty(iPageJsonResult.getData())){ | |||
return JsonResult.error("未查询到数据,请确认查询条件!"); |
@@ -38,6 +38,8 @@ public class AlarmLogController extends BaseController { | |||
*/ | |||
@GetMapping("/index") | |||
public JsonResult index(@Valid AlarmLogQuery alarmLogQuery) { | |||
//TODO 获取当前登录用户所在的租户 | |||
alarmLogQuery.setTenantId(null); | |||
return alarmLogService.queryAlarmLog(alarmLogQuery); | |||
} | |||
@@ -49,6 +51,8 @@ public class AlarmLogController extends BaseController { | |||
*/ | |||
@GetMapping("/exportExcel") | |||
public JsonResult exportExcel(@Valid AlarmLogQuery alarmLogQuery) { | |||
//TODO 获取当前登录用户所在的租户 | |||
alarmLogQuery.setTenantId(null); | |||
JsonResult<IPage<AlarmLogVo>> iPageJsonResult = alarmLogService.queryAlarmLog(alarmLogQuery); | |||
if(ObjectUtil.isEmpty(iPageJsonResult) || iPageJsonResult.getCode() != JsonResult.SUCCESS || ObjectUtil.isEmpty(iPageJsonResult.getData())){ | |||
return JsonResult.error("未查询到数据,请确认查询条件!"); |
@@ -45,4 +45,9 @@ public class AirportLogQuery extends BaseQuery { | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date endTime; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
} |
@@ -35,4 +35,9 @@ public class AlarmLogQuery extends BaseQuery { | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date endTime; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
} |
@@ -128,6 +128,7 @@ public class AlarmTopicHandleService implements ITopicHandleService { | |||
Date createDate = new Date(Long.valueOf(time) * 1000L);//注意硬件传过来的时间戳是10位的,故需要乘以1000 | |||
alarmLog.setCreateTime(createDate); | |||
alarmLog.setUpdateTime(createDate); | |||
alarmLog.setTenantId(airports.get(0).getTenantId()); | |||
if (AlarmTypeEnum.ALARM_ERROR.getType().equals(jsonObject.get("type").toString())) { | |||
/** |
@@ -29,6 +29,9 @@ | |||
airport_log al | |||
LEFT JOIN sys_user su ON al.create_user = su.id | |||
WHERE al.mark = 1 | |||
<if test="airportlogQuery.tenantId != null and airportlogQuery.tenantId != ''"> | |||
and al.tenant_id = #{airportlogQuery.tenantId} | |||
</if> | |||
<if test="airportlogQuery.airportId != null and airportlogQuery.airportId != ''"> | |||
and al.airport_id = #{airportlogQuery.airportId} | |||
</if> |
@@ -29,6 +29,9 @@ | |||
th_alarm_log tal | |||
LEFT JOIN th_airport ta ON tal.airport_id = ta.id | |||
WHERE tal.mark = 1 | |||
<if test="alarmLogQuery.tenantId != null and alarmLogQuery.tenantId != ''"> | |||
and tal.tenant_id = #{alarmLogQuery.tenantId} | |||
</if> | |||
<if test="alarmLogQuery.airportId != null and alarmLogQuery.airportId != ''"> | |||
and tal.airport_id = #{alarmLogQuery.airportId} | |||
</if> |