From 18d292f1091b8b86ad29ba76e3cbe8ffaf2c222e Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期三, 11 六月 2025 17:45:39 +0800
Subject: [PATCH] 1.正式库合并以及优化 2.销售模块

---
 main-business/src/main/java/com/ruoyi/business/controller/SalesRecordController.java                    |   52 +++
 main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java              |   33 +
 main-business/src/main/java/com/ruoyi/business/entity/PurchaseRegistration.java                         |    4 
 main-business/src/main/resources/mapper/OfficialInventoryMapper.xml                                     |    5 
 main-business/src/main/java/com/ruoyi/business/mapper/SalesRecordMapper.java                            |   18 +
 main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java                            |    3 
 main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java                    |    9 
 main-business/src/main/resources/mapper/SalesRecordMapper.xml                                           |   43 ++
 main-business/src/main/java/com/ruoyi/business/service/SalesRecordService.java                          |   24 +
 basic-server/src/main/java/com/ruoyi/basic/service/impl/CoalInfoServiceImpl.java                        |    4 
 main-business/src/main/java/com/ruoyi/business/vo/OfficialInventoryVo.java                              |   16 +
 main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java                             |   19 
 basic-server/src/main/java/com/ruoyi/basic/entity/CoalValue.java                                        |   11 
 main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java        |    4 
 main-business/src/main/resources/mapper/PendingInventoryMapper.xml                                      |    5 
 main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java                                  |  120 ++++++++
 main-business/src/main/java/com/ruoyi/business/dto/SalesRecordDto.java                                  |    8 
 basic-server/src/main/java/com/ruoyi/basic/entity/CoalInfo.java                                         |   11 
 main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java           |  140 ++++++++
 main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java                 |  144 +++++++++
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/init/MyStartupRunner.java                            |    1 
 main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java                            |   21 +
 main-business/src/main/java/com/ruoyi/business/entity/File.java                                         |   94 +++---
 main-business/src/main/java/com/ruoyi/business/entity/Production.java                                   |    4 
 main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql |   59 +++
 25 files changed, 753 insertions(+), 99 deletions(-)

diff --git a/basic-server/src/main/java/com/ruoyi/basic/entity/CoalInfo.java b/basic-server/src/main/java/com/ruoyi/basic/entity/CoalInfo.java
index 934495c..0880eea 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/entity/CoalInfo.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/entity/CoalInfo.java
@@ -1,11 +1,14 @@
 package com.ruoyi.basic.entity;
 
-import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
 import com.ruoyi.common.core.domain.MyBaseEntity;
+import lombok.Data;
 
-import java.util.Date;
+import java.time.LocalDate;
 
 /**
  * 鐓ょ淇℃伅琛� 瀹炰綋绫�
@@ -39,5 +42,5 @@
      */
     @TableField(value = "maintenance_date")
     @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date maintenanceDate;
+    private LocalDate maintenanceDate;
 }
\ No newline at end of file
diff --git a/basic-server/src/main/java/com/ruoyi/basic/entity/CoalValue.java b/basic-server/src/main/java/com/ruoyi/basic/entity/CoalValue.java
index f52bd3a..7f5848f 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/entity/CoalValue.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/entity/CoalValue.java
@@ -17,8 +17,7 @@
  */
 @Data
 @TableName("coal_value")
-public class
-CoalValue extends MyBaseEntity {
+public class CoalValue extends MyBaseEntity {
 
     private static final long serialVersionUID = 1L;
 
@@ -30,7 +29,7 @@
     private Long id;
 
     /**
-     * 鍏宠仈閲囪喘鍏ュ簱涓婚敭ID
+     * 鍏宠仈閲囪喘/姝e紡鍏ュ簱涓婚敭ID
      */
     @TableField(value = "plan_id")
     private Long planId;
@@ -50,4 +49,10 @@
     @TableField(value = "field_name")
     private String fieldName;
 
+    /**
+     * 1 閲囪喘/ 2 姝e紡   鍏ュ簱
+     */
+    @TableField(value = "type")
+    private String type;
+
 }
\ No newline at end of file
diff --git a/basic-server/src/main/java/com/ruoyi/basic/service/impl/CoalInfoServiceImpl.java b/basic-server/src/main/java/com/ruoyi/basic/service/impl/CoalInfoServiceImpl.java
index 750e6b1..fb2b5d0 100644
--- a/basic-server/src/main/java/com/ruoyi/basic/service/impl/CoalInfoServiceImpl.java
+++ b/basic-server/src/main/java/com/ruoyi/basic/service/impl/CoalInfoServiceImpl.java
@@ -9,13 +9,13 @@
 import com.ruoyi.basic.entity.CoalInfo;
 import com.ruoyi.basic.mapper.CoalInfoMapper;
 import com.ruoyi.basic.service.CoalInfoService;
-import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import java.time.LocalDate;
 import java.util.Objects;
 
 /**
@@ -47,7 +47,7 @@
         CoalInfo coalInfo = new CoalInfo();
         BeanUtils.copyProperties(coalInfoDto, coalInfo);
         coalInfo.setMaintainerId(SecurityUtils.getUserId());
-        coalInfo.setMaintenanceDate(DateUtils.getNowDate());
+        coalInfo.setMaintenanceDate(LocalDate.now());
         if (Objects.isNull(coalInfoDto.getId())) {
             return coalInfoMapper.insert(coalInfo);
         } else {
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java b/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java
index 9dedce7..196e7ad 100644
--- a/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java
+++ b/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java
@@ -4,11 +4,12 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.business.dto.OfficialInventoryDto;
 import com.ruoyi.business.service.OfficialInventoryService;
+import com.ruoyi.business.vo.OfficialInventoryVo;
 import com.ruoyi.common.core.domain.R;
 import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 /**
  * <p>
@@ -31,8 +32,32 @@
      */
     @GetMapping("/list")
     public R<IPage<OfficialInventoryDto>> list(Page page, OfficialInventoryDto officialInventoryDto) {
-        IPage<OfficialInventoryDto> list = officialInventoryService.selectOfficialInventoryList(page,officialInventoryDto);
+        IPage<OfficialInventoryDto> list = officialInventoryService.selectOfficialInventoryList(page, officialInventoryDto);
         return R.ok(list);
     }
 
+    /**
+     * 姝e紡搴撶叅绉嶉儴鍒嗕俊鎭痩ist
+     */
+    @GetMapping("/OfficialList")
+    public R<List<OfficialInventoryVo>> officialList(OfficialInventoryVo officialInventoryVo) {
+        return R.ok(officialInventoryService.selectOfficialList(officialInventoryVo));
+    }
+
+    /**
+     * 姝e紡搴撲慨鏀�
+     */
+    @PostMapping("/editOfficial")
+    public R editOfficial(@RequestBody OfficialInventoryDto officialInventoryDto) {
+        return R.ok(officialInventoryService.editOfficial(officialInventoryDto));
+    }
+
+    /**
+     * 鍚堝苟
+     */
+    @PostMapping("/merge")
+    public R merge(@RequestBody OfficialInventoryDto officialInventoryDto) {
+        return R.ok(officialInventoryService.mergeAll(officialInventoryDto));
+    }
+
 }
