Compare commits
2 Commits
0f382df17d
...
a585a1be26
Author | SHA1 | Date | |
---|---|---|---|
a585a1be26 | |||
3100f8f54d |
@ -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.SisDeviceManageVo;
|
||||
import org.dromara.sis.domain.bo.SisDeviceManageBo;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备管理
|
||||
* 前端访问路由地址为:/system/deviceManage
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/deviceManage")
|
||||
public class SisDeviceManageController extends BaseController {
|
||||
|
||||
private final ISisDeviceManageService sisDeviceManageService;
|
||||
|
||||
/**
|
||||
* 查询设备管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:deviceManage:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<SisDeviceManageVo> list(SisDeviceManageBo bo, PageQuery pageQuery) {
|
||||
return sisDeviceManageService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备管理列表
|
||||
*/
|
||||
@SaCheckPermission("system:deviceManage:export")
|
||||
@Log(title = "设备管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(SisDeviceManageBo bo, HttpServletResponse response) {
|
||||
List<SisDeviceManageVo> list = sisDeviceManageService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备管理", SisDeviceManageVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备管理详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("system:deviceManage:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<SisDeviceManageVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable("id") Long id) {
|
||||
return R.ok(sisDeviceManageService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*/
|
||||
@SaCheckPermission("system:deviceManage:add")
|
||||
@Log(title = "设备管理", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody SisDeviceManageBo bo) {
|
||||
return toAjax(sisDeviceManageService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*/
|
||||
@SaCheckPermission("system:deviceManage:edit")
|
||||
@Log(title = "设备管理", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody SisDeviceManageBo bo) {
|
||||
return toAjax(sisDeviceManageService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备管理
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("system:deviceManage:remove")
|
||||
@Log(title = "设备管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable("ids") Long[] ids) {
|
||||
return toAjax(sisDeviceManageService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
package org.dromara.sis.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备管理对象 sis_device_manage
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sis_device_manage")
|
||||
public class SisDeviceManage extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
private Long devicePort;
|
||||
|
||||
/**
|
||||
* 设备
|
||||
*/
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 设备在线状态 0:离线 1:在线 2:未知
|
||||
*/
|
||||
private Long deviceStatus;
|
||||
|
||||
/**
|
||||
* 父级设备id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 录像机ip
|
||||
*/
|
||||
private String vcrIp;
|
||||
|
||||
/**
|
||||
* 录像机端口
|
||||
*/
|
||||
private Long vcrPort;
|
||||
|
||||
/**
|
||||
* 门禁id
|
||||
*/
|
||||
private Long accessControlId;
|
||||
|
||||
|
||||
}
|
@ -11,7 +11,7 @@ import java.io.Serial;
|
||||
* 宇视设备点位(通道)对象 sis_device_point
|
||||
*
|
||||
* @author mocheng
|
||||
* @date 2025-06-25
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -33,15 +33,12 @@ public class SisDevicePoint extends TenantEntity {
|
||||
private String eqpCode;
|
||||
|
||||
/**
|
||||
* 视频协议 1:onvif 2:
|
||||
rtsp
|
||||
* 视频协议 1:onvif 2:rtsp
|
||||
*/
|
||||
private Long video;
|
||||
|
||||
/**
|
||||
* 传输协议(AIBOX 需要,一
|
||||
体机不需要) 1: tcp 2:
|
||||
udp
|
||||
* 传输协议(AIBOX 需要,一体机不需要) 1: tcp 2:udp
|
||||
*/
|
||||
private Long transportType;
|
||||
|
||||
@ -51,8 +48,7 @@ udp
|
||||
private String channelName;
|
||||
|
||||
/**
|
||||
* rtsp 地址(当视频协议为
|
||||
rtsp 时,该字段必填)
|
||||
* rtsp 地址(当视频协议为 rtsp 时,该字段必填)
|
||||
*/
|
||||
private String rtspAddr;
|
||||
|
||||
@ -77,17 +73,13 @@ rtsp 时,该字段必填)
|
||||
private String pwd;
|
||||
|
||||
/**
|
||||
* onvif 设备码流添加方
|
||||
式:1:主码流 2:自定
|
||||
义码流
|
||||
* onvif 设备码流添加方式:1:主码流 2:自定义码流
|
||||
*/
|
||||
private Long videoType;
|
||||
|
||||
/**
|
||||
* 码流 id:当选择自定义码
|
||||
流时,该字段必填,值为
|
||||
获取设备码流信息接口返
|
||||
回的码流 id
|
||||
* 码流 id:当选择自定义码流时,该字段必填,
|
||||
* 值为获取设备码流信息接口返回的码流 id
|
||||
*/
|
||||
private Long videoId;
|
||||
|
||||
|
@ -13,7 +13,7 @@ import jakarta.validation.constraints.*;
|
||||
* 门禁设备业务对象 sis_access_control
|
||||
*
|
||||
* @author lxj
|
||||
* @date 2025-06-25
|
||||
* @since 2025-06-25
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ -21,7 +21,7 @@ import jakarta.validation.constraints.*;
|
||||
public class SisAccessControlBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
@ -57,7 +57,7 @@ public class SisAccessControlBo extends BaseEntity {
|
||||
private String accessIp;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@NotNull(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long accessPort;
|
||||
@ -69,7 +69,7 @@ public class SisAccessControlBo extends BaseEntity {
|
||||
private Long accessType;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
@NotBlank(message = "不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String factoryCode;
|
||||
@ -107,5 +107,9 @@ public class SisAccessControlBo extends BaseEntity {
|
||||
*/
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* 绑定设备Id
|
||||
*/
|
||||
private Long deviceId;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
package org.dromara.sis.domain.bo;
|
||||
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
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_manage
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = SisDeviceManage.class, reverseConvertGenerate = false)
|
||||
public class SisDeviceManageBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@NotNull(message = "主键id不能为空", groups = {EditGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@NotBlank(message = "设备编码不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotBlank(message = "设备名称不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
@NotBlank(message = "设备ip不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
@NotNull(message = "设备端口不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long devicePort;
|
||||
|
||||
/**
|
||||
* 设备
|
||||
*/
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 设备在线状态 0:离线 1:在线 2:未知
|
||||
*/
|
||||
private Long deviceStatus;
|
||||
|
||||
/**
|
||||
* 父级设备id
|
||||
*/
|
||||
@NotNull(message = "父级设备id不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 录像机ip
|
||||
*/
|
||||
private String vcrIp;
|
||||
|
||||
/**
|
||||
* 录像机端口
|
||||
*/
|
||||
private Long vcrPort;
|
||||
|
||||
/**
|
||||
* 门禁id
|
||||
*/
|
||||
private Long accessControlId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
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 java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备管理视图对象 sis_device_manage
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = SisDeviceManage.class)
|
||||
public class SisDeviceManageVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@ExcelProperty(value = "主键id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@ExcelProperty(value = "设备编码")
|
||||
private String deviceNo;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 设备ip
|
||||
*/
|
||||
@ExcelProperty(value = "设备ip")
|
||||
private String deviceIp;
|
||||
|
||||
/**
|
||||
* 设备端口
|
||||
*/
|
||||
@ExcelProperty(value = "设备端口")
|
||||
private Long devicePort;
|
||||
|
||||
/**
|
||||
* 设备
|
||||
*/
|
||||
@ExcelProperty(value = "设备")
|
||||
private String deviceMac;
|
||||
|
||||
/**
|
||||
* 设备在线状态 0:离线 1:在线 2:未知
|
||||
*/
|
||||
@ExcelProperty(value = "设备在线状态 0:离线 1:在线 2:未知")
|
||||
private Long deviceStatus;
|
||||
|
||||
/**
|
||||
* 父级设备id
|
||||
*/
|
||||
@ExcelProperty(value = "父级设备id")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 录像机ip
|
||||
*/
|
||||
@ExcelProperty(value = "录像机ip")
|
||||
private String vcrIp;
|
||||
|
||||
/**
|
||||
* 录像机端口
|
||||
*/
|
||||
@ExcelProperty(value = "录像机端口")
|
||||
private Long vcrPort;
|
||||
|
||||
/**
|
||||
* 门禁id
|
||||
*/
|
||||
@ExcelProperty(value = "门禁id")
|
||||
private Long accessControlId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.dromara.sis.mapper;
|
||||
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备管理Mapper接口
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
public interface SisDeviceManageMapper extends BaseMapperPlus<SisDeviceManage, SisDeviceManageVo> {
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package org.dromara.sis.service;
|
||||
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.domain.bo.SisDeviceManageBo;
|
||||
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 mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
public interface ISisDeviceManageService {
|
||||
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备管理
|
||||
*/
|
||||
SisDeviceManageVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询设备管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备管理分页列表
|
||||
*/
|
||||
TableDataInfo<SisDeviceManageVo> queryPageList(SisDeviceManageBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备管理列表
|
||||
*/
|
||||
List<SisDeviceManageVo> queryList(SisDeviceManageBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*
|
||||
* @param bo 设备管理
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(SisDeviceManageBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*
|
||||
* @param bo 设备管理
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(SisDeviceManageBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备管理信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -9,6 +9,11 @@ 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.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.mapper.SisDeviceManageMapper;
|
||||
import org.dromara.sis.sdk.e8.DoorDeviceService;
|
||||
import org.dromara.sis.sdk.e8.domain.door.req.DoorDeviceAddReq;
|
||||
import org.dromara.sis.sdk.e8.domain.door.res.DoorDeviceAddRes;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.sis.domain.bo.SisAccessControlBo;
|
||||
import org.dromara.sis.domain.vo.SisAccessControlVo;
|
||||
@ -32,6 +37,8 @@ import java.util.Collection;
|
||||
public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
|
||||
private final SisAccessControlMapper baseMapper;
|
||||
private final DoorDeviceService doorDeviceService;
|
||||
private final SisDeviceManageMapper sisDeviceManageMapper;
|
||||
|
||||
/**
|
||||
* 查询门禁设备
|
||||
@ -100,9 +107,47 @@ public class SisAccessControlServiceImpl implements ISisAccessControlService {
|
||||
public Boolean insertByBo(SisAccessControlBo bo) {
|
||||
SisAccessControl add = MapstructUtils.convert(bo, SisAccessControl.class);
|
||||
validEntityBeforeSave(add);
|
||||
|
||||
// 添加E8门禁设备
|
||||
if (add.getControlType() == 2L){
|
||||
DoorDeviceAddReq e8DoorReq = new DoorDeviceAddReq();
|
||||
// 设备类型
|
||||
e8DoorReq.setType(add.getAccessType());
|
||||
// 设备名称
|
||||
e8DoorReq.setName(add.getAccessName());
|
||||
// 通讯类型
|
||||
e8DoorReq.setCommType(0);
|
||||
// cpuid
|
||||
e8DoorReq.setCpuID(add.getFactoryCode());
|
||||
// ip
|
||||
e8DoorReq.setIp(add.getAccessIp());
|
||||
// 端口
|
||||
e8DoorReq.setPort(add.getAccessPort());
|
||||
// 网关ip
|
||||
e8DoorReq.setGatewayIP("");
|
||||
// 子网掩码
|
||||
e8DoorReq.setNetMask("255.255.255.0");
|
||||
|
||||
DoorDeviceAddRes e8DoorRes = doorDeviceService.addDoorDevice(e8DoorReq);
|
||||
|
||||
if (e8DoorRes != null) {
|
||||
add.setOutCode(e8DoorRes.getId().toString());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
|
||||
// 判断是否绑定摄像头
|
||||
if (bo.getDeviceId() != null){
|
||||
SisDeviceManage device = new SisDeviceManage();
|
||||
device.setId(bo.getDeviceId());
|
||||
device.setAccessControlId(add.getId());
|
||||
sisDeviceManageMapper.updateById(device);
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
@ -0,0 +1,141 @@
|
||||
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.SisDeviceManageBo;
|
||||
import org.dromara.sis.domain.vo.SisDeviceManageVo;
|
||||
import org.dromara.sis.domain.SisDeviceManage;
|
||||
import org.dromara.sis.mapper.SisDeviceManageMapper;
|
||||
import org.dromara.sis.service.ISisDeviceManageService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备管理Service业务层处理
|
||||
*
|
||||
* @author mocheng
|
||||
* @since 2025-06-26
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class SisDeviceManageServiceImpl implements ISisDeviceManageService {
|
||||
|
||||
private final SisDeviceManageMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备管理
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备管理
|
||||
*/
|
||||
@Override
|
||||
public SisDeviceManageVo queryById(Long id) {
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备管理分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SisDeviceManageVo> queryPageList(SisDeviceManageBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = buildQueryWrapper(bo);
|
||||
Page<SisDeviceManageVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备管理列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备管理列表
|
||||
*/
|
||||
@Override
|
||||
public List<SisDeviceManageVo> queryList(SisDeviceManageBo bo) {
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<SisDeviceManage> buildQueryWrapper(SisDeviceManageBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SisDeviceManage> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(SisDeviceManage::getId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceNo()), SisDeviceManage::getDeviceNo, bo.getDeviceNo());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), SisDeviceManage::getDeviceName, bo.getDeviceName());
|
||||
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.getDeviceStatus() != null, SisDeviceManage::getDeviceStatus, bo.getDeviceStatus());
|
||||
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.getAccessControlId() != null, SisDeviceManage::getAccessControlId, bo.getAccessControlId());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备管理
|
||||
*
|
||||
* @param bo 设备管理
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(SisDeviceManageBo bo) {
|
||||
SisDeviceManage add = MapstructUtils.convert(bo, SisDeviceManage.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备管理
|
||||
*
|
||||
* @param bo 设备管理
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(SisDeviceManageBo bo) {
|
||||
SisDeviceManage update = MapstructUtils.convert(bo, SisDeviceManage.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(SisDeviceManage entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备管理信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.sis.mapper.SisDeviceManageMapper">
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user