From c7088098f14ab2148a3a9dc057a41a7ad39fd85f Mon Sep 17 00:00:00 2001
From: mengff <1198151809@qq.com>
Date: Sat, 20 Jan 2024 10:47:43 +0800
Subject: [PATCH] =?UTF-8?q?--device=E8=A1=A8=E5=A2=9E=E5=8A=A0=E5=A2=9E?=
=?UTF-8?q?=E5=88=A0=E6=94=B9=E6=9F=A5=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=92=8C?=
=?UTF-8?q?=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
ruoyi-ui/src/api/system/device.js | 53 +++
ruoyi-ui/src/views/system/device/index.vue | 338 ++++++++++++++++++
.../business/controller/DeviceController.java | 105 ++++++
.../zc/business/controller/DeviceStatus.java | 9 +-
.../java/com/zc/business/domain/Device.java | 170 +++++++--
.../com/zc/business/mapper/DeviceMapper.java | 63 +++-
.../zc/business/service/IDeviceService.java | 63 ++++
.../business/service/impl/DeviceService.java | 23 --
.../service/impl/DeviceServiceImpl.java | 95 +++++
.../mapper/business/DeviceMapper.xml | 100 +++++-
10 files changed, 937 insertions(+), 82 deletions(-)
create mode 100644 ruoyi-ui/src/api/system/device.js
create mode 100644 ruoyi-ui/src/views/system/device/index.vue
create mode 100644 zc-business/src/main/java/com/zc/business/controller/DeviceController.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/IDeviceService.java
delete mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DeviceService.java
create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DeviceServiceImpl.java
diff --git a/ruoyi-ui/src/api/system/device.js b/ruoyi-ui/src/api/system/device.js
new file mode 100644
index 00000000..9366e7c9
--- /dev/null
+++ b/ruoyi-ui/src/api/system/device.js
@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+// 查询【请填写功能名称】列表
+export function listDevice(query) {
+ return request({
+ url: '/system/device/list',
+ method: 'get',
+ params: query
+ })
+}
+
+// 查询【请填写功能名称】详细
+export function getDevice(id) {
+ return request({
+ url: '/system/device/' + id,
+ method: 'get'
+ })
+}
+
+// 新增【请填写功能名称】
+export function addDevice(data) {
+ return request({
+ url: '/system/device',
+ method: 'post',
+ data: data
+ })
+}
+
+// 修改【请填写功能名称】
+export function updateDevice(data) {
+ return request({
+ url: '/system/device',
+ method: 'put',
+ data: data
+ })
+}
+
+// 删除【请填写功能名称】
+export function delDevice(id) {
+ return request({
+ url: '/system/device/' + id,
+ method: 'delete'
+ })
+}
+
+// 导出【请填写功能名称】
+export function exportDevice(query) {
+ return request({
+ url: '/system/device/export',
+ method: 'get',
+ params: query
+ })
+}
\ No newline at end of file
diff --git a/ruoyi-ui/src/views/system/device/index.vue b/ruoyi-ui/src/views/system/device/index.vue
new file mode 100644
index 00000000..906c0f2e
--- /dev/null
+++ b/ruoyi-ui/src/views/system/device/index.vue
@@ -0,0 +1,338 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 搜索
+ 重置
+
+
+
+
+
+ 新增
+
+
+ 修改
+
+
+ 删除
+
+
+ 导出
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 修改
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/zc-business/src/main/java/com/zc/business/controller/DeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DeviceController.java
new file mode 100644
index 00000000..59068c78
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/controller/DeviceController.java
@@ -0,0 +1,105 @@
+package com.zc.business.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.zc.business.domain.Device;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.zc.business.service.IDeviceService;
+
+/**
+ * 【请填写功能名称】Controller
+ *
+ * @author ruoyi
+ * @date 2024-01-20
+ */
+@RestController
+@RequestMapping("/system/device")
+public class DeviceController extends BaseController
+{
+ @Autowired
+ private IDeviceService deviceService;
+
+ /**
+ * 查询【请填写功能名称】列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:device:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(Device device)
+ {
+ startPage();
+ List list = deviceService.selectDeviceList(device);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出【请填写功能名称】列表
+ */
+ @PreAuthorize("@ss.hasPermi('system:device:export')")
+ @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, Device device)
+ {
+ List list = deviceService.selectDeviceList(device);
+ ExcelUtil util = new ExcelUtil<>(Device.class);
+ util.exportExcel(response, list, "【请填写功能名称】数据");
+ }
+
+ /**
+ * 获取【请填写功能名称】详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('system:device:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(deviceService.selectDeviceById(id));
+ }
+
+ /**
+ * 新增【请填写功能名称】
+ */
+ @PreAuthorize("@ss.hasPermi('system:device:add')")
+ @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody Device device)
+ {
+ return toAjax(deviceService.insertDevice(device));
+ }
+
+ /**
+ * 修改【请填写功能名称】
+ */
+ @PreAuthorize("@ss.hasPermi('system:device:edit')")
+ @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody Device device)
+ {
+ return toAjax(deviceService.updateDevice(device));
+ }
+
+ /**
+ * 删除【请填写功能名称】
+ */
+ @PreAuthorize("@ss.hasPermi('system:device:remove')")
+ @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(deviceService.deleteDeviceByIds(ids));
+ }
+}
diff --git a/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java b/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java
index 956bc788..47413189 100644
--- a/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java
+++ b/zc-business/src/main/java/com/zc/business/controller/DeviceStatus.java
@@ -1,6 +1,6 @@
package com.zc.business.controller;
import com.ruoyi.common.utils.spring.SpringUtils;
-import com.zc.business.service.impl.DeviceService;
+import com.zc.business.service.IDeviceService;
import com.zc.business.service.impl.ExcelExportService;
import com.zc.business.service.impl.StatusService;
import org.apache.poi.ss.usermodel.Workbook;
@@ -29,7 +29,7 @@ import java.util.stream.Collectors;
@EnableScheduling
public class DeviceStatus {
@Autowired
- private DeviceService deviceService;
+ private IDeviceService deviceService;
@Autowired
private StatusService statusService;
@@ -42,10 +42,11 @@ public class DeviceStatus {
// @Scheduled(cron = "0 0 0-23 * * ?")
// @Scheduled(cron = "0 0 1,5,7,8,11,14,17,19,21,23")
public void deviceStatus() {
- DeviceService deviceService= SpringUtils.getBean(DeviceService.class);
+ Device devices=new Device();
+ IDeviceService deviceService= SpringUtils.getBean(IDeviceService.class);
StatusService statusService= SpringUtils.getBean(StatusService.class);
ExecutorService executor = Executors.newFixedThreadPool(100);
- List deviceList = deviceService.SelectList();
+ List deviceList = deviceService.selectDeviceList(devices);
List> futures = new ArrayList<>();
diff --git a/zc-business/src/main/java/com/zc/business/domain/Device.java b/zc-business/src/main/java/com/zc/business/domain/Device.java
index de6dbbff..e835da54 100644
--- a/zc-business/src/main/java/com/zc/business/domain/Device.java
+++ b/zc-business/src/main/java/com/zc/business/domain/Device.java
@@ -1,65 +1,163 @@
package com.zc.business.domain;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+
/**
- * @author mengff
- * @Date 2020/03/03
+ * 【请填写功能名称】对象 device
+ *
+ * @author ruoyi
+ * @date 2024-01-20
*/
-public class Device {
- private long id;
+public class Device extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
- public String getDeviceNo() {
- return deviceNo;
+ /** 设备ID */
+ private Long id;
+
+ /** 设备桩号 */
+ @Excel(name = "设备桩号")
+ private String deviceNo;
+
+ /** 设备名称 */
+ @Excel(name = "设备名称")
+ private String deviceName;
+
+ /** 设备IP */
+ @Excel(name = "设备IP")
+ private String deviceIp;
+
+ /** 方向 */
+ @Excel(name = "方向")
+ private String direction;
+
+ /** 厂家 */
+ @Excel(name = "厂家")
+ private String production;
+
+ /** 型号 */
+ @Excel(name = "型号")
+ private String model;
+
+ /** 网段 */
+ @Excel(name = "网段")
+ private String network;
+
+ /** 备注 */
+ @Excel(name = "备注")
+ private String content;
+
+ /** 设备类型 */
+ @Excel(name = "设备类型")
+ private String type;
+
+ public void setId(Long id)
+ {
+ this.id = id;
}
- public void setDeviceNo(String deviceNo) {
+ public Long getId()
+ {
+ return id;
+ }
+ public void setDeviceNo(String deviceNo)
+ {
this.deviceNo = deviceNo;
}
- public String getDeviceName() {
- return deviceName;
+ public String getDeviceNo()
+ {
+ return deviceNo;
}
-
- public void setDeviceName(String deviceName) {
+ public void setDeviceName(String deviceName)
+ {
this.deviceName = deviceName;
}
- public String getDeviceIp() {
+ public String getDeviceName()
+ {
+ return deviceName;
+ }
+ public void setDeviceIp(String deviceIp)
+ {
+ this.deviceIp = deviceIp;
+ }
+
+ public String getDeviceIp()
+ {
return deviceIp;
}
+ public void setDirection(String direction)
+ {
+ this.direction = direction;
+ }
- @Override
- public String toString() {
- return "Device{" +
- "id=" + id +
- ", deviceNo='" + deviceNo + '\'' +
- ", deviceName='" + deviceName + '\'' +
- ", deviceIp='" + deviceIp + '\'' +
- '}';
+ public String getDirection()
+ {
+ return direction;
+ }
+ public void setProduction(String production)
+ {
+ this.production = production;
}
- public Device(long id, String deviceNo, String deviceName, String deviceIp) {
- this.id = id;
- this.deviceNo = deviceNo;
- this.deviceName = deviceName;
- this.deviceIp = deviceIp;
+ public String getProduction()
+ {
+ return production;
+ }
+ public void setModel(String model)
+ {
+ this.model = model;
}
- public void setDeviceIp(String deviceIp) {
- this.deviceIp = deviceIp;
+ public String getModel()
+ {
+ return model;
+ }
+ public void setNetwork(String network)
+ {
+ this.network = network;
}
- public String getType() {
- return type;
+ public String getNetwork()
+ {
+ return network;
+ }
+ public void setContent(String content)
+ {
+ this.content = content;
}
- public void setType(String type) {
+ public String getContent()
+ {
+ return content;
+ }
+ public void setType(String type)
+ {
this.type = type;
}
- private String deviceNo;
- private String deviceName;
- private String deviceIp;
-
- private String type;
+ public String getType()
+ {
+ return type;
+ }
-}
\ No newline at end of file
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+ .append("id", getId())
+ .append("deviceNo", getDeviceNo())
+ .append("deviceName", getDeviceName())
+ .append("deviceIp", getDeviceIp())
+ .append("direction", getDirection())
+ .append("production", getProduction())
+ .append("model", getModel())
+ .append("network", getNetwork())
+ .append("content", getContent())
+ .append("type", getType())
+ .toString();
+ }
+}
diff --git a/zc-business/src/main/java/com/zc/business/mapper/DeviceMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DeviceMapper.java
index 270a9e83..b7b627e9 100644
--- a/zc-business/src/main/java/com/zc/business/mapper/DeviceMapper.java
+++ b/zc-business/src/main/java/com/zc/business/mapper/DeviceMapper.java
@@ -1,16 +1,61 @@
package com.zc.business.mapper;
-import com.zc.business.domain.Device;
-import org.springframework.stereotype.Repository;
-
import java.util.List;
+import com.zc.business.domain.Device;
/**
- * @author mengff
- * @Date 2024/01/04
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author ruoyi
+ * @date 2024-01-20
*/
-@Repository
-public interface DeviceMapper {
+public interface DeviceMapper
+{
+ /**
+ * 查询【请填写功能名称】
+ *
+ * @param id 【请填写功能名称】主键
+ * @return 【请填写功能名称】
+ */
+ Device selectDeviceById(Long id);
+
+ /**
+ * 查询【请填写功能名称】列表
+ *
+ * @param device 【请填写功能名称】
+ * @return 【请填写功能名称】集合
+ */
+ List selectDeviceList(Device device);
+
+ /**
+ * 新增【请填写功能名称】
+ *
+ * @param device 【请填写功能名称】
+ * @return 结果
+ */
+ int insertDevice(Device device);
+
+ /**
+ * 修改【请填写功能名称】
+ *
+ * @param device 【请填写功能名称】
+ * @return 结果
+ */
+ int updateDevice(Device device);
+
+ /**
+ * 删除【请填写功能名称】
+ *
+ * @param id 【请填写功能名称】主键
+ * @return 结果
+ */
+ int deleteDeviceById(Long id);
- List SelectList();
-}
\ No newline at end of file
+ /**
+ * 批量删除【请填写功能名称】
+ *
+ * @param ids 需要删除的数据主键集合
+ * @return 结果
+ */
+ int deleteDeviceByIds(Long[] ids);
+}
diff --git a/zc-business/src/main/java/com/zc/business/service/IDeviceService.java b/zc-business/src/main/java/com/zc/business/service/IDeviceService.java
new file mode 100644
index 00000000..34f51f3b
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/service/IDeviceService.java
@@ -0,0 +1,63 @@
+package com.zc.business.service;
+
+
+import com.zc.business.domain.Device;
+
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author ruoyi
+ * @date 2024-01-20
+ */
+public interface IDeviceService
+{
+ /**
+ * 查询【请填写功能名称】
+ *
+ * @param id 【请填写功能名称】主键
+ * @return 【请填写功能名称】
+ */
+ public Device selectDeviceById(Long id);
+
+ /**
+ * 查询【请填写功能名称】列表
+ *
+ * @param device 【请填写功能名称】
+ * @return 【请填写功能名称】集合
+ */
+ List selectDeviceList(Device device);
+
+ /**
+ * 新增【请填写功能名称】
+ *
+ * @param device 【请填写功能名称】
+ * @return 结果
+ */
+ int insertDevice(Device device);
+
+ /**
+ * 修改【请填写功能名称】
+ *
+ * @param device 【请填写功能名称】
+ * @return 结果
+ */
+ int updateDevice(Device device);
+
+ /**
+ * 批量删除【请填写功能名称】
+ *
+ * @param ids 需要删除的【请填写功能名称】主键集合
+ * @return 结果
+ */
+ int deleteDeviceByIds(Long[] ids);
+
+ /**
+ * 删除【请填写功能名称】信息
+ *
+ * @param id 【请填写功能名称】主键
+ * @return 结果
+ */
+ int deleteDeviceById(Long id);
+}
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DeviceService.java b/zc-business/src/main/java/com/zc/business/service/impl/DeviceService.java
deleted file mode 100644
index 416a0256..00000000
--- a/zc-business/src/main/java/com/zc/business/service/impl/DeviceService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.zc.business.service.impl;
-
-import com.zc.business.domain.Device;
-import com.zc.business.mapper.DeviceMapper;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * @author mengff
- * @Date 2024/01/04
- */
-@Service
-public class DeviceService {
- @Autowired
- DeviceMapper deviceMapper;
-
- public List SelectList() {
- return deviceMapper.SelectList();
- }
-
-}
\ No newline at end of file
diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DeviceServiceImpl.java
new file mode 100644
index 00000000..f4b03c15
--- /dev/null
+++ b/zc-business/src/main/java/com/zc/business/service/impl/DeviceServiceImpl.java
@@ -0,0 +1,95 @@
+package com.zc.business.service.impl;
+
+import java.util.List;
+
+import com.zc.business.domain.Device;
+import com.zc.business.mapper.DeviceMapper;
+import com.zc.business.service.IDeviceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2024-01-20
+ */
+@Service
+public class DeviceServiceImpl implements IDeviceService
+{
+ @Autowired
+ private DeviceMapper deviceMapper;
+
+ /**
+ * 查询【请填写功能名称】
+ *
+ * @param id 【请填写功能名称】主键
+ * @return 【请填写功能名称】
+ */
+ @Override
+ public Device selectDeviceById(Long id)
+ {
+ return deviceMapper.selectDeviceById(id);
+ }
+
+ /**
+ * 查询【请填写功能名称】列表
+ *
+ * @param device 【请填写功能名称】
+ * @return 【请填写功能名称】
+ */
+ @Override
+ public List selectDeviceList(Device device)
+ {
+ return deviceMapper.selectDeviceList(device);
+ }
+
+ /**
+ * 新增【请填写功能名称】
+ *
+ * @param device 【请填写功能名称】
+ * @return 结果
+ */
+ @Override
+ public int insertDevice(Device device)
+ {
+ return deviceMapper.insertDevice(device);
+ }
+
+ /**
+ * 修改【请填写功能名称】
+ *
+ * @param device 【请填写功能名称】
+ * @return 结果
+ */
+ @Override
+ public int updateDevice(Device device)
+ {
+ return deviceMapper.updateDevice(device);
+ }
+
+ /**
+ * 批量删除【请填写功能名称】
+ *
+ * @param ids 需要删除的【请填写功能名称】主键
+ * @return 结果
+ */
+ @Override
+ public int deleteDeviceByIds(Long[] ids)
+ {
+ return deviceMapper.deleteDeviceByIds(ids);
+ }
+
+ /**
+ * 删除【请填写功能名称】信息
+ *
+ * @param id 【请填写功能名称】主键
+ * @return 结果
+ */
+ @Override
+ public int deleteDeviceById(Long id)
+ {
+ return deviceMapper.deleteDeviceById(id);
+ }
+}
diff --git a/zc-business/src/main/resources/mapper/business/DeviceMapper.xml b/zc-business/src/main/resources/mapper/business/DeviceMapper.xml
index a64ae26f..bc59809b 100644
--- a/zc-business/src/main/resources/mapper/business/DeviceMapper.xml
+++ b/zc-business/src/main/resources/mapper/business/DeviceMapper.xml
@@ -1,16 +1,96 @@
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
\ No newline at end of file