设备管理
This commit is contained in:
parent
8485bc8c63
commit
6b4ddc55be
@ -0,0 +1,108 @@
|
||||
package com.eqc.web.controller.equipments;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.eqc.common.annotation.RepeatSubmit;
|
||||
import com.eqc.common.annotation.Log;
|
||||
import com.eqc.common.core.controller.BaseController;
|
||||
import com.eqc.common.core.domain.PageQuery;
|
||||
import com.eqc.common.core.domain.R;
|
||||
import com.eqc.common.core.validate.AddGroup;
|
||||
import com.eqc.common.core.validate.EditGroup;
|
||||
import com.eqc.common.core.validate.QueryGroup;
|
||||
import com.eqc.common.enums.BusinessType;
|
||||
import com.eqc.common.utils.poi.ExcelUtil;
|
||||
import com.eqc.system.domain.vo.EquipmentConsumablesVo;
|
||||
import com.eqc.system.domain.bo.EquipmentConsumablesBo;
|
||||
import com.eqc.system.service.IEquipmentConsumablesService;
|
||||
import com.eqc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备耗材
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/equipment/consumables")
|
||||
public class EquipmentConsumablesController extends BaseController {
|
||||
|
||||
private final IEquipmentConsumablesService iEquipmentConsumablesService;
|
||||
|
||||
/**
|
||||
* 查询设备耗材列表
|
||||
*/
|
||||
@SaCheckPermission("equipment:consumables:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EquipmentConsumablesVo> list(EquipmentConsumablesBo bo, PageQuery pageQuery) {
|
||||
return iEquipmentConsumablesService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备耗材列表
|
||||
*/
|
||||
@SaCheckPermission("equipment:consumables:export")
|
||||
@Log(title = "设备耗材", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EquipmentConsumablesBo bo, HttpServletResponse response) {
|
||||
List<EquipmentConsumablesVo> list = iEquipmentConsumablesService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备耗材", EquipmentConsumablesVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备耗材详细信息
|
||||
*
|
||||
* @param consumableId 主键
|
||||
*/
|
||||
@SaCheckPermission("equipment:consumables:query")
|
||||
@GetMapping("/{consumableId}")
|
||||
public R<EquipmentConsumablesVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long consumableId) {
|
||||
return R.ok(iEquipmentConsumablesService.queryById(consumableId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备耗材
|
||||
*/
|
||||
@SaCheckPermission("equipment:consumables:add")
|
||||
@Log(title = "设备耗材", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EquipmentConsumablesBo bo) {
|
||||
return toAjax(iEquipmentConsumablesService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备耗材
|
||||
*/
|
||||
@SaCheckPermission("equipment:consumables:edit")
|
||||
@Log(title = "设备耗材", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EquipmentConsumablesBo bo) {
|
||||
return toAjax(iEquipmentConsumablesService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备耗材
|
||||
*
|
||||
* @param consumableIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("equipment:consumables:remove")
|
||||
@Log(title = "设备耗材", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{consumableIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] consumableIds) {
|
||||
return toAjax(iEquipmentConsumablesService.deleteWithValidByIds(Arrays.asList(consumableIds), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,108 @@
|
||||
package com.eqc.web.controller.equipments;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import com.eqc.common.annotation.RepeatSubmit;
|
||||
import com.eqc.common.annotation.Log;
|
||||
import com.eqc.common.core.controller.BaseController;
|
||||
import com.eqc.common.core.domain.PageQuery;
|
||||
import com.eqc.common.core.domain.R;
|
||||
import com.eqc.common.core.validate.AddGroup;
|
||||
import com.eqc.common.core.validate.EditGroup;
|
||||
import com.eqc.common.core.validate.QueryGroup;
|
||||
import com.eqc.common.enums.BusinessType;
|
||||
import com.eqc.common.utils.poi.ExcelUtil;
|
||||
import com.eqc.system.domain.vo.EquipmentsVo;
|
||||
import com.eqc.system.domain.bo.EquipmentsBo;
|
||||
import com.eqc.system.service.IEquipmentsService;
|
||||
import com.eqc.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 设备
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/equipments")
|
||||
public class EquipmentsController extends BaseController {
|
||||
|
||||
private final IEquipmentsService iEquipmentsService;
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
@SaCheckPermission("equipments:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<EquipmentsVo> list(EquipmentsBo bo, PageQuery pageQuery) {
|
||||
return iEquipmentsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备列表
|
||||
*/
|
||||
@SaCheckPermission("equipments:export")
|
||||
@Log(title = "设备", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(EquipmentsBo bo, HttpServletResponse response) {
|
||||
List<EquipmentsVo> list = iEquipmentsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "设备", EquipmentsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备详细信息
|
||||
*
|
||||
* @param equipmentId 主键
|
||||
*/
|
||||
@SaCheckPermission("equipments:query")
|
||||
@GetMapping("/{equipmentId}")
|
||||
public R<EquipmentsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long equipmentId) {
|
||||
return R.ok(iEquipmentsService.queryById(equipmentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*/
|
||||
@SaCheckPermission("equipments:add")
|
||||
@Log(title = "设备", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody EquipmentsBo bo) {
|
||||
return toAjax(iEquipmentsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*/
|
||||
@SaCheckPermission("equipments:edit")
|
||||
@Log(title = "设备", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody EquipmentsBo bo) {
|
||||
return toAjax(iEquipmentsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备
|
||||
*
|
||||
* @param equipmentIds 主键串
|
||||
*/
|
||||
@SaCheckPermission("equipments:remove")
|
||||
@Log(title = "设备", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{equipmentIds}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] equipmentIds) {
|
||||
return toAjax(iEquipmentsService.deleteWithValidByIds(Arrays.asList(equipmentIds), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.eqc.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.eqc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备耗材对象 equipment_consumables
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("equipment_consumables")
|
||||
public class EquipmentConsumables extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "consumable_id")
|
||||
private Long consumableId;
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
private Long equipmentId;
|
||||
/**
|
||||
* 耗材名称
|
||||
*/
|
||||
private String consumableName;
|
||||
/**
|
||||
* 耗材编号
|
||||
*/
|
||||
private String consumableNo;
|
||||
/**
|
||||
* 开始使用时间
|
||||
*/
|
||||
private Date activationTime;
|
||||
/**
|
||||
* 使用期效
|
||||
*/
|
||||
private Long validity;
|
||||
/**
|
||||
* 使用期效单位
|
||||
*/
|
||||
private String validityUint;
|
||||
/**
|
||||
* 负责人,到期后通知其更换
|
||||
*/
|
||||
private Long chargeUser;
|
||||
/**
|
||||
* 状态 0正在使用,1已报废 2未使用过
|
||||
*/
|
||||
private Long status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
55
system/src/main/java/com/eqc/system/domain/Equipments.java
Normal file
55
system/src/main/java/com/eqc/system/domain/Equipments.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.eqc.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.eqc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备对象 equipments
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("equipments")
|
||||
public class Equipments extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(value = "equipment_id")
|
||||
private Long equipmentId;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
private String equipmentName;
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
private String equipmentNo;
|
||||
/**
|
||||
* 设备供应商
|
||||
*/
|
||||
private String equipmentSupplier;
|
||||
/**
|
||||
* 所属科室
|
||||
*/
|
||||
private String department;
|
||||
/**
|
||||
* 所在位置
|
||||
*/
|
||||
private String location;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.eqc.system.domain.bo;
|
||||
|
||||
import com.eqc.common.core.validate.AddGroup;
|
||||
import com.eqc.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.eqc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备耗材业务对象 equipment_consumables
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EquipmentConsumablesBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long consumableId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@NotNull(message = "设备id不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long equipmentId;
|
||||
|
||||
/**
|
||||
* 耗材名称
|
||||
*/
|
||||
@NotBlank(message = "耗材名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String consumableName;
|
||||
|
||||
/**
|
||||
* 耗材编号
|
||||
*/
|
||||
@NotBlank(message = "耗材编号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String consumableNo;
|
||||
|
||||
/**
|
||||
* 开始使用时间
|
||||
*/
|
||||
@NotNull(message = "开始使用时间不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Date activationTime;
|
||||
|
||||
/**
|
||||
* 使用期效
|
||||
*/
|
||||
@NotNull(message = "使用期效不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long validity;
|
||||
|
||||
/**
|
||||
* 使用期效单位
|
||||
*/
|
||||
@NotBlank(message = "使用期效单位不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String validityUint;
|
||||
|
||||
/**
|
||||
* 负责人,到期后通知其更换
|
||||
*/
|
||||
@NotNull(message = "负责人,到期后通知其更换不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long chargeUser;
|
||||
|
||||
/**
|
||||
* 状态 0正在使用,1已报废 2未使用过
|
||||
*/
|
||||
@NotNull(message = "状态 0正在使用,1已报废 2未使用过不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.eqc.system.domain.bo;
|
||||
|
||||
import com.eqc.common.core.validate.AddGroup;
|
||||
import com.eqc.common.core.validate.EditGroup;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.eqc.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备业务对象 equipments
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EquipmentsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "主键不能为空", groups = { EditGroup.class })
|
||||
private Long equipmentId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@NotBlank(message = "设备名称不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String equipmentName;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@NotBlank(message = "设备序列号不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String equipmentNo;
|
||||
|
||||
/**
|
||||
* 设备供应商
|
||||
*/
|
||||
@NotBlank(message = "设备供应商不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String equipmentSupplier;
|
||||
|
||||
/**
|
||||
* 所属科室
|
||||
*/
|
||||
@NotBlank(message = "所属科室不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 所在位置
|
||||
*/
|
||||
@NotBlank(message = "所在位置不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@NotBlank(message = "备注不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package com.eqc.system.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.eqc.common.annotation.ExcelDictFormat;
|
||||
import com.eqc.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 设备耗材视图对象 equipment_consumables
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EquipmentConsumablesVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long consumableId;
|
||||
|
||||
/**
|
||||
* 设备id
|
||||
*/
|
||||
@ExcelProperty(value = "设备id")
|
||||
private Long equipmentId;
|
||||
|
||||
/**
|
||||
* 耗材名称
|
||||
*/
|
||||
@ExcelProperty(value = "耗材名称")
|
||||
private String consumableName;
|
||||
|
||||
/**
|
||||
* 耗材编号
|
||||
*/
|
||||
@ExcelProperty(value = "耗材编号")
|
||||
private String consumableNo;
|
||||
|
||||
/**
|
||||
* 开始使用时间
|
||||
*/
|
||||
@ExcelProperty(value = "开始使用时间")
|
||||
private Date activationTime;
|
||||
|
||||
/**
|
||||
* 使用期效
|
||||
*/
|
||||
@ExcelProperty(value = "使用期效")
|
||||
private Long validity;
|
||||
|
||||
/**
|
||||
* 使用期效单位
|
||||
*/
|
||||
@ExcelProperty(value = "使用期效单位")
|
||||
private String validityUint;
|
||||
|
||||
/**
|
||||
* 负责人,到期后通知其更换
|
||||
*/
|
||||
@ExcelProperty(value = "负责人,到期后通知其更换")
|
||||
private Long chargeUser;
|
||||
|
||||
/**
|
||||
* 状态 0正在使用,1已报废 2未使用过
|
||||
*/
|
||||
@ExcelProperty(value = "状态 0正在使用,1已报废 2未使用过")
|
||||
private Long status;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.eqc.system.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.eqc.common.annotation.ExcelDictFormat;
|
||||
import com.eqc.common.convert.ExcelDictConvert;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 设备视图对象 equipments
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class EquipmentsVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@ExcelProperty(value = "主键")
|
||||
private Long equipmentId;
|
||||
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@ExcelProperty(value = "设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
/**
|
||||
* 设备序列号
|
||||
*/
|
||||
@ExcelProperty(value = "设备序列号")
|
||||
private String equipmentNo;
|
||||
|
||||
/**
|
||||
* 设备供应商
|
||||
*/
|
||||
@ExcelProperty(value = "设备供应商")
|
||||
private String equipmentSupplier;
|
||||
|
||||
/**
|
||||
* 所属科室
|
||||
*/
|
||||
@ExcelProperty(value = "所属科室")
|
||||
private String department;
|
||||
|
||||
/**
|
||||
* 所在位置
|
||||
*/
|
||||
@ExcelProperty(value = "所在位置")
|
||||
private String location;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.eqc.system.mapper;
|
||||
|
||||
import com.eqc.system.domain.EquipmentConsumables;
|
||||
import com.eqc.system.domain.vo.EquipmentConsumablesVo;
|
||||
import com.eqc.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备耗材Mapper接口
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
public interface EquipmentConsumablesMapper extends BaseMapperPlus<EquipmentConsumablesMapper, EquipmentConsumables, EquipmentConsumablesVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.eqc.system.mapper;
|
||||
|
||||
import com.eqc.system.domain.Equipments;
|
||||
import com.eqc.system.domain.vo.EquipmentsVo;
|
||||
import com.eqc.common.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 设备Mapper接口
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
public interface EquipmentsMapper extends BaseMapperPlus<EquipmentsMapper, Equipments, EquipmentsVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.eqc.system.service;
|
||||
|
||||
import com.eqc.system.domain.EquipmentConsumables;
|
||||
import com.eqc.system.domain.vo.EquipmentConsumablesVo;
|
||||
import com.eqc.system.domain.bo.EquipmentConsumablesBo;
|
||||
import com.eqc.common.core.page.TableDataInfo;
|
||||
import com.eqc.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备耗材Service接口
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
public interface IEquipmentConsumablesService {
|
||||
|
||||
/**
|
||||
* 查询设备耗材
|
||||
*/
|
||||
EquipmentConsumablesVo queryById(Long consumableId);
|
||||
|
||||
/**
|
||||
* 查询设备耗材列表
|
||||
*/
|
||||
TableDataInfo<EquipmentConsumablesVo> queryPageList(EquipmentConsumablesBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询设备耗材列表
|
||||
*/
|
||||
List<EquipmentConsumablesVo> queryList(EquipmentConsumablesBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备耗材
|
||||
*/
|
||||
Boolean insertByBo(EquipmentConsumablesBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备耗材
|
||||
*/
|
||||
Boolean updateByBo(EquipmentConsumablesBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备耗材信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,49 @@
|
||||
package com.eqc.system.service;
|
||||
|
||||
import com.eqc.system.domain.Equipments;
|
||||
import com.eqc.system.domain.vo.EquipmentsVo;
|
||||
import com.eqc.system.domain.bo.EquipmentsBo;
|
||||
import com.eqc.common.core.page.TableDataInfo;
|
||||
import com.eqc.common.core.domain.PageQuery;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备Service接口
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
public interface IEquipmentsService {
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
*/
|
||||
EquipmentsVo queryById(Long equipmentId);
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
TableDataInfo<EquipmentsVo> queryPageList(EquipmentsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
List<EquipmentsVo> queryList(EquipmentsBo bo);
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*/
|
||||
Boolean insertByBo(EquipmentsBo bo);
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*/
|
||||
Boolean updateByBo(EquipmentsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除设备信息
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package com.eqc.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.eqc.common.utils.StringUtils;
|
||||
import com.eqc.common.core.page.TableDataInfo;
|
||||
import com.eqc.common.core.domain.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 com.eqc.system.domain.bo.EquipmentConsumablesBo;
|
||||
import com.eqc.system.domain.vo.EquipmentConsumablesVo;
|
||||
import com.eqc.system.domain.EquipmentConsumables;
|
||||
import com.eqc.system.mapper.EquipmentConsumablesMapper;
|
||||
import com.eqc.system.service.IEquipmentConsumablesService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备耗材Service业务层处理
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EquipmentConsumablesServiceImpl implements IEquipmentConsumablesService {
|
||||
|
||||
private final EquipmentConsumablesMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备耗材
|
||||
*/
|
||||
@Override
|
||||
public EquipmentConsumablesVo queryById(Long consumableId){
|
||||
return baseMapper.selectVoById(consumableId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备耗材列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EquipmentConsumablesVo> queryPageList(EquipmentConsumablesBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<EquipmentConsumables> lqw = buildQueryWrapper(bo);
|
||||
Page<EquipmentConsumablesVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备耗材列表
|
||||
*/
|
||||
@Override
|
||||
public List<EquipmentConsumablesVo> queryList(EquipmentConsumablesBo bo) {
|
||||
LambdaQueryWrapper<EquipmentConsumables> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<EquipmentConsumables> buildQueryWrapper(EquipmentConsumablesBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<EquipmentConsumables> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getEquipmentId() != null, EquipmentConsumables::getEquipmentId, bo.getEquipmentId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getConsumableName()), EquipmentConsumables::getConsumableName, bo.getConsumableName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getConsumableNo()), EquipmentConsumables::getConsumableNo, bo.getConsumableNo());
|
||||
lqw.eq(bo.getActivationTime() != null, EquipmentConsumables::getActivationTime, bo.getActivationTime());
|
||||
lqw.eq(bo.getValidity() != null, EquipmentConsumables::getValidity, bo.getValidity());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getValidityUint()), EquipmentConsumables::getValidityUint, bo.getValidityUint());
|
||||
lqw.eq(bo.getChargeUser() != null, EquipmentConsumables::getChargeUser, bo.getChargeUser());
|
||||
lqw.eq(bo.getStatus() != null, EquipmentConsumables::getStatus, bo.getStatus());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备耗材
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EquipmentConsumablesBo bo) {
|
||||
EquipmentConsumables add = BeanUtil.toBean(bo, EquipmentConsumables.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setConsumableId(add.getConsumableId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备耗材
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EquipmentConsumablesBo bo) {
|
||||
EquipmentConsumables update = BeanUtil.toBean(bo, EquipmentConsumables.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(EquipmentConsumables entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备耗材
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.eqc.system.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.eqc.common.utils.StringUtils;
|
||||
import com.eqc.common.core.page.TableDataInfo;
|
||||
import com.eqc.common.core.domain.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 com.eqc.system.domain.bo.EquipmentsBo;
|
||||
import com.eqc.system.domain.vo.EquipmentsVo;
|
||||
import com.eqc.system.domain.Equipments;
|
||||
import com.eqc.system.mapper.EquipmentsMapper;
|
||||
import com.eqc.system.service.IEquipmentsService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 设备Service业务层处理
|
||||
*
|
||||
* @author yunpeng.zhang
|
||||
* @date 2023-12-29
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class EquipmentsServiceImpl implements IEquipmentsService {
|
||||
|
||||
private final EquipmentsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
*/
|
||||
@Override
|
||||
public EquipmentsVo queryById(Long equipmentId){
|
||||
return baseMapper.selectVoById(equipmentId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<EquipmentsVo> queryPageList(EquipmentsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<Equipments> lqw = buildQueryWrapper(bo);
|
||||
Page<EquipmentsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备列表
|
||||
*/
|
||||
@Override
|
||||
public List<EquipmentsVo> queryList(EquipmentsBo bo) {
|
||||
LambdaQueryWrapper<Equipments> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<Equipments> buildQueryWrapper(EquipmentsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<Equipments> lqw = Wrappers.lambdaQuery();
|
||||
lqw.like(StringUtils.isNotBlank(bo.getEquipmentName()), Equipments::getEquipmentName, bo.getEquipmentName());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getEquipmentNo()), Equipments::getEquipmentNo, bo.getEquipmentNo());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getEquipmentSupplier()), Equipments::getEquipmentSupplier, bo.getEquipmentSupplier());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDepartment()), Equipments::getDepartment, bo.getDepartment());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getLocation()), Equipments::getLocation, bo.getLocation());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(EquipmentsBo bo) {
|
||||
Equipments add = BeanUtil.toBean(bo, Equipments.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setEquipmentId(add.getEquipmentId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(EquipmentsBo bo) {
|
||||
Equipments update = BeanUtil.toBean(bo, Equipments.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(Equipments entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
<?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.eqc.system.mapper.EquipmentConsumablesMapper">
|
||||
|
||||
<resultMap type="com.eqc.system.domain.EquipmentConsumables" id="EquipmentConsumablesResult">
|
||||
<result property="consumableId" column="consumable_id"/>
|
||||
<result property="equipmentId" column="equipment_id"/>
|
||||
<result property="consumableName" column="consumable_name"/>
|
||||
<result property="consumableNo" column="consumable_no"/>
|
||||
<result property="activationTime" column="activation_time"/>
|
||||
<result property="validity" column="validity"/>
|
||||
<result property="validityUint" column="validity_uint"/>
|
||||
<result property="chargeUser" column="charge_user"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
22
system/src/main/resources/mapper/system/EquipmentsMapper.xml
Normal file
22
system/src/main/resources/mapper/system/EquipmentsMapper.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?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.eqc.system.mapper.EquipmentsMapper">
|
||||
|
||||
<resultMap type="com.eqc.system.domain.Equipments" id="EquipmentsResult">
|
||||
<result property="equipmentId" column="equipment_id"/>
|
||||
<result property="equipmentName" column="equipment_name"/>
|
||||
<result property="equipmentNo" column="equipment_no"/>
|
||||
<result property="equipmentSupplier" column="equipment_supplier"/>
|
||||
<result property="department" column="department"/>
|
||||
<result property="location" column="location"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue
Block a user