Ver Fonte

add pangu-archetype-web 新增web类型的骨架
add pangu-component-dto 新增dto工具类

bianlz há 3 meses atrás
pai
commit
0a7c57418c
28 ficheiros alterados com 133 adições e 806 exclusões
  1. 6 1
      pangu-archetypes/pangu-archetype-sc/README.md
  2. 4 1
      pangu-archetypes/pangu-archetype-sc/pangu-archetype-sc-client/pom.xml
  3. 14 0
      pangu-archetypes/pangu-archetype-sc/pangu-archetype-sc-domain/pom.xml
  4. 8 1
      pangu-archetypes/pangu-archetype-sc/pom.xml
  5. 9 13
      pangu-archetypes/pangu-archetype-web/pangu-archetype-web-adapter/pom.xml
  6. 29 0
      pangu-archetypes/pangu-archetype-web/pangu-archetype-web-app/pom.xml
  7. 25 0
      pangu-archetypes/pangu-archetype-web/start/pom.xml
  8. 38 0
      pangu-component/pangu-component-bom/pom.xml
  9. 0 38
      pangu-components/.gitignore
  10. 0 17
      pangu-components/README.md
  11. 0 57
      pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/ApplicationContextHelper.java
  12. 0 21
      pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/DomainAutoConfiguration.java
  13. 0 14
      pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/DomainFactory.java
  14. 0 20
      pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/Entity.java
  15. 0 1
      pangu-components/pangu-component-domain-starter/src/main/resources/META-INF/spring.factories
  16. 0 20
      pangu-components/pangu-component-dto/pom.xml
  17. 0 67
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/BizScenario.java
  18. 0 39
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/ClientObject.java
  19. 0 12
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Command.java
  20. 0 14
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/DTO.java
  21. 0 62
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/MultiResponse.java
  22. 0 96
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/PageQuery.java
  23. 0 124
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/PageResponse.java
  24. 0 12
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Query.java
  25. 0 61
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Response.java
  26. 0 11
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Scope.java
  27. 0 43
      pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/SingleResponse.java
  28. 0 61
      pangu-components/pom.xml

+ 6 - 1
pangu-archetypes/pangu-archetype-sc/README.md

@@ -17,4 +17,9 @@ mvn archetype:generate -DarchetypeCatalog=local
 
 ## 使用本地模式进行开发
 
-在启动环境中添加spring.profiles.active=local
+在启动环境中添加spring.profiles.active=local
+
+
+# 如何删除本地archetype
+
+清理 ~/.m2/repository/archetype-catalog.xml

+ 4 - 1
pangu-archetypes/pangu-archetype-sc/pangu-archetype-sc-client/pom.xml

@@ -18,7 +18,10 @@
     </properties>
 
     <dependencies>
-
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-component-dto</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 14 - 0
pangu-archetypes/pangu-archetype-sc/pangu-archetype-sc-domain/pom.xml

@@ -17,4 +17,18 @@
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     </properties>
 
+    <dependencies>
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-component-domain-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-component-dto</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-component-tool</artifactId>
+        </dependency>
+    </dependencies>
 </project>

+ 8 - 1
pangu-archetypes/pangu-archetype-sc/pom.xml

@@ -21,13 +21,13 @@
         <maven.compiler.source>8</maven.compiler.source>
         <maven.compiler.target>8</maven.compiler.target>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-        <pangu.components.version>1.0.0</pangu.components.version>
 
         <spring-boot.version>2.7.6</spring-boot.version>
         <spring-cloud-alibaba.version>2021.0.5.0</spring-cloud-alibaba.version>
         <mybatis-starter.version>2.2.2</mybatis-starter.version>
         <mybatis-plus.version>3.5.4.1</mybatis-plus.version>
         <druid-starter.version>1.2.9</druid-starter.version>
+        <pangu-component.version>1.0.0</pangu-component.version>
     </properties>
 
     <dependencies>
@@ -51,6 +51,13 @@
                 <artifactId>start</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>com.hrsk.pangu</groupId>
