cjl
2023-11-01 23ad681499f8652fe4e2084e6492ececb6fc7551
screen-api/src/main/java/com/moral/api/controller/AppDevicController.java
New file
@@ -0,0 +1,72 @@
package com.moral.api.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import com.moral.api.entity.Device;
import com.moral.api.entity.MonitorPoint;
import com.moral.api.pojo.vo.device.AppDeviceVo;
import com.moral.api.service.DeviceService;
import com.moral.api.service.MonitorPointService;
import com.moral.api.service.SpecialDeviceService;
import com.moral.constant.ResultMessage;
@Slf4j
@Api(tags = {"小程序设备管理"})
@RestController
@RequestMapping("/AppDevice")
public class AppDevicController {
    @Autowired
    private MonitorPointService monitorPointService;
    @Autowired
    private DeviceService deviceService;
    @Autowired
    private SpecialDeviceService specialDeviceService;
    @GetMapping("selectOrganization")
    @ApiOperation(value = "小程序获取站点")
    public ResultMessage selectOrganization(){
        List<MonitorPoint> monitorPoints = monitorPointService.getOrganizations();
        return ResultMessage.ok(monitorPoints);
    }
    @GetMapping("selectDevice")
    @ApiOperation(value = "小程序获取设备")
    public ResultMessage selectDevice(@RequestParam @ApiParam(value = "monitorPointId",name = "站点ID") Integer monitorPointId){
        List<Device> organizationDevice = deviceService.getOrganizationDevice(monitorPointId);
        return ResultMessage.ok(ObjectUtils.isEmpty(organizationDevice)?null:organizationDevice);
    }
    @GetMapping("fuzzySearch")
    @ApiOperation(value = "小程序模糊搜索")
    public ResultMessage fuzzySearch(@RequestParam @ApiParam(value = "mac",name = "设备mac号") String mac){
        List<AppDeviceVo> devices = deviceService.getFuzzySearch(mac);
        return ResultMessage.ok(devices);
    }
    @GetMapping("specialDevice")
    @ApiOperation(value = "查询特殊设备")
    public ResultMessage selectSpecialDevice(){
        List<AppDeviceVo> appDeviceVos = specialDeviceService.selectSpecialDevice();
        return ResultMessage.ok(appDeviceVos);
    }
}