From adafd52d0fe7125c071279e9c5430d83e697b353 Mon Sep 17 00:00:00 2001 From: 15683799673 Date: Sat, 19 Jul 2025 09:10:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=89=E9=98=B2=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E7=AE=A1=E7=90=86=E6=A8=A1=E5=9D=97=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dromara/common/core/domain/TreeNode.java | 9 + .../mapper/CostPayFeeAuditMapper.xml | 247 ------------------ .../SisDeviceChannelController.java | 118 +++++++++ .../controller/SisDeviceGroupController.java | 106 ++++++++ .../dromara/sis/domain/SisDeviceChannel.java | 76 ++++++ .../dromara/sis/domain/SisDeviceGroup.java | 46 ++++ .../dromara/sis/domain/SisDeviceManage.java | 29 +- .../sis/domain/bo/SisDeviceChannelBo.java | 81 ++++++ .../sis/domain/bo/SisDeviceGroupBo.java | 47 ++++ .../sis/domain/bo/SisDeviceManageBo.java | 28 +- .../sis/domain/vo/SisDeviceChannelVo.java | 92 +++++++ .../sis/domain/vo/SisDeviceGroupVo.java | 56 ++++ .../sis/domain/vo/SisDeviceManageVo.java | 37 +-- .../sis/mapper/SisDeviceChannelMapper.java | 15 ++ .../sis/mapper/SisDeviceGroupMapper.java | 15 ++ .../sis/service/ISisDeviceChannelService.java | 78 ++++++ .../sis/service/ISisDeviceGroupService.java | 72 +++++ .../impl/SisDeviceChannelServiceImpl.java | 186 +++++++++++++ .../impl/SisDeviceGroupServiceImpl.java | 138 ++++++++++ .../impl/SisDeviceManageServiceImpl.java | 5 +- .../mapper/sis/SisDeviceChannelMapper.xml | 7 + .../mapper/sis/SisDeviceGroupMapper.xml | 7 + 22 files changed, 1171 insertions(+), 324 deletions(-) delete mode 100644 ruoyi-common/ruoyi-common-core/src/main/resources/mapper/CostPayFeeAuditMapper.xml create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceChannelController.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceGroupController.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceChannel.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceGroup.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceChannelBo.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceGroupBo.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceChannelVo.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceGroupVo.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceChannelMapper.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceGroupMapper.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceChannelService.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceGroupService.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceChannelServiceImpl.java create mode 100644 ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceGroupServiceImpl.java create mode 100644 ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceChannelMapper.xml create mode 100644 ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceGroupMapper.xml diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/TreeNode.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/TreeNode.java index 5b5e7ae..82c92f9 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/TreeNode.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/TreeNode.java @@ -10,10 +10,19 @@ public class TreeNode implements TreeEntity, T> { private Integer level; // 编码 private T code; + private T key; // 父编码 private T ParentCode; // 标签 private String label; + private String title; + + + /** + * 存放阶段数据 + */ + private Object data; + // 子节点 private List> children; diff --git a/ruoyi-common/ruoyi-common-core/src/main/resources/mapper/CostPayFeeAuditMapper.xml b/ruoyi-common/ruoyi-common-core/src/main/resources/mapper/CostPayFeeAuditMapper.xml deleted file mode 100644 index 3187edd..0000000 --- a/ruoyi-common/ruoyi-common-core/src/main/resources/mapper/CostPayFeeAuditMapper.xml +++ /dev/null @@ -1,247 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - insert into cost_pay_fee_audit(house_charge_iditem_idstart_timeend_timereceived_amountreceivable_amountpay_timestateremarkcreate_timecreate_byupdate_timeupdate_bysearch_valuecreate_depttenant_id) - values (#{houseChargeId}#{itemId}#{startTime}#{endTime}#{receivedAmount}#{receivableAmount}#{payTime}#{state}#{remark}#{createTime}#{createBy}#{updateTime}#{updateBy}#{searchValue}#{createDept}#{tenantId}) - - - - insert into cost_pay_fee_audit(house_charge_iditem_idstart_timeend_timereceived_amountreceivable_amountpay_timestateremarkcreate_timecreate_byupdate_timeupdate_bysearch_valuecreate_depttenant_id) - values - - (#{entity.houseChargeId}#{entity.itemId}#{entity.startTime}#{entity.endTime}#{entity.receivedAmount}#{entity.receivableAmount}#{entity.payTime}#{entity.state}#{entity.remark}#{entity.createTime}#{entity.createBy}#{entity.updateTime}#{entity.updateBy}#{entity.searchValue}#{entity.createDept}#{entity.tenantId}) - - - - - insert into cost_pay_fee_audit(house_charge_iditem_idstart_timeend_timereceived_amountreceivable_amountpay_timestateremarkcreate_timecreate_byupdate_timeupdate_bysearch_valuecreate_depttenant_id) - values - - (#{entity.houseChargeId}#{entity.itemId}#{entity.startTime}#{entity.endTime}#{entity.receivedAmount}#{entity.receivableAmount}#{entity.payTime}#{entity.state}#{entity.remark}#{entity.createTime}#{entity.createBy}#{entity.updateTime}#{entity.updateBy}#{entity.searchValue}#{entity.createDept}#{entity.tenantId}) - - on duplicate key update -house_charge_id = values(house_charge_id)item_id = values(item_id)start_time = values(start_time)end_time = values(end_time)received_amount = values(received_amount)receivable_amount = values(receivable_amount)pay_time = values(pay_time)state = values(state)remark = values(remark)create_time = values(create_time)create_by = values(create_by)update_time = values(update_time)update_by = values(update_by)search_value = values(search_value)create_dept = values(create_dept)tenant_id = values(tenant_id) - - - - - update cost_pay_fee_audit - - - house_charge_id = #{houseChargeId}, - - - item_id = #{itemId}, - - - start_time = #{startTime}, - - - end_time = #{endTime}, - - - received_amount = #{receivedAmount}, - - - receivable_amount = #{receivableAmount}, - - - pay_time = #{payTime}, - - - state = #{state}, - - - remark = #{remark}, - - - create_time = #{createTime}, - - - create_by = #{createBy}, - - - update_time = #{updateTime}, - - - update_by = #{updateBy}, - - - search_value = #{searchValue}, - - - create_dept = #{createDept}, - - - tenant_id = #{tenantId}, - - - where id = #{id} - - - - - delete from cost_pay_fee_audit where id = #{id} - - - - - diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceChannelController.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceChannelController.java new file mode 100644 index 0000000..101a412 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceChannelController.java @@ -0,0 +1,118 @@ +package org.dromara.sis.controller; + +import cn.dev33.satoken.annotation.SaCheckPermission; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.RequiredArgsConstructor; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.domain.TreeNode; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.web.core.BaseController; +import org.dromara.sis.domain.bo.SisDeviceChannelBo; +import org.dromara.sis.domain.vo.SisDeviceChannelVo; +import org.dromara.sis.service.ISisDeviceChannelService; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 设备通道管理 + * 前端访问路由地址为:/sis/deviceChannel + * + * @author lxj + * @date 2025-07-19 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/deviceChannel") +public class SisDeviceChannelController extends BaseController { + + private final ISisDeviceChannelService sisDeviceChannelService; + + /** + * 查询设备通道管理列表 + */ + @SaCheckPermission("sis:deviceChannel:list") + @GetMapping("/list") + public TableDataInfo list(SisDeviceChannelBo bo, PageQuery pageQuery) { + return sisDeviceChannelService.queryPageList(bo, pageQuery); + } + + /** + * 查询设备通道树 + * + * @return 返回设备通道树 + */ + @GetMapping("/treeList") + public R>> tree() { + return R.ok(sisDeviceChannelService.queryTree()); + } + + /** + * 导出设备通道管理列表 + */ + @SaCheckPermission("sis:deviceChannel:export") + @Log(title = "设备通道管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(SisDeviceChannelBo bo, HttpServletResponse response) { + List list = sisDeviceChannelService.queryList(bo); + ExcelUtil.exportExcel(list, "设备通道管理", SisDeviceChannelVo.class, response); + } + + /** + * 获取设备通道管理详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("sis:deviceChannel:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return R.ok(sisDeviceChannelService.queryById(id)); + } + + /** + * 新增设备通道管理 + */ + @SaCheckPermission("sis:deviceChannel:add") + @Log(title = "设备通道管理", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody SisDeviceChannelBo bo) { + return toAjax(sisDeviceChannelService.insertByBo(bo)); + } + + /** + * 修改设备通道管理 + */ + @SaCheckPermission("sis:deviceChannel:edit") + @Log(title = "设备通道管理", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody SisDeviceChannelBo bo) { + return toAjax(sisDeviceChannelService.updateByBo(bo)); + } + + /** + * 删除设备通道管理 + * + * @param ids 主键串 + */ + @SaCheckPermission("sis:deviceChannel:remove") + @Log(title = "设备通道管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable("ids") Long[] ids) { + return toAjax(sisDeviceChannelService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceGroupController.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceGroupController.java new file mode 100644 index 0000000..10a817f --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/controller/SisDeviceGroupController.java @@ -0,0 +1,106 @@ +package org.dromara.sis.controller; + +import java.util.List; + +import lombok.RequiredArgsConstructor; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.validation.constraints.*; +import cn.dev33.satoken.annotation.SaCheckPermission; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import org.dromara.common.idempotent.annotation.RepeatSubmit; +import org.dromara.common.log.annotation.Log; +import org.dromara.common.web.core.BaseController; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.core.domain.R; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import org.dromara.common.log.enums.BusinessType; +import org.dromara.common.excel.utils.ExcelUtil; +import org.dromara.sis.domain.vo.SisDeviceGroupVo; +import org.dromara.sis.domain.bo.SisDeviceGroupBo; +import org.dromara.sis.service.ISisDeviceGroupService; +import org.dromara.common.mybatis.core.page.TableDataInfo; + +/** + * 设备组管理 + * 前端访问路由地址为:/sis/deviceGroup + * + * @author lxj + * @date 2025-07-19 + */ +@Validated +@RequiredArgsConstructor +@RestController +@RequestMapping("/deviceGroup") +public class SisDeviceGroupController extends BaseController { + + private final ISisDeviceGroupService sisDeviceGroupService; + + /** + * 查询设备组管理列表 + */ + @SaCheckPermission("sis:deviceGroup:list") + @GetMapping("/list") + public TableDataInfo list(SisDeviceGroupBo bo, PageQuery pageQuery) { + return sisDeviceGroupService.queryPageList(bo, pageQuery); + } + + /** + * 导出设备组管理列表 + */ + @SaCheckPermission("sis:deviceGroup:export") + @Log(title = "设备组管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(SisDeviceGroupBo bo, HttpServletResponse response) { + List list = sisDeviceGroupService.queryList(bo); + ExcelUtil.exportExcel(list, "设备组管理", SisDeviceGroupVo.class, response); + } + + /** + * 获取设备组管理详细信息 + * + * @param id 主键 + */ + @SaCheckPermission("sis:deviceGroup:query") + @GetMapping("/{id}") + public R getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return R.ok(sisDeviceGroupService.queryById(id)); + } + + /** + * 新增设备组管理 + */ + @SaCheckPermission("sis:deviceGroup:add") + @Log(title = "设备组管理", businessType = BusinessType.INSERT) + @RepeatSubmit() + @PostMapping() + public R add(@Validated(AddGroup.class) @RequestBody SisDeviceGroupBo bo) { + return toAjax(sisDeviceGroupService.insertByBo(bo)); + } + + /** + * 修改设备组管理 + */ + @SaCheckPermission("sis:deviceGroup:edit") + @Log(title = "设备组管理", businessType = BusinessType.UPDATE) + @RepeatSubmit() + @PutMapping() + public R edit(@Validated(EditGroup.class) @RequestBody SisDeviceGroupBo bo) { + return toAjax(sisDeviceGroupService.updateByBo(bo)); + } + + /** + * 删除设备组管理 + * + * @param ids 主键串 + */ + @SaCheckPermission("sis:deviceGroup:remove") + @Log(title = "设备组管理", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public R remove(@NotEmpty(message = "主键不能为空") + @PathVariable("ids") Long[] ids) { + return toAjax(sisDeviceGroupService.deleteWithValidByIds(List.of(ids), true)); + } +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceChannel.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceChannel.java new file mode 100644 index 0000000..167aa38 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceChannel.java @@ -0,0 +1,76 @@ +package org.dromara.sis.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 设备通道管理对象 sis_device_channel + * + * @author lxj + * @date 2025-07-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sis_device_channel") +public class SisDeviceChannel extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 设备id + */ + private Long deviceId; + + /** + * 设备名称 + */ + private String channelName; + + /** + * 通道分组组id + */ + private Long groupId; + + /** + * 设备ip + */ + private String deviceIp; + + /** + * 设备端口 + */ + private Long devicePort; + + /** + * 设备账号 + */ + private String deviceAccount; + + /** + * 设备密码 + */ + private String devicePwd; + + /** + * 设备 + */ + private String deviceMac; + + /** + * 设备通道编号 + */ + private String channelNo; + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceGroup.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceGroup.java new file mode 100644 index 0000000..48937e1 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceGroup.java @@ -0,0 +1,46 @@ +package org.dromara.sis.domain; + +import org.dromara.common.tenant.core.TenantEntity; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serial; + +/** + * 设备组管理对象 sis_device_group + * + * @author lxj + * @date 2025-07-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@TableName("sis_device_group") +public class SisDeviceGroup extends TenantEntity { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @TableId(value = "id") + private Long id; + + /** + * 分组名称 + */ + private String name; + + /** + * 父编码id(-1 表示根节点) + */ + private Long parentId; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceManage.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceManage.java index e72e57a..658b358 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceManage.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/SisDeviceManage.java @@ -53,21 +53,6 @@ public class SisDeviceManage extends BaseEntity { */ private Integer deviceStatus; - /** - * 父级设备id - */ - private Long parentId; - - /** - * 录像机ip - */ - private String vcrIp; - - /** - * 录像机端口 - */ - private Integer vcrPort; - /** * 设备账号 */ @@ -79,19 +64,17 @@ public class SisDeviceManage extends BaseEntity { private String devicePwd; /** - * 录像机账号 + * 设备类型 */ - private String vcrAccount; + private Integer deviceType; /** - * 录像机密码 + * 设备厂商编号 */ - private String vcrPwd; + private String factoryNo; /** - * 设备在录像机的通道编码 + * 设备组id */ - private String channelNo; - - + private Long groupId; } diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceChannelBo.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceChannelBo.java new file mode 100644 index 0000000..24fd340 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceChannelBo.java @@ -0,0 +1,81 @@ +package org.dromara.sis.domain.bo; + +import org.dromara.sis.domain.SisDeviceChannel; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 设备通道管理业务对象 sis_device_channel + * + * @author lxj + * @date 2025-07-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = SisDeviceChannel.class, reverseConvertGenerate = false) +public class SisDeviceChannelBo extends BaseEntity { + + /** + * 主键id + */ + @NotNull(message = "主键id不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 设备id + */ + @NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long deviceId; + + /** + * 设备名称 + */ + private String channelName; + + /** + * 通道分组组id + */ + @NotNull(message = "通道分组组id不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long groupId; + + /** + * 设备ip + */ + @NotBlank(message = "设备ip不能为空", groups = { AddGroup.class, EditGroup.class }) + private String deviceIp; + + /** + * 设备端口 + */ + @NotNull(message = "设备端口不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long devicePort; + + /** + * 设备账号 + */ + @NotBlank(message = "设备账号不能为空", groups = { AddGroup.class, EditGroup.class }) + private String deviceAccount; + + /** + * 设备密码 + */ + @NotBlank(message = "设备密码不能为空", groups = { AddGroup.class, EditGroup.class }) + private String devicePwd; + + /** + * 设备 + */ + private String deviceMac; + + /** + * 设备通道编号 + */ + private String channelNo; + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceGroupBo.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceGroupBo.java new file mode 100644 index 0000000..4a2c0ed --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceGroupBo.java @@ -0,0 +1,47 @@ +package org.dromara.sis.domain.bo; + +import org.dromara.sis.domain.SisDeviceGroup; +import org.dromara.common.mybatis.core.domain.BaseEntity; +import org.dromara.common.core.validate.AddGroup; +import org.dromara.common.core.validate.EditGroup; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import lombok.EqualsAndHashCode; +import jakarta.validation.constraints.*; + +/** + * 设备组管理业务对象 sis_device_group + * + * @author lxj + * @date 2025-07-19 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@AutoMapper(target = SisDeviceGroup.class, reverseConvertGenerate = false) +public class SisDeviceGroupBo extends BaseEntity { + + /** + * 主键id + */ + @NotNull(message = "主键id不能为空", groups = { EditGroup.class }) + private Long id; + + /** + * 分组名称 + */ + @NotBlank(message = "分组名称不能为空", groups = { AddGroup.class, EditGroup.class }) + private String name; + + /** + * 父编码id(-1 表示根节点) + */ + @NotNull(message = "父编码id(-1 表示根节点)不能为空", groups = { AddGroup.class, EditGroup.class }) + private Long parentId; + + /** + * 备注 + */ + private String remark; + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceManageBo.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceManageBo.java index cc1d0f3..c5e1fc4 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceManageBo.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/bo/SisDeviceManageBo.java @@ -50,22 +50,6 @@ public class SisDeviceManageBo extends BaseEntity { */ private String deviceMac; - /** - * 父级设备id - */ -// @NotNull(message = "父级设备id不能为空", groups = {AddGroup.class, EditGroup.class}) - private Long parentId; - - /** - * 录像机ip - */ - private String vcrIp; - - /** - * 录像机端口 - */ - private Long vcrPort; - /** * 设备账号 */ @@ -79,19 +63,19 @@ public class SisDeviceManageBo extends BaseEntity { private String devicePwd; /** - * 录像机账号 + * 设备类型 */ - private String vcrAccount; + private Integer deviceType; /** - * 录像机密码 + * 设备厂商编号 */ - private String vcrPwd; + private String factoryNo; /** - * 设备在录像机的通道编码 + * 设备组id */ - private String channelNo; + private Long groupId; } diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceChannelVo.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceChannelVo.java new file mode 100644 index 0000000..f7e084b --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceChannelVo.java @@ -0,0 +1,92 @@ +package org.dromara.sis.domain.vo; + +import org.dromara.sis.domain.SisDeviceChannel; +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 设备通道管理视图对象 sis_device_channel + * + * @author lxj + * @date 2025-07-19 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = SisDeviceChannel.class) +public class SisDeviceChannelVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ExcelProperty(value = "主键id") + private Long id; + + /** + * 设备id + */ + @ExcelProperty(value = "设备id") + private Long deviceId; + + /** + * 设备名称 + */ + @ExcelProperty(value = "设备名称") + private String channelName; + + /** + * 通道分组组id + */ + @ExcelProperty(value = "通道分组组id") + private Long groupId; + + /** + * 设备ip + */ + @ExcelProperty(value = "设备ip") + private String deviceIp; + + /** + * 设备端口 + */ + @ExcelProperty(value = "设备端口") + private Long devicePort; + + /** + * 设备账号 + */ + @ExcelProperty(value = "设备账号") + private String deviceAccount; + + /** + * 设备密码 + */ + @ExcelProperty(value = "设备密码") + private String devicePwd; + + /** + * 设备 + */ + @ExcelProperty(value = "设备") + private String deviceMac; + + /** + * 设备通道编号 + */ + @ExcelProperty(value = "设备通道编号") + private String channelNo; + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceGroupVo.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceGroupVo.java new file mode 100644 index 0000000..0ed3550 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceGroupVo.java @@ -0,0 +1,56 @@ +package org.dromara.sis.domain.vo; + +import org.dromara.sis.domain.SisDeviceGroup; +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; +import cn.idev.excel.annotation.ExcelProperty; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; + +import java.io.Serial; +import java.io.Serializable; +import java.util.Date; + + + +/** + * 设备组管理视图对象 sis_device_group + * + * @author lxj + * @date 2025-07-19 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = SisDeviceGroup.class) +public class SisDeviceGroupVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 主键id + */ + @ExcelProperty(value = "主键id") + private Long id; + + /** + * 分组名称 + */ + @ExcelProperty(value = "分组名称") + private String name; + + /** + * 父编码id(-1 表示根节点) + */ + @ExcelProperty(value = "父编码id(-1 表示根节点)") + private Long parentId; + + /** + * 备注 + */ + @ExcelProperty(value = "备注") + private String remark; + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceManageVo.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceManageVo.java index bc29925..adbf940 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceManageVo.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/domain/vo/SisDeviceManageVo.java @@ -1,21 +1,20 @@ package org.dromara.sis.domain.vo; -import org.dromara.sis.domain.SisDeviceManage; import cn.idev.excel.annotation.ExcelIgnoreUnannotated; import cn.idev.excel.annotation.ExcelProperty; import io.github.linpeilie.annotations.AutoMapper; import lombok.Data; +import org.dromara.sis.domain.SisDeviceManage; import java.io.Serial; import java.io.Serializable; - /** * 设备管理视图对象 sis_device_manage * * @author mocheng - * @since 2025-06-26 + * @since 2025-06-26 */ @Data @ExcelIgnoreUnannotated @@ -55,24 +54,6 @@ public class SisDeviceManageVo implements Serializable { @ExcelProperty(value = "设备") private String deviceMac; - /** - * 父级设备id - */ - @ExcelProperty(value = "父级设备id") - private Long parentId; - - /** - * 录像机ip - */ - @ExcelProperty(value = "录像机ip") - private String vcrIp; - - /** - * 录像机端口 - */ - @ExcelProperty(value = "录像机端口") - private Integer vcrPort; - /** * 设备账号 */ @@ -84,20 +65,18 @@ public class SisDeviceManageVo implements Serializable { private String devicePwd; /** - * 录像机账号 + * 设备类型 */ - private String vcrAccount; + private Integer deviceType; /** - * 录像机密码 + * 设备厂商编号 */ - private String vcrPwd; + private String factoryNo; /** - * 设备在录像机的通道编码 + * 设备组id */ - private String channelNo; - - private String bindDeviceId; + private Long groupId; } diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceChannelMapper.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceChannelMapper.java new file mode 100644 index 0000000..2bc99e3 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceChannelMapper.java @@ -0,0 +1,15 @@ +package org.dromara.sis.mapper; + +import org.dromara.sis.domain.SisDeviceChannel; +import org.dromara.sis.domain.vo.SisDeviceChannelVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 设备通道管理Mapper接口 + * + * @author lxj + * @date 2025-07-19 + */ +public interface SisDeviceChannelMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceGroupMapper.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceGroupMapper.java new file mode 100644 index 0000000..0a0ec60 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/mapper/SisDeviceGroupMapper.java @@ -0,0 +1,15 @@ +package org.dromara.sis.mapper; + +import org.dromara.sis.domain.SisDeviceGroup; +import org.dromara.sis.domain.vo.SisDeviceGroupVo; +import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; + +/** + * 设备组管理Mapper接口 + * + * @author lxj + * @date 2025-07-19 + */ +public interface SisDeviceGroupMapper extends BaseMapperPlus { + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceChannelService.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceChannelService.java new file mode 100644 index 0000000..e917a49 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceChannelService.java @@ -0,0 +1,78 @@ +package org.dromara.sis.service; + +import org.dromara.common.core.domain.TreeNode; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.sis.domain.bo.SisDeviceChannelBo; +import org.dromara.sis.domain.vo.SisDeviceChannelVo; + +import java.util.Collection; +import java.util.List; + +/** + * 设备通道管理Service接口 + * + * @author lxj + * @date 2025-07-19 + */ +public interface ISisDeviceChannelService { + + /** + * 查询设备通道管理 + * + * @param id 主键 + * @return 设备通道管理 + */ + SisDeviceChannelVo queryById(Long id); + + /** + * 分页查询设备通道管理列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 设备通道管理分页列表 + */ + TableDataInfo queryPageList(SisDeviceChannelBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的设备通道管理列表 + * + * @param bo 查询条件 + * @return 设备通道管理列表 + */ + List queryList(SisDeviceChannelBo bo); + + /** + * 新增设备通道管理 + * + * @param bo 设备通道管理 + * @return 是否新增成功 + */ + Boolean insertByBo(SisDeviceChannelBo bo); + + /** + * 修改设备通道管理 + * + * @param bo 设备通道管理 + * @return 是否修改成功 + */ + Boolean updateByBo(SisDeviceChannelBo bo); + + /** + * 校验并批量删除设备通道管理信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * 查询设备通道树 + * + * @return 返回通道树结构 + */ + List> queryTree(); + + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceGroupService.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceGroupService.java new file mode 100644 index 0000000..f4d468c --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/ISisDeviceGroupService.java @@ -0,0 +1,72 @@ +package org.dromara.sis.service; + +import org.dromara.sis.domain.SisDeviceGroup; +import org.dromara.sis.domain.vo.SisDeviceGroupVo; +import org.dromara.sis.domain.bo.SisDeviceGroupBo; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; + +import java.util.Collection; +import java.util.List; + +/** + * 设备组管理Service接口 + * + * @author lxj + * @date 2025-07-19 + */ +public interface ISisDeviceGroupService { + + /** + * 查询设备组管理 + * + * @param id 主键 + * @return 设备组管理 + */ + SisDeviceGroupVo queryById(Long id); + + /** + * 分页查询设备组管理列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 设备组管理分页列表 + */ + TableDataInfo queryPageList(SisDeviceGroupBo bo, PageQuery pageQuery); + + /** + * 查询符合条件的设备组管理列表 + * + * @param bo 查询条件 + * @return 设备组管理列表 + */ + List queryList(SisDeviceGroupBo bo); + + /** + * 新增设备组管理 + * + * @param bo 设备组管理 + * @return 是否新增成功 + */ + Boolean insertByBo(SisDeviceGroupBo bo); + + /** + * 修改设备组管理 + * + * @param bo 设备组管理 + * @return 是否修改成功 + */ + Boolean updateByBo(SisDeviceGroupBo bo); + + /** + * 校验并批量删除设备组管理信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + List querAll(); + +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceChannelServiceImpl.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceChannelServiceImpl.java new file mode 100644 index 0000000..164a800 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceChannelServiceImpl.java @@ -0,0 +1,186 @@ +package org.dromara.sis.service.impl; + +import cn.hutool.core.collection.CollUtil; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.domain.TreeNode; +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.core.utils.TreeUtils; +import org.dromara.common.mybatis.core.page.PageQuery; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.sis.domain.SisDeviceChannel; +import org.dromara.sis.domain.bo.SisDeviceChannelBo; +import org.dromara.sis.domain.vo.SisDeviceChannelVo; +import org.dromara.sis.domain.vo.SisDeviceGroupVo; +import org.dromara.sis.mapper.SisDeviceChannelMapper; +import org.dromara.sis.service.ISisDeviceChannelService; +import org.dromara.sis.service.ISisDeviceGroupService; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Map; + +/** + * 设备通道管理Service业务层处理 + * + * @author lxj + * @date 2025-07-19 + */ +@Slf4j +@RequiredArgsConstructor +@Service +public class SisDeviceChannelServiceImpl implements ISisDeviceChannelService { + + private final SisDeviceChannelMapper baseMapper; + private final ISisDeviceGroupService deviceGroupService; + + /** + * 查询设备通道管理 + * + * @param id 主键 + * @return 设备通道管理 + */ + @Override + public SisDeviceChannelVo queryById(Long id) { + return baseMapper.selectVoById(id); + } + + /** + * 分页查询设备通道管理列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 设备通道管理分页列表 + */ + @Override + public TableDataInfo queryPageList(SisDeviceChannelBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的设备通道管理列表 + * + * @param bo 查询条件 + * @return 设备通道管理列表 + */ + @Override + public List queryList(SisDeviceChannelBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(SisDeviceChannelBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.orderByAsc(SisDeviceChannel::getId); + lqw.eq(bo.getDeviceId() != null, SisDeviceChannel::getDeviceId, bo.getDeviceId()); + lqw.like(StringUtils.isNotBlank(bo.getChannelName()), SisDeviceChannel::getChannelName, bo.getChannelName()); + lqw.eq(bo.getGroupId() != null, SisDeviceChannel::getGroupId, bo.getGroupId()); + lqw.eq(StringUtils.isNotBlank(bo.getDeviceIp()), SisDeviceChannel::getDeviceIp, bo.getDeviceIp()); + lqw.eq(bo.getDevicePort() != null, SisDeviceChannel::getDevicePort, bo.getDevicePort()); + lqw.eq(StringUtils.isNotBlank(bo.getDeviceAccount()), SisDeviceChannel::getDeviceAccount, bo.getDeviceAccount()); + lqw.eq(StringUtils.isNotBlank(bo.getDevicePwd()), SisDeviceChannel::getDevicePwd, bo.getDevicePwd()); + lqw.eq(StringUtils.isNotBlank(bo.getDeviceMac()), SisDeviceChannel::getDeviceMac, bo.getDeviceMac()); + lqw.eq(StringUtils.isNotBlank(bo.getChannelNo()), SisDeviceChannel::getChannelNo, bo.getChannelNo()); + return lqw; + } + + /** + * 新增设备通道管理 + * + * @param bo 设备通道管理 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(SisDeviceChannelBo bo) { + SisDeviceChannel add = MapstructUtils.convert(bo, SisDeviceChannel.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改设备通道管理 + * + * @param bo 设备通道管理 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(SisDeviceChannelBo bo) { + SisDeviceChannel update = MapstructUtils.convert(bo, SisDeviceChannel.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(SisDeviceChannel entity) { + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除设备通道管理信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if (isValid) { + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } + + @Override + public List> queryTree() { + // 查询设备的分组信息 + List ls = deviceGroupService.querAll(); + if (CollUtil.isEmpty(ls)) { + return List.of(); + } + // 查询通道信息 + List sisDeviceChannelVos = baseMapper.selectVoList(null); + if (CollUtil.isEmpty(sisDeviceChannelVos)) { + return List.of(); + } + // 组装树结构 + List> treeNodes = new ArrayList<>(ls.size() + sisDeviceChannelVos.size()); + ls.forEach(item -> { + TreeNode treeNode = new TreeNode<>(); + treeNode.setLevel(1); + treeNode.setCode(item.getId()); + treeNode.setKey(item.getId()); + treeNode.setParentCode(item.getParentId()); + treeNode.setLabel(item.getName()); + treeNode.setTitle(item.getName()); + treeNode.setData(item); + treeNodes.add(treeNode); + }); + sisDeviceChannelVos.forEach(item -> { + TreeNode treeNode = new TreeNode<>(); + treeNode.setLevel(2); + treeNode.setCode(item.getId()); + treeNode.setKey(item.getId()); + treeNode.setParentCode(item.getGroupId()); + treeNode.setLabel(item.getChannelName()); + treeNode.setTitle(item.getChannelName()); + treeNode.setData(item); + treeNodes.add(treeNode); + }); + return TreeUtils.build(treeNodes, -1L); + } +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceGroupServiceImpl.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceGroupServiceImpl.java new file mode 100644 index 0000000..4c3ab3f --- /dev/null +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceGroupServiceImpl.java @@ -0,0 +1,138 @@ +package org.dromara.sis.service.impl; + +import org.dromara.common.core.utils.MapstructUtils; +import org.dromara.common.core.utils.StringUtils; +import org.dromara.common.mybatis.core.page.TableDataInfo; +import org.dromara.common.mybatis.core.page.PageQuery; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.Wrappers; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.dromara.sis.domain.bo.SisDeviceGroupBo; +import org.dromara.sis.domain.vo.SisDeviceGroupVo; +import org.dromara.sis.domain.SisDeviceGroup; +import org.dromara.sis.mapper.SisDeviceGroupMapper; +import org.dromara.sis.service.ISisDeviceGroupService; + +import java.util.List; +import java.util.Map; +import java.util.Collection; + +/** + * 设备组管理Service业务层处理 + * + * @author lxj + * @date 2025-07-19 + */ +@Slf4j +@RequiredArgsConstructor +@Service +public class SisDeviceGroupServiceImpl implements ISisDeviceGroupService { + + private final SisDeviceGroupMapper baseMapper; + + /** + * 查询设备组管理 + * + * @param id 主键 + * @return 设备组管理 + */ + @Override + public SisDeviceGroupVo queryById(Long id){ + return baseMapper.selectVoById(id); + } + + /** + * 分页查询设备组管理列表 + * + * @param bo 查询条件 + * @param pageQuery 分页参数 + * @return 设备组管理分页列表 + */ + @Override + public TableDataInfo queryPageList(SisDeviceGroupBo bo, PageQuery pageQuery) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + Page result = baseMapper.selectVoPage(pageQuery.build(), lqw); + return TableDataInfo.build(result); + } + + /** + * 查询符合条件的设备组管理列表 + * + * @param bo 查询条件 + * @return 设备组管理列表 + */ + @Override + public List queryList(SisDeviceGroupBo bo) { + LambdaQueryWrapper lqw = buildQueryWrapper(bo); + return baseMapper.selectVoList(lqw); + } + + private LambdaQueryWrapper buildQueryWrapper(SisDeviceGroupBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.orderByAsc(SisDeviceGroup::getId); + lqw.like(StringUtils.isNotBlank(bo.getName()), SisDeviceGroup::getName, bo.getName()); + lqw.eq(bo.getParentId() != null, SisDeviceGroup::getParentId, bo.getParentId()); + return lqw; + } + + /** + * 新增设备组管理 + * + * @param bo 设备组管理 + * @return 是否新增成功 + */ + @Override + public Boolean insertByBo(SisDeviceGroupBo bo) { + SisDeviceGroup add = MapstructUtils.convert(bo, SisDeviceGroup.class); + validEntityBeforeSave(add); + boolean flag = baseMapper.insert(add) > 0; + if (flag) { + bo.setId(add.getId()); + } + return flag; + } + + /** + * 修改设备组管理 + * + * @param bo 设备组管理 + * @return 是否修改成功 + */ + @Override + public Boolean updateByBo(SisDeviceGroupBo bo) { + SisDeviceGroup update = MapstructUtils.convert(bo, SisDeviceGroup.class); + validEntityBeforeSave(update); + return baseMapper.updateById(update) > 0; + } + + /** + * 保存前的数据校验 + */ + private void validEntityBeforeSave(SisDeviceGroup entity){ + //TODO 做一些数据校验,如唯一约束 + } + + /** + * 校验并批量删除设备组管理信息 + * + * @param ids 待删除的主键集合 + * @param isValid 是否进行有效性校验 + * @return 是否删除成功 + */ + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return baseMapper.deleteByIds(ids) > 0; + } + + @Override + public List querAll() { + return baseMapper.selectVoList(null); + } +} diff --git a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceManageServiceImpl.java b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceManageServiceImpl.java index 6433ba8..e604250 100644 --- a/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceManageServiceImpl.java +++ b/ruoyi-modules/Sis/src/main/java/org/dromara/sis/service/impl/SisDeviceManageServiceImpl.java @@ -79,9 +79,8 @@ public class SisDeviceManageServiceImpl implements ISisDeviceManageService { lqw.eq(StringUtils.isNotBlank(bo.getDeviceIp()), SisDeviceManage::getDeviceIp, bo.getDeviceIp()); lqw.eq(bo.getDevicePort() != null, SisDeviceManage::getDevicePort, bo.getDevicePort()); lqw.eq(StringUtils.isNotBlank(bo.getDeviceMac()), SisDeviceManage::getDeviceMac, bo.getDeviceMac()); - lqw.eq(bo.getParentId() != null, SisDeviceManage::getParentId, bo.getParentId()); - lqw.eq(StringUtils.isNotBlank(bo.getVcrIp()), SisDeviceManage::getVcrIp, bo.getVcrIp()); - lqw.eq(bo.getVcrPort() != null, SisDeviceManage::getVcrPort, bo.getVcrPort()); + lqw.eq(bo.getDeviceType() != null, SisDeviceManage::getDeviceType, bo.getDeviceType()); + lqw.eq(StringUtils.isNotBlank(bo.getFactoryNo()), SisDeviceManage::getFactoryNo, bo.getFactoryNo()); return lqw; } diff --git a/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceChannelMapper.xml b/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceChannelMapper.xml new file mode 100644 index 0000000..4a40633 --- /dev/null +++ b/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceChannelMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceGroupMapper.xml b/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceGroupMapper.xml new file mode 100644 index 0000000..d16092b --- /dev/null +++ b/ruoyi-modules/Sis/src/main/resources/mapper/sis/SisDeviceGroupMapper.xml @@ -0,0 +1,7 @@ + + + + +