+                <artifactId>pangu-component-bom</artifactId>
+                <version>${pangu-component.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
             <dependency>
                 <groupId>com.hrsk.pangu</groupId>
                 <artifactId>pangu-archetype-sc-adapter</artifactId>

+ 9 - 13
pangu-components/pangu-component-domain-starter/pom.xml → pangu-archetypes/pangu-archetype-web/pangu-archetype-web-adapter/pom.xml

@@ -1,15 +1,13 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>com.hrsk.pangu</groupId>
-        <artifactId>component-parent</artifactId>
-        <version>1.0.0</version>
+        <artifactId>pangu-archetype-web</artifactId>
+        <version>1.0-SNAPSHOT</version>
     </parent>
 
-    <artifactId>pangu-component-domain-starter</artifactId>
+    <artifactId>pangu-archetype-web-adapter</artifactId>
 
     <properties>
         <maven.compiler.source>8</maven.compiler.source>
@@ -19,20 +17,18 @@
 
     <dependencies>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-autoconfigure</artifactId>
-            <scope>provided</scope>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-archetype-web-app</artifactId>
         </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-configuration-processor</artifactId>
-            <scope>provided</scope>
+            <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
-        <!-- 测试包 -->
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>
             <scope>test</scope>
         </dependency>
     </dependencies>
-</project>
+
+</project>

+ 29 - 0
pangu-archetypes/pangu-archetype-web/pangu-archetype-web-app/pom.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.hrsk.pangu</groupId>
+        <artifactId>pangu-archetype-web</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>pangu-archetype-web-app</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-archetype-web-infrastructure</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-archetype-web-client</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 25 - 0
pangu-archetypes/pangu-archetype-web/start/pom.xml

@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>com.hrsk.pangu</groupId>
+        <artifactId>pangu-archetype-web</artifactId>
+        <version>1.0-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>start</artifactId>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.hrsk.pangu</groupId>
+            <artifactId>pangu-archetype-web-adapter</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 38 - 0
pangu-component/pangu-component-bom/pom.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>com.hrsk.pangu</groupId>
+    <artifactId>pangu-component-bom</artifactId>
+    <version>1.0.0</version>
+    <packaging>pom</packaging>
+
+    <properties>
+        <maven.compiler.source>8</maven.compiler.source>
+        <maven.compiler.target>8</maven.compiler.target>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.hrsk.pangu</groupId>
+                <artifactId>pangu-component-tool</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.hrsk.pangu</groupId>
+                <artifactId>pangu-component-domain-starter</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.hrsk.pangu</groupId>
+                <artifactId>pangu-component-dto</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+</project>

+ 0 - 38
pangu-components/.gitignore

@@ -1,38 +0,0 @@
-target/
-!.mvn/wrapper/maven-wrapper.jar
-!**/src/main/**/target/
-!**/src/test/**/target/
-
-### IntelliJ IDEA ###
-.idea/modules.xml
-.idea/jarRepositories.xml
-.idea/compiler.xml
-.idea/libraries/
-*.iws
-*.iml
-*.ipr
-
-### Eclipse ###
-.apt_generated
-.classpath
-.factorypath
-.project
-.settings
-.springBeans
-.sts4-cache
-
-### NetBeans ###
-/nbproject/private/
-/nbbuild/
-/dist/
-/nbdist/
-/.nb-gradle/
-build/
-!**/src/main/**/build/
-!**/src/test/**/build/
-
-### VS Code ###
-.vscode/
-
-### Mac OS ###
-.DS_Store

+ 0 - 17
pangu-components/README.md

@@ -1,17 +0,0 @@
-# 组件工程
-此工程为组件工程,对于公共组件的升级都在此工程下,后续新的组件在创建后都需要在此处进行登记。
-
-## 组件登记
-
-### 1.pangu-component-domain-start
-    
-    DDD相关组件starter工程,提供DDD相关能力的组件。
-
-### 2.pangu-component-dto
-
-    DTO组件工程,提供数据传输对象标准。
-
-    
-    
-    
-

+ 0 - 57
pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/ApplicationContextHelper.java

@@ -1,57 +0,0 @@
-package com.hrsk.pangu.domain;
-
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-@Component("colaDomainApplicationContextHelper")
-public class ApplicationContextHelper implements ApplicationContextAware {
-    private static ApplicationContext applicationContext;
-
-    @Override
-    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-        ApplicationContextHelper.applicationContext = applicationContext;
-    }
-
-    public static <T> T getBean(Class<T> targetClz) {
-        T beanInstance = null;
-        //优先按type查
-        try {
-            beanInstance = (T)applicationContext.getBean(targetClz);
-        } catch (Exception e) {
-        }
-        //按name查
-        if (beanInstance == null) {
-            String simpleName = targetClz.getSimpleName();
-            //首字母小写
-            simpleName = Character.toLowerCase(simpleName.charAt(0)) + simpleName.substring(1);
-            beanInstance = (T)applicationContext.getBean(simpleName);
-        }
-        if (beanInstance == null) {
-            throw new RuntimeException("Component " + targetClz + " can not be found in Spring Container");
-        }
-        return beanInstance;
-    }
-
-    public static Object getBean(String claz) {
-        return ApplicationContextHelper.applicationContext.getBean(claz);
-    }
-
-    public static <T> T getBean(String name, Class<T> requiredType) {
-        return ApplicationContextHelper.applicationContext.getBean(name, requiredType);
-    }
-
-    public static <T> T getBean(Class<T> requiredType, Object... params) {
-        return ApplicationContextHelper.applicationContext.getBean(requiredType, params);
-    }
-
-    public static ApplicationContext getApplicationContext() {
-        return applicationContext;
-    }
-}

