TRX 1 yıl önce
ebeveyn
işleme
0e9e77093e

+ 26 - 55
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/devices/deviceProduct/DeviceProductController.java

@@ -4,8 +4,10 @@ import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.net.ResultContent;
 import com.zhongshu.card.client.model.base.IDParam;
-import com.zhongshu.card.client.model.devices.*;
-import com.zhongshu.card.client.service.school.DeviceInfoService;
+import com.zhongshu.card.client.model.devices.deviceProduct.DeviceProductModel;
+import com.zhongshu.card.client.model.devices.deviceProduct.DeviceProductParam;
+import com.zhongshu.card.client.model.devices.deviceProduct.DeviceProductSearch;
+import com.zhongshu.card.server.core.service.devices.deviceProduct.DeviceProductService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -14,84 +16,53 @@ import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.web.PageableDefault;
 import org.springframework.util.Assert;
-import org.springframework.web.bind.annotation.*;
-
-import javax.validation.Valid;
-import java.util.List;
+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;
 
 /**
- * 项目 产品管理 (设备用的)
+ * 项目 产品管理 (产品用的)
  *
  * @author TRX
  * @date 2024/6/5
  */
 @RestController
 @RequestMapping("/deviceProduct")
-@Tag(name = "产品管理-设备的产品管理")
+@Tag(name = "产品管理-产品管理")
 public class DeviceProductController {
 
     @Autowired
-    private DeviceInfoService deviceInfoService;
-
-    //----------------------------设备基础信息 start------------------------
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "根据设备数据ID 设备详情", description = "根据设备数据ID 设备详情")
-    @RequestMapping(value = "getDeviceById", method = {RequestMethod.POST})
-    public ResultContent<DeviceInfoMoreModel> getDeviceById(@RequestBody IDParam param) {
-        return this.deviceInfoService.getDeviceDetail(param.getId());
-    }
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "根据设备ID 设备详情(精确匹配)", description = "根据设备ID 设备详情(精确匹配)")
-    @RequestMapping(value = "getDeviceByDeviceId", method = {RequestMethod.GET})
-    public ResultContent<DeviceInfoMoreModel> getDeviceByDeviceId(@RequestParam(name = "deviceId") String deviceId) {
-        return this.deviceInfoService.getDeviceDetailByDeviceId(deviceId);
-    }
+    private DeviceProductService deviceProductService;
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "根据设备ID 设备列表(模糊匹配)", description = "根据设备ID 设备列表(模糊匹配)")
-    @RequestMapping(value = "getDeviceDetailByDeviceIdLike", method = {RequestMethod.GET})
-    public ResultContent<List<DeviceInfoMoreModel>> getDeviceDetailByDeviceIdLike(@RequestParam(name = "deviceId") String deviceId) {
-        return this.deviceInfoService.getDeviceDetailByDeviceIdLike(deviceId);
+    @Operation(summary = "根据产品数据ID 产品详情", description = "根据产品数据ID 产品详情")
+    @RequestMapping(value = "getInfo", method = {RequestMethod.POST})
+    public ResultContent<DeviceProductModel> getInfo(@RequestBody IDParam param) {
+        return this.deviceProductService.getInfo(param.getId());
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "添加-编辑设备", description = "添加-编辑设备")
-    @RequestMapping(value = "addDeviceInfo", method = {RequestMethod.POST})
-    public ResultContent addDeviceInfo(@RequestBody DeviceInfoParam param) {
-        return this.deviceInfoService.addDeviceInfo(param);
+    @Operation(summary = "添加-编辑产品", description = "添加-编辑产品")
+    @RequestMapping(value = "saveInfo", method = {RequestMethod.POST})
+    public ResultContent saveInfo(@RequestBody DeviceProductParam param) {
+        return this.deviceProductService.saveInfo(param);
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "删除设备", description = "删除设备")
-    @RequestMapping(value = "deleteDeviceInfo", method = {RequestMethod.POST})
-    public ResultContent deleteDeviceInfo(@RequestBody IDParam param) {
-        return this.deviceInfoService.deleteDeviceInfo(param.getId());
+    @Operation(summary = "删除产品", description = "删除产品")
+    @RequestMapping(value = "deleteInfo", method = {RequestMethod.POST})
+    public ResultContent deleteInfo(@RequestBody IDParam param) {
+        return this.deviceProductService.deleteInfo(param.getId());
     }
 
     @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "设备列表-分页查询", description = "设备列表-分页查询")
+    @Operation(summary = "产品列表-分页查询", description = "产品列表-分页查询")
     @RequestMapping(value = {"page"}, method = {RequestMethod.POST})
-    public ResultContent<Page<DeviceInfoModel>> page(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable, @Parameter(required = false) DeviceInfoSearch param) {
+    public ResultContent<Page<DeviceProductModel>> page(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable, @Parameter(required = false) DeviceProductSearch param) {
         Assert.hasText(param.getProjectOid(), "projectOid不能为空");
-        return deviceInfoService.page(param, pageable);
-    }
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "设备列表-分页查询(商户小程序用)", description = "设备列表-分页查询")
-    @RequestMapping(value = {"busPage"}, method = {RequestMethod.POST})
-    public ResultContent<Page<DeviceInfoModel>> busPage(@Parameter(hidden = true) @PageableDefault(page = 0, size = 10) Pageable pageable, @Parameter(required = false) DeviceInfoSearch param) {
-        return deviceInfoService.busPage(param, pageable);
-    }
-
-    @ResourceAuth(value = "user", type = AuthType.User)
-    @Operation(summary = "编辑设备信息", description = "编辑设备信息")
-    @RequestMapping(value = "updateDevice", method = {RequestMethod.POST})
-    public ResultContent updateDevice(@RequestBody @Valid DeviceBindAreaParam param) {
-        return this.deviceInfoService.updateDevice(param);
+        return deviceProductService.page(param, pageable);
     }
 
-    //----------------------------设备基础信息 end--------------------------
 
 }