Explorar o código

fix mapstruct-plus配置

jay %!s(int64=2) %!d(string=hai) anos
pai
achega
b470be12c3

+ 7 - 1
iot-common/iot-common-core/src/main/java/cc/iotkit/common/utils/MessageUtils.java

@@ -23,6 +23,12 @@ public class MessageUtils {
      * @return 获取国际化翻译值
      */
     public static String message(String code, Object... args) {
-        return MESSAGE_SOURCE.getMessage(code, args, LocaleContextHolder.getLocale());
+//        TODO: 国际化
+        try{
+            return MESSAGE_SOURCE.getMessage(code, args, LocaleContextHolder.getLocale());
+        } catch (Exception e) {
+            return code;
+        }
+
     }
 }

+ 27 - 12
iot-common/iot-common-dao/iot-data-serviceImpl-rdb/pom.xml

@@ -47,11 +47,20 @@
             <artifactId>hutool-core</artifactId>
         </dependency>
 
+<!--        <dependency>-->
+<!--            <groupId>org.mapstruct</groupId>-->
+<!--            <artifactId>mapstruct</artifactId>-->
+<!--        </dependency>-->
         <dependency>
-            <groupId>org.mapstruct</groupId>
-            <artifactId>mapstruct</artifactId>
+            <groupId>io.github.linpeilie</groupId>
+            <artifactId>mapstruct-plus</artifactId>
         </dependency>
 
+<!--        <dependency>-->
+<!--            <groupId>io.github.linpeilie</groupId>-->
+<!--            <artifactId>mapstruct-plus-spring-boot-starter</artifactId>-->
+<!--        </dependency>-->
+
         <dependency>
             <groupId>org.projectlombok</groupId>
             <artifactId>lombok</artifactId>
@@ -90,16 +99,22 @@
                     <source>${java.version}</source> <!-- depending on your project -->
                     <target>${java.version}</target> <!-- depending on your project -->
                     <annotationProcessorPaths>
-                        <path>
-                            <groupId>org.projectlombok</groupId>
-                            <artifactId>lombok</artifactId>
-                            <version>1.18.24</version>
-                        </path>
-                        <path>
-                            <groupId>org.mapstruct</groupId>
-                            <artifactId>mapstruct-processor</artifactId>
-                            <version>1.4.2.Final</version>
-                        </path>
+                       <path>
+                        <groupId>org.projectlombok</groupId>
+                        <artifactId>lombok</artifactId>
+                           <version>${lombok.version}</version>
+                    </path>
+                    <path>
+                        <groupId>io.github.linpeilie</groupId>
+                        <artifactId>mapstruct-plus-processor</artifactId>
+                        <version>${mapstruct-plus.version}</version>
+                    </path>
+                    <path>
+                        <groupId>org.projectlombok</groupId>
+                        <artifactId>lombok-mapstruct-binding</artifactId>
+                        <version>0.2.0</version>
+                    </path>
+
                         <!-- other annotation processors -->
                     </annotationProcessorPaths>
                 </configuration>

+ 15 - 0
iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/config/AutoMapperConfig3.java

@@ -0,0 +1,15 @@
+package cc.iotkit.data.config;
+
+import io.github.linpeilie.annotations.ComponentModelConfig;
+import io.github.linpeilie.annotations.MapperConfig;
+
+/**
+ * @Author: jay
+ * @Date: 2023/6/4 14:21
+ * @Version: V1.0
+ * @Description: mapperstruct 配置
+ */
+//@MapperConfig
+@ComponentModelConfig(componentModel = "default")
+public class AutoMapperConfig3 {
+}

+ 17 - 13
iot-common/iot-common-dao/iot-temporal-serviceImpl-es/pom.xml

@@ -30,10 +30,9 @@
         </dependency>
 
         <dependency>
-            <groupId>org.mapstruct</groupId>
-            <artifactId>mapstruct</artifactId>
+            <groupId>io.github.linpeilie</groupId>
+            <artifactId>mapstruct-plus</artifactId>
         </dependency>
-
         <dependency>
             <groupId>cc.iotkit</groupId>
             <artifactId>iot-temporal-service</artifactId>
@@ -56,16 +55,21 @@
                     <source>${java.version}</source> <!-- depending on your project -->
                     <target>${java.version}</target> <!-- depending on your project -->
                     <annotationProcessorPaths>
-                        <path>
-                            <groupId>org.projectlombok</groupId>
-                            <artifactId>lombok</artifactId>
-                            <version>1.18.24</version>
-                        </path>
-                        <path>
-                            <groupId>org.mapstruct</groupId>
-                            <artifactId>mapstruct-processor</artifactId>
-                            <version>1.4.2.Final</version>
-                        </path>
+                       <path>
+                        <groupId>org.projectlombok</groupId>
+                        <artifactId>lombok</artifactId>
+                        <version>${lombok.version}</version>
+                    </path>
+                    <path>
+                        <groupId>io.github.linpeilie</groupId>
+                        <artifactId>mapstruct-plus-processor</artifactId>
+                        <version>${mapstruct-plus.version}</version>
+                    </path>
+                    <path>
+                        <groupId>org.projectlombok</groupId>
+                        <artifactId>lombok-mapstruct-binding</artifactId>
+                        <version>0.2.0</version>
+                    </path>
                         <!-- other annotation processors -->
                     </annotationProcessorPaths>
                 </configuration>