+ 0 - 21
pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/DomainAutoConfiguration.java

@@ -1,21 +0,0 @@
-package com.hrsk.pangu.domain;
-
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.EnableAspectJAutoProxy;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-@Configuration
-public class DomainAutoConfiguration {
-
-    @Bean
-    @ConditionalOnMissingBean(ApplicationContextHelper.class)
-    public ApplicationContextHelper applicationContextHelper() {
-        return new ApplicationContextHelper();
-    }
-}

+ 0 - 14
pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/DomainFactory.java

@@ -1,14 +0,0 @@
-package com.hrsk.pangu.domain;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public class DomainFactory {
-
-    public static <T> T create(Class<T> entityClz){
-        return ApplicationContextHelper.getBean(entityClz);
-    }
-
-}

+ 0 - 20
pangu-components/pangu-component-domain-starter/src/main/java/com/hrsk/pangu/domain/Entity.java

@@ -1,20 +0,0 @@
-package com.hrsk.pangu.domain;
-
-import org.springframework.beans.factory.config.ConfigurableBeanFactory;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import java.lang.annotation.*;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-@Inherited
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE})
-@Component
-@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
-public @interface Entity {
-}

+ 0 - 1
pangu-components/pangu-component-domain-starter/src/main/resources/META-INF/spring.factories

@@ -1 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration =com.hrsk.pangu.domain.DomainAutoConfiguration

+ 0 - 20
pangu-components/pangu-component-dto/pom.xml

@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>com.hrsk.pangu</groupId>
-        <artifactId>component-parent</artifactId>
-        <version>1.0.0</version>
-    </parent>
-
-    <artifactId>pangu-component-dto</artifactId>
-
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-    </properties>
-
-</project>

+ 0 - 67
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/BizScenario.java

@@ -1,67 +0,0 @@
-package com.hrsk.pangu.dto;
-
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public class BizScenario {
-    public final static String DEFAULT_BIZ_ID = "#defaultBizId#";
-    public final static String DEFAULT_USE_CASE = "#defaultUseCase#";
-    public final static String DEFAULT_SCENARIO = "#defaultScenario#";
-    private final static String DOT_SEPARATOR = ".";
-
-    /**
-     * bizId is used to identify a business, such as "tmall", it's nullable if there is only one biz
-     */
-    private String bizId = DEFAULT_BIZ_ID;
-
-    /**
-     * useCase is used to identify a use case, such as "placeOrder", can not be null
-     */
-    private String useCase = DEFAULT_USE_CASE;
-
-    /**
-     * scenario is used to identify a use case, such as "88vip","normal", can not be null
-     */
-    private String scenario = DEFAULT_SCENARIO;
-
-    /**
-     * For above case, the BizScenario will be "tmall.placeOrder.88vip",
-     * with this code, we can provide extension processing other than "tmall.placeOrder.normal" scenario.
-     *
-     * @return
-     */
-    public String getUniqueIdentity(){
-        return bizId + DOT_SEPARATOR + useCase + DOT_SEPARATOR + scenario;
-    }
-
-    public static BizScenario valueOf(String bizId, String useCase, String scenario){
-        BizScenario bizScenario = new BizScenario();
-        bizScenario.bizId = bizId;
-        bizScenario.useCase = useCase;
-        bizScenario.scenario = scenario;
-        return bizScenario;
-    }
-
-    public static BizScenario valueOf(String bizId, String useCase){
-        return BizScenario.valueOf(bizId, useCase, DEFAULT_SCENARIO);
-    }
-
-    public static BizScenario valueOf(String bizId){
-        return BizScenario.valueOf(bizId, DEFAULT_USE_CASE, DEFAULT_SCENARIO);
-    }
-
-    public static BizScenario newDefault(){
-        return BizScenario.valueOf(DEFAULT_BIZ_ID, DEFAULT_USE_CASE, DEFAULT_SCENARIO);
-    }
-
-    public String getIdentityWithDefaultScenario(){
-        return bizId + DOT_SEPARATOR + useCase + DOT_SEPARATOR + DEFAULT_SCENARIO;
-    }
-
-    public String getIdentityWithDefaultUseCase(){
-        return bizId + DOT_SEPARATOR + DEFAULT_USE_CASE + DOT_SEPARATOR + DEFAULT_SCENARIO;
-    }
-}