diff --git a/main-business/src/main/java/com/ruoyi/business/controller/SalesRecordController.java b/main-business/src/main/java/com/ruoyi/business/controller/SalesRecordController.java
new file mode 100644
index 0000000..753ee0e
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/controller/SalesRecordController.java
@@ -0,0 +1,52 @@
+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.SalesRecordDto;
+import com.ruoyi.business.entity.SalesRecord;
+import com.ruoyi.business.service.SalesRecordService;
+import com.ruoyi.common.core.domain.R;
+import lombok.AllArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ * 閿�鍞褰曡〃 鍓嶇鎺у埗鍣�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-11
+ */
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/salesRecord")
+public class SalesRecordController {
+
+    private SalesRecordService salesRecordService;
+
+    /**
+     * 閿�鍞褰曡〃鏌ヨ
+     */
+    @GetMapping("/list")
+    public R<IPage<SalesRecord>> list(Page page, SalesRecordDto salesRecordDto) {
+        IPage<SalesRecord> list = salesRecordService.selectSalesRecordList(page,salesRecordDto);
+        return R.ok(list);
+    }
+
+    /**
+     * 閿�鍞褰曡〃鏂板淇敼
+     */
+    @PostMapping("/addOrEditSalesRecord")
+    public R addOrEditSalesRecord(@RequestBody SalesRecordDto salesRecordDto) {
+        return R.ok(salesRecordService.addOrEditSalesRecord(salesRecordDto));
+    }
+
+    /**
+     * 閿�鍞褰曡〃鍒犻櫎
+     */
+    @DeleteMapping("/delSalesRecord")
+    public R remove(@RequestBody Long[] ids) {
+        return R.ok(salesRecordService.delByIds(ids));
+    }
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java b/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java
index 0e386e9..066257f 100644
--- a/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java
+++ b/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java
@@ -10,4 +10,7 @@
 public class OfficialInventoryDto extends OfficialInventory {
 
     private List<Map<String, String>> fields;
+
+    private List<Long> ids;
+
 }
diff --git a/main-business/src/main/java/com/ruoyi/business/dto/SalesRecordDto.java b/main-business/src/main/java/com/ruoyi/business/dto/SalesRecordDto.java
new file mode 100644
index 0000000..c32a713
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/dto/SalesRecordDto.java
@@ -0,0 +1,8 @@
+package com.ruoyi.business.dto;
+
+import com.ruoyi.business.entity.SalesRecord;
+import lombok.Data;
+
+@Data
+public class SalesRecordDto extends SalesRecord {
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/File.java b/main-business/src/main/java/com/ruoyi/business/entity/File.java
index 2e85ac4..6b64336 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/File.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/File.java
@@ -2,58 +2,58 @@
 
 import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
-    import com.ruoyi.common.core.domain.MyBaseEntity;
+import com.ruoyi.common.core.domain.MyBaseEntity;
 
 /**
-* 涓婁紶鏂囦欢鐨勫熀鏈俊鎭� 瀹炰綋绫�
-*
-* @author ruoyi
-* @date 2025-06-10
-*/
+ * 涓婁紶鏂囦欢鐨勫熀鏈俊鎭� 瀹炰綋绫�
+ *
+ * @author ruoyi
+ * @date 2025-06-10
+ */
 @Data
 @TableName("file")
 public class File extends MyBaseEntity {
 
-private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 1L;
 
-        /**
-        * 涓婚敭ID
-        */
-            @TableId(value = "id", type = IdType.AUTO)
-        private Long id;
-        /**
-        * 鍏宠仈鐨勬。妗圛D锛屽閿紩鐢� archive.id
-        */
-            @TableField(value = "archive_id")
-        private Long archiveId;
-        /**
-        * 鍘熷鏂囦欢鍚嶏紙鐢ㄦ埛涓婁紶鏃剁殑鍚嶇О锛�
-        */
-            @TableField(value = "original_name")
-        private String originalName;
-        /**
-        * 棰勮鍦板潃
-        */
-            @TableField(value = "preview_url")
-        private String previewUrl;
-        /**
-        * 绯荤粺瀛樺偍鐨勫敮涓�鏂囦欢鍚�
-        */
-            @TableField(value = "file_name")
-        private String fileName;
-        /**
-        * 鏂囦欢鍦ㄦ湇鍔″櫒涓婄殑瀛樺偍璺緞鎴栬闂甎RL
-        */
-            @TableField(value = "file_path")
-        private String filePath;
-        /**
-        * 鏂囦欢MIME绫诲瀷锛屼緥濡� image/png銆乤pplication/pdf
-        */
-            @TableField(value = "file_type")
-        private String fileType;
-        /**
-        * 鏂囦欢澶у皬锛屽崟浣嶄负瀛楄妭
-        */
-            @TableField(value = "file_size")
-        private String fileSize;
+    /**
+     * 涓婚敭ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     * 鍏宠仈鐨勬。妗圛D锛屽閿紩鐢� archive.id
+     */
+    @TableField(value = "archive_id")
+    private Long archiveId;
+    /**
+     * 鍘熷鏂囦欢鍚嶏紙鐢ㄦ埛涓婁紶鏃剁殑鍚嶇О锛�
+     */
+    @TableField(value = "original_name")
+    private String originalName;
+    /**
+     * 棰勮鍦板潃
+     */
+    @TableField(value = "preview_url")
+    private String previewUrl;
+    /**
+     * 绯荤粺瀛樺偍鐨勫敮涓�鏂囦欢鍚�
+     */
+    @TableField(value = "file_name")
+    private String fileName;
+    /**
+     * 鏂囦欢鍦ㄦ湇鍔″櫒涓婄殑瀛樺偍璺緞鎴栬闂甎RL
+     */
+    @TableField(value = "file_path")
+    private String filePath;
+    /**
+     * 鏂囦欢MIME绫诲瀷锛屼緥濡� image/png銆乤pplication/pdf
+     */
+    @TableField(value = "file_type")
+    private String fileType;
+    /**
+     * 鏂囦欢澶у皬锛屽崟浣嶄负瀛楄妭
+     */
+    @TableField(value = "file_size")
+    private String fileSize;
 }
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java b/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java
index e97889f..49fa6da 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/OfficialInventory.java
@@ -8,7 +8,7 @@
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.Date;
+import java.time.LocalDate;
 
 /**
  * 姝e紡搴撳瓨琛� 瀹炰綋绫�
@@ -63,10 +63,15 @@
     @TableField(value = "total_price_including_tax")
     private BigDecimal totalPriceIncludingTax;
     /**
-     * 鎴愭湰鍗曚环
+     * 涓嶅惈绋庡崟浠�
      */
-    @TableField(value = "cost_per_unit")
-    private BigDecimal costPerUnit;
+    @TableField(value = "price_excluding_tax")
+    private BigDecimal priceExcludingTax;
+    /**
+     * 涓嶅惈绋庢�讳环
+     */
+    @TableField(value = "total_price_excluding_tax")
+    private BigDecimal totalPriceExcludingTax;
     /**
      * 寰呰ˉ搴�
      */
@@ -81,5 +86,11 @@
      * 鐧昏鏃ユ湡
      */
     @TableField(value = "registration_date")
-    private Date registrationDate;
+    private LocalDate registrationDate;
+
+    /**
+     * 鍚堝苟id
+     */
+    @TableField(value = "merge_id")
+    private String mergeId;
 }
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java b/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
index 9fe9ca2..df8b306 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/PendingInventory.java
@@ -8,7 +8,7 @@
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.Date;
+import java.time.LocalDate;
 
 /**
  * 寰呭叆搴撹〃 瀹炰綋绫�
@@ -56,18 +56,23 @@
     @TableField(value = "total_price_including_tax")
     private BigDecimal totalPriceIncludingTax;
     /**
-     * 鎴愭湰鍗曚环
+     * 涓嶅惈绋庡崟浠�
      */
-    @TableField(value = "cost_per_unit")
-    private BigDecimal costPerUnit;
+    @TableField(value = "price_excluding_tax")
+    private BigDecimal priceExcludingTax;
+    /**
+     * 涓嶅惈绋庢�讳环
+     */
+    @TableField(value = "total_price_excluding_tax")
+    private BigDecimal totalPriceExcludingTax;
     /**
      * 鐧昏浜�
      */
     @TableField(value = "registrant_id")
     private String registrantId;
     /**
-     * 鐧昏鏃堕棿
+     * 鐧昏鏃ユ湡
      */
-    @TableField(value = "registration_time")
-    private Date registrationTime;
+    @TableField(value = "registration_date")
+    private LocalDate registrationDate;
 }
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/Production.java b/main-business/src/main/java/com/ruoyi/business/entity/Production.java
index d79ea0f..2465357 100644
--- a/main-business/src/main/java/com/ruoyi/business/entity/Production.java
+++ b/main-business/src/main/java/com/ruoyi/business/entity/Production.java
@@ -8,7 +8,7 @@
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.Date;
+import java.time.LocalDate;
 
 /**
  * 鐢熶骇鏄庣粏琛� 瀹炰綋绫�
@@ -81,5 +81,5 @@
      * 鐢熶骇鏃ユ湡
      */
     @TableField(value = "production_date")
