|
|
@@ -1,14 +1,19 @@
|
|
|
package com.coffee.bus.controller;
|
|
|
|
|
|
+import cn.dev33.satoken.annotation.SaCheckPermission;
|
|
|
import com.baomidou.mybatisplus.core.mapper.Mapper;
|
|
|
import com.coffee.bus.entity.BusDeviceAlarmEntity;
|
|
|
+import com.coffee.bus.enums.DeviceEnum;
|
|
|
import com.coffee.bus.service.LocalBusDeviceAlarmService;
|
|
|
import com.coffee.common.crud.BaseService;
|
|
|
import com.coffee.common.crud.controller.BaseCrudController;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
+import com.coffee.common.result.R;
|
|
|
+import io.swagger.annotations.*;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.util.ReflectionUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.lang.reflect.Field;
|
|
|
|
|
|
/**
|
|
|
* @author lifang
|
|
|
@@ -20,13 +25,36 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("/bus/alarm")
|
|
|
-@Api(tags = "设备报警管理",description = "统一权限前缀(bus:alarm),例如新增bus:alarm:add")
|
|
|
+@Api(tags = "设备报警管理",value = "统一权限前缀(bus:alarm),例如新增bus:alarm:add")
|
|
|
public class BusAlarmController extends BaseCrudController<BusDeviceAlarmEntity, String> {
|
|
|
|
|
|
private final LocalBusDeviceAlarmService deviceAlarmService;
|
|
|
|
|
|
+ @PutMapping("/cause/{id}")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "cause",value = "报警原因",dataTypeClass = String.class,required = true,example = "设备误报"),
|
|
|
+ @ApiImplicitParam(name = "id",value = "报警信息id",dataTypeClass = String.class,required = true)
|
|
|
+ })
|
|
|
+ @ApiOperation(value = "添加报警原因",notes = "权限:【bus:alarm:cause】")
|
|
|
+ @SaCheckPermission("bus:alarm:cause")
|
|
|
+ public R cause(@PathVariable("id") String id, @RequestBody String cause) {
|
|
|
+ deviceAlarmService.addCause(id,cause);
|
|
|
+ return R.success();
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public BaseService<? extends Mapper<BusDeviceAlarmEntity>, BusDeviceAlarmEntity, String> getService() {
|
|
|
return deviceAlarmService;
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ set(DeviceEnum.net);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public static void set(Object value){
|
|
|
+ Field ordinal = ReflectionUtils.findField(value.getClass(), "ordinal");
|
|
|
+ ordinal.setAccessible(true);
|
|
|
+ System.out.println( ReflectionUtils.getField(ordinal,value));
|
|
|
+ }
|
|
|
}
|