|
|
@@ -0,0 +1,68 @@
|
|
|
+package com.zhongshu.iot.server.core.controller.user;
|
|
|
+
|
|
|
+import com.github.microservice.net.ResultContent;
|
|
|
+import com.zhongshu.iot.client.model.mqtt.ProjectInfoAddParam;
|
|
|
+import com.zhongshu.iot.client.model.mqtt.ProjectInfoModel;
|
|
|
+import com.zhongshu.iot.client.model.mqtt.ProjectInfoSearchParam;
|
|
|
+import com.zhongshu.iot.server.core.service.mqtt.ProjectInfoService;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.data.domain.Pageable;
|
|
|
+import org.springframework.data.web.PageableDefault;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 项目 服务
|
|
|
+ *
|
|
|
+ * @author TRX
|
|
|
+ * @date 2024/3/21
|
|
|
+ */
|
|
|
+@RequestMapping("/project")
|
|
|
+@RestController
|
|
|
+@Validated
|
|
|
+@Tag(name = "项目管理")
|
|
|
+public class ProjectInfoController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ProjectInfoService projectInfoService;
|
|
|
+
|
|
|
+ @Operation(summary = "添加-编辑项目")
|
|
|
+ @RequestMapping(value = "addProjectInfo", method = {RequestMethod.POST})
|
|
|
+ public ResultContent addProjectInfo(@RequestBody ProjectInfoAddParam param) {
|
|
|
+ return projectInfoService.addProjectInfo(param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "项目列表-分页查询")
|
|
|
+ @RequestMapping(value = {"pageProject"}, method = {RequestMethod.POST})
|
|
|
+ public ResultContent<Page<ProjectInfoModel>> pageProject(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable, ProjectInfoSearchParam param) {
|
|
|
+ return projectInfoService.page(pageable, param);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "删除项目")
|
|
|
+ @RequestMapping(value = "deleteProjectInfo", method = {RequestMethod.GET})
|
|
|
+ public ResultContent deleteProjectInfo(String id) {
|
|
|
+ return projectInfoService.deleteProjectInfo(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "查询项目详情")
|
|
|
+ @RequestMapping(value = "getProjectInfo", method = {RequestMethod.GET})
|
|
|
+ @Parameter(name = "id", description = "数据ID")
|
|
|
+ public ResultContent<ProjectInfoModel> getProjectInfo(String id) {
|
|
|
+ return projectInfoService.getProjectInfo(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "查询所有可用的项目列表")
|
|
|
+ @RequestMapping(value = "getAllProject", method = {RequestMethod.GET})
|
|
|
+ public ResultContent<List<ProjectInfoModel>> getAllProject() {
|
|
|
+ return projectInfoService.getAllProject();
|
|
|
+ }
|
|
|
+}
|