|
@@ -0,0 +1,100 @@
|
|
|
+package org.thingsboard.server.controller.nanxi;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.thingsboard.server.domain.BaseOutput;
|
|
|
+import org.thingsboard.server.domain.ScadaDeviceData;
|
|
|
+import org.thingsboard.server.service.nanxi.ScadaDeviceDataService;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+
|
|
|
+ * @author hs
|
|
|
+ * @date 2023-05-17
|
|
|
+ *
|
|
|
+ * @description
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequestMapping("/api/scadaDeviceData")
|
|
|
+@Api(value = "scadaDeviceData", tags = "物联网推送数据模块")
|
|
|
+public class ScadaDeviceDataController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ScadaDeviceDataService scadaDeviceDataService;
|
|
|
+
|
|
|
+
|
|
|
+ * 分页查询
|
|
|
+ * @param scadaDeviceData 分页对象
|
|
|
+ * @return IPage
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "分页查询", notes = "分页查询")
|
|
|
+ @GetMapping("/page")
|
|
|
+ public BaseOutput<Page<ScadaDeviceData>> pageList(Page page, @ModelAttribute ScadaDeviceData scadaDeviceData) {
|
|
|
+ return BaseOutput.success(scadaDeviceDataService.page(page, Wrappers.query(scadaDeviceData)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * 列表查询
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "列表查询", notes = "列表查询")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public BaseOutput<List<ScadaDeviceData>> pageList(@ModelAttribute ScadaDeviceData scadaDeviceData) {
|
|
|
+ return BaseOutput.success(scadaDeviceDataService.list(Wrappers.query(scadaDeviceData)));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 通过id查询
|
|
|
+ * @param id id
|
|
|
+ * @return Result
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "通过id获取", notes = "通过id获取")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public BaseOutput<ScadaDeviceData> getById(@PathVariable Integer id) {
|
|
|
+ return BaseOutput.success(scadaDeviceDataService.getById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 新增
|
|
|
+ * @param scadaDeviceData
|
|
|
+ * @return Result
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "新增", notes = "新增")
|
|
|
+ @PostMapping
|
|
|
+ public BaseOutput save(@RequestBody ScadaDeviceData scadaDeviceData) {
|
|
|
+ return scadaDeviceDataService.save(scadaDeviceData) ? BaseOutput.successMsg("添加成功") : BaseOutput.failure("添加失败");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 修改
|
|
|
+ * @param ScadaDeviceData
|
|
|
+ * @return Result
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "修改", notes = "修改")
|
|
|
+ @PutMapping
|
|
|
+ public BaseOutput updateById(@RequestBody ScadaDeviceData scadaDeviceData) {
|
|
|
+ return scadaDeviceDataService.updateById(scadaDeviceData) ? BaseOutput.successMsg("修改成功") : BaseOutput.failure("修改失败");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ * 通过id删除
|
|
|
+ * @param id id
|
|
|
+ * @return Result
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "通过id删除", notes = "通过id删除")
|
|
|
+ @DeleteMapping("/{id}")
|
|
|
+ public BaseOutput removeById(@PathVariable Integer id) {
|
|
|
+ return scadaDeviceDataService.removeById(id) ? BaseOutput.successMsg("删除成功") : BaseOutput.failure("删除失败");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|