-    private Date productionDate;
+    private LocalDate productionDate;
 }
\ No newline at end of file
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 1857da2..4a7c3ac 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
@@ -8,7 +8,7 @@
 import lombok.Data;
 
 import java.math.BigDecimal;
-import java.util.Date;
+import java.time.LocalDate;
 
 /**
  * 閲囪喘鐧昏琛� 瀹炰綋绫�
@@ -91,5 +91,5 @@
      * 鐧昏鏃ユ湡
      */
     @TableField(value = "registration_date")
-    private Date registrationDate;
+    private LocalDate registrationDate;
 }
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java b/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java
new file mode 100644
index 0000000..7f5d55c
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/entity/SalesRecord.java
@@ -0,0 +1,120 @@
+package com.ruoyi.business.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.MyBaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.time.LocalDate;
+
+/**
+ * 閿�鍞褰曡〃 瀹炰綋绫�
+ *
+ * @author ruoyi
+ * @date 2025-06-11
+ */
+@Data
+@TableName("sales_record")
+public class SalesRecord extends MyBaseEntity {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 涓婚敭ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Long id;
+    /**
+     * 閿�鍞棩鏈�
+     */
+    @TableField(value = "sale_date")
+    private LocalDate saleDate;
+    /**
+     * 瀹㈡埛id
+     */
+    @TableField(value = "customer_id")
+    private Long customerId;
+    /**
+     * 瀹㈡埛
+     */
+    @TableField(value = "customer")
+    private String customer;
+    /**
+     * 鐓ょid
+     */
+    @TableField(value = "coal_id")
+    private String coalId;
+    /**
+     * 鐓ょ
+     */
+    @TableField(value = "coal")
+    private String coal;
+    /**
+     * 鍗曚环锛堝惈绋庯級
+     */
+    @TableField(value = "price_including_tax")
+    private BigDecimal priceIncludingTax;
+    /**
+     * 搴撳瓨鏁伴噺
+     */
+    @TableField(value = "inventory_quantity")
+    private Long inventoryQuantity;
+    /**
+     * 鍗曚綅
+     */
+    @TableField(value = "unit")
+    private String unit;
+    /**
+     * 閿�鍞暟閲�
+     */
+    @TableField(value = "sale_quantity")
+    private BigDecimal saleQuantity;
+    /**
+     * 閿�鍞崟浠� (鍚◣)
+     */
+    @TableField(value = "sale_price")
+    private BigDecimal salePrice;
+    /**
+     * 閿�鍞�讳环 (鍚◣)
+     */
+    @TableField(value = "total_amount")
+    private BigDecimal totalAmount;
+    /**
+     * 璐攢鐓ょ◣鐜�13%
+     */
+    @TableField(value = "tax_coal")
+    private String taxCoal;
+    /**
+     * 杩愯緭绋庣巼9%
+     */
+    @TableField(value = "tax_trans")
+    private String taxTrans;
+    /**
+     * 姣涘埄娑�
+     */
+    @TableField(value = "gross_profit")
+    private BigDecimal grossProfit;
+    /**
+     * 鍑�鍒╂鼎
+     */
+    @TableField(value = "net_profit")
+    private BigDecimal netProfit;
+    /**
+     * 鐧昏浜篿d
+     */
+    @TableField(value = "registrant_id")
+    private Long registrantId;
+    /**
+     * 鐧昏浜�
+     */
+    @TableField(value = "registrant")
+    private String registrant;
+    /**
+     * 鐧昏鏃ユ湡
+     */
+    @TableField(value = "registration_date")
+    private LocalDate registrationDate;
+}
\ No newline at end of file
diff --git a/main-business/src/main/java/com/ruoyi/business/mapper/SalesRecordMapper.java b/main-business/src/main/java/com/ruoyi/business/mapper/SalesRecordMapper.java
new file mode 100644
index 0000000..57e6f8f
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/mapper/SalesRecordMapper.java
@@ -0,0 +1,18 @@
+package com.ruoyi.business.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.business.entity.SalesRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ * 閿�鍞褰曡〃 Mapper 鎺ュ彛
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-11
+ */
+@Mapper
+public interface SalesRecordMapper extends BaseMapper<SalesRecord> {
+
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java b/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java
index 9b4e444..59b2bf3 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java
@@ -5,6 +5,9 @@
 import com.ruoyi.business.dto.OfficialInventoryDto;
 import com.ruoyi.business.entity.OfficialInventory;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.business.vo.OfficialInventoryVo;
+
+import java.util.List;
 
 /**
  * <p>
@@ -17,4 +20,10 @@
 public interface OfficialInventoryService extends IService<OfficialInventory> {
 
     IPage<OfficialInventoryDto> selectOfficialInventoryList(Page page, OfficialInventoryDto officialInventoryDto);
+
+    int mergeAll(OfficialInventoryDto officialInventoryDto);
+
+    int editOfficial(OfficialInventoryDto officialInventoryDto);
+
+    List<OfficialInventoryVo> selectOfficialList(OfficialInventoryVo officialInventoryVo);
 }
diff --git a/main-business/src/main/java/com/ruoyi/business/service/SalesRecordService.java b/main-business/src/main/java/com/ruoyi/business/service/SalesRecordService.java
new file mode 100644
index 0000000..8440766
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/SalesRecordService.java
@@ -0,0 +1,24 @@
+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.SalesRecordDto;
+import com.ruoyi.business.entity.SalesRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ * 閿�鍞褰曡〃 鏈嶅姟绫�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-11
+ */
+public interface SalesRecordService extends IService<SalesRecord> {
+
+    IPage<SalesRecord> selectSalesRecordList(Page page, SalesRecordDto salesRecordDto);
+
+    int addOrEditSalesRecord(SalesRecordDto salesRecordDto);
+
+    int delByIds(Long[] ids);
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java
index 7be4276..f964ab8 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java
@@ -1,7 +1,9 @@
 package com.ruoyi.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.basic.entity.CoalField;
@@ -11,16 +13,16 @@
 import com.ruoyi.business.dto.OfficialInventoryDto;
 import com.ruoyi.business.entity.OfficialInventory;
 import com.ruoyi.business.mapper.OfficialInventoryMapper;
-import com.ruoyi.business.mapper.PendingInventoryMapper;
 import com.ruoyi.business.service.OfficialInventoryService;
+import com.ruoyi.business.vo.OfficialInventoryVo;
+import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.bean.BeanUtils;
 import lombok.RequiredArgsConstructor;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -41,7 +43,6 @@
 
     private final CoalFieldMapper coalFieldMapper;
 
-    private final PendingInventoryMapper pendingInventoryMapper;
 
     @Override
     public IPage<OfficialInventoryDto> selectOfficialInventoryList(Page page, OfficialInventoryDto officialInventoryDto) {
@@ -66,14 +67,19 @@
         //  閬嶅巻姣忔潯璁板綍锛岃繘琛岃浆鎹㈠苟濉厖 fields
         for (OfficialInventory entity : entityPage.getRecords()) {
             OfficialInventoryDto dto = new OfficialInventoryDto();
-            BeanUtils.copyProperties(entity, dto); 
-
-            Long pendingId = entity.getPendingId();
-
-            //  鏌ヨ璇� pendingId 瀵瑰簲鐨� CoalValue 鏁版嵁
-            List<CoalValue> coalValues = coalValueMapper.selectList(
-                    new LambdaQueryWrapper<CoalValue>().eq(CoalValue::getPlanId, pendingId)
-            );
+            BeanUtils.copyProperties(entity, dto);
+            List<CoalValue> coalValues;
+            if (entity.getMergeId() == null) {
+                coalValues = coalValueMapper.selectList(new LambdaQueryWrapper<CoalValue>()
+                        .eq(CoalValue::getPlanId, entity.getPendingId())
+                        .and(wrapper -> wrapper.ne(CoalValue::getType, "2").or().isNull(CoalValue::getType))
+                );
+            } else {
+                coalValues = coalValueMapper.selectList(new LambdaQueryWrapper<CoalValue>()
+                        .eq(CoalValue::getPlanId, entity.getId())
+                        .eq(CoalValue::getType, "2")
+                );
+            }
 
             //  鏋勫缓 Map<fieldName, value>
             Map<String, String> fieldValueMap = coalValues.stream()
@@ -99,4 +105,110 @@
         dtoPage.setRecords(dtoList); // 璁剧疆杞崲鍚庣殑 DtoList
         return dtoPage;
     }
+
+    @Override
+    public int editOfficial(OfficialInventoryDto officialInventoryDto) {
+        OfficialInventory officialInventory = new OfficialInventory();
+        BeanUtils.copyProperties(officialInventoryDto, officialInventory);
+        return officialInventoryMapper.updateById(officialInventory);
+    }
+
+    @Override
+    public List<OfficialInventoryVo> selectOfficialList(OfficialInventoryVo officialInventoryVo) {
+        List<OfficialInventory> officialInventories = officialInventoryMapper.selectList(null);
+        return officialInventories.stream()
+                .map(OI -> {
+                    OfficialInventoryVo vo = new OfficialInventoryVo();
+                    BeanUtils.copyProperties(OI, vo);
+                    return vo;
+                })
+                .collect(Collectors.toList());
+    }
+
+    @Transactional
+    @Override
+    public int mergeAll(OfficialInventoryDto officialInventoryDto) {
+        List<Long> ids = officialInventoryDto.getIds();
+
+        // 鏍¢獙鍙傛暟
+        if (CollectionUtils.isEmpty(ids) || ids.size() < 2) {
+            throw new BaseException("璇烽�変腑鑷冲皯涓ゆ潯鏁版嵁");
+        }
+        if (CollectionUtils.isEmpty(officialInventoryDto.getFields())) {
+            throw new BaseException("瀛楁鍊间笉鑳戒负绌�");
+        }
+
+        // 1. 鎵归噺鏍囪鍒犻櫎鏃ф暟鎹�
+        LambdaUpdateWrapper<OfficialInventory> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.in(OfficialInventory::getId, ids)
+                .set(OfficialInventory::getDeleted, 1);
+        int rowsAffected = officialInventoryMapper.update(null, updateWrapper);
+        if (rowsAffected == 0) {
+            throw new BaseException("鏈壘鍒板尮閰嶇殑鏁版嵁锛岃纭閫夋嫨鏄惁姝g‘");
+        }
+
+        // 2. 鎻掑叆鏂板簱瀛樿褰�
+        OfficialInventory officialInventory = new OfficialInventory();
+        BeanUtils.copyProperties(officialInventoryDto, officialInventory);
+        officialInventory.setMergeId(ids.toString());
+        officialInventory.setRegistrantId(SecurityUtils.getLoginUser().getUser().getUserName());
+        if (officialInventoryMapper.insert(officialInventory) <= 0) {
+            throw new BaseException("搴撳瓨璁板綍鍒涘缓澶辫触");
+        }
+
+        // 3. 鎵归噺澶勭悊瀛楁鍊�
+        batchProcessCoalValues(officialInventory.getId(), officialInventoryDto.getFields());
+
+        return rowsAffected;
+    }
+
+    private void batchProcessCoalValues(Long planId, List<Map<String, String>> fields) {
+        // 1. 鎻愬彇鎵�鏈夊敮涓�瀛楁鏍囪瘑
+        Set<String> allFields = fields.stream()
+                .flatMap(map -> map.keySet().stream())
+                .collect(Collectors.toSet());
+
+        // 2. 鏌ヨ瀛楁鏄犲皠鍏崇郴
+        List<CoalField> coalFields = coalFieldMapper.selectList(
+                new LambdaQueryWrapper<CoalField>().in(CoalField::getFields, allFields)
+        );
+
+        Map<String, String> fieldMap = coalFields.stream()
+                .collect(Collectors.toMap(
+                        CoalField::getFields,
+                        CoalField::getFieldName
+                ));
+
+        // 3. 鏋勯�犲苟鎻掑叆姣忔潯璁板綍
+        CoalValue coalValueTemplate = new CoalValue();
+        coalValueTemplate.setPlanId(planId);
+        coalValueTemplate.setType("2");
+
+        for (Map<String, String> fieldMapEntry : fields) {
+            for (Map.Entry<String, String> entry : fieldMapEntry.entrySet()) {
+                String key = entry.getKey();
+                String value = entry.getValue();
+
+                String fieldName = fieldMap.get(key);
+                if (fieldName == null) {
+                    throw new BaseException("瀛楁鍚嶄笉瀛樺湪: " + key);
+                }
+
+                CoalValue coalValue = new CoalValue();
+                BeanUtils.copyProperties(coalValueTemplate, coalValue); // 澶嶇敤妯℃澘灞炴��
+                coalValue.setId(null);
+                coalValue.setCoalValue(value);
+                coalValue.setType("2");
+                coalValue.setPlanId(planId);
+                coalValue.setFields(key);
+                coalValue.setFieldName(fieldName);
+
+                // 鍗曟潯鎻掑叆
+                int result = coalValueMapper.insert(coalValue);
+                if (result <= 0) {
+                    throw new BaseException("瀛楁鍊间繚瀛樺け璐ワ紝瀛楁锛�" + key);
+                }
+            }
+        }
+    }
 }
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
index ec9edcf..de2bec4 100644
--- a/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PurchaseRegistrationServiceImpl.java
@@ -17,7 +17,7 @@
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.Assert;
 
-import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.Objects;
 
 /**
@@ -55,6 +55,7 @@
         BeanUtils.copyProperties(purchaseRegistrationDto, purchaseRegistration);
         if (Objects.isNull(purchaseRegistrationDto.getId())) {
             // 鏂板閲囪喘鐧昏
+            purchaseRegistration.setRegistrationDate(LocalDate.now());
             int insertCount = purchaseRegistrationMapper.insert(purchaseRegistration);
             if (insertCount > 0) {
                 // 閲囪喘鐧昏鎴愬姛锛屽悓姝ュ垱寤哄緟鍏ュ簱璁板綍
@@ -80,7 +81,6 @@
 
         // 璁剧疆寰呭叆搴撹褰曠壒鏈夌殑灞炴�э紙濡傛灉鏈夛級
          pendingInventory.setInventoryQuantity(purchaseRegistration.getPurchaseQuantity());
-         pendingInventory.setCostPerUnit(new BigDecimal(22));
         return pendingInventory;
     }
 
diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java
new file mode 100644
index 0000000..ae66aa0
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/service/impl/SalesRecordServiceImpl.java
@@ -0,0 +1,144 @@
+package com.ruoyi.business.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.basic.entity.Customer;
+import com.ruoyi.basic.mapper.CustomerMapper;
+import com.ruoyi.business.dto.SalesRecordDto;
+import com.ruoyi.business.entity.SalesRecord;
+import com.ruoyi.business.mapper.SalesRecordMapper;
+import com.ruoyi.business.service.SalesRecordService;
+import com.ruoyi.common.core.domain.entity.SysUser;
+import com.ruoyi.common.exception.base.BaseException;
+import com.ruoyi.common.utils.bean.BeanUtils;
+import com.ruoyi.system.mapper.SysUserMapper;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.time.LocalDate;
+
+/**
+ * <p>
+ * 閿�鍞褰曡〃 鏈嶅姟瀹炵幇绫�
+ * </p>
+ *
+ * @author ruoyi
+ * @since 2025-06-11
+ */
+@Service
+@RequiredArgsConstructor
+public class SalesRecordServiceImpl extends ServiceImpl<SalesRecordMapper, SalesRecord> implements SalesRecordService {
+
+    private final SalesRecordMapper salesRecordMapper;
+
+    private final SysUserMapper userMapper;
+
+    private final CustomerMapper customerMapper;
+
+    @Override
+    public IPage<SalesRecord> selectSalesRecordList(Page page, SalesRecordDto salesRecordDto) {
+        LambdaQueryWrapper<SalesRecord> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.orderByDesc(SalesRecord::getCreateTime);
+        return salesRecordMapper.selectPage(page, queryWrapper);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int addOrEditSalesRecord(SalesRecordDto salesRecordDto) {
+        // 鍙傛暟鏍¢獙
+        validateSalesRecordDto(salesRecordDto);
+
+        // 鏋勫缓閿�鍞褰曞疄浣�
+        SalesRecord salesRecord = buildSalesRecord(salesRecordDto);
+
+        // 澶勭悊鏂板/鏇存柊閫昏緫
+        if (salesRecordDto.getId() == null) {
+            return insertSalesRecord(salesRecord);
+        } else {
+            return updateSalesRecord(salesRecord);
+        }
+    }
+
+    private void validateSalesRecordDto(SalesRecordDto dto) {
+        if (dto == null) {
+            throw new BaseException("閿�鍞褰曟暟鎹笉鑳戒负绌�");
+        }
+        if (dto.getRegistrantId() == null) {
+            throw new BaseException("鐧昏浜篒D涓嶈兘涓虹┖");
+        }
+        if (dto.getCustomerId() == null) {
+            throw new BaseException("瀹㈡埛ID涓嶈兘涓虹┖");
+        }
+    }
+
+    private SalesRecord buildSalesRecord(SalesRecordDto dto) {
+        SalesRecord record = new SalesRecord();
+        BeanUtils.copyProperties(dto, record);
+
+        // 璁剧疆鐧昏浜轰俊鎭�
+        SysUser registrant = userMapper.selectUserById(dto.getRegistrantId());
+        if (registrant == null) {
+            throw new BaseException("鐧昏浜轰俊鎭笉瀛樺湪");
+        }
+        record.setRegistrant(registrant.getUserName());
+
+        // 璁剧疆瀹㈡埛淇℃伅
+        Customer customer = customerMapper.selectById(dto.getCustomerId());
+        if (customer == null) {
+            throw new BaseException("瀹㈡埛淇℃伅涓嶅瓨鍦�");
+        }
+        record.setCustomer(customer.getCustomerName());
+
+        // 璁剧疆鏃ユ湡淇℃伅
+        LocalDate now = LocalDate.now();
+        if (record.getId() == null) {
+            // 鏂板鏃惰缃棩鏈�
+            record.setSaleDate(now);
+            record.setRegistrationDate(now);
+        } else {
+            // 鏇存柊鏃朵笉瑕嗙洊鍘熸湁鏃ユ湡
+            SalesRecord existing = salesRecordMapper.selectById(record.getId());
+            if (existing == null) {
+                throw new BaseException("閿�鍞褰曚笉瀛樺湪");
+            }
+            record.setSaleDate(existing.getSaleDate());
+            record.setRegistrationDate(existing.getRegistrationDate());
+        }
+
+        return record;
+    }
+
+    private int insertSalesRecord(SalesRecord record) {
+        int result = salesRecordMapper.insert(record);
+        if (result <= 0) {
+            throw new BaseException("閿�鍞褰曞垱寤哄け璐�");
+        }
+        return result;
+    }
+
+    private int updateSalesRecord(SalesRecord record) {
+        int result = salesRecordMapper.updateById(record);
+        if (result <= 0) {
+            throw new BaseException("閿�鍞褰曟洿鏂板け璐�");
+        }
+        return result;
+    }
+
+    @Override
+    public int delByIds(Long[] ids) {
+        // 妫�鏌ュ弬鏁�
+        if (ids == null || ids.length == 0) {
+            return 0;
+        }
+        // 鏋勯�犳洿鏂版潯浠�
+        UpdateWrapper<SalesRecord> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.in("id", ids)
+                .set("deleted", 1);  // 璁剧疆 deleted 涓� 1 琛ㄧず宸插垹闄�
+        // 鎵ц鎵归噺閫昏緫鍒犻櫎
+        return salesRecordMapper.update(null, updateWrapper);
+    }
+}
diff --git a/main-business/src/main/java/com/ruoyi/business/vo/OfficialInventoryVo.java b/main-business/src/main/java/com/ruoyi/business/vo/OfficialInventoryVo.java
new file mode 100644
index 0000000..67526a4
--- /dev/null
+++ b/main-business/src/main/java/com/ruoyi/business/vo/OfficialInventoryVo.java
@@ -0,0 +1,16 @@
+package com.ruoyi.business.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class OfficialInventoryVo {
+
+    private Long id;  // 涓婚敭ID
+    private String coal;   // 鐓ょ
+    private String unit;   // 鍗曚綅
+    private BigDecimal inventoryQuantity;  // 搴撳瓨鏁伴噺
+    private BigDecimal priceIncludingTax; // 鍗曚环锛堝惈绋庯級
+
+}
diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql b/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql
new file mode 100644
index 0000000..b963e59
--- /dev/null
+++ b/main-business/src/main/resources/db/migration/postgresql/V20250611160300__create_table_sales_record.sql
@@ -0,0 +1,59 @@
+-- 鍒涘缓閿�鍞褰曡〃
+CREATE TABLE sales_record
+(
+    id                  BIGSERIAL PRIMARY KEY,                              -- 涓婚敭ID
+    sale_date           DATE           NOT NULL,                            -- 閿�鍞棩鏈�
+    customer_id         BIGINT,                                             -- 瀹㈡埛id
+    customer            VARCHAR(255)   NOT NULL,                            -- 瀹㈡埛
+    coal_id             VARCHAR(255)   NOT NULL,                            -- 鐓ょ id
+    coal                VARCHAR(255)   NOT NULL,                            -- 鐓ょ
+    price_including_tax DECIMAL(10, 2) NOT NULL,                            -- 鍗曚环锛堝惈绋庯級
+    inventory_quantity  DECIMAL(10, 0) NOT NULL,                            -- 搴撳瓨鏁伴噺
+    unit                VARCHAR(100)   NOT NULL,                            -- 鍗曚綅
+    sale_quantity       DECIMAL(10, 2) NOT NULL,                            -- 閿�鍞暟閲�
+    sale_price          DECIMAL(10, 2) NOT NULL,                            -- 閿�鍞崟浠� (鍚◣)
+    total_amount        DECIMAL(10, 2) NOT NULL,                            -- 閿�鍞�讳环 (鍚◣)
+    tax_coal            VARCHAR(36),                                        -- 璐攢鐓ょ◣鐜�13%
+    tax_trans           VARCHAR(36),                                        -- 杩愯緭绋庣巼9%
+    gross_profit        DECIMAL(10, 2),                                     -- 姣涘埄娑�
+    net_profit          DECIMAL(10, 2),                                     -- 鍑�鍒╂鼎
+    registrant_id       BIGINT,                                             -- 鐧昏浜篿d
+    registrant          VARCHAR(255)   NOT NULL,                            -- 鐧昏浜�
+    registration_date   DATE           NOT NULL,                            -- 鐧昏鏃ユ湡
+
+    create_time         TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 涓婁紶鏃堕棿锛岄粯璁ゅ綋鍓嶆椂闂�
+    update_time         TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP, -- 鏈�鍚庢洿鏂版椂闂达紝榛樿褰撳墠鏃堕棿
+    create_by           VARCHAR(255),                                       -- 涓婁紶浜虹敤鎴峰悕
+    update_by           VARCHAR(255),                                       -- 鏈�鍚庝慨鏀逛汉鐢ㄦ埛鍚�
+    deleted             INT            NOT NULL  DEFAULT 0                  -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄�
+);
+
+-- 琛ㄦ敞閲�
+COMMENT ON TABLE sales_record IS '閿�鍞褰曡〃';
+
+-- 娣诲姞瀛楁娉ㄩ噴
+COMMENT ON COLUMN sales_record.id IS '涓婚敭ID';
+COMMENT ON COLUMN sales_record.sale_date IS '閿�鍞棩鏈�';
+COMMENT ON COLUMN sales_record.customer IS '瀹㈡埛';
+COMMENT ON COLUMN sales_record.customer_id IS '瀹㈡埛id';
+COMMENT ON COLUMN sales_record.coal IS '鐓ょ';
+COMMENT ON COLUMN sales_record.coal_id IS '鐓ょid';
+COMMENT ON COLUMN sales_record.unit IS '鍗曚綅';
+COMMENT ON COLUMN sales_record.price_including_tax IS '鍗曚环锛堝惈绋庯級';
+COMMENT ON COLUMN sales_record.inventory_quantity IS '搴撳瓨鏁伴噺';
+COMMENT ON COLUMN sales_record.sale_quantity IS '閿�鍞暟閲�';
+COMMENT ON COLUMN sales_record.sale_price IS '閿�鍞崟浠� (鍚◣)';
+COMMENT ON COLUMN sales_record.total_amount IS '閿�鍞�讳环 (鍚◣)';
+COMMENT ON COLUMN sales_record.tax_coal IS '璐攢鐓ょ◣鐜�13%';
+COMMENT ON COLUMN sales_record.tax_trans IS '杩愯緭绋庣巼9%';
+COMMENT ON COLUMN sales_record.gross_profit IS '姣涘埄娑�';
+COMMENT ON COLUMN sales_record.net_profit IS '鍑�鍒╂鼎';
+COMMENT ON COLUMN sales_record.registrant IS '鐧昏浜�';
+COMMENT ON COLUMN sales_record.registrant_id IS '鐧昏浜篿d';
+COMMENT ON COLUMN sales_record.registration_date IS '鐧昏鏃ユ湡';
+
+COMMENT ON COLUMN sales_record.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�';
+COMMENT ON COLUMN sales_record.create_by IS '鍒涘缓璇ヨ褰曠殑鐢ㄦ埛';
+COMMENT ON COLUMN sales_record.create_time IS '璁板綍鍒涘缓鏃堕棿';
+COMMENT ON COLUMN sales_record.update_by IS '鏈�鍚庝慨鏀硅璁板綍鐨勭敤鎴�';
+COMMENT ON COLUMN sales_record.update_time IS '璁板綍鏈�鍚庢洿鏂版椂闂�';
diff --git a/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml b/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml
index 278bdb6..7fdf772 100644
--- a/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml
+++ b/main-business/src/main/resources/mapper/OfficialInventoryMapper.xml
@@ -11,12 +11,11 @@
                 <result column="update_by" property="updateBy" />
                 <result column="update_time" property="updateTime" />
                     <result column="supplier_name" property="supplierName" />
-                    <result column="coal_type" property="coalType" />
+                    <result column="coal" property="coal" />
                     <result column="unit" property="unit" />
                     <result column="inventory_quantity" property="inventoryQuantity" />
                     <result column="price_including_tax" property="priceIncludingTax" />
                     <result column="total_price_including_tax" property="totalPriceIncludingTax" />
-                    <result column="cost_per_unit" property="costPerUnit" />
                     <result column="pending_replenishment" property="pendingReplenishment" />
                     <result column="registrant_id" property="registrantId" />
                     <result column="registration_date" property="registrationDate" />
@@ -29,7 +28,7 @@
                 create_time,
                 update_by,
                 update_time,
-            id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, cost_per_unit, pending_replenishment, registrant_id, registration_date
+            id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, pending_replenishment, registrant_id, registration_date
         </sql>
 
 </mapper>
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/PendingInventoryMapper.xml b/main-business/src/main/resources/mapper/PendingInventoryMapper.xml
index 384f9ef..c8d125e 100644
--- a/main-business/src/main/resources/mapper/PendingInventoryMapper.xml
+++ b/main-business/src/main/resources/mapper/PendingInventoryMapper.xml
@@ -16,9 +16,8 @@
                     <result column="inventory_quantity" property="inventoryQuantity" />
                     <result column="price_including_tax" property="priceIncludingTax" />
                     <result column="total_price_including_tax" property="totalPriceIncludingTax" />
-                    <result column="cost_per_unit" property="costPerUnit" />
                     <result column="registrant_id" property="registrantId" />
-                    <result column="registration_time" property="registrationTime" />
+                    <result column="registration_date" property="registrationDate" />
         </resultMap>
 
         <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
@@ -28,7 +27,7 @@
                 create_time,
                 update_by,
                 update_time,
-            id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, cost_per_unit, registrant, registration_time
+            id, supplier_name, coal_type, unit, inventory_quantity, price_including_tax, total_price_including_tax, registrant, registration_time
         </sql>
 
 </mapper>
\ No newline at end of file
diff --git a/main-business/src/main/resources/mapper/SalesRecordMapper.xml b/main-business/src/main/resources/mapper/SalesRecordMapper.xml
new file mode 100644
index 0000000..d284f8a
--- /dev/null
+++ b/main-business/src/main/resources/mapper/SalesRecordMapper.xml
@@ -0,0 +1,43 @@
+<?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.SalesRecordMapper">
+
+        <!-- 閫氱敤鏌ヨ鏄犲皠缁撴灉 -->
+        <resultMap id="BaseResultMap" type="com.ruoyi.business.entity.SalesRecord">
+                    <id column="id" property="id" />
+                <result column="create_time" property="createTime" />
+                <result column="update_time" property="updateTime" />
+                <result column="create_by" property="createBy" />
+                <result column="update_by" property="updateBy" />
+                <result column="deleted" property="deleted" />
+                    <result column="sale_date" property="saleDate" />
+                    <result column="customer_id" property="customerId" />
+                    <result column="customer" property="customer" />
+                    <result column="coal_id" property="coalId" />
+                    <result column="coal" property="coal" />
+                    <result column="price_including_tax" property="priceIncludingTax" />
+                    <result column="inventory_quantity" property="inventoryQuantity" />
+                    <result column="unit" property="unit" />
+                    <result column="sale_quantity" property="saleQuantity" />
+                    <result column="sale_price" property="salePrice" />
+                    <result column="total_amount" property="totalAmount" />
+                    <result column="tax_coal" property="taxCoal" />
+                    <result column="tax_trans" property="taxTrans" />
+                    <result column="gross_profit" property="grossProfit" />
+                    <result column="net_profit" property="netProfit" />
+                    <result column="registrant_id" property="registrantId" />
+                    <result column="registrant" property="registrant" />
+                    <result column="registration_date" property="registrationDate" />
+        </resultMap>
+
+        <!-- 閫氱敤鏌ヨ缁撴灉鍒� -->
+        <sql id="Base_Column_List">
+                create_time,
+                update_time,
+                create_by,
+                update_by,
+                deleted,
+            id, sale_date, customer_id, customer, coal_id, coal, price_including_tax, inventory_quantity, unit, sale_quantity, sale_price, total_amount, tax_coal, tax_trans, gross_profit, net_profit, registrant_id, registrant, registration_date
+        </sql>
+
+</mapper>
\ No newline at end of file
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/init/MyStartupRunner.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/init/MyStartupRunner.java
index 696543f..595d5fb 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/init/MyStartupRunner.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/init/MyStartupRunner.java
@@ -99,7 +99,6 @@
                 provinceMapper.insert(provinces);
                 cityMapper.insert(cities);
                 districtMapper.insert(districts);
-
                 log.info("鍦板尯淇℃伅鍒濆鍖栫粨鏉�");
             }
         }

--
Gitblit v1.9.3