+ 0 - 39
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/ClientObject.java

@@ -1,39 +0,0 @@
-package com.hrsk.pangu.dto;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public abstract class ClientObject implements Serializable{
-
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * This is for extended values
-     */
-    protected Map<String, Object> extValues = new HashMap<String, Object>();
-
-    public Object getExtField(String key){
-        if(extValues != null){
-            return extValues.get(key);
-        }
-        return null;
-    }
-
-    public void putExtField(String fieldName, Object value){
-        this.extValues.put(fieldName, value);
-    }
-
-    public Map<String, Object> getExtValues() {
-        return extValues;
-    }
-
-    public void setExtValues(Map<String, Object> extValues) {
-        this.extValues = extValues;
-    }
-}

+ 0 - 12
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Command.java

@@ -1,12 +0,0 @@
-package com.hrsk.pangu.dto;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public abstract class Command extends DTO {
-
-    private static final long serialVersionUID = 1L;
-
-}

+ 0 - 14
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/DTO.java

@@ -1,14 +0,0 @@
-package com.hrsk.pangu.dto;
-
-import java.io.Serializable;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public abstract class DTO implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-}

+ 0 - 62
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/MultiResponse.java

@@ -1,62 +0,0 @@
-package com.hrsk.pangu.dto;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public class MultiResponse<T> extends Response {
-
-    private static final long serialVersionUID = 1L;
-
-    private Collection<T> data;
-
-    public List<T> getData() {
-        if (null == data) {
-            return Collections.emptyList();
-        }
-        if (data instanceof List) {
-            return (List<T>) data;
-        }
-        return new ArrayList<>(data);
-    }
-
-    public void setData(Collection<T> data) {
-        this.data = data;
-    }
-
-    public boolean isEmpty() {
-        return data == null || data.isEmpty();
-    }
-
-    public boolean isNotEmpty() {
-        return !isEmpty();
-    }
-
-    public static MultiResponse buildSuccess() {
-        MultiResponse response = new MultiResponse();
-        response.setSuccess(true);
-        return response;
-    }
-
-    public static MultiResponse buildFailure(String errCode, String errMessage) {
-        MultiResponse response = new MultiResponse();
-        response.setSuccess(false);
-        response.setErrCode(errCode);
-        response.setErrMessage(errMessage);
-        return response;
-    }
-
-    public static <T> MultiResponse<T> of(Collection<T> data) {
-        MultiResponse<T> response = new MultiResponse<>();
-        response.setSuccess(true);
-        response.setData(data);
-        return response;
-    }
-
-}

+ 0 - 96
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/PageQuery.java

