package com.moral.api.controller; import com.moral.api.entity.MonitorPoint; import com.moral.api.pojo.form.device.MonitorPointQueryForm; import com.moral.api.pojo.vo.monitorPoint.MonitorPointsVO; import com.moral.api.service.MonitorPointService; import com.moral.api.service.OrganizationService; import com.moral.constant.ResponseCodeEnum; import com.moral.constant.ResultMessage; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; /** * @ClassName DeviceController * @Description TODO * @Author 陈凯裕 * @Date 2021/7/1 9:24 * @Version TODO **/ @Slf4j @Api(tags = {"设备数据"}) @RestController @CrossOrigin(origins = "*", maxAge = 3600) @RequestMapping("/monitorPoint") public class MonitorPointController { @Autowired MonitorPointService monitorPointService; @GetMapping("queryMonitorPoints") public ResultMessage queryMonitorPointsAndDevices(MonitorPointQueryForm form){ //判断是否缺少参数 if (!form.valid()) return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); //处理查询业务 List monitorPoints = monitorPointService.query(form); //转换前端参数 MonitorPointsVO vo = MonitorPointsVO.convert(monitorPoints); return new ResultMessage(ResponseCodeEnum.SUCCESS.getCode(), ResponseCodeEnum.SUCCESS.getMsg(), vo); } }