|
@@ -1,44 +1,40 @@
|
|
|
package com.ruoyi.biz.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Controller;
|
|
|
-import org.springframework.ui.ModelMap;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
-import com.ruoyi.common.annotation.Log;
|
|
|
-import com.ruoyi.common.enums.BusinessType;
|
|
|
import com.ruoyi.biz.domain.TwinDevice;
|
|
|
import com.ruoyi.biz.service.ITwinDeviceService;
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
-import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
+import org.springframework.ui.ModelMap;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 设备管理Controller
|
|
|
- *
|
|
|
+ *
|
|
|
* @author ruoyi
|
|
|
* @date 2024-05-19
|
|
|
*/
|
|
|
@Controller
|
|
|
-@RequestMapping("/biz/biz")
|
|
|
-public class TwinDeviceController extends BaseController
|
|
|
-{
|
|
|
- private String prefix = "biz/biz";
|
|
|
+@RequestMapping("/biz/device")
|
|
|
+public class TwinDeviceController extends BaseController {
|
|
|
+ private String prefix = "biz/device";
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private ITwinDeviceService twinDeviceService;
|
|
|
|
|
|
@RequiresPermissions("biz:biz:view")
|
|
|
@GetMapping()
|
|
|
- public String biz()
|
|
|
- {
|
|
|
- return prefix + "/biz";
|
|
|
+ public String biz() {
|
|
|
+ return prefix + "/device";
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -47,8 +43,7 @@ public class TwinDeviceController extends BaseController
|
|
|
@RequiresPermissions("biz:biz:list")
|
|
|
@PostMapping("/list")
|
|
|
@ResponseBody
|
|
|
- public TableDataInfo list(TwinDevice twinDevice)
|
|
|
- {
|
|
|
+ public TableDataInfo list(TwinDevice twinDevice) {
|
|
|
startPage();
|
|
|
List<TwinDevice> list = twinDeviceService.selectTwinDeviceList(twinDevice);
|
|
|
return getDataTable(list);
|
|
@@ -61,8 +56,7 @@ public class TwinDeviceController extends BaseController
|
|
|
@Log(title = "设备管理", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
@ResponseBody
|
|
|
- public AjaxResult export(TwinDevice twinDevice)
|
|
|
- {
|
|
|
+ public AjaxResult export(TwinDevice twinDevice) {
|
|
|
List<TwinDevice> list = twinDeviceService.selectTwinDeviceList(twinDevice);
|
|
|
ExcelUtil<TwinDevice> util = new ExcelUtil<TwinDevice>(TwinDevice.class);
|
|
|
return util.exportExcel(list, "设备管理数据");
|
|
@@ -72,8 +66,7 @@ public class TwinDeviceController extends BaseController
|
|
|
* 新增设备管理
|
|
|
*/
|
|
|
@GetMapping("/add")
|
|
|
- public String add()
|
|
|
- {
|
|
|
+ public String add() {
|
|
|
return prefix + "/add";
|
|
|
}
|
|
|
|
|
@@ -84,8 +77,9 @@ public class TwinDeviceController extends BaseController
|
|
|
@Log(title = "设备管理", businessType = BusinessType.INSERT)
|
|
|
@PostMapping("/add")
|
|
|
@ResponseBody
|
|
|
- public AjaxResult addSave(TwinDevice twinDevice)
|
|
|
- {
|
|
|
+ public AjaxResult addSave(TwinDevice twinDevice) {
|
|
|
+ twinDevice.setCreatedBy(getLoginName());
|
|
|
+ twinDevice.setCreatedTime(new Date());
|
|
|
return toAjax(twinDeviceService.insertTwinDevice(twinDevice));
|
|
|
}
|
|
|
|
|
@@ -94,8 +88,7 @@ public class TwinDeviceController extends BaseController
|
|
|
*/
|
|
|
@RequiresPermissions("biz:biz:edit")
|
|
|
@GetMapping("/edit/{id}")
|
|
|
- public String edit(@PathVariable("id") Long id, ModelMap mmap)
|
|
|
- {
|
|
|
+ public String edit(@PathVariable("id") Long id, ModelMap mmap) {
|
|
|
TwinDevice twinDevice = twinDeviceService.selectTwinDeviceById(id);
|
|
|
mmap.put("twinDevice", twinDevice);
|
|
|
return prefix + "/edit";
|
|
@@ -108,8 +101,9 @@ public class TwinDeviceController extends BaseController
|
|
|
@Log(title = "设备管理", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/edit")
|
|
|
@ResponseBody
|
|
|
- public AjaxResult editSave(TwinDevice twinDevice)
|
|
|
- {
|
|
|
+ public AjaxResult editSave(TwinDevice twinDevice) {
|
|
|
+ twinDevice.setUpdatedBy(getLoginName());
|
|
|
+ twinDevice.setUpdatedTime(new Date());
|
|
|
return toAjax(twinDeviceService.updateTwinDevice(twinDevice));
|
|
|
}
|
|
|
|
|
@@ -118,10 +112,9 @@ public class TwinDeviceController extends BaseController
|
|
|
*/
|
|
|
@RequiresPermissions("biz:biz:remove")
|
|
|
@Log(title = "设备管理", businessType = BusinessType.DELETE)
|
|
|
- @PostMapping( "/remove")
|
|
|
+ @PostMapping("/remove")
|
|
|
@ResponseBody
|
|
|
- public AjaxResult remove(String ids)
|
|
|
- {
|
|
|
+ public AjaxResult remove(String ids) {
|
|
|
return toAjax(twinDeviceService.deleteTwinDeviceByIds(ids));
|
|
|
}
|
|
|
}
|