From 0f8f4c5de1d817aa87c4c79e966d3cfbd0997aeb Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 23 七月 2025 16:55:56 +0800
Subject: [PATCH] 1.设备领用添加记录 2.采购添加运费
---
main-business/src/main/java/com/ruoyi/business/service/EquipmentUsageDetailService.java | 20 +
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java | 4
main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageDetailDto.java | 25 ++
main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageRecord.java | 10
main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java | 5
main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageRecordServiceImpl.java | 191 +++++++++++----
main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java | 2
main-business/src/main/resources/db/migration/postgresql/V20250707155600__create_table_equipment_usage_record.sql | 76 +++--
main-business/src/main/java/com/ruoyi/business/controller/EquipmentUsageDetailController.java | 43 +++
main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageRecordDto.java | 2
main-business/src/main/resources/db/migration/postgresql/V20250723134500__create_table_equipment_usage_detail.sql | 53 ++++
main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageDetail.java | 59 ++++
main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql | 3
main-business/src/main/java/com/ruoyi/business/mapper/EquipmentUsageDetailMapper.java | 18 +
main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageDetailServiceImpl.java | 118 +++++++++
main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql | 3
main-business/src/main/resources/mapper/EquipmentUsageDetailMapper.xml | 31 ++
17 files changed, 574 insertions(+), 89 deletions(-)
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/EquipmentUsageDetailController.java b/main-business/src/main/java/com/ruoyi/business/controller/EquipmentUsageDetailController.java
new file mode 100644
index 0000000..466c033
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/controller/EquipmentUsageDetailController.java
@@ -0,0 +1,43 @@
+package com.ruoyi.business.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.dto.EquipmentManagementDto;
+import com.ruoyi.business.dto.EquipmentUsageDetailDto;
+import com.ruoyi.business.entity.EquipmentManagement;
+import com.ruoyi.business.entity.EquipmentUsageDetail;
+import com.ruoyi.business.mapper.EquipmentUsageDetailMapper;
+import com.ruoyi.business.service.EquipmentManagementService;
+import com.ruoyi.business.service.EquipmentUsageDetailService;
+import com.ruoyi.common.core.domain.R;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 璁惧浣跨敤鏄庣粏琛� 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author ld
+ * @since 2025-07-23
+ */
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/equipmentUsageDetail")
+public class EquipmentUsageDetailController {
+
+ private EquipmentUsageDetailService equipmentUsageDetailService;
+
+ /**
+ * 璁惧棰嗙敤褰掕繕璁板綍鏌ヨ
+ */
+ @GetMapping("/list")
+ public R<IPage<EquipmentUsageDetailDto>> list(Page<EquipmentUsageDetail> page,EquipmentUsageDetailDto equipmentUsageDetailDto) {
+ IPage<EquipmentUsageDetailDto> list = equipmentUsageDetailService.selectEquipmentUsageDetailList(page,equipmentUsageDetailDto);
+ return R.ok(list);
+ }
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageDetailDto.java b/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageDetailDto.java
new file mode 100644
index 0000000..4d5ea0b
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageDetailDto.java
@@ -0,0 +1,25 @@
+package com.ruoyi.business.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.ruoyi.business.entity.EquipmentUsageDetail;
+import lombok.Data;
+
+@Data
+public class EquipmentUsageDetailDto extends EquipmentUsageDetail {
+
+ /**
+ * 璁惧缂栧彿
+ */
+ @TableField(value = "equipment_no")
+ private String equipmentNo;
+ /**
+ * 璁惧鍚嶇О
+ */
+ @TableField(value = "equipment_name")
+ private String equipmentName;
+ /**
+ * 瑙勬牸鍨嬪彿
+ */
+ @TableField(value = "specification")
+ private String specification;
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageRecordDto.java b/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageRecordDto.java
index dbfe153..81dfc76 100644
--- a/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageRecordDto.java
+++ b/main-business/src/main/java/com/ruoyi/business/dto/EquipmentUsageRecordDto.java
@@ -11,4 +11,6 @@
private String equipmentName; //璁惧鍚嶇О
private String userName; //棰嗙敤浜�
+
+ private Integer totalReturnNo; //宸插綊杩樻�绘暟
}
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageDetail.java b/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageDetail.java
new file mode 100644
index 0000000..fb5e628
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageDetail.java
@@ -0,0 +1,59 @@
+package com.ruoyi.business.entity;
+
+import com.baomidou.mybatisplus.annotation.*;
+import lombok.Data;
+import com.ruoyi.common.core.domain.MyBaseEntity;
+
+/**
+ * 璁惧浣跨敤鏄庣粏琛� 瀹炰綋绫�
+ *
+ * @author ld
+ * @date 2025-07-23
+ */
+@Data
+@TableName("equipment_usage_detail")
+public class EquipmentUsageDetail extends MyBaseEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 涓婚敭ID
+ */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+ /**
+ * 鍏宠仈鐨勪娇鐢ㄨ褰旾D
+ */
+ @TableField(value = "usage_id")
+ private Long usageId;
+ /**
+ * 鍏宠仈鐨勮澶嘔D
+ */
+ @TableField(value = "equipment_id")
+ private Long equipmentId;
+ /**
+ * 鎿嶄綔绫诲瀷锛�1-棰嗙敤锛�2-褰掕繕
+ */
+ @TableField(value = "operation_type")
+ private Integer operationType;
+ /**
+ * 鎿嶄綔鏁伴噺
+ */
+ @TableField(value = "quantity")
+ private Integer quantity;
+ /**
+ * 鎿嶄綔浜篒D
+ */
+ @TableField(value = "operator_id")
+ private Long operatorId;
+ /**
+ * 鎿嶄綔浜�
+ */
+ @TableField(value = "operator")
+ private String operator;
+ /**
+ * 澶囨敞
+ */
+ @TableField(value = "remark")
+ private String remark;
+}
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageRecord.java b/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageRecord.java
index 5f20912..b9c9e9b 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageRecord.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/EquipmentUsageRecord.java
@@ -1,6 +1,7 @@
package com.ruoyi.business.entity;
import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import com.ruoyi.common.core.domain.MyBaseEntity;
@@ -29,10 +30,15 @@
@TableField(value = "equipment_id")
private Long equipmentId;
/**
- * 浣跨敤鏁伴噺
+ * 棰嗙敤鏁伴噺
*/
@TableField(value = "usage_quantity")
private Integer usageQuantity;
+ /**
+ * 褰掕繕鏁伴噺
+ */
+ @TableField(value = "return_quantity")
+ private Integer returnQuantity;
/**
* 浣跨敤浜篒D
*/
@@ -52,11 +58,13 @@
* 浣跨敤寮�濮嬫椂闂�
*/
@TableField(value = "usage_start_time")
+ @JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate usageStartTime;
/**
* 浣跨敤缁撴潫鏃堕棿
*/
@TableField(value = "usage_end_time")
+ @JsonFormat(pattern = "yyyy-MM-dd")
private LocalDate usageEndTime;
/**
* 澶囨敞淇℃伅
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java b/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java
index 482e72e..890aa3b 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java
@@ -88,4 +88,9 @@
*/
@TableField(value = "registration_date")
private LocalDate registrationDate;
+ /**
+ * 杩愯垂
+ */
+ @TableField(value = "freight")
+ private BigDecimal freight;
}
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/mapper/EquipmentUsageDetailMapper.java b/main-business/src/main/java/com/ruoyi/business/mapper/EquipmentUsageDetailMapper.java
new file mode 100644
index 0000000..5b83c3a
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/mapper/EquipmentUsageDetailMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.business.entity.EquipmentUsageDetail;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 璁惧浣跨敤鏄庣粏琛� Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author ld
+ * @since 2025-07-23
+ */
+@Mapper
+public interface EquipmentUsageDetailMapper extends BaseMapper<EquipmentUsageDetail> {
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/EquipmentUsageDetailService.java b/main-business/src/main/java/com/ruoyi/business/service/EquipmentUsageDetailService.java
new file mode 100644
index 0000000..6dd1ff2
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/EquipmentUsageDetailService.java
@@ -0,0 +1,20 @@
+package com.ruoyi.business.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.dto.EquipmentUsageDetailDto;
+import com.ruoyi.business.entity.EquipmentUsageDetail;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 璁惧浣跨敤鏄庣粏琛� 鏈嶅姟绫�
+ * </p>
+ *
+ * @author ld
+ * @since 2025-07-23
+ */
+public interface EquipmentUsageDetailService extends IService<EquipmentUsageDetail> {
+
+ IPage<EquipmentUsageDetailDto> selectEquipmentUsageDetailList(Page<EquipmentUsageDetail> page, EquipmentUsageDetailDto equipmentUsageDetailDto);
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageDetailServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageDetailServiceImpl.java
new file mode 100644
index 0000000..cb19b1a
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageDetailServiceImpl.java
@@ -0,0 +1,118 @@
+package com.ruoyi.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.business.dto.EquipmentManagementDto;
+import com.ruoyi.business.dto.EquipmentUsageDetailDto;
+import com.ruoyi.business.entity.EquipmentManagement;
+import com.ruoyi.business.entity.EquipmentUsageDetail;
+import com.ruoyi.business.entity.EquipmentUsageRecord;
+import com.ruoyi.business.mapper.EquipmentManagementMapper;
+import com.ruoyi.business.mapper.EquipmentUsageDetailMapper;
+import com.ruoyi.business.mapper.EquipmentUsageRecordMapper;
+import com.ruoyi.business.service.EquipmentManagementService;
+import com.ruoyi.business.service.EquipmentUsageDetailService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.business.service.EquipmentUsageRecordService;
+import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import org.springframework.stereotype.Service;
+import lombok.RequiredArgsConstructor;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 璁惧浣跨敤鏄庣粏琛� 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author ld
+ * @since 2025-07-23
+ */
+@Service
+@RequiredArgsConstructor
+public class EquipmentUsageDetailServiceImpl extends ServiceImpl<EquipmentUsageDetailMapper, EquipmentUsageDetail> implements EquipmentUsageDetailService {
+
+ private final EquipmentUsageDetailMapper equipmentUsageDetailMapper;
+
+ private final EquipmentUsageRecordMapper equipmentUsageRecordMapper;
+
+ private final EquipmentManagementMapper equipmentManagementMapper;
+
+
+ @Override
+ public IPage<EquipmentUsageDetailDto> selectEquipmentUsageDetailList(Page<EquipmentUsageDetail> page,EquipmentUsageDetailDto equipmentUsageDetailDto) {
+ // 蹇呴』浼犻�抲sageId鍙傛暟
+ if (equipmentUsageDetailDto.getUsageId() == null) {
+ throw new BaseException("璇烽�夋嫨浣跨敤璁板綍");
+ }
+ LambdaQueryWrapper<EquipmentUsageDetail> queryWrapper = new LambdaQueryWrapper<>();
+ queryWrapper.eq(EquipmentUsageDetail::getUsageId, equipmentUsageDetailDto.getUsageId());
+
+ Page<EquipmentUsageDetail> entityPage = equipmentUsageDetailMapper.selectPage(page, queryWrapper);
+ IPage<EquipmentUsageDetailDto> dtoPage = new Page<>();
+ BeanUtils.copyProperties(entityPage, dtoPage);
+ // 鍏堣幏鍙栦富琛ㄨ褰�
+ List<Long> usageIds = entityPage.getRecords().stream()
+ .map(EquipmentUsageDetail::getUsageId)
+ .distinct()
+ .collect(Collectors.toList());
+
+ if (!usageIds.isEmpty()) {
+ // 鏌ヨ鍏宠仈鐨勪娇鐢ㄨ褰�
+ List<EquipmentUsageRecord> usageRecords = equipmentUsageRecordMapper.selectList(
+ new LambdaQueryWrapper<EquipmentUsageRecord>()
+ .in(EquipmentUsageRecord::getId, usageIds)
+ );
+
+ // 鑾峰彇鎵�鏈夎澶嘔D
+ List<Long> equipmentIds = usageRecords.stream()
+ .map(EquipmentUsageRecord::getEquipmentId)
+ .distinct()
+ .collect(Collectors.toList());
+
+ // 鏌ヨ璁惧淇℃伅
+ Map<Long, EquipmentManagement> equipmentMap;
+ if (!equipmentIds.isEmpty()) {
+ equipmentMap = equipmentManagementMapper.selectList(
+ new LambdaQueryWrapper<EquipmentManagement>()
+ .in(EquipmentManagement::getId, equipmentIds)
+ ).stream().collect(Collectors.toMap(EquipmentManagement::getId, Function.identity()));
+ } else {
+ equipmentMap = new HashMap<>();
+ }
+
+ // 鏋勫缓浣跨敤璁板綍ID鍒拌澶嘔D鐨勬槧灏�
+ Map<Long, Long> usageIdToEquipmentIdMap = usageRecords.stream()
+ .collect(Collectors.toMap(EquipmentUsageRecord::getId, EquipmentUsageRecord::getEquipmentId));
+
+ // 杞崲DTO骞跺~鍏呰澶囦俊鎭�
+ List<EquipmentUsageDetailDto> dtoList = entityPage.getRecords().stream().map(detail -> {
+ EquipmentUsageDetailDto detailDto = new EquipmentUsageDetailDto();
+ BeanUtils.copyProperties(detail, detailDto);
+
+ // 鑾峰彇鍏宠仈鐨勮澶嘔D
+ Long equipmentId = usageIdToEquipmentIdMap.get(detail.getUsageId());
+ if (equipmentId != null && equipmentMap.containsKey(equipmentId)) {
+ EquipmentManagement equipment = equipmentMap.get(equipmentId);
+ detailDto.setEquipmentNo(equipment.getEquipmentNo());
+ detailDto.setEquipmentName(equipment.getEquipmentName());
+ detailDto.setSpecification(equipment.getSpecification());
+ }
+
+ return detailDto;
+ }).collect(Collectors.toList());
+
+ dtoPage.setRecords(dtoList);
+ } else {
+ dtoPage.setRecords(Collections.emptyList());
+ }
+ return dtoPage;
+ }
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageRecordServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageRecordServiceImpl.java
index fde6bd6..13c1d08 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageRecordServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/EquipmentUsageRecordServiceImpl.java
@@ -8,8 +8,10 @@
import com.ruoyi.business.dto.EquipmentManagementDto;
import com.ruoyi.business.dto.EquipmentUsageRecordDto;
import com.ruoyi.business.entity.EquipmentManagement;
+import com.ruoyi.business.entity.EquipmentUsageDetail;
import com.ruoyi.business.entity.EquipmentUsageRecord;
import com.ruoyi.business.mapper.EquipmentManagementMapper;
+import com.ruoyi.business.mapper.EquipmentUsageDetailMapper;
import com.ruoyi.business.mapper.EquipmentUsageRecordMapper;
import com.ruoyi.business.service.EquipmentUsageRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -43,6 +45,8 @@
private final EquipmentUsageRecordMapper equipmentUsageRecordMapper;
private final EquipmentManagementMapper equipmentManagementMapper;
+
+ private final EquipmentUsageDetailMapper equipmentUsageDetailMapper;
private final SysUserMapper sysUserMapper;
@@ -83,6 +87,15 @@
if (sysUser != null) {
dto.setUserName(sysUser.getNickName());
}
+ int totalReturnNo = equipmentUsageDetailMapper.selectList(
+ new LambdaQueryWrapper<EquipmentUsageDetail>()
+ .eq(EquipmentUsageDetail::getUsageId, entity.getId())
+ .eq(EquipmentUsageDetail::getOperationType,2))
+ .stream()
+ .mapToInt(EquipmentUsageDetail::getQuantity)
+ .sum();
+
+ dto.setTotalReturnNo(totalReturnNo);
return dto;
}).toList();
dtoPage.setRecords(dtoRecords);
@@ -97,13 +110,10 @@
throw new IllegalArgumentException("璁惧浣跨敤璁板綍鍙傛暟涓嶈兘涓虹┖");
}
- // 澶嶅埗灞炴�у埌瀹炰綋瀵硅薄
- EquipmentUsageRecord equipmentUsageRecord = new EquipmentUsageRecord();
- BeanUtils.copyProperties(equipmentUsageRecordDto, equipmentUsageRecord);
-
- // 鑾峰彇璁惧ID鍜岄鐢ㄦ暟閲�
+ // 鑾峰彇璁惧ID鍜屾搷浣滄暟閲�
Long equipmentId = equipmentUsageRecordDto.getEquipmentId();
- Integer newUsageQuantity = equipmentUsageRecordDto.getUsageQuantity();
+ Long userId = equipmentUsageRecordDto.getUserId();
+ String username = sysUserMapper.selectUserById(userId).getNickName();
// 鏌ヨ璁惧淇℃伅
EquipmentManagement equipment = equipmentManagementMapper.selectById(equipmentId);
@@ -111,20 +121,10 @@
throw new RuntimeException("璁惧涓嶅瓨鍦�");
}
+ int result;
// 鏂板璁板綍閫昏緫
if (Objects.isNull(equipmentUsageRecordDto.getId())) {
- // 妫�鏌ュ簱瀛樻槸鍚﹀厖瓒�
- if (equipment.getQuantity() < newUsageQuantity) {
- throw new RuntimeException("搴撳瓨涓嶈冻锛屽綋鍓嶅簱瀛橈細" + equipment.getQuantity());
- }
-
- // 鎵e噺搴撳瓨
- equipment.setQuantity(equipment.getQuantity() - newUsageQuantity);
- equipmentManagementMapper.updateById(equipment);
-
- // 璁剧疆浣跨敤寮�濮嬫椂闂翠负褰撳墠鏃堕棿
- equipmentUsageRecord.setUsageStartTime(LocalDate.now());
- return equipmentUsageRecordMapper.insert(equipmentUsageRecord);
+ result = handleNewUsage(equipmentUsageRecordDto, equipment, userId, username);
} else {
// 缂栬緫璁板綍閫昏緫
EquipmentUsageRecord originalRecord = equipmentUsageRecordMapper.selectById(equipmentUsageRecordDto.getId());
@@ -134,45 +134,124 @@
// 澶勭悊褰掕繕閫昏緫
if (equipmentUsageRecordDto.getEquipmentStatus() == 2) {
- // 妫�鏌ュ綊杩樻暟閲忔槸鍚﹀悎娉�
- if (newUsageQuantity > originalRecord.getUsageQuantity()) {
- throw new RuntimeException("褰掕繕鏁伴噺涓嶈兘瓒呰繃鍘熼鐢ㄦ暟閲�");
- }
-
- // 璁$畻瀹為檯褰掕繕鏁伴噺锛堝師棰嗙敤鏁伴噺 - 鏂伴鐢ㄦ暟閲忥級
- int returnedQuantity = originalRecord.getUsageQuantity() - newUsageQuantity;
-
- // 鎭㈠閮ㄥ垎搴撳瓨
- equipment.setQuantity(equipment.getQuantity() + returnedQuantity);
- equipmentManagementMapper.updateById(equipment);
-
- // 濡傛灉鍏ㄩ儴褰掕繕锛岃缃綊杩樻椂闂�
- if (newUsageQuantity == 0) {
- equipmentUsageRecord.setUsageEndTime(LocalDate.now());
- }
- return equipmentUsageRecordMapper.updateById(equipmentUsageRecord);
+ result = handleReturnOperation(equipmentUsageRecordDto, equipment, originalRecord, userId, username);
+ } else {
+ // 澶勭悊鏅�氱紪杈戦�昏緫锛堥潪褰掕繕鐘舵�侊級
+ result = handleEditOperation(equipmentUsageRecordDto, equipment, originalRecord, userId, username);
}
-
- // 澶勭悊鏅�氱紪杈戦�昏緫锛堥潪褰掕繕鐘舵�侊級
- if (!newUsageQuantity.equals(originalRecord.getUsageQuantity())) {
- // 璁$畻搴撳瓨鍙樺寲閲忥紙鏃ф暟閲� - 鏂版暟閲忥級
- int quantityDelta = originalRecord.getUsageQuantity() - newUsageQuantity;
-
- // 妫�鏌ヨ皟鏁村悗搴撳瓨鏄惁鍏呰冻
- int newInventory = equipment.getQuantity() + quantityDelta;
- if (newInventory < 0) {
- throw new RuntimeException("搴撳瓨涓嶈冻锛岃皟鏁村悗搴撳瓨灏嗕负锛�" + newInventory);
- }
-
- // 璋冩暣搴撳瓨
- equipment.setQuantity(newInventory);
- if (equipmentManagementMapper.updateById(equipment) == 0) {
- throw new RuntimeException("搴撳瓨鏇存柊澶辫触锛屽彲鑳藉凡琚叾浠栨搷浣滀慨鏀�");
- }
- }
-
- // 鏇存柊棰嗙敤璁板綍
- return equipmentUsageRecordMapper.updateById(equipmentUsageRecord);
}
+ return result;
+ }
+
+ private int handleNewUsage(EquipmentUsageRecordDto dto, EquipmentManagement equipment, Long userId, String username) {
+ // 妫�鏌ュ簱瀛�
+ if (equipment.getQuantity() < dto.getUsageQuantity()) {
+ throw new RuntimeException("搴撳瓨涓嶈冻锛屽綋鍓嶅簱瀛橈細" + equipment.getQuantity());
+ }
+
+ // 鍒涘缓涓昏褰�
+ EquipmentUsageRecord record = new EquipmentUsageRecord();
+ BeanUtils.copyProperties(dto, record);
+ record.setUsageStartTime(LocalDate.now());
+ record.setEquipmentStatus(1); // 浣跨敤涓姸鎬�
+ record.setReturnQuantity(0);
+
+ // 鎵e噺搴撳瓨
+ equipment.setQuantity(equipment.getQuantity() - dto.getUsageQuantity());
+ equipmentManagementMapper.updateById(equipment);
+
+ // 淇濆瓨涓昏褰�
+ int result = equipmentUsageRecordMapper.insert(record);
+
+ // 淇濆瓨棰嗙敤鏄庣粏璁板綍
+ if (result > 0) {
+ saveUsageDetail(record.getId(), record.getEquipmentId(), 1, dto.getUsageQuantity(), userId, username, "璁惧棰嗙敤");
+ }
+
+ return result;
+ }
+
+ private int handleReturnOperation(EquipmentUsageRecordDto dto, EquipmentManagement equipment,
+ EquipmentUsageRecord originalRecord, Long userId, String username) {
+ // 鑾峰彇鏈褰掕繕鏁伴噺
+ Integer returnQuantity = dto.getReturnQuantity();
+ if (returnQuantity == null || returnQuantity <= 0) {
+ throw new RuntimeException("褰掕繕鏁伴噺蹇呴』澶т簬0");
+ }
+
+ // 璁$畻鍓╀綑鏈綊杩樻暟閲�
+ int remainingQuantity = originalRecord.getUsageQuantity() - originalRecord.getReturnQuantity();
+ if (returnQuantity > remainingQuantity) {
+ throw new RuntimeException("褰掕繕鏁伴噺涓嶈兘瓒呰繃鏈綊杩樻暟閲忥紝鍓╀綑鏈綊杩樻暟閲忥細" + remainingQuantity);
+ }
+
+ // 鏇存柊涓昏褰�
+ EquipmentUsageRecord updateRecord = new EquipmentUsageRecord();
+ updateRecord.setId(originalRecord.getId());
+ updateRecord.setReturnQuantity(originalRecord.getReturnQuantity() + returnQuantity);
+ updateRecord.setEquipmentStatus(2); // 宸插綊杩樼姸鎬�
+ updateRecord.setUsageEndTime(LocalDate.now());
+ // 濡傛灉鍏ㄩ儴褰掕繕锛屾洿鏂扮姸鎬佸拰鏃堕棿
+// if (updateRecord.getReturnQuantity().equals(originalRecord.getUsageQuantity())) {
+//
+// }
+
+ // 鎭㈠搴撳瓨
+ equipment.setQuantity(equipment.getQuantity() + returnQuantity);
+ equipmentManagementMapper.updateById(equipment);
+
+ // 鏇存柊涓昏褰�
+ int result = equipmentUsageRecordMapper.updateById(updateRecord);
+
+ // 淇濆瓨褰掕繕鏄庣粏璁板綍
+ if (result > 0) {
+ String remark = "璁惧褰掕繕" + (updateRecord.getEquipmentStatus() == 2 ? "锛堝叏閮ㄥ綊杩橈級" : "锛堥儴鍒嗗綊杩橈級");
+ saveUsageDetail(originalRecord.getId(), originalRecord.getEquipmentId(), 2, returnQuantity, userId, username, remark);
+ }
+
+ return result;
+ }
+
+ private int handleEditOperation(EquipmentUsageRecordDto dto, EquipmentManagement equipment,
+ EquipmentUsageRecord originalRecord, Long userId, String username) {
+ // 妫�鏌ラ鐢ㄦ暟閲忔槸鍚︽湁鍙樺寲
+ if (!dto.getUsageQuantity().equals(originalRecord.getUsageQuantity())) {
+ // 璁$畻搴撳瓨鍙樺寲閲忥紙鏃ф暟閲� - 鏂版暟閲忥級
+ int quantityDelta = originalRecord.getUsageQuantity() - dto.getUsageQuantity();
+
+ // 妫�鏌ヨ皟鏁村悗搴撳瓨鏄惁鍏呰冻
+ int newInventory = equipment.getQuantity() + quantityDelta;
+ if (newInventory < 0) {
+ throw new RuntimeException("搴撳瓨涓嶈冻锛岃皟鏁村悗搴撳瓨灏嗕负锛�" + newInventory);
+ }
+
+ // 璋冩暣搴撳瓨
+ equipment.setQuantity(newInventory);
+ if (equipmentManagementMapper.updateById(equipment) == 0) {
+ throw new RuntimeException("搴撳瓨鏇存柊澶辫触锛屽彲鑳藉凡琚叾浠栨搷浣滀慨鏀�");
+ }
+
+ // 璁板綍鏁伴噺鍙樻洿鏄庣粏
+ saveUsageDetail(originalRecord.getId(), originalRecord.getEquipmentId(), 3, dto.getUsageQuantity(), userId, username,
+ "棰嗙敤鏁伴噺鍙樻洿锛�" + originalRecord.getUsageQuantity() + "鈫�" + dto.getUsageQuantity());
+ }
+
+ // 鏇存柊棰嗙敤璁板綍
+ EquipmentUsageRecord updateRecord = new EquipmentUsageRecord();
+ BeanUtils.copyProperties(dto, updateRecord);
+ return equipmentUsageRecordMapper.updateById(updateRecord);
+ }
+
+ private void saveUsageDetail(Long usageId, Long equipmentId, Integer operationType, Integer quantity,
+ Long operatorId, String operator, String remark) {
+ EquipmentUsageDetail detail = new EquipmentUsageDetail();
+ detail.setUsageId(usageId);
+ detail.setEquipmentId(equipmentId);
+ detail.setOperationType(operationType);
+ detail.setQuantity(quantity);
+ detail.setOperatorId(operatorId);
+ detail.setOperator(operator);
+ detail.setRemark(remark);
+ equipmentUsageDetailMapper.insert(detail);
}
}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
index 1e6c5ad..e4532e2 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java
@@ -316,7 +316,7 @@
// 2. 鍑嗗寰呭叆搴撹褰�
Long userId = SecurityUtils.getUserId();
PendingInventory pendingInventory = new PendingInventory();
- pendingInventory.setUnit("t");
+ pendingInventory.setUnit("鍚�");
pendingInventory.setRegistrantId(userId);
pendingInventory.setRegistrationDate(LocalDate.now());
pendingInventory.setSupplierName("閰嶇叅璁$畻鍣ㄦ柟妗堝叆搴�");
@@ -352,7 +352,7 @@
// 5. 璁剧疆浠锋牸鍜屾暟閲�
BigDecimal cost = safeGetBigDecimal(map, "cost");
- BigDecimal tonnage = safeGetBigDecimal(map, "totalTonnage");
+ BigDecimal tonnage = safeGetBigDecimal(map, "createCoalQuantity");
if (cost == null || tonnage == null) {
throw new BaseException("鎴愭湰鎴栧惃浣嶄笉鑳戒负绌�");
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
index eef4183..3dab18e 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/ProductionMasterServiceImpl.java
@@ -295,7 +295,7 @@
PendingInventory pending = new PendingInventory();
pending.setCoalId(p.getCoalId());
pending.setInventoryQuantity(p.getProductionQuantity());
- pending.setUnit("t");
+ pending.setUnit("鍚�");
pending.setSupplierName(formattedDate + " - " + "鐢熶骇鍔犲伐鍏ュ簱");
// 闈炵┖澶勭悊
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql b/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql
index d24a052..51c1cb1 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250603160101__create_table_purchase_registration.sql
@@ -15,6 +15,7 @@
total_price_excluding_tax DECIMAL(10, 2) NOT NULL, -- 涓嶅惈绋庢�讳环锛屼笉鍏佽涓虹┖
registrant_id BIGINT NOT NULL, -- 鐧昏浜篿d锛屼笉鍏佽涓虹┖
registration_date DATE NOT NULL, -- 鐧昏鏃ユ湡锛屼笉鍏佽涓虹┖
+ freight DECIMAL(10, 2) NOT NULL, -- 杩愯垂
deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕
@@ -39,6 +40,8 @@
COMMENT ON COLUMN purchase_registration.total_price_excluding_tax IS '涓嶅惈绋庢�讳环';
COMMENT ON COLUMN purchase_registration.registrant_id IS '鐧昏浜篿d';
COMMENT ON COLUMN purchase_registration.registration_date IS '鐧昏鏃ユ湡';
+COMMENT ON COLUMN purchase_registration.freight IS '杩愯垂';
+
COMMENT ON COLUMN purchase_registration.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
COMMENT ON COLUMN purchase_registration.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
COMMENT ON COLUMN purchase_registration.create_time IS '璁板綍鍒涘缓鏃堕棿';
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
index b40aa8e..5e4b100 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250604111200__create_table_official_inventory.sql
@@ -41,6 +41,9 @@
COMMENT ON COLUMN official_inventory.registration_date IS '鐧昏鏃ユ湡';
COMMENT ON COLUMN official_inventory.merge_id IS '鍚堝苟id';
COMMENT ON COLUMN official_inventory.coal_plan_id IS '鐓よ川鏂规id';
+COMMENT ON COLUMN official_inventory.pending_id IS '寰呭叆搴搃d';
+COMMENT ON COLUMN official_inventory.price_excluding_tax IS '涓嶅惈绋庡崟浠�';
+COMMENT ON COLUMN official_inventory.total_price_excluding_tax IS '涓嶅惈绋庢�讳环';
COMMENT ON COLUMN official_inventory.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
COMMENT ON COLUMN official_inventory.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250707155600__create_table_equipment_usage_record.sql b/main-business/src/main/resources/db/migration/postgresql/V20250707155600__create_table_equipment_usage_record.sql
index af01796..d67ea18 100644
--- a/main-business/src/main/resources/db/migration/postgresql/V20250707155600__create_table_equipment_usage_record.sql
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250707155600__create_table_equipment_usage_record.sql
@@ -1,39 +1,57 @@
-- 鍒涘缓璁惧浣跨敤璁板綍琛� equipment_usage_record
CREATE TABLE equipment_usage_record
(
-id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
- equipment_id BIGINT NOT NULL, -- 璁惧ID锛屽叧鑱旇澶囦俊鎭〃锛屼笉鍏佽涓虹┖
- usage_quantity INT NOT NULL, -- 浣跨敤鏁伴噺锛屼笉鍏佽涓虹┖
- user_id BIGINT NOT NULL, -- 浣跨敤浜篒D锛屽叧鑱旂敤鎴疯〃锛屼笉鍏佽涓虹┖
- department_id BIGINT , -- 閮ㄩ棬ID锛屽叧鑱旈儴闂ㄨ〃锛屼笉鍏佽涓虹┖
- equipment_status BIGINT NOT NULL, -- 璁惧鐘舵��:1.浣跨敤涓� 2.宸插綊杩�
- usage_start_time TIMESTAMP NOT NULL, -- 浣跨敤寮�濮嬫椂闂达紝涓嶅厑璁镐负绌�
- usage_end_time TIMESTAMP, -- 浣跨敤缁撴潫鏃堕棿锛屽彲涓虹┖锛堟湭褰掕繕鏃讹級
- remarks VARCHAR(1000), -- 澶囨敞淇℃伅锛屽彲涓虹┖
+ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
+ equipment_id BIGINT NOT NULL, -- 璁惧ID锛屽叧鑱旇澶囦俊鎭〃锛屼笉鍏佽涓虹┖
+ usage_quantity INT NOT NULL, -- 棰嗙敤鏁伴噺锛屼笉鍏佽涓虹┖
+ return_quantity INT, -- 褰掕繕鏁伴噺
+ user_id BIGINT NOT NULL, -- 浣跨敤浜篒D锛屽叧鑱旂敤鎴疯〃锛屼笉鍏佽涓虹┖
+ department_id BIGINT, -- 閮ㄩ棬ID锛屽叧鑱旈儴闂ㄨ〃锛屼笉鍏佽涓虹┖
+ equipment_status BIGINT NOT NULL, -- 璁惧鐘舵��:1.浣跨敤涓� 2.宸插綊杩�
+ usage_start_time TIMESTAMP NOT NULL, -- 浣跨敤寮�濮嬫椂闂达紝涓嶅厑璁镐负绌�
+ usage_end_time TIMESTAMP, -- 浣跨敤缁撴潫鏃堕棿锛屽彲涓虹┖锛堟湭褰掕繕鏃讹級
+ remarks VARCHAR(1000), -- 澶囨敞淇℃伅锛屽彲涓虹┖
- deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
- create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕
- create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
- update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚�
- update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂�
+ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
+ create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕
+ create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
+ update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚�
+ update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂�
);
-- 涓鸿〃娣诲姞娉ㄩ噴
-COMMENT ON TABLE equipment_usage_record IS '璁惧浣跨敤璁板綍琛�';
+COMMENT
+ON TABLE equipment_usage_record IS '璁惧浣跨敤璁板綍琛�';
-- 涓哄瓧娈垫坊鍔犳敞閲�
-COMMENT ON COLUMN equipment_usage_record.id IS '涓婚敭ID';
-COMMENT ON COLUMN equipment_usage_record.equipment_id IS '璁惧ID';
-COMMENT ON COLUMN equipment_usage_record.usage_quantity IS '浣跨敤鏁伴噺';
-COMMENT ON COLUMN equipment_usage_record.user_id IS '浣跨敤浜篒D';
-COMMENT ON COLUMN equipment_usage_record.department_id IS '閮ㄩ棬ID';
-COMMENT ON COLUMN equipment_usage_record.equipment_status IS '璁惧鐘舵��:1.浣跨敤涓� 2.宸插綊杩�';
-COMMENT ON COLUMN equipment_usage_record.usage_start_time IS '浣跨敤寮�濮嬫椂闂�';
-COMMENT ON COLUMN equipment_usage_record.usage_end_time IS '浣跨敤缁撴潫鏃堕棿';
-COMMENT ON COLUMN equipment_usage_record.remarks IS '澶囨敞淇℃伅';
+COMMENT
+ON COLUMN equipment_usage_record.id IS '涓婚敭ID';
+COMMENT
+ON COLUMN equipment_usage_record.equipment_id IS '璁惧ID';
+COMMENT
+ON COLUMN equipment_usage_record.usage_quantity IS '棰嗙敤鏁伴噺';
+COMMENT
+ON COLUMN equipment_usage_record.return_quantity IS '褰掕繕鏁伴噺';
+COMMENT
+ON COLUMN equipment_usage_record.user_id IS '浣跨敤浜篒D';
+COMMENT
+ON COLUMN equipment_usage_record.department_id IS '閮ㄩ棬ID';
+COMMENT
+ON COLUMN equipment_usage_record.equipment_status IS '璁惧鐘舵��:1.浣跨敤涓� 2.宸插綊杩�';
+COMMENT
+ON COLUMN equipment_usage_record.usage_start_time IS '浣跨敤寮�濮嬫椂闂�';
+COMMENT
+ON COLUMN equipment_usage_record.usage_end_time IS '浣跨敤缁撴潫鏃堕棿';
+COMMENT
+ON COLUMN equipment_usage_record.remarks IS '澶囨敞淇℃伅';
-COMMENT ON COLUMN equipment_usage_record.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
-COMMENT ON COLUMN equipment_usage_record.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
-COMMENT ON COLUMN equipment_usage_record.create_time IS '璁板綍鍒涘缓鏃堕棿';
-COMMENT ON COLUMN equipment_usage_record.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
-COMMENT ON COLUMN equipment_usage_record.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
+COMMENT
+ON COLUMN equipment_usage_record.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+COMMENT
+ON COLUMN equipment_usage_record.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+COMMENT
+ON COLUMN equipment_usage_record.create_time IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT
+ON COLUMN equipment_usage_record.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+COMMENT
+ON COLUMN equipment_usage_record.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250723134500__create_table_equipment_usage_detail.sql b/main-business/src/main/resources/db/migration/postgresql/V20250723134500__create_table_equipment_usage_detail.sql
new file mode 100644
index 0000000..0882436
--- /dev/null
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250723134500__create_table_equipment_usage_detail.sql
@@ -0,0 +1,53 @@
+-- 鍒涘缓璁惧浣跨敤鏄庣粏琛� equipment_usage_detail
+DROP TABLE IF EXISTS equipment_usage_detail;
+
+CREATE TABLE equipment_usage_detail
+(
+ id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID锛岃嚜鍔ㄩ�掑
+ usage_id BIGINT NOT NULL, -- 鍏宠仈鐨勪娇鐢ㄨ褰旾D
+ equipment_id BIGINT NOT NULL, -- 鍏宠仈鐨勮澶嘔D
+ operation_type INT NOT NULL, -- 鎿嶄綔绫诲瀷锛�1-棰嗙敤锛�2-褰掕繕
+ quantity INT NOT NULL, -- 鎿嶄綔鏁伴噺
+ operator_id BIGINT NOT NULL, -- 鎿嶄綔浜篒D
+ operator VARCHAR(255), -- 鎿嶄綔浜�
+ remark VARCHAR(255), -- 澶囨敞
+
+ deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
+ create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕
+ create_time TIMESTAMP WITHOUT TIME ZONE, -- 鍒涘缓鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
+ update_by VARCHAR(255), -- 鏈�鍚庢洿鏂颁汉鐢ㄦ埛鍚�
+ update_time TIMESTAMP WITHOUT TIME ZONE -- 鏈�鍚庢洿鏂版椂闂�
+);
+
+-- 涓鸿〃娣诲姞娉ㄩ噴
+COMMENT
+ON TABLE equipment_usage_detail IS '璁惧浣跨敤鏄庣粏琛�';
+
+-- 涓哄瓧娈垫坊鍔犳敞閲�
+COMMENT
+ON COLUMN equipment_usage_detail.id IS '涓婚敭ID';
+COMMENT
+ON COLUMN equipment_usage_detail.usage_id IS '鍏宠仈鐨勪娇鐢ㄨ褰旾D';
+COMMENT
+ON COLUMN equipment_usage_detail.equipment_id IS '鍏宠仈鐨勮澶嘔D';
+COMMENT
+ON COLUMN equipment_usage_detail.operation_type IS '鎿嶄綔绫诲瀷锛�1-棰嗙敤锛�2-褰掕繕';
+COMMENT
+ON COLUMN equipment_usage_detail.quantity IS '鎿嶄綔鏁伴噺';
+COMMENT
+ON COLUMN equipment_usage_detail.operator_id IS '鎿嶄綔浜篒D';
+COMMENT
+ON COLUMN equipment_usage_detail.operator IS '鎿嶄綔浜�';
+COMMENT
+ON COLUMN equipment_usage_detail.remark IS '澶囨敞';
+
+COMMENT
+ON COLUMN equipment_usage_detail.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+COMMENT
+ON COLUMN equipment_usage_detail.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+COMMENT
+ON COLUMN equipment_usage_detail.create_time IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT
+ON COLUMN equipment_usage_detail.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+COMMENT
+ON COLUMN equipment_usage_detail.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/EquipmentUsageDetailMapper.xml b/main-business/src/main/resources/mapper/EquipmentUsageDetailMapper.xml
new file mode 100644
index 0000000..0b665c9
--- /dev/null
+++ b/main-business/src/main/resources/mapper/EquipmentUsageDetailMapper.xml
@@ -0,0 +1,31 @@
+<?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.ruoyi.business.mapper.EquipmentUsageDetailMapper">
+
+ <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+ <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.EquipmentUsageDetail">
+ <id column="id" property="id" />
+ <result column="deleted" property="deleted" />
+ <result column="create_by" property="createBy" />
+ <result column="create_time" property="createTime" />
+ <result column="update_by" property="updateBy" />
+ <result column="update_time" property="updateTime" />
+ <result column="usage_id" property="usageId" />
+ <result column="operation_type" property="operationType" />
+ <result column="quantity" property="quantity" />
+ <result column="operator_id" property="operatorId" />
+ <result column="operator" property="operator" />
+ <result column="remark" property="remark" />
+ </resultMap>
+
+ <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
+ <sql id="Base_Column_List">
+ deleted,
+ create_by,
+ create_time,
+ update_by,
+ update_time,
+ id, usage_id, operation_type, quantity, operator_id, operator, remark
+ </sql>
+
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3