设备分组
This commit is contained in:
@ -0,0 +1,105 @@
|
||||
package com.fuyuanshen.equipment.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 com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
||||
|
||||
/**
|
||||
* 设备分组
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/fys-equipment/group")
|
||||
public class DeviceGroupController extends BaseController {
|
||||
|
||||
private final IDeviceGroupService deviceGroupService;
|
||||
|
||||
/**
|
||||
* 查询设备分组列表
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:group:list")
|
||||
@GetMapping("/list")
|
||||
public R<List<DeviceGroupVo>> list(DeviceGroupBo bo) {
|
||||
List<DeviceGroupVo> list = deviceGroupService.queryList(bo);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备分组列表
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:group:export")
|
||||
@Log(title = "设备分组", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(DeviceGroupBo bo, HttpServletResponse response) {
|
||||
List<DeviceGroupVo> list = deviceGroupService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备分组", DeviceGroupVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备分组详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:group:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<DeviceGroupVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(deviceGroupService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备分组
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:group:add")
|
||||
@Log(title = "设备分组", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceGroupBo bo) {
|
||||
return toAjax(deviceGroupService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备分组
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:group:edit")
|
||||
@Log(title = "设备分组", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceGroupBo bo) {
|
||||
return toAjax(deviceGroupService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备分组
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("fys-equipment:group:remove")
|
||||
@Log(title = "设备分组", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(deviceGroupService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
package com.fuyuanshen.equipment.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 com.fuyuanshen.common.idempotent.annotation.RepeatSubmit;
|
||||
import com.fuyuanshen.common.log.annotation.Log;
|
||||
import com.fuyuanshen.common.web.core.BaseController;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
import com.fuyuanshen.common.core.domain.R;
|
||||
import com.fuyuanshen.common.core.validate.AddGroup;
|
||||
import com.fuyuanshen.common.core.validate.EditGroup;
|
||||
import com.fuyuanshen.common.log.enums.BusinessType;
|
||||
import com.fuyuanshen.common.excel.utils.ExcelUtil;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceRepairRecordsVo;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceRepairRecordsBo;
|
||||
import com.fuyuanshen.equipment.service.IDeviceRepairRecordsService;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备维修记录
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/equipment/repairRecords")
|
||||
public class DeviceRepairRecordsController extends BaseController {
|
||||
|
||||
private final IDeviceRepairRecordsService deviceRepairRecordsService;
|
||||
|
||||
/**
|
||||
* 查询设备维修记录列表
|
||||
*/
|
||||
@SaCheckPermission("equipment:repairRecords:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<DeviceRepairRecordsVo> list(DeviceRepairRecordsBo bo, PageQuery pageQuery) {
|
||||
return deviceRepairRecordsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备维修记录列表
|
||||
*/
|
||||
@SaCheckPermission("equipment:repairRecords:export")
|
||||
@Log(title = "设备维修记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(DeviceRepairRecordsBo bo, HttpServletResponse response) {
|
||||
List<DeviceRepairRecordsVo> list = deviceRepairRecordsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备维修记录", DeviceRepairRecordsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备维修记录详细信息
|
||||
*
|
||||
* @param recordId 主键
|
||||
*/
|
||||
@SaCheckPermission("equipment:repairRecords:query")
|
||||
@GetMapping("/{recordId}")
|
||||
public R<DeviceRepairRecordsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long recordId) {
|
||||
return R.ok(deviceRepairRecordsService.queryById(recordId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备维修记录
|
||||
*/
|
||||
@SaCheckPermission("equipment:repairRecords:add")
|
||||
@Log(title = "设备维修记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody DeviceRepairRecordsBo bo) {
|
||||
return toAjax(deviceRepairRecordsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备维修记录
|
||||
*/
|
||||
@SaCheckPermission("equipment:repairRecords:edit")
|
||||
@Log(title = "设备维修记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody DeviceRepairRecordsBo bo) {
|
||||
return toAjax(deviceRepairRecordsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备维修记录
|
||||
*
|
||||
* @param recordIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("equipment:repairRecords:remove")
|
||||
@Log(title = "设备维修记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{recordIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] recordIds) {
|
||||
return toAjax(deviceRepairRecordsService.deleteWithValidByIds(List.of(recordIds), true));
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.fuyuanshen.equipment.domain;
|
||||
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备分组对象 device_group
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("device_group")
|
||||
public class DeviceGroup extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 状态:0-禁用,1-正常
|
||||
*/
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 父分组ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 完整分组路径
|
||||
*/
|
||||
private String fullPath;
|
||||
|
||||
/**
|
||||
* 删除标记:0-未删除,1-已删除
|
||||
*/
|
||||
private Long isDeleted;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.fuyuanshen.equipment.domain;
|
||||
|
||||
import com.fuyuanshen.common.tenant.core.TenantEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 设备维修记录对象 device_repair_records
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("device_repair_records")
|
||||
public class DeviceRepairRecords extends TenantEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 维修记录ID
|
||||
*/
|
||||
@TableId(value = "record_id")
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 维修时间
|
||||
*/
|
||||
private Date repairTime;
|
||||
|
||||
/**
|
||||
* 维修部位
|
||||
*/
|
||||
private String repairPart;
|
||||
|
||||
/**
|
||||
* 维修原因
|
||||
*/
|
||||
private String repairReason;
|
||||
|
||||
/**
|
||||
* 维修人员
|
||||
*/
|
||||
private String repairPerson;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.fuyuanshen.equipment.domain.bo;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.DeviceGroup;
|
||||
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 设备分组业务对象 device_group
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = DeviceGroup.class, reverseConvertGenerate = false)
|
||||
public class DeviceGroupBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@NotNull(message = "主键ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
@NotBlank(message = "分组名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 状态:0-禁用,1-正常
|
||||
*/
|
||||
@NotNull(message = "状态:0-禁用,1-正常不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 父分组ID
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 完整分组路径
|
||||
*/
|
||||
private String fullPath;
|
||||
|
||||
/**
|
||||
* 删除标记:0-未删除,1-已删除
|
||||
*/
|
||||
@NotNull(message = "删除标记:0-未删除,1-已删除不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long isDeleted;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package com.fuyuanshen.equipment.domain.bo;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.DeviceRepairRecords;
|
||||
import com.fuyuanshen.common.mybatis.core.domain.BaseEntity;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 设备维修记录业务对象 device_repair_records
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = DeviceRepairRecords.class, reverseConvertGenerate = false)
|
||||
public class DeviceRepairRecordsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 维修记录ID
|
||||
*/
|
||||
@NotNull(message = "维修记录ID不能为空", groups = { EditGroup.class })
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@NotBlank(message = "设备ID不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 维修时间
|
||||
*/
|
||||
@NotNull(message = "维修时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date repairTime;
|
||||
|
||||
/**
|
||||
* 维修部位
|
||||
*/
|
||||
@NotBlank(message = "维修部位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String repairPart;
|
||||
|
||||
/**
|
||||
* 维修原因
|
||||
*/
|
||||
@NotBlank(message = "维修原因不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String repairReason;
|
||||
|
||||
/**
|
||||
* 维修人员
|
||||
*/
|
||||
@NotBlank(message = "维修人员不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String repairPerson;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.fuyuanshen.equipment.domain.vo;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.DeviceGroup;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||
import com.fuyuanshen.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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备分组视图对象 device_group
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = DeviceGroup.class)
|
||||
public class DeviceGroupVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@ExcelProperty(value = "主键ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
@ExcelProperty(value = "分组名称")
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 状态:0-禁用,1-正常
|
||||
*/
|
||||
@ExcelProperty(value = "状态:0-禁用,1-正常")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 父分组ID
|
||||
*/
|
||||
@ExcelProperty(value = "父分组ID")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 完整分组路径
|
||||
*/
|
||||
@ExcelProperty(value = "完整分组路径")
|
||||
private String fullPath;
|
||||
|
||||
/**
|
||||
* 删除标记:0-未删除,1-已删除
|
||||
*/
|
||||
@ExcelProperty(value = "删除标记:0-未删除,1-已删除")
|
||||
private Long isDeleted;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package com.fuyuanshen.equipment.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fuyuanshen.equipment.domain.DeviceRepairRecords;
|
||||
import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import cn.idev.excel.annotation.ExcelProperty;
|
||||
import com.fuyuanshen.common.excel.annotation.ExcelDictFormat;
|
||||
import com.fuyuanshen.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;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 设备维修记录视图对象 device_repair_records
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = DeviceRepairRecords.class)
|
||||
public class DeviceRepairRecordsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 维修记录ID
|
||||
*/
|
||||
@ExcelProperty(value = "维修记录ID")
|
||||
private Long recordId;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@ExcelProperty(value = "设备ID")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 维修时间
|
||||
*/
|
||||
@ExcelProperty(value = "维修时间")
|
||||
private Date repairTime;
|
||||
|
||||
/**
|
||||
* 维修部位
|
||||
*/
|
||||
@ExcelProperty(value = "维修部位")
|
||||
private String repairPart;
|
||||
|
||||
/**
|
||||
* 维修原因
|
||||
*/
|
||||
@ExcelProperty(value = "维修原因")
|
||||
private String repairReason;
|
||||
|
||||
/**
|
||||
* 维修人员
|
||||
*/
|
||||
@ExcelProperty(value = "维修人员")
|
||||
private String repairPerson;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.fuyuanshen.equipment.mapper;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.DeviceGroup;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备分组Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
public interface DeviceGroupMapper extends BaseMapperPlus<DeviceGroup, DeviceGroupVo> {
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.fuyuanshen.equipment.mapper;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.DeviceRepairRecords;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceRepairRecordsVo;
|
||||
import com.fuyuanshen.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备维修记录Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
public interface DeviceRepairRecordsMapper extends BaseMapperPlus<DeviceRepairRecords, DeviceRepairRecordsVo> {
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
package com.fuyuanshen.equipment.service;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备分组Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
public interface IDeviceGroupService {
|
||||
|
||||
/**
|
||||
* 查询设备分组
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备分组
|
||||
*/
|
||||
DeviceGroupVo queryById(Long id);
|
||||
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备分组列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备分组列表
|
||||
*/
|
||||
List<DeviceGroupVo> queryList(DeviceGroupBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备分组
|
||||
*
|
||||
* @param bo 设备分组
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(DeviceGroupBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备分组
|
||||
*
|
||||
* @param bo 设备分组
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(DeviceGroupBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备分组信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.fuyuanshen.equipment.service;
|
||||
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceRepairRecordsVo;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceRepairRecordsBo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备维修记录Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
public interface IDeviceRepairRecordsService {
|
||||
|
||||
/**
|
||||
* 查询设备维修记录
|
||||
*
|
||||
* @param recordId 主键
|
||||
* @return 设备维修记录
|
||||
*/
|
||||
DeviceRepairRecordsVo queryById(Long recordId);
|
||||
|
||||
/**
|
||||
* 分页查询设备维修记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备维修记录分页列表
|
||||
*/
|
||||
TableDataInfo<DeviceRepairRecordsVo> queryPageList(DeviceRepairRecordsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备维修记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备维修记录列表
|
||||
*/
|
||||
List<DeviceRepairRecordsVo> queryList(DeviceRepairRecordsBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备维修记录
|
||||
*
|
||||
* @param bo 设备维修记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(DeviceRepairRecordsBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备维修记录
|
||||
*
|
||||
* @param bo 设备维修记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(DeviceRepairRecordsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备维修记录信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.fuyuanshen.equipment.service.impl;
|
||||
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
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.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fuyuanshen.equipment.domain.bo.DeviceGroupBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceGroupVo;
|
||||
import com.fuyuanshen.equipment.domain.DeviceGroup;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceGroupMapper;
|
||||
import com.fuyuanshen.equipment.service.IDeviceGroupService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备分组Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class DeviceGroupServiceImpl implements IDeviceGroupService {
|
||||
|
||||
private final DeviceGroupMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备分组
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 设备分组
|
||||
*/
|
||||
@Override
|
||||
public DeviceGroupVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备分组列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备分组列表
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceGroupVo> queryList(DeviceGroupBo bo) {
|
||||
LambdaQueryWrapper<DeviceGroup> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<DeviceGroup> buildQueryWrapper(DeviceGroupBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<DeviceGroup> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(DeviceGroup::getId);
|
||||
lqw.like(StringUtils.isNotBlank(bo.getGroupName()), DeviceGroup::getGroupName, bo.getGroupName());
|
||||
lqw.eq(bo.getStatus() != null, DeviceGroup::getStatus, bo.getStatus());
|
||||
lqw.eq(bo.getParentId() != null, DeviceGroup::getParentId, bo.getParentId());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFullPath()), DeviceGroup::getFullPath, bo.getFullPath());
|
||||
lqw.eq(bo.getIsDeleted() != null, DeviceGroup::getIsDeleted, bo.getIsDeleted());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备分组
|
||||
*
|
||||
* @param bo 设备分组
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(DeviceGroupBo bo) {
|
||||
DeviceGroup add = MapstructUtils.convert(bo, DeviceGroup.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备分组
|
||||
*
|
||||
* @param bo 设备分组
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(DeviceGroupBo bo) {
|
||||
DeviceGroup update = MapstructUtils.convert(bo, DeviceGroup.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(DeviceGroup 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,135 @@
|
||||
package com.fuyuanshen.equipment.service.impl;
|
||||
|
||||
import com.fuyuanshen.common.core.utils.MapstructUtils;
|
||||
import com.fuyuanshen.common.mybatis.core.page.TableDataInfo;
|
||||
import com.fuyuanshen.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 com.fuyuanshen.equipment.domain.bo.DeviceRepairRecordsBo;
|
||||
import com.fuyuanshen.equipment.domain.vo.DeviceRepairRecordsVo;
|
||||
import com.fuyuanshen.equipment.domain.DeviceRepairRecords;
|
||||
import com.fuyuanshen.equipment.mapper.DeviceRepairRecordsMapper;
|
||||
import com.fuyuanshen.equipment.service.IDeviceRepairRecordsService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备维修记录Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-08-08
|
||||
*/
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class DeviceRepairRecordsServiceImpl implements IDeviceRepairRecordsService {
|
||||
|
||||
private final DeviceRepairRecordsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备维修记录
|
||||
*
|
||||
* @param recordId 主键
|
||||
* @return 设备维修记录
|
||||
*/
|
||||
@Override
|
||||
public DeviceRepairRecordsVo queryById(Long recordId){
|
||||
return baseMapper.selectVoById(recordId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备维修记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 设备维修记录分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<DeviceRepairRecordsVo> queryPageList(DeviceRepairRecordsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<DeviceRepairRecords> lqw = buildQueryWrapper(bo);
|
||||
Page<DeviceRepairRecordsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的设备维修记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 设备维修记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceRepairRecordsVo> queryList(DeviceRepairRecordsBo bo) {
|
||||
LambdaQueryWrapper<DeviceRepairRecords> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<DeviceRepairRecords> buildQueryWrapper(DeviceRepairRecordsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<DeviceRepairRecords> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByAsc(DeviceRepairRecords::getRecordId);
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDeviceId()), DeviceRepairRecords::getDeviceId, bo.getDeviceId());
|
||||
lqw.eq(bo.getRepairTime() != null, DeviceRepairRecords::getRepairTime, bo.getRepairTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRepairPart()), DeviceRepairRecords::getRepairPart, bo.getRepairPart());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRepairReason()), DeviceRepairRecords::getRepairReason, bo.getRepairReason());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRepairPerson()), DeviceRepairRecords::getRepairPerson, bo.getRepairPerson());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备维修记录
|
||||
*
|
||||
* @param bo 设备维修记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(DeviceRepairRecordsBo bo) {
|
||||
DeviceRepairRecords add = MapstructUtils.convert(bo, DeviceRepairRecords.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setRecordId(add.getRecordId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备维修记录
|
||||
*
|
||||
* @param bo 设备维修记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(DeviceRepairRecordsBo bo) {
|
||||
DeviceRepairRecords update = MapstructUtils.convert(bo, DeviceRepairRecords.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(DeviceRepairRecords 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="com.fuyuanshen.equipment.mapper.DeviceGroupMapper">
|
||||
|
||||
</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="com.fuyuanshen.equipment.mapper.DeviceRepairRecordsMapper">
|
||||
|
||||
</mapper>
|
Reference in New Issue
Block a user