Преглед на файлове

徐明浩
特种设备-定点测厚-导入更新增加字段

徐明浩 преди 3 години
родител
ревизия
5c668c2451

+ 6 - 4
master/src/main/java/com/ruoyi/project/sems/controller/TMeasureRecordController.java

@@ -202,8 +202,10 @@ public class TMeasureRecordController extends BaseController {
                     if (j == 0) {
                         entity.setMeasureId(cellValue);
                     } else if (j == 1) {
-                        entity.setMeasureValue(Double.parseDouble(cellValue));
+                        entity.setMeasureId(entity.getMeasureId() + "," + cellValue);
                     } else if (j == 2) {
+                        entity.setMeasureValue(Double.parseDouble(cellValue));
+                    } else if (j == 3) {
                         entity.setMeasureDate(sdf.parse(cellValue));
                     }
                 }
@@ -218,13 +220,13 @@ public class TMeasureRecordController extends BaseController {
         }
         int successNumber = 0;
         int failNum = 0;
-        for (TMeasureRecord t : list
-        ) {
+        for (TMeasureRecord t : list) {
             failNum++;
             try {
                 //保存测厚记录
                 String measureId = t.getMeasureId();
-                Long id = this.tMeasureThicknessService.selectByTagNo(measureId);
+                String[] split = measureId.split(",");
+                Long id = this.tMeasureThicknessService.selectByTagNo(split[0], split[1]);
                 t.setMeasureId(id + "");
                 this.tMeasureRecordService.insertTMeasureRecord(t);
                 this.updateMeasure(id + "");

+ 6 - 4
master/src/main/java/com/ruoyi/project/sems/mapper/TMeasureThicknessMapper.java

@@ -1,9 +1,11 @@
 package com.ruoyi.project.sems.mapper;
 
 import java.util.List;
+
 import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
 import com.ruoyi.framework.aspectj.lang.annotation.DataScopePlant;
 import com.ruoyi.project.sems.domain.TMeasureThickness;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 定点测厚Mapper接口
@@ -11,8 +13,7 @@ import com.ruoyi.project.sems.domain.TMeasureThickness;
  * @author ruoyi
  * @date 2021-07-07
  */
-public interface TMeasureThicknessMapper
-{
+public interface TMeasureThicknessMapper {
     /**
      * 查询定点测厚
      *
@@ -24,10 +25,11 @@ public interface TMeasureThicknessMapper
     /**
      * 根据位号查询id
      *
-     * @param tagNo 位号
+     * @param tagNo    位号
+     * @param position 测厚部位
      * @return
      */
-    public Long selectByTagNo(String tagNo);
+    public Long selectByTagNo(@Param("tagNo") String tagNo, @Param("position") String position);
 
     /**
      * 查询定点测厚列表

+ 3 - 2
master/src/main/java/com/ruoyi/project/sems/service/ITMeasureThicknessService.java

@@ -22,10 +22,11 @@ public interface ITMeasureThicknessService {
     /**
      * 根据位号查询id
      *
-     * @param tagNo 位号
+     * @param tagNo    位号
+     * @param position 测厚部位
      * @return
      */
-    public Long selectByTagNo(String tagNo);
+    public Long selectByTagNo(String tagNo, String position);
 
     /**
      * 查询定点测厚列表

+ 6 - 2
master/src/main/resources/mybatis/sems/TMeasureThicknessMapper.xml

@@ -105,8 +105,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </select>
 
-    <select id="selectByTagNo" parameterType="String" resultType="Long">
-        select id from t_measure_thickness where tagno = #{tagno}
+    <select id="selectByTagNo" resultType="Long">
+        select id from t_measure_thickness
+            <where>
+                <if test="tagNo != null  and tagNo != ''"> and tagno = #{tagNo}</if>
+                <if test="position != null  and position != ''"> and position = #{position}</if>
+            </where>
     </select>
 
     <insert id="insertTMeasureThickness" parameterType="TMeasureThickness">

BIN
master/src/main/resources/static/template/sems/thickness.xlsx