From 98d0e65ddbb42e7c5fab436f45dde3a4b051c77f Mon Sep 17 00:00:00 2001
From: zhanghl <253316343@qq.com>
Date: 星期五, 25 四月 2025 14:22:20 +0800
Subject: [PATCH] 气柜和管路物料用量-接口提交
---
aps-modules/aps-core/src/main/resources/mapper/core/ApsGasMaterialUsageMapper.xml | 120 ++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasMaterialUsageServiceImpl.java | 169 +++++++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsGasMaterialUsageController.java | 113 ++++++++++
aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasMaterialUsageService.java | 64 +++++
aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasMaterialUsage.java | 78 +++++++
aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasMaterialUsageMapper.java | 75 ++++++
6 files changed, 619 insertions(+), 0 deletions(-)
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsGasMaterialUsageController.java b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsGasMaterialUsageController.java
new file mode 100644
index 0000000..e1630a0
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/controller/basicData/ApsGasMaterialUsageController.java
@@ -0,0 +1,113 @@
+package com.aps.core.controller.basicData;
+
+import com.aps.common.core.utils.poi.ExcelUtil;
+import com.aps.common.core.web.controller.BaseController;
+import com.aps.common.core.web.domain.AjaxResult;
+import com.aps.common.core.web.page.TableDataInfo;
+import com.aps.common.log.annotation.Log;
+import com.aps.common.log.enums.BusinessType;
+import com.aps.common.security.annotation.RequiresPermissions;
+import com.aps.core.domain.ApsGasMaterialUsage;
+import com.aps.core.service.IApsGasMaterialUsageService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.util.List;
+
+/**
+ * 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺Controller
+ *
+ * @author zhl
+ * @date 2025-04-25
+ */
+
+@Tag(name = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", description = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鎺ュ彛")
+@RestController
+@RequestMapping("/gasMaterialUsage")
+public class ApsGasMaterialUsageController extends BaseController {
+ @Autowired
+ private IApsGasMaterialUsageService apsGasMaterialUsageService;
+
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃
+ */
+ @Operation(summary = "鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃", description = "鍒嗛〉鏌ヨ")
+ @RequiresPermissions("gasMaterialUsage:list")
+ @GetMapping("/list")
+ public TableDataInfo list(ApsGasMaterialUsage apsGasMaterialUsage) {
+ startPage();
+ List<ApsGasMaterialUsage> list = apsGasMaterialUsageService.selectApsGasMaterialUsageList(apsGasMaterialUsage);
+ return getDataTable(list);
+ }
+
+ /**
+ * 瀵煎嚭姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃
+ */
+ @Operation(summary = "瀵煎嚭姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃", description = "瀵煎嚭")
+ @RequiresPermissions("gasMaterialUsage:export")
+ @Log(title = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, ApsGasMaterialUsage apsGasMaterialUsage) {
+ List<ApsGasMaterialUsage> list = apsGasMaterialUsageService.selectApsGasMaterialUsageList(apsGasMaterialUsage);
+ ExcelUtil<ApsGasMaterialUsage> util = new ExcelUtil<ApsGasMaterialUsage>(ApsGasMaterialUsage.class);
+ util.exportExcel(response, list, "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鏁版嵁");
+ }
+
+ /**
+ * 鑾峰彇姘旀煖绠¤矾鐗╂枡鐢ㄩ噺璇︾粏淇℃伅
+ */
+ @Operation(summary = "鑾峰彇姘旀煖绠¤矾鐗╂枡鐢ㄩ噺璇︾粏淇℃伅", description = "鏍规嵁id鑾峰彇")
+ @RequiresPermissions("gasMaterialUsage:query")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return success(apsGasMaterialUsageService.selectApsGasMaterialUsageById(id));
+ }
+
+ /**
+ * 鏂板姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ @Operation(summary = "鏂板姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", description = "鍗曚釜鏂板")
+ @RequiresPermissions("gasMaterialUsage:add")
+ @Log(title = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody ApsGasMaterialUsage apsGasMaterialUsage) {
+ return toAjax(apsGasMaterialUsageService.insertApsGasMaterialUsage(apsGasMaterialUsage));
+ }
+
+ /**
+ * 淇敼姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ @Operation(summary = "淇敼姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", description = "鍗曚釜淇敼")
+ @RequiresPermissions("gasMaterialUsage:edit")
+ @Log(title = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody ApsGasMaterialUsage apsGasMaterialUsage) {
+ return toAjax(apsGasMaterialUsageService.updateApsGasMaterialUsage(apsGasMaterialUsage));
+ }
+
+ /**
+ * 鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ @Operation(summary = "鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", description = "鎵归噺鍒犻櫎")
+ @RequiresPermissions("gasMaterialUsage:remove")
+ @Log(title = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ return toAjax(apsGasMaterialUsageService.deleteApsGasMaterialUsageByIds(ids));
+ }
+
+
+ @Operation(summary = "瀵煎叆姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", description = "鎵归噺瀵煎叆")
+ @Log(title = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺", businessType = BusinessType.IMPORT)
+ @RequiresPermissions("gasMaterialUsage:import")
+ @PostMapping("/importData")
+ public AjaxResult importData(MultipartFile file) throws Exception {
+
+ int i = apsGasMaterialUsageService.batchInsertGasMaterialUsage(file);
+ return toAjax(i);
+ }
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasMaterialUsage.java b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasMaterialUsage.java
new file mode 100644
index 0000000..6521244
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/domain/ApsGasMaterialUsage.java
@@ -0,0 +1,78 @@
+package com.aps.core.domain;
+
+import com.aps.common.core.annotation.Excel;
+import com.aps.common.core.web.domain.BaseEntity;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+
+/**
+ * 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺瀵硅薄 aps_gas_material_usage
+ *
+ * @author zhl
+ * @date 2025-04-25
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Schema(description = "姘旀煖绠¤矾鐗╂枡鐢ㄩ噺瀹炰綋绫�")
+public class ApsGasMaterialUsage extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 鏁版嵁涓婚敭
+ */
+ @Schema(description ="鏁版嵁涓婚敭", type = "String")
+ private Long id;
+
+ /**
+ * 鏂欏彿
+ */
+ @Excel(name = "鏂欏彿")
+ @Schema(description ="鏂欏彿", type = "String")
+ private String itemNumber;
+
+ /**
+ * 鍥惧彿
+ */
+ @Excel(name = "鍥惧彿")
+ @Schema(description ="鍥惧彿", type = "String")
+ private String drawingNo;
+
+ /**
+ * 鐗堟湰
+ */
+ @Excel(name = "鐗堟湰")
+ @Schema(description ="鐗堟湰", type = "String")
+ private String version;
+
+ /**
+ * 宸ュ簭鍚嶇О
+ */
+ @Excel(name = "宸ュ簭鍚嶇О")
+ @Schema(description ="宸ュ簭鍚嶇О", type = "String")
+ private String processName;
+
+ /**
+ * 鏍囧噯鐢ㄩ噺
+ */
+ @Excel(name = "鏍囧噯鐢ㄩ噺")
+ @Schema(description ="鏍囧噯鐢ㄩ噺", type = "String")
+ private BigDecimal standardAmount;
+
+ /**
+ * 璐﹀缂栫爜
+ */
+ @Excel(name = "璐﹀缂栫爜")
+ @Schema(description ="璐﹀缂栫爜", type = "String")
+ private String orgCode;
+
+ /**
+ * 鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 1浠h〃鍒犻櫎锛�
+ */
+ @Schema(description ="鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 1浠h〃鍒犻櫎锛�", type = "String")
+ private String delFlag;
+}
\ No newline at end of file
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasMaterialUsageMapper.java b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasMaterialUsageMapper.java
new file mode 100644
index 0000000..516b3ab
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/mapper/ApsGasMaterialUsageMapper.java
@@ -0,0 +1,75 @@
+package com.aps.core.mapper;
+
+import java.util.List;
+import com.aps.core.domain.ApsGasMaterialUsage;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺Mapper鎺ュ彛
+ *
+ * @author zhl
+ * @date 2025-04-25
+ */
+@Mapper
+public interface ApsGasMaterialUsageMapper
+{
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param id 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ public ApsGasMaterialUsage selectApsGasMaterialUsageById(Long id);
+
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺闆嗗悎
+ */
+ public List<ApsGasMaterialUsage> selectApsGasMaterialUsageList(ApsGasMaterialUsage apsGasMaterialUsage);
+
+ /**
+ * 鏂板姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 缁撴灉
+ */
+ public int insertApsGasMaterialUsage(ApsGasMaterialUsage apsGasMaterialUsage);
+
+ /**
+ * 淇敼姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 缁撴灉
+ */
+ public int updateApsGasMaterialUsage(ApsGasMaterialUsage apsGasMaterialUsage);
+
+ /**
+ * 鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param id 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsGasMaterialUsageById(Long id);
+
+ /**
+ * 鎵归噺鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsGasMaterialUsageByIds(Long[] ids);
+
+ /**
+ * 鎵归噺鍒犻櫎鏁版嵁
+ * */
+ int batchDeleteGasMaterialUsage();
+ /**
+ * 鎵归噺鎻掑叆鏁版嵁
+ * */
+ int batchInsertGasMaterialUsage(List<ApsGasMaterialUsage> list);
+
+
+
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasMaterialUsageService.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasMaterialUsageService.java
new file mode 100644
index 0000000..63cf2f8
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/IApsGasMaterialUsageService.java
@@ -0,0 +1,64 @@
+package com.aps.core.service;
+
+import java.util.List;
+import com.aps.core.domain.ApsGasMaterialUsage;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺Service鎺ュ彛
+ *
+ * @author zhl
+ * @date 2025-04-25
+ */
+public interface IApsGasMaterialUsageService
+{
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param id 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ public ApsGasMaterialUsage selectApsGasMaterialUsageById(Long id);
+
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺闆嗗悎
+ */
+ public List<ApsGasMaterialUsage> selectApsGasMaterialUsageList(ApsGasMaterialUsage apsGasMaterialUsage);
+
+ /**
+ * 鏂板姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 缁撴灉
+ */
+ public int insertApsGasMaterialUsage(ApsGasMaterialUsage apsGasMaterialUsage);
+
+ /**
+ * 淇敼姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 缁撴灉
+ */
+ public int updateApsGasMaterialUsage(ApsGasMaterialUsage apsGasMaterialUsage);
+
+ /**
+ * 鎵归噺鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭闆嗗悎
+ * @return 缁撴灉
+ */
+ public int deleteApsGasMaterialUsageByIds(Long[] ids);
+
+ /**
+ * 鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺淇℃伅
+ *
+ * @param id 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 缁撴灉
+ */
+ public int deleteApsGasMaterialUsageById(Long id);
+
+ int batchInsertGasMaterialUsage(MultipartFile file);
+}
diff --git a/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasMaterialUsageServiceImpl.java b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasMaterialUsageServiceImpl.java
new file mode 100644
index 0000000..801ee5c
--- /dev/null
+++ b/aps-modules/aps-core/src/main/java/com/aps/core/service/impl/ApsGasMaterialUsageServiceImpl.java
@@ -0,0 +1,169 @@
+package com.aps.core.service.impl;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import com.aps.common.core.utils.DateUtils;
+import com.aps.common.core.utils.StringUtils;
+import com.aps.common.security.utils.SecurityUtils;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.WorkbookFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.aps.core.mapper.ApsGasMaterialUsageMapper;
+import com.aps.core.domain.ApsGasMaterialUsage;
+import com.aps.core.service.IApsGasMaterialUsageService;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺Service涓氬姟灞傚鐞�
+ *
+ * @author zhl
+ * @date 2025-04-25
+ */
+@Service
+public class ApsGasMaterialUsageServiceImpl implements IApsGasMaterialUsageService
+{
+ @Autowired
+ private ApsGasMaterialUsageMapper apsGasMaterialUsageMapper;
+
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param id 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ @Override
+ public ApsGasMaterialUsage selectApsGasMaterialUsageById(Long id)
+ {
+ return apsGasMaterialUsageMapper.selectApsGasMaterialUsageById(id);
+ }
+
+ /**
+ * 鏌ヨ姘旀煖绠¤矾鐗╂枡鐢ㄩ噺鍒楄〃
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ */
+ @Override
+ public List<ApsGasMaterialUsage> selectApsGasMaterialUsageList(ApsGasMaterialUsage apsGasMaterialUsage)
+ {
+ return apsGasMaterialUsageMapper.selectApsGasMaterialUsageList(apsGasMaterialUsage);
+ }
+
+ /**
+ * 鏂板姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 缁撴灉
+ */
+ @Override
+ public int insertApsGasMaterialUsage(ApsGasMaterialUsage apsGasMaterialUsage)
+ {
+ apsGasMaterialUsage.setCreateTime(DateUtils.getNowDate());
+ return apsGasMaterialUsageMapper.insertApsGasMaterialUsage(apsGasMaterialUsage);
+ }
+
+ /**
+ * 淇敼姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param apsGasMaterialUsage 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ * @return 缁撴灉
+ */
+ @Override
+ public int updateApsGasMaterialUsage(ApsGasMaterialUsage apsGasMaterialUsage)
+ {
+ return apsGasMaterialUsageMapper.updateApsGasMaterialUsage(apsGasMaterialUsage);
+ }
+
+ /**
+ * 鎵归噺鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺
+ *
+ * @param ids 闇�瑕佸垹闄ょ殑姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsGasMaterialUsageByIds(Long[] ids)
+ {
+ return apsGasMaterialUsageMapper.deleteApsGasMaterialUsageByIds(ids);
+ }
+
+ /**
+ * 鍒犻櫎姘旀煖绠¤矾鐗╂枡鐢ㄩ噺淇℃伅
+ *
+ * @param id 姘旀煖绠¤矾鐗╂枡鐢ㄩ噺涓婚敭
+ * @return 缁撴灉
+ */
+ @Override
+ public int deleteApsGasMaterialUsageById(Long id)
+ {
+ return apsGasMaterialUsageMapper.deleteApsGasMaterialUsageById(id);
+ }
+
+ @Transactional
+ @Override
+ public int batchInsertGasMaterialUsage(MultipartFile file) {
+ ArrayList<ApsGasMaterialUsage> list = new ArrayList<>();
+
+ Workbook workbook = null;
+ try {
+ workbook = WorkbookFactory.create(file.getInputStream());
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ Sheet sheet =workbook.getSheetAt(0);
+ int rows = sheet.getLastRowNum();
+ if (rows > 0)
+ {
+ /*浠庤〃澶翠腑鍙栧嚭宸ュ簭鍚嶇О*/
+ Hashtable<Integer,String> processTitle=new Hashtable<>();
+ Row titleRow = sheet.getRow(0);
+ short lastTitleNum = titleRow.getLastCellNum();
+ for (int i = 4; i < lastTitleNum; i++) {
+ processTitle.put(i,titleRow.getCell(i).getStringCellValue());
+ }
+ /*鏁版嵁鍒椾粠1寮�濮�*/
+ for (int i = 1; i <= rows; i++)
+ {
+ Row row = sheet.getRow(i);
+ String itemNumber = row.getCell(0).getStringCellValue();
+ String drawingNo = row.getCell(1).getStringCellValue();
+ String version = row.getCell(2).getStringCellValue();
+ for (int j = 4; j < lastTitleNum; j++){
+ String processName = processTitle.get(j);
+ double standardAmount = row.getCell(j).getNumericCellValue();
+ ApsGasMaterialUsage apsGasMaterialUsage = new ApsGasMaterialUsage();
+ apsGasMaterialUsage.setItemNumber(itemNumber);
+ apsGasMaterialUsage.setDrawingNo(drawingNo);
+ apsGasMaterialUsage.setVersion(version);
+ apsGasMaterialUsage.setProcessName(processName);
+ apsGasMaterialUsage.setStandardAmount(BigDecimal.valueOf(standardAmount));
+ apsGasMaterialUsage.setDelFlag("0");
+ apsGasMaterialUsage.setCreateBy(SecurityUtils.getUsername());
+ apsGasMaterialUsage.setCreateTime(DateUtils.getNowDate());
+ list.add(apsGasMaterialUsage);
+ }
+ }
+ }
+ int batchSize = 1000;
+ int totalInserted = 0;
+ apsGasMaterialUsageMapper.batchDeleteGasMaterialUsage();
+ for (int i = 0; i < list.size(); i += batchSize) {
+ int end = Math.min(i + batchSize, list.size());
+ List<ApsGasMaterialUsage> subList = list.subList(i, end);
+ // 璁剧疆鍒涘缓鏃堕棿 鐧诲綍浜�
+ for (ApsGasMaterialUsage item : subList) {
+ item.setCreateBy(SecurityUtils.getUsername());
+ item.setCreateTime(DateUtils.getNowDate());
+ }
+ totalInserted += apsGasMaterialUsageMapper.batchInsertGasMaterialUsage(subList);
+ }
+ return totalInserted;
+ }
+}
diff --git a/aps-modules/aps-core/src/main/resources/mapper/core/ApsGasMaterialUsageMapper.xml b/aps-modules/aps-core/src/main/resources/mapper/core/ApsGasMaterialUsageMapper.xml
new file mode 100644
index 0000000..277d982
--- /dev/null
+++ b/aps-modules/aps-core/src/main/resources/mapper/core/ApsGasMaterialUsageMapper.xml
@@ -0,0 +1,120 @@
+<?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.aps.core.mapper.ApsGasMaterialUsageMapper">
+ <resultMap type="ApsGasMaterialUsage" id="ApsGasMaterialUsageResult">
+ <result property="id" column="id" />
+ <result property="itemNumber" column="item_number" />
+ <result property="drawingNo" column="drawing_no" />
+ <result property="version" column="version" />
+ <result property="processName" column="process_name" />
+ <result property="standardAmount" column="standard_amount" />
+ <result property="orgCode" column="org_code" />
+ <result property="createBy" column="create_by" />
+ <result property="createTime" column="create_time" />
+ <result property="delFlag" column="del_flag" />
+ </resultMap>
+
+ <sql id="selectApsGasMaterialUsageVo">
+ select id, item_number, drawing_no, version, process_name, standard_amount, org_code, create_by, create_time, del_flag from aps_gas_material_usage
+ </sql>
+
+ <select id="selectApsGasMaterialUsageList" parameterType="ApsGasMaterialUsage" resultMap="ApsGasMaterialUsageResult">
+ <include refid="selectApsGasMaterialUsageVo"/>
+ <where>
+ <if test="itemNumber != null and itemNumber != ''"> and item_number = #{itemNumber}</if>
+ <if test="drawingNo != null and drawingNo != ''"> and drawing_no = #{drawingNo}</if>
+ <if test="version != null and version != ''"> and version = #{version}</if>
+ <if test="processName != null and processName != ''"> and process_name = #{processName}</if>
+ <if test="standardAmount != null "> and standard_amount = #{standardAmount}</if>
+ <if test="orgCode != null and orgCode != ''"> and org_code = #{orgCode}</if>
+ and del_flag='0'
+ </where>
+ </select>
+
+ <select id="selectApsGasMaterialUsageById" parameterType="Long" resultMap="ApsGasMaterialUsageResult">
+ <include refid="selectApsGasMaterialUsageVo"/>
+ where id = #{id}
+ </select>
+
+ <insert id="insertApsGasMaterialUsage" parameterType="ApsGasMaterialUsage" useGeneratedKeys="true" keyProperty="id">
+ insert into aps_gas_material_usage
+ <trim prefix="(" suffix=")" suffixOverrides=",">
+ <if test="itemNumber != null">item_number,</if>
+ <if test="drawingNo != null">drawing_no,</if>
+ <if test="version != null">version,</if>
+ <if test="processName != null">process_name,</if>
+ <if test="standardAmount != null">standard_amount,</if>
+ <if test="orgCode != null">org_code,</if>
+ <if test="createBy != null">create_by,</if>
+ <if test="createTime != null">create_time,</if>
+ <if test="delFlag != null">del_flag,</if>
+ </trim>
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
+ <if test="itemNumber != null">#{itemNumber},</if>
+ <if test="drawingNo != null">#{drawingNo},</if>
+ <if test="version != null">#{version},</if>
+ <if test="processName != null">#{processName},</if>
+ <if test="standardAmount != null">#{standardAmount},</if>
+ <if test="orgCode != null">#{orgCode},</if>
+ <if test="createBy != null">#{createBy},</if>
+ <if test="createTime != null">#{createTime},</if>
+ <if test="delFlag != null">#{delFlag},</if>
+ </trim>
+ </insert>
+
+ <update id="updateApsGasMaterialUsage" parameterType="ApsGasMaterialUsage">
+ update aps_gas_material_usage
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="itemNumber != null">item_number = #{itemNumber},</if>
+ <if test="drawingNo != null">drawing_no = #{drawingNo},</if>
+ <if test="version != null">version = #{version},</if>
+ <if test="processName != null">process_name = #{processName},</if>
+ <if test="standardAmount != null">standard_amount = #{standardAmount},</if>
+ <if test="orgCode != null">org_code = #{orgCode},</if>
+ <if test="createBy != null">create_by = #{createBy},</if>
+ <if test="createTime != null">create_time = #{createTime},</if>
+ <if test="delFlag != null">del_flag = #{delFlag},</if>
+ </trim>
+ where id = #{id}
+ </update>
+
+ <delete id="deleteApsGasMaterialUsageById" parameterType="Long">
+ delete from aps_gas_material_usage where id = #{id}
+ </delete>
+
+ <delete id="deleteApsGasMaterialUsageByIds" parameterType="String">
+ delete from aps_gas_material_usage where id in
+ <foreach item="id" collection="array" open="(" separator="," close=")">
+ #{id}
+ </foreach>
+ </delete>
+
+
+
+ <!-- 鏂板鎵归噺鎻掑叆鏂规硶 -->
+ <insert id="batchInsertGasMaterialUsage" parameterType="java.util.List">
+ insert into aps_gas_material_usage (item_number, drawing_no, version
+ , process_name, standard_amount, org_code, del_flag, create_by, create_time)
+ values
+ <foreach collection="list" item="item" separator=",">
+ (
+ #{item.itemNumber},
+ #{item.drawingNo},
+ #{item.version},
+ #{item.processName},
+ #{item.standardAmount},
+ #{item.orgCode},
+ #{item.delFlag},
+ #{item.createBy},
+ #{item.createTime}
+ )
+ </foreach>
+ </insert>
+
+ <delete id="batchDeleteGasMaterialUsage" >
+ delete from aps_gas_material_usage where del_flag in ('0','1');
+ </delete>
+
+</mapper>
\ No newline at end of file
--
Gitblit v1.9.3