feat: 增加point表接口
parent
ac9c347063
commit
a9b41a6d8f
@ -0,0 +1,48 @@
|
||||
package com.xydl.cac.controller;
|
||||
|
||||
import com.xydl.cac.entity.NPoint;
|
||||
import com.xydl.cac.model.Response;
|
||||
import com.xydl.cac.service.NPointService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@Api(tags = {"监测设备属性相关接口"})
|
||||
@RequestMapping("npoint")
|
||||
@Slf4j
|
||||
public class NPointController extends BasicController {
|
||||
|
||||
@Resource
|
||||
NPointService service;
|
||||
|
||||
@GetMapping("listAll")
|
||||
@ApiOperation("查询全部")
|
||||
public Response<List<NPoint>> listAll(@ApiParam("监测设备id") @RequestParam(value = "sensorId", required = true) Integer sensorId) throws Exception {
|
||||
List<NPoint> result = service.listAll(sensorId);
|
||||
return Response.success(result);
|
||||
}
|
||||
|
||||
@PostMapping("add")
|
||||
@ApiOperation("新增")
|
||||
public Response<NPoint> add(@Validated @RequestBody NPoint item) throws Exception {
|
||||
NPoint result = service.add(item);
|
||||
return Response.success(result);
|
||||
}
|
||||
|
||||
@PostMapping("delete")
|
||||
@ApiOperation("删除")
|
||||
public Response<String> delete(@Validated @NotNull(message = "ID不能为空!") @Param("id") Integer id) {
|
||||
service.delete(id);
|
||||
return Response.success("OK");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue