设备
This commit is contained in:
@ -305,6 +305,8 @@ springdoc:
|
|||||||
packages-to-scan: org.dromara.ai
|
packages-to-scan: org.dromara.ai
|
||||||
- group: 31.投标管理模块
|
- group: 31.投标管理模块
|
||||||
packages-to-scan: org.dromara.bidding
|
packages-to-scan: org.dromara.bidding
|
||||||
|
- group: 32.设备模块
|
||||||
|
packages-to-scan: org.dromara.device
|
||||||
# knife4j的增强配置,不需要增强可以不配
|
# knife4j的增强配置,不需要增强可以不配
|
||||||
knife4j:
|
knife4j:
|
||||||
enable: true
|
enable: true
|
||||||
|
|||||||
@ -0,0 +1,107 @@
|
|||||||
|
package org.dromara.device.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.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/accessRecord")
|
||||||
|
public class DeviceAccessRecordController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceAccessRecordService deviceAccessRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备进出场记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceAccessRecordVo> list(DeviceAccessRecordBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceAccessRecordService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备进出场记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:export")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceAccessRecordBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceAccessRecordVo> list = deviceAccessRecordService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备进出场记录", DeviceAccessRecordVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备进出场记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceAccessRecordVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceAccessRecordService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备进出场记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:add")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceAccessRecordBo bo) {
|
||||||
|
return toAjax(deviceAccessRecordService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备进出场记录
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:edit")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceAccessRecordBo bo) {
|
||||||
|
return toAjax(deviceAccessRecordService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备进出场记录
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:accessRecord:remove")
|
||||||
|
@Log(title = "设备进出场记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceAccessRecordService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,134 @@
|
|||||||
|
package org.dromara.device.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoCountVo;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
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.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceInfoBo;
|
||||||
|
import org.dromara.device.service.IDeviceInfoService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/info")
|
||||||
|
public class DeviceInfoController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceInfoService deviceInfoService;
|
||||||
|
|
||||||
|
private final IDeviceAccessRecordService deviceAccessRecordService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceInfoVo> list(DeviceInfoBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceInfoService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备信息列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:export")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceInfoBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceInfoVo> list = deviceInfoService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备信息", DeviceInfoVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备信息详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:info:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceInfoVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceInfoService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进出场纪录
|
||||||
|
*/
|
||||||
|
@GetMapping("/recordList")
|
||||||
|
public R<List<DeviceAccessRecordVo>> recordList(DeviceAccessRecordBo bo) {
|
||||||
|
List<DeviceAccessRecordVo> list = deviceAccessRecordService.queryList(bo);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SaCheckPermission("device:info:list")
|
||||||
|
@GetMapping("/count/{projectId}")
|
||||||
|
public R<DeviceInfoCountVo> count(@PathVariable Long projectId) {
|
||||||
|
return R.ok(deviceInfoService.count(projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SaCheckPermission("device:info:list")
|
||||||
|
@GetMapping("/typeCount/{projectId}")
|
||||||
|
public R<Map<String, Integer>> typeCount(@PathVariable Long projectId) {
|
||||||
|
return R.ok(deviceInfoService.typeCount(projectId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:add")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceInfoBo bo) {
|
||||||
|
return toAjax(deviceInfoService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:edit")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceInfoBo bo) {
|
||||||
|
return toAjax(deviceInfoService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备信息
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:info:remove")
|
||||||
|
@Log(title = "设备信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceInfoService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
package org.dromara.device.controller;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
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.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceTypeBo;
|
||||||
|
import org.dromara.device.service.IDeviceTypeService;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/device/type")
|
||||||
|
public class DeviceTypeController extends BaseController {
|
||||||
|
|
||||||
|
private final IDeviceTypeService deviceTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<DeviceTypeVo> list(DeviceTypeBo bo, PageQuery pageQuery) {
|
||||||
|
return deviceTypeService.queryPageList(bo, pageQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备树状列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:list")
|
||||||
|
@GetMapping("/treeList")
|
||||||
|
public R<List<DeviceTypeVo>> treeList(DeviceTypeBo bo) {
|
||||||
|
List<DeviceTypeVo> list = deviceTypeService.queryList(bo);
|
||||||
|
buildTreeWithAutoRoot(list);
|
||||||
|
return R.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<DeviceTypeVo> buildTreeWithAutoRoot(List<DeviceTypeVo> list) {
|
||||||
|
// 1. 用 Map 缓存所有节点(key=节点ID,value=节点对象)
|
||||||
|
Map<Long, DeviceTypeVo> nodeMap = list.stream()
|
||||||
|
.collect(Collectors.toMap(DeviceTypeVo::getId, node -> node));
|
||||||
|
|
||||||
|
List<DeviceTypeVo> rootNodes = new ArrayList<>(); // 存储自动识别的顶级节点
|
||||||
|
List<DeviceTypeVo> orphanNodes = new ArrayList<>(); // 存储孤儿节点(可选:单独处理)
|
||||||
|
|
||||||
|
for (DeviceTypeVo node : list) {
|
||||||
|
Long parentId = node.getParentId();
|
||||||
|
// 情况1:parent_id 为0或NULL → 直接视为顶级节点
|
||||||
|
if (parentId == null || parentId == 0) {
|
||||||
|
rootNodes.add(node);
|
||||||
|
} else {
|
||||||
|
// 情况2:查找父节点
|
||||||
|
DeviceTypeVo parentNode = nodeMap.get(parentId);
|
||||||
|
if (parentNode != null) {
|
||||||
|
// 父节点存在 → 挂载到子节点列表
|
||||||
|
if (parentNode.getChildren() == null) {
|
||||||
|
parentNode.setChildren(new ArrayList<>());
|
||||||
|
}
|
||||||
|
parentNode.getChildren().add(node);
|
||||||
|
} else {
|
||||||
|
// 父节点不存在 → 视为顶级节点(或加入孤儿节点列表)
|
||||||
|
rootNodes.add(node);
|
||||||
|
// 可选:记录孤儿节点,用于后续告警或修复
|
||||||
|
orphanNodes.add(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 可选:打印孤儿节点日志(便于排查数据问题)
|
||||||
|
// if (!orphanNodes.isEmpty()) {
|
||||||
|
// System.out.println("警告:存在孤儿节点(父节点不存在),节点ID:" +
|
||||||
|
// orphanNodes.stream().map(DeviceType::getId).collect(Collectors.toList()));
|
||||||
|
// }
|
||||||
|
|
||||||
|
return rootNodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出设备类型列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:export")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(DeviceTypeBo bo, HttpServletResponse response) {
|
||||||
|
List<DeviceTypeVo> list = deviceTypeService.queryList(bo);
|
||||||
|
ExcelUtil.exportExcel(list, "设备类型", DeviceTypeVo.class, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备类型详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
// @SaCheckPermission("device:type:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<DeviceTypeVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(deviceTypeService.queryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:add")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.INSERT)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PostMapping()
|
||||||
|
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceTypeBo bo) {
|
||||||
|
return toAjax(deviceTypeService.insertByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:edit")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceTypeBo bo) {
|
||||||
|
return toAjax(deviceTypeService.updateByBo(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除设备类型
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("device:type:remove")
|
||||||
|
@Log(title = "设备类型", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(deviceTypeService.deleteWithValidByIds(List.of(ids), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
package org.dromara.device.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录对象 device_access_record
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_access_record")
|
||||||
|
public class DeviceAccessRecord extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录编号(唯一标识,如:RC-2024-0012)
|
||||||
|
*/
|
||||||
|
private String recordNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID(关联设备表device的id)
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1-进场,2-出场,可扩展其他状态)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间(记录发生的时间,如:2024-03-15 09:30:25)
|
||||||
|
*/
|
||||||
|
private LocalDateTime operateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项目名字
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID(关联用户表user的id)
|
||||||
|
*/
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人姓名(冗余存储,如:张三)
|
||||||
|
*/
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因(如:安装使用、设备调拨、入库存储)
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细说明(查看详情时展示的补充信息,可选)
|
||||||
|
*/
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子项目ID
|
||||||
|
*/
|
||||||
|
private Long childProjectId;
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.device.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息对象 device_info
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_info")
|
||||||
|
public class DeviceInfo extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
private String modelSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID(关联设备类型表device_type的id)
|
||||||
|
*/
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出厂日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保修日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate warrantyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0-闲置,1-使用中,2-维修中,3-报废)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String responsiblePerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话(支持固定电话和手机号)
|
||||||
|
*/
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备描述(详细说明)
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package org.dromara.device.domain;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型对象 device_type
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("device_type")
|
||||||
|
public class DeviceType extends BaseEntity {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
*/
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类型ID
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级(1=顶级,2=二级,3=三级...,最大支持255级)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
package org.dromara.device.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录业务对象 device_access_record
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceAccessRecord.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceAccessRecordBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录编号(唯一标识,如:RC-2024-0012)
|
||||||
|
*/
|
||||||
|
private String recordNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID(关联设备表device的id)
|
||||||
|
*/
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1-进场,2-出场,可扩展其他状态)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间(记录发生的时间,如:2024-03-15 09:30:25)
|
||||||
|
*/
|
||||||
|
private LocalDateTime operateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置/目的地(如:A区-1号电站、B区仓库→A区电站)
|
||||||
|
*/
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID(关联用户表user的id)
|
||||||
|
*/
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人姓名(冗余存储,如:张三)
|
||||||
|
*/
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因(如:安装使用、设备调拨、入库存储)
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细说明(查看详情时展示的补充信息,可选)
|
||||||
|
*/
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,104 @@
|
|||||||
|
package org.dromara.device.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
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.*;
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息业务对象 device_info
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceInfo.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceInfoBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
private String modelSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID(关联设备类型表device_type的id)
|
||||||
|
*/
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出厂日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保修日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
private LocalDate warrantyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0-闲置,1-使用中,2-维修中,3-报废)
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
private String responsiblePerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话(支持固定电话和手机号)
|
||||||
|
*/
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备描述(详细说明)
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
package org.dromara.device.domain.bo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型业务对象 device_type
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@AutoMapper(target = DeviceType.class, reverseConvertGenerate = false)
|
||||||
|
public class DeviceTypeBo extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@NotNull(message = "id不能为空", groups = { EditGroup.class })
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "设备类型名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类型ID
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级(1=顶级,2=二级,3=三级...,最大支持255级)
|
||||||
|
*/
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.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.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录视图对象 device_access_record
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceAccessRecord.class)
|
||||||
|
public class DeviceAccessRecordVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 记录编号(唯一标识,如:RC-2024-0012)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "记录编号", converter = ExcelDictConvert.class)
|
||||||
|
private String recordNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备ID(关联设备表device的id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备ID", converter = ExcelDictConvert.class)
|
||||||
|
private Long deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(1-进场,2-出场,可扩展其他状态)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "状态", converter = ExcelDictConvert.class)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作时间(记录发生的时间,如:2024-03-15 09:30:25)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作时间", converter = ExcelDictConvert.class)
|
||||||
|
private LocalDateTime operateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 位置/目的地(如:A区-1号电站、B区仓库→A区电站)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "位置/目的地", converter = ExcelDictConvert.class)
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人ID(关联用户表user的id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作人ID", converter = ExcelDictConvert.class)
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作人姓名(冗余存储,如:张三)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "操作人姓名", converter = ExcelDictConvert.class)
|
||||||
|
private String operatorName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 原因(如:安装使用、设备调拨、入库存储)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "原因", converter = ExcelDictConvert.class)
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详细说明(查看详情时展示的补充信息,可选)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "详细说明", converter = ExcelDictConvert.class)
|
||||||
|
private String details;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DeviceInfoCountVo {
|
||||||
|
/**
|
||||||
|
* 总数
|
||||||
|
*/
|
||||||
|
private Integer total;
|
||||||
|
/**
|
||||||
|
* 使用
|
||||||
|
*/
|
||||||
|
private Integer use;
|
||||||
|
/**
|
||||||
|
* 维护
|
||||||
|
*/
|
||||||
|
private Integer maintain;
|
||||||
|
/**
|
||||||
|
* 闲置
|
||||||
|
*/
|
||||||
|
private Integer idle;
|
||||||
|
}
|
||||||
@ -0,0 +1,138 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.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.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息视图对象 device_info
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceInfo.class)
|
||||||
|
public class DeviceInfoVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目Id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "项目Id")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备编号
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备编号")
|
||||||
|
private String deviceCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备名称")
|
||||||
|
private String deviceName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 型号规格
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "型号规格")
|
||||||
|
private String modelSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型ID(关联设备类型表device_type的id)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型ID", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "关=联设备类型表device_type的id")
|
||||||
|
private Long typeId;
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生产厂家
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "生产厂家")
|
||||||
|
private String manufacturer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出厂日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "出厂日期", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "y=yyy-mm-dd")
|
||||||
|
private LocalDate productionDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保修日期(yyyy-mm-dd)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "保修日期", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "y=yyy-mm-dd")
|
||||||
|
private LocalDate warrantyDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备状态(0-闲置,1-使用中,2-维修中,3-报废)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备状态", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "0=-闲置,1-使用中,2-维修中,3-报废")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 负责人姓名
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "负责人姓名")
|
||||||
|
private String responsiblePerson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 联系电话(支持固定电话和手机号)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "联系电话", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "支=持固定电话和手机号")
|
||||||
|
private String contactPhone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备描述(详细说明)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备描述", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "详=细说明")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "图片")
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图片Url
|
||||||
|
*/
|
||||||
|
@Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "image")
|
||||||
|
private String imageUrl;
|
||||||
|
/**
|
||||||
|
* 附件
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "附件")
|
||||||
|
private String file;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,78 @@
|
|||||||
|
package org.dromara.device.domain.vo;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.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;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型视图对象 device_type
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ExcelIgnoreUnannotated
|
||||||
|
@AutoMapper(target = DeviceType.class)
|
||||||
|
public class DeviceTypeVo implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型编码
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型编码")
|
||||||
|
private String typeCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型名称
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型名称")
|
||||||
|
private String typeName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父类型ID
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "父类型ID")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 层级(1=顶级,2=二级,3=三级...,最大支持255级)
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "层级", converter = ExcelDictConvert.class)
|
||||||
|
@ExcelDictFormat(readConverterExp = "1==顶级,2=二级,3=三级...,最大支持255级")
|
||||||
|
private Integer level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 祖级列表
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "祖级列表")
|
||||||
|
private String ancestors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型描述
|
||||||
|
*/
|
||||||
|
@ExcelProperty(value = "设备类型描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
|
||||||
|
private List<DeviceTypeVo> children;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.device.mapper;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DeviceAccessRecordMapper extends BaseMapperPlus<DeviceAccessRecord, DeviceAccessRecordVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.device.mapper;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DeviceInfoMapper extends BaseMapperPlus<DeviceInfo, DeviceInfoVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.device.mapper;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型Mapper接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface DeviceTypeMapper extends BaseMapperPlus<DeviceType, DeviceTypeVo> {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.device.service;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDeviceAccessRecordService extends IService<DeviceAccessRecord>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备进出场记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备进出场记录
|
||||||
|
*/
|
||||||
|
DeviceAccessRecordVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备进出场记录分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceAccessRecordVo> queryPageList(DeviceAccessRecordBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备进出场记录列表
|
||||||
|
*/
|
||||||
|
List<DeviceAccessRecordVo> queryList(DeviceAccessRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceAccessRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceAccessRecordBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备进出场记录信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,85 @@
|
|||||||
|
package org.dromara.device.service;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoCountVo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceInfoBo;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDeviceInfoService extends IService<DeviceInfo>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备信息
|
||||||
|
*/
|
||||||
|
DeviceInfoVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备信息分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceInfoVo> queryPageList(DeviceInfoBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备信息列表
|
||||||
|
*/
|
||||||
|
List<DeviceInfoVo> queryList(DeviceInfoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceInfoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceInfoBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备数量统计
|
||||||
|
*/
|
||||||
|
DeviceInfoCountVo count(Long projectId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型统计
|
||||||
|
*/
|
||||||
|
Map<String, Integer> typeCount(Long projectId);
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,70 @@
|
|||||||
|
package org.dromara.device.service;
|
||||||
|
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.device.domain.bo.DeviceTypeBo;
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型Service接口
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
public interface IDeviceTypeService extends IService<DeviceType>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备类型
|
||||||
|
*/
|
||||||
|
DeviceTypeVo queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备类型分页列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<DeviceTypeVo> queryPageList(DeviceTypeBo bo, PageQuery pageQuery);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备类型列表
|
||||||
|
*/
|
||||||
|
List<DeviceTypeVo> queryList(DeviceTypeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(DeviceTypeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
Boolean updateByBo(DeviceTypeBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备类型信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
}
|
||||||
@ -0,0 +1,140 @@
|
|||||||
|
package org.dromara.device.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
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 org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.device.domain.bo.DeviceAccessRecordBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceAccessRecordVo;
|
||||||
|
import org.dromara.device.domain.DeviceAccessRecord;
|
||||||
|
import org.dromara.device.mapper.DeviceAccessRecordMapper;
|
||||||
|
import org.dromara.device.service.IDeviceAccessRecordService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备进出场记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceAccessRecordServiceImpl extends ServiceImpl<DeviceAccessRecordMapper, DeviceAccessRecord> implements IDeviceAccessRecordService {
|
||||||
|
|
||||||
|
private final DeviceAccessRecordMapper baseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备进出场记录
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备进出场记录
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceAccessRecordVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备进出场记录分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceAccessRecordVo> queryPageList(DeviceAccessRecordBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceAccessRecordVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备进出场记录列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备进出场记录列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceAccessRecordVo> queryList(DeviceAccessRecordBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceAccessRecord> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceAccessRecord> buildQueryWrapper(DeviceAccessRecordBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceAccessRecord> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(DeviceAccessRecord::getId);
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getRecordNo()), DeviceAccessRecord::getRecordNo, bo.getRecordNo());
|
||||||
|
lqw.eq(bo.getDeviceId() != null, DeviceAccessRecord::getDeviceId, bo.getDeviceId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceAccessRecord::getDeviceName, bo.getDeviceName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DeviceAccessRecord::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(bo.getOperateTime() != null, DeviceAccessRecord::getOperateTime, bo.getOperateTime());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getLocation()), DeviceAccessRecord::getLocation, bo.getLocation());
|
||||||
|
lqw.eq(bo.getOperatorId() != null, DeviceAccessRecord::getOperatorId, bo.getOperatorId());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getOperatorName()), DeviceAccessRecord::getOperatorName, bo.getOperatorName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getReason()), DeviceAccessRecord::getReason, bo.getReason());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDetails()), DeviceAccessRecord::getDetails, bo.getDetails());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceAccessRecordBo bo) {
|
||||||
|
DeviceAccessRecord add = MapstructUtils.convert(bo, DeviceAccessRecord.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备进出场记录
|
||||||
|
*
|
||||||
|
* @param bo 设备进出场记录
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceAccessRecordBo bo) {
|
||||||
|
DeviceAccessRecord update = MapstructUtils.convert(bo, DeviceAccessRecord.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceAccessRecord 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,197 @@
|
|||||||
|
package org.dromara.device.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
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 org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoCountVo;
|
||||||
|
import org.dromara.device.service.IDeviceTypeService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.device.domain.bo.DeviceInfoBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceInfoVo;
|
||||||
|
import org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.device.mapper.DeviceInfoMapper;
|
||||||
|
import org.dromara.device.service.IDeviceInfoService;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备信息Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceInfo> implements IDeviceInfoService {
|
||||||
|
|
||||||
|
private final DeviceInfoMapper baseMapper;
|
||||||
|
|
||||||
|
private final IDeviceTypeService deviceTypeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备信息
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceInfoVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备信息分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceInfoVo> queryPageList(DeviceInfoBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceInfo> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceInfoVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
List<DeviceInfoVo> records = result.getRecords();
|
||||||
|
Set<Long> collect = records.stream().map(DeviceInfoVo::getTypeId).collect(Collectors.toSet());
|
||||||
|
if(CollectionUtil.isEmpty(collect)){
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
List<DeviceType> deviceTypes = deviceTypeService.listByIds(collect);
|
||||||
|
Map<Long, String> deviceTypeMap = deviceTypes.stream().collect(Collectors.toMap(DeviceType::getId, DeviceType::getTypeName));
|
||||||
|
result.getRecords().forEach(deviceInfoVo -> {
|
||||||
|
deviceInfoVo.setTypeName(deviceTypeMap.get(deviceInfoVo.getTypeId()));
|
||||||
|
});
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备信息列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备信息列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceInfoVo> queryList(DeviceInfoBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceInfo> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceInfo> buildQueryWrapper(DeviceInfoBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceInfo> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(DeviceInfo::getId);
|
||||||
|
lqw.eq(bo.getProjectId() != null, DeviceInfo::getProjectId, bo.getProjectId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDeviceCode()), DeviceInfo::getDeviceCode, bo.getDeviceCode());
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), DeviceInfo::getDeviceName, bo.getDeviceName());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getModelSpec()), DeviceInfo::getModelSpec, bo.getModelSpec());
|
||||||
|
lqw.eq(bo.getTypeId() != null, DeviceInfo::getTypeId, bo.getTypeId());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getManufacturer()), DeviceInfo::getManufacturer, bo.getManufacturer());
|
||||||
|
lqw.eq(bo.getProductionDate() != null, DeviceInfo::getProductionDate, bo.getProductionDate());
|
||||||
|
lqw.eq(bo.getWarrantyDate() != null, DeviceInfo::getWarrantyDate, bo.getWarrantyDate());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), DeviceInfo::getStatus, bo.getStatus());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getResponsiblePerson()), DeviceInfo::getResponsiblePerson, bo.getResponsiblePerson());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getContactPhone()), DeviceInfo::getContactPhone, bo.getContactPhone());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), DeviceInfo::getDescription, bo.getDescription());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getImage()), DeviceInfo::getImage, bo.getImage());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getFile()), DeviceInfo::getFile, bo.getFile());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceInfoBo bo) {
|
||||||
|
DeviceInfo add = MapstructUtils.convert(bo, DeviceInfo.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备信息
|
||||||
|
*
|
||||||
|
* @param bo 设备信息
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceInfoBo bo) {
|
||||||
|
DeviceInfo update = MapstructUtils.convert(bo, DeviceInfo.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceInfo entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备信息信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return baseMapper.deleteByIds(ids) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceInfoCountVo count(Long projectId) {
|
||||||
|
List<DeviceInfo> list = this.lambdaQuery().eq(DeviceInfo::getProjectId, projectId).list();
|
||||||
|
DeviceInfoCountVo countVo = new DeviceInfoCountVo();
|
||||||
|
countVo.setTotal(list.size());
|
||||||
|
countVo.setUse((int)list.stream().filter(deviceInfo -> "1".equals(deviceInfo.getStatus())).count());
|
||||||
|
countVo.setMaintain((int)list.stream().filter(deviceInfo -> "2".equals(deviceInfo.getStatus())).count());
|
||||||
|
countVo.setIdle((int)list.stream().filter(deviceInfo -> "0".equals(deviceInfo.getStatus())).count());
|
||||||
|
|
||||||
|
return countVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Integer> typeCount(Long projectId) {
|
||||||
|
Map<String, Integer> map = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
List<DeviceInfo> list = this.lambdaQuery().eq(DeviceInfo::getProjectId, projectId).list();
|
||||||
|
Set<Long> collect = list.stream().map(DeviceInfo::getTypeId).collect(Collectors.toSet());
|
||||||
|
List<DeviceType> deviceTypes;
|
||||||
|
if(CollectionUtil.isEmpty(collect)){
|
||||||
|
deviceTypes = new ArrayList<>();
|
||||||
|
}else{
|
||||||
|
deviceTypes = deviceTypeService.listByIds(collect);
|
||||||
|
}
|
||||||
|
List<DeviceType> list1 = deviceTypeService.lambdaQuery().eq(DeviceType::getParentId, 0L).list();
|
||||||
|
for (DeviceType deviceType : list1) {
|
||||||
|
Long id = deviceType.getId();
|
||||||
|
long count = deviceTypes.stream()
|
||||||
|
.filter(vo -> vo.getAncestors().contains(StringUtils.SEPARATOR + id) ||vo.getId().equals(id))
|
||||||
|
.count();
|
||||||
|
map.put(deviceType.getTypeName(), (int)count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,161 @@
|
|||||||
|
package org.dromara.device.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
|
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 org.dromara.device.domain.DeviceInfo;
|
||||||
|
import org.dromara.device.service.IDeviceInfoService;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.dromara.device.domain.bo.DeviceTypeBo;
|
||||||
|
import org.dromara.device.domain.vo.DeviceTypeVo;
|
||||||
|
import org.dromara.device.domain.DeviceType;
|
||||||
|
import org.dromara.device.mapper.DeviceTypeMapper;
|
||||||
|
import org.dromara.device.service.IDeviceTypeService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备类型Service业务层处理
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
* @date 2025-12-01
|
||||||
|
*/
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class DeviceTypeServiceImpl extends ServiceImpl<DeviceTypeMapper, DeviceType> implements IDeviceTypeService {
|
||||||
|
|
||||||
|
private final DeviceTypeMapper baseMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private IDeviceInfoService deviceInfoService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询设备类型
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
* @return 设备类型
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public DeviceTypeVo queryById(Long id){
|
||||||
|
return baseMapper.selectVoById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @param pageQuery 分页参数
|
||||||
|
* @return 设备类型分页列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<DeviceTypeVo> queryPageList(DeviceTypeBo bo, PageQuery pageQuery) {
|
||||||
|
LambdaQueryWrapper<DeviceType> lqw = buildQueryWrapper(bo);
|
||||||
|
Page<DeviceTypeVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||||
|
return TableDataInfo.build(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询符合条件的设备类型列表
|
||||||
|
*
|
||||||
|
* @param bo 查询条件
|
||||||
|
* @return 设备类型列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<DeviceTypeVo> queryList(DeviceTypeBo bo) {
|
||||||
|
LambdaQueryWrapper<DeviceType> lqw = buildQueryWrapper(bo);
|
||||||
|
return baseMapper.selectVoList(lqw);
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<DeviceType> buildQueryWrapper(DeviceTypeBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<DeviceType> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.orderByDesc(DeviceType::getId);
|
||||||
|
lqw.like(StringUtils.isNotBlank(bo.getTypeName()), DeviceType::getTypeName, bo.getTypeName());
|
||||||
|
lqw.eq(bo.getParentId() != null, DeviceType::getParentId, bo.getParentId());
|
||||||
|
lqw.eq(bo.getLevel() != null, DeviceType::getLevel, bo.getLevel());
|
||||||
|
lqw.eq(StringUtils.isNotBlank(bo.getDescription()), DeviceType::getDescription, bo.getDescription());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否新增成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean insertByBo(DeviceTypeBo bo) {
|
||||||
|
DeviceType add = MapstructUtils.convert(bo, DeviceType.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
handleLevelAndAcestors(add);
|
||||||
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
if (flag) {
|
||||||
|
bo.setId(add.getId());
|
||||||
|
}
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改设备类型
|
||||||
|
*
|
||||||
|
* @param bo 设备类型
|
||||||
|
* @return 是否修改成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean updateByBo(DeviceTypeBo bo) {
|
||||||
|
DeviceType update = MapstructUtils.convert(bo, DeviceType.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
handleLevelAndAcestors(update);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleLevelAndAcestors(DeviceType deviceType) {
|
||||||
|
if(deviceType.getParentId() == 0L){
|
||||||
|
deviceType.setAncestors("0");
|
||||||
|
deviceType.setLevel(1);
|
||||||
|
}else {
|
||||||
|
DeviceType parent = baseMapper.selectById(deviceType.getParentId());
|
||||||
|
deviceType.setAncestors(parent.getAncestors() + StringUtils.SEPARATOR + parent.getId());
|
||||||
|
deviceType.setLevel(parent.getLevel() + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(DeviceType entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并批量删除设备类型信息
|
||||||
|
*
|
||||||
|
* @param ids 待删除的主键集合
|
||||||
|
* @param isValid 是否进行有效性校验
|
||||||
|
* @return 是否删除成功
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
List<DeviceInfo> list = deviceInfoService.lambdaQuery().in(DeviceInfo::getTypeId, ids).list();
|
||||||
|
if(CollectionUtil.isNotEmpty(list)){
|
||||||
|
throw new ServiceException("请先删除该设备类型下的设备");
|
||||||
|
}
|
||||||
|
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.device.mapper.DeviceAccessRecordMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -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.device.mapper.DeviceInfoMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@ -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.device.mapper.DeviceTypeMapper">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user