@@ -1,96 +0,0 @@
-package com.hrsk.pangu.dto;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public abstract class PageQuery extends Query {
-    private static final long serialVersionUID = 1L;
-
-    public static final String ASC = "ASC";
-
-    public static final String DESC = "DESC";
-
-    private static final int DEFAULT_PAGE_SIZE = 10;
-
-    private int pageSize = DEFAULT_PAGE_SIZE;
-
-    private int pageIndex = 1;
-
-    private String orderBy;
-
-    private String orderDirection = DESC;
-
-    private String groupBy;
-
-    private boolean needTotalCount = true;
-
-    public int getPageIndex() {
-        if (pageIndex < 1) {
-            return 1;
-        }
-        return pageIndex;
-    }
-
-    public PageQuery setPageIndex(int pageIndex) {
-        this.pageIndex = pageIndex;
-        return this;
-    }
-
-    public int getPageSize() {
-        if (pageSize < 1) {
-            pageSize = DEFAULT_PAGE_SIZE;
-        }
-        return pageSize;
-    }
-
-    public PageQuery setPageSize(int pageSize) {
-        if (pageSize < 1) {
-            pageSize = DEFAULT_PAGE_SIZE;
-        }
-        this.pageSize = pageSize;
-        return this;
-    }
-
-    public int getOffset() {
-        return (getPageIndex() - 1) * getPageSize();
-    }
-
-    public String getOrderBy() {
-        return orderBy;
-    }
-
-    public PageQuery setOrderBy(String orderBy) {
-        this.orderBy = orderBy;
-        return this;
-    }
-
-    public String getOrderDirection() {
-        return orderDirection;
-    }
-
-    public PageQuery setOrderDirection(String orderDirection) {
-        if (ASC.equalsIgnoreCase(orderDirection) || DESC.equalsIgnoreCase(orderDirection)) {
-            this.orderDirection = orderDirection;
-        }
-        return this;
-    }
-
-    public String getGroupBy() {
-        return groupBy;
-    }
-
-    public void setGroupBy(String groupBy) {
-        this.groupBy = groupBy;
-    }
-
-    public boolean isNeedTotalCount() {
-        return needTotalCount;
-    }
-
-    public void setNeedTotalCount(boolean needTotalCount) {
-        this.needTotalCount = needTotalCount;
-    }
-
-}

+ 0 - 124
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/PageResponse.java

@@ -1,124 +0,0 @@
-package com.hrsk.pangu.dto;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public class PageResponse<T> extends Response {
-
-    private static final long serialVersionUID = 1L;
-
-    private int totalCount = 0;
-
-    private int pageSize = 1;
-
-    private int pageIndex = 1;
-
-    private Collection<T> data;
-
-    public int getTotalCount() {
-        return totalCount;
-    }
-
-    public void setTotalCount(int totalCount) {
-        this.totalCount = totalCount;
-    }
-
-    public int getPageSize() {
-        if (pageSize < 1) {
-            return 1;
-        }
-        return pageSize;
-    }
-
-    public void setPageSize(int pageSize) {
-        if (pageSize < 1) {
-            this.pageSize = 1;
-        } else {
-            this.pageSize = pageSize;
-        }
-    }
-
-    public int getPageIndex() {
-        if (pageIndex < 1) {
-            return 1;
-        }
-        return pageIndex;
-    }
-
-    public void setPageIndex(int pageIndex) {
-        if (pageIndex < 1) {
-            this.pageIndex = 1;
-        } else {
-            this.pageIndex = pageIndex;
-        }
-    }
-
-    public List<T> getData() {
-        if (null == data) {
-            return Collections.emptyList();
-        }
-        if (data instanceof List) {
-            return (List<T>) data;
-        }
-        return new ArrayList<>(data);
-    }
-
-    public void setData(Collection<T> data) {
-        this.data = data;
-    }
-
-    public int getTotalPages() {
-        return this.totalCount % this.pageSize == 0 ? this.totalCount
-            / this.pageSize : (this.totalCount / this.pageSize) + 1;
-    }
-
-    public boolean isEmpty() {
-        return data == null || data.isEmpty();
-    }
-
-    public boolean isNotEmpty() {
-        return !isEmpty();
-    }
-
-    public static PageResponse buildSuccess() {
-        PageResponse response = new PageResponse();
-        response.setSuccess(true);
-        return response;
-    }
-
-    public static PageResponse buildFailure(String errCode, String errMessage) {
-        PageResponse response = new PageResponse();
-        response.setSuccess(false);
-        response.setErrCode(errCode);
-        response.setErrMessage(errMessage);
-        return response;
-    }
-
-    public static <T> PageResponse<T> of(int pageSize, int pageIndex) {
-        PageResponse<T> response = new PageResponse<>();
-        response.setSuccess(true);
-        response.setData(Collections.emptyList());
-        response.setTotalCount(0);
-        response.setPageSize(pageSize);
-        response.setPageIndex(pageIndex);
-        return response;
-    }
-
-    public static <T> PageResponse<T> of(Collection<T> data, int totalCount, int pageSize, int pageIndex) {
-        PageResponse<T> response = new PageResponse<>();
-        response.setSuccess(true);
-        response.setData(data);
-        response.setTotalCount(totalCount);
-        response.setPageSize(pageSize);
-        response.setPageIndex(pageIndex);
-        return response;
-    }
-
-}

