Эх сурвалжийг харах

Merge branch 'master' into dev

王苗苗 7 сар өмнө
parent
commit
5fd71c38d5

+ 3 - 0
slibra-system/src/main/java/com/slibra/business/domain/TXinyiCarbonMajor.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.time.LocalDate;
 import java.time.format.DateTimeFormatter;
 import java.util.List;
+import java.util.Map;
 
 import com.slibra.business.res.ChartBasic;
 import lombok.AllArgsConstructor;
@@ -476,6 +477,8 @@ public class TXinyiCarbonMajor extends BaseEntity
     //额外的关联多条数据的集合
     private List<TXinyiCarbonExtra> extraList;
 
+    private Map<Integer, List<TXinyiCarbonExtra>> extraMap;
+
 
 
 

+ 6 - 1
slibra-system/src/main/java/com/slibra/business/service/impl/TXinyiCarbonMajorServiceImpl.java

@@ -3,6 +3,7 @@ package com.slibra.business.service.impl;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import com.alibaba.fastjson2.JSON;
 import com.slibra.business.domain.TXinyiCarbonExtra;
@@ -739,7 +740,8 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
         }
         tXinyiCarbonMajor.setRecent7Datas(recent7PflDatas);
         //关联的多条数据
-        tXinyiCarbonMajor.setExtraList(this.xinyiCarbonExtraMapper.selectTXinyiCarbonExtraList(TXinyiCarbonExtra.builder().majorId(tXinyiCarbonMajor.getId()).build()));
+//        tXinyiCarbonMajor.setExtraList();
+        tXinyiCarbonMajor.setExtraMap(this.xinyiCarbonExtraMapper.selectTXinyiCarbonExtraList(TXinyiCarbonExtra.builder().majorId(tXinyiCarbonMajor.getId()).build()).stream().collect(Collectors.groupingBy(TXinyiCarbonExtra::getType)));
     }
 
     public static void main(String[] args) {
@@ -757,5 +759,8 @@ public class TXinyiCarbonMajorServiceImpl implements ITXinyiCarbonMajorService
         System.out.println(reduce);
         System.out.println(reduce.isPresent());
         System.out.println(reduce.get());
+        list = new ArrayList<>();
+        Map<Integer, List<TXinyiCarbonExtra>> collect = list.stream().collect(Collectors.groupingBy(TXinyiCarbonExtra::getType));
+        System.out.println(collect);
     }
 }

+ 3 - 0
slibra-system/src/main/resources/mapper/business/TXinyiCarbonExtraMapper.xml

@@ -65,6 +65,7 @@
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="majorId != null">#{majorId},</if>
@@ -81,6 +82,7 @@
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
         </trim>
     </insert>
 
@@ -101,6 +103,7 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
         </trim>
         ,revision = revision + 1
         where id = #{id}

+ 3 - 0
slibra-system/src/main/resources/mapper/business/TXinyiCarbonMajorMapper.xml

@@ -220,6 +220,7 @@
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
             <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="addOwner != null">#{addOwner},</if>
@@ -322,6 +323,7 @@
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
             <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
         </trim>
     </insert>
 
@@ -428,6 +430,7 @@
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
             <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
         </trim>
         ,revision = revision + 1
         where id = #{id}