+ 4 - 4
iot-common/iot-common-dao/iot-temporal-serviceImpl-ts/pom.xml

@@ -44,10 +44,10 @@
             <artifactId>jackson-annotations</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>org.mapstruct</groupId>
-            <artifactId>mapstruct</artifactId>
-        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>org.mapstruct</groupId>-->
+<!--            <artifactId>mapstruct</artifactId>-->
+<!--        </dependency>-->
 
         <dependency>
             <groupId>cn.hutool</groupId>

+ 2 - 3
iot-common/iot-common-dao/iot-temproal-serviceImpl-td/pom.xml

@@ -48,10 +48,9 @@
         </dependency>
 
         <dependency>
-            <groupId>org.mapstruct</groupId>
-            <artifactId>mapstruct</artifactId>
+            <groupId>io.github.linpeilie</groupId>
+            <artifactId>mapstruct-plus-spring-boot-starter</artifactId>
         </dependency>
-
         <dependency>
             <groupId>cn.hutool</groupId>
             <artifactId>hutool-http</artifactId>

+ 11 - 11
iot-common/iot-common-dao/pom.xml

@@ -32,17 +32,17 @@
 
         <dependencies>
 
-            <dependency>
-                <groupId>org.mapstruct</groupId>
-                <artifactId>mapstruct</artifactId>
-                <version>1.4.2.Final</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.mapstruct</groupId>
-                <artifactId>mapstruct-processor</artifactId>
-                <version>1.4.2.Final</version>
-            </dependency>
+<!--            <dependency>-->
+<!--                <groupId>org.mapstruct</groupId>-->
+<!--                <artifactId>mapstruct</artifactId>-->
+<!--                <version>1.4.2.Final</version>-->
+<!--            </dependency>-->
+
+<!--            <dependency>-->
+<!--                <groupId>org.mapstruct</groupId>-->
+<!--                <artifactId>mapstruct-processor</artifactId>-->
+<!--                <version>1.4.2.Final</version>-->
+<!--            </dependency>-->
 
         </dependencies>
 

+ 15 - 0
iot-module/iot-manager/src/main/java/cc/iotkit/manager/config/AutoMapperConfig2.java

@@ -0,0 +1,15 @@
+package cc.iotkit.manager.config;
+
+import io.github.linpeilie.annotations.ComponentModelConfig;
+import io.github.linpeilie.annotations.MapperConfig;
+
+/**
+ * @Author: jay
+ * @Date: 2023/6/4 14:21
+ * @Version: V1.0
+ * @Description: mapperstruct 配置
+ */
+@MapperConfig
+@ComponentModelConfig(componentModel = "default")
+public class AutoMapperConfig2 {
+}

+ 15 - 0
iot-module/iot-system/src/main/java/cc/iotkit/system/config/AutoMapperConfig.java

@@ -0,0 +1,15 @@
+package cc.iotkit.system.config;
+
+import io.github.linpeilie.annotations.ComponentModelConfig;
+import io.github.linpeilie.annotations.MapperConfig;
+
+/**
+ * @Author: jay
+ * @Date: 2023/6/4 14:21
+ * @Version: V1.0
+ * @Description: mapperstruct 配置
+ */
+@MapperConfig()
+@ComponentModelConfig(componentModel = "default")
+public class AutoMapperConfig {
+}

+ 9 - 2
pom.xml

@@ -35,7 +35,7 @@
         <hutool.version>5.8.18</hutool.version>
         <redisson.version>3.20.1</redisson.version>
         <lock4j.version>2.2.4</lock4j.version>
-        <mapstruct-plus.version>1.2.1</mapstruct-plus.version>
+        <mapstruct-plus.version>1.2.5</mapstruct-plus.version>
         <alibaba-ttl.version>2.14.2</alibaba-ttl.version>
         <poi.version>5.2.3</poi.version>
         <easyexcel.version>3.2.1</easyexcel.version>
@@ -44,6 +44,8 @@
         <jap-comment.version>1.0.0</jap-comment.version>
         <knife4j.version>2.0.9</knife4j.version>
         <validateion.version>1.1.0.Final</validateion.version>
+        <lombok.version>1.18.26</lombok.version>
+
     </properties>
 
     <dependencyManagement>
@@ -119,7 +121,7 @@
             <dependency>
                 <groupId>org.projectlombok</groupId>
                 <artifactId>lombok</artifactId>
-                <version>1.18.26</version>
+                <version>${lombok.version}</version>
             </dependency>
 
             <dependency>
@@ -285,6 +287,11 @@
                 <version>${graalvm.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>io.github.linpeilie</groupId>
+                <artifactId>mapstruct-plus</artifactId>
+                <version>${mapstruct-plus.version}</version>
+            </dependency>
             <dependency>
                 <groupId>io.github.linpeilie</groupId>
                 <artifactId>mapstruct-plus-spring-boot-starter</artifactId>