+ 0 - 12
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Query.java

@@ -1,12 +0,0 @@
-package com.hrsk.pangu.dto;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public abstract class Query extends Command {
-
-    private static final long serialVersionUID = 1L;
-
-}

+ 0 - 61
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Response.java

@@ -1,61 +0,0 @@
-package com.hrsk.pangu.dto;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public class Response extends DTO {
-
-    private static final long serialVersionUID = 1L;
-
-    private boolean success;
-
-    private String errCode;
-
-    private String errMessage;
-
-    public boolean isSuccess() {
-        return success;
-    }
-
-    public void setSuccess(boolean success) {
-        this.success = success;
-    }
-
-    public String getErrCode() {
-        return errCode;
-    }
-
-    public void setErrCode(String errCode) {
-        this.errCode = errCode;
-    }
-
-    public String getErrMessage() {
-        return errMessage;
-    }
-
-    public void setErrMessage(String errMessage) {
-        this.errMessage = errMessage;
-    }
-
-    @Override
-    public String toString() {
-        return "Response [success=" + success + ", errCode=" + errCode + ", errMessage=" + errMessage + "]";
-    }
-
-    public static Response buildSuccess() {
-        Response response = new Response();
-        response.setSuccess(true);
-        return response;
-    }
-
-    public static Response buildFailure(String errCode, String errMessage) {
-        Response response = new Response();
-        response.setSuccess(false);
-        response.setErrCode(errCode);
-        response.setErrMessage(errMessage);
-        return response;
-    }
-
-}

+ 0 - 11
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/Scope.java

@@ -1,11 +0,0 @@
-package com.hrsk.pangu.dto;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public abstract class Scope extends DTO {
-
-    private static final long serialVersionUID = 1L;
-}

+ 0 - 43
pangu-components/pangu-component-dto/src/main/java/com/hrsk/pangu/dto/SingleResponse.java

@@ -1,43 +0,0 @@
-package com.hrsk.pangu.dto;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-08-05 17:20
- * @description: copy from https://github.com/alibaba/COLA/tree/COLA4.3.2?tab=readme-ov-file
- **/
-public class SingleResponse<T> extends Response {
-
-    private static final long serialVersionUID = 1L;
-
-    private T data;
-
-    public T getData() {
-        return data;
-    }
-
-    public void setData(T data) {
-        this.data = data;
-    }
-
-    public static SingleResponse buildSuccess() {
-        SingleResponse response = new SingleResponse();
-        response.setSuccess(true);
-        return response;
-    }
-
-    public static SingleResponse buildFailure(String errCode, String errMessage) {
-        SingleResponse response = new SingleResponse();
-        response.setSuccess(false);
-        response.setErrCode(errCode);
-        response.setErrMessage(errMessage);
-        return response;
-    }
-
-    public static <T> SingleResponse<T> of(T data) {
-        SingleResponse<T> response = new SingleResponse<>();
-        response.setSuccess(true);
-        response.setData(data);
-        return response;
-    }
-
-}

+ 0 - 61
pangu-components/pom.xml

@@ -1,61 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-
-    <groupId>com.hrsk.pangu</groupId>
-    <artifactId>component-parent</artifactId>
-    <version>1.0.0</version>
-    <packaging>pom</packaging>
-    <modules>
-        <module>pangu-component-domain-starter</module>
-        <module>pangu-component-dto</module>
-    </modules>
-
-    <properties>
-        <maven.compiler.source>8</maven.compiler.source>
-        <maven.compiler.target>8</maven.compiler.target>
-        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-
-        <spring.boot.version>2.7.5</spring.boot.version>
-        <fastjson.version>1.2.83</fastjson.version>
-        <commons-cli.version>1.5.0</commons-cli.version>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.projectlombok</groupId>
-            <artifactId>lombok</artifactId>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-dependencies</artifactId>
-                <version>${spring.boot.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>com.alibaba</groupId>
-                <artifactId>fastjson</artifactId>
-                <version>${fastjson.version}</version>
-                <scope>provided</scope>
-            </dependency>
-            <dependency>
-                <groupId>commons-cli</groupId>
-                <artifactId>commons-cli</artifactId>
-                <version>${commons-cli.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-</project>