cjl
2023-11-15 28776b56db3bbd2fbbfd64394e40aa11a6b7ea29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package com.moral.api.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.moral.api.entity.Group;
import com.moral.api.service.GroupService;
import com.moral.api.service.SensorService;
import com.moral.api.service.UserGroupService;
import com.moral.constant.ResponseCodeEnum;
import com.moral.constant.ResultMessage;
import com.moral.util.PageResult;
import com.moral.util.WebUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
 
@Slf4j
@Api(tags = {"组管理"})
@RestController
@RequestMapping("/sensor")
public class SensorController {
 
    @Resource
    private SensorService sensorService;
 
    @GetMapping(value = "getSensorsByMonitorPointIds")
    private ResultMessage getSensorsByMonitorPointIds(HttpServletRequest request) {
        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
        if (ObjectUtils.isEmpty(params.get("monitorPointIds"))){
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(),ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
        List<Map<String, Object>> sensors = sensorService.getSensorsByMonitorPointIds(params);
        return ResultMessage.ok(sensors);
    }
 
}