Browse Source

项目完善

王育民 3 years ago
parent
commit
5c8c81c430

+ 0 - 1
config/application.properties

@@ -1 +0,0 @@
-server.port=8000

+ 0 - 0
config/application.yml


+ 32 - 0
pom.xml

@@ -31,9 +31,41 @@
         <java.version>1.8</java.version>
         <maven.compiler.source>${java.version}</maven.compiler.source>
         <maven.compiler.target>${java.version}</maven.compiler.target>
+        <build.finalName.core>server-core</build.finalName.core>
+        <build.finalName.control>server-control</build.finalName.control>
     </properties>
 
     <dependencies>
+
+        <!-- Web -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-undertow</artifactId>
+        </dependency>
+
         <!-- https://mvnrepository.com/artifact/com.alibaba.spring.boot/dubbo-spring-boot-starter -->
         <dependency>
             <groupId>com.alibaba.spring.boot</groupId>

+ 13 - 0
server-dao/pom.xml

@@ -26,4 +26,17 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <sourceDirectory>src/main/java</sourceDirectory>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <includes>
+                    <include>**/*.*</include>
+                </includes>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+    </build>
+
 </project>

+ 0 - 6
server-dao/src/main/resources/mapper/UserMapper.fxml

@@ -1,6 +0,0 @@
-<?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="cn.minbb.server.dao.UserMapper">
-
-</mapper>

+ 19 - 0
server-dao/src/main/resources/mapper/UserMapper.xml

@@ -0,0 +1,19 @@
+<?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="cn.minbb.server.dao.UserMapper">
+    <resultMap id="BaseResultMap" type="cn.minbb.server.beans.User">
+        <id column="id" jdbcType="INTEGER" property="id"/>
+        <result column="username" jdbcType="VARCHAR" property="username"/>
+        <result column="password" jdbcType="VARCHAR" property="password"/>
+    </resultMap>
+
+    <select id="findAll" resultMap="BaseResultMap">
+        SELECT '1'      AS id,
+               '111'    AS username,
+               '111111' AS password
+        UNION ALL
+        SELECT '2'      AS id,
+               '222'    AS username,
+               '222222' AS password
+    </select>
+</mapper>

+ 2 - 13
server-dao/src/main/resources/mybatis/mybatis-config.xml

@@ -1,32 +1,21 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-config.dtd">
-
+<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
 <configuration>
-    <!-- SQL日志输出配置与 2019.07.11 删除,符合《日志规范》:“严禁生产环境打印mybatis的sql执行日志”标准 -->
-
     <plugins>
-        <!-- PageHelper分页插件 -->
+        <!-- PageHelper 分页插件 -->
         <plugin interceptor="com.github.pagehelper.PageHelper">
-
             <!-- 4.0.0 以上版本可自动识别 -->
             <property name="dialect" value="mysql"/>
-
             <!-- RowBounds:参数offset作为PageNum使用 - 默认不使用 -->
             <property name="offsetAsPageNum" value="false"/>
-
             <!-- RowBounds:是否进行count查询 - 默认不查询 -->
             <property name="rowBoundsWithCount" value="false"/>
-
             <!-- 当设置为true的时候,如果pagesize设置为0(或RowBounds的limit=0),就不执行分页,返回全部结果 -->
             <property name="pageSizeZero" value="true"/>
-
             <!-- 分页合理化 -->
             <property name="reasonable" value="false"/>
-
             <!-- 是否支持接口参数来传递分页参数,默认false -->
             <property name="supportMethodsArguments" value="false"/>
-
             <!-- 是否返回分页信息 -->
             <property name="returnPageInfo" value="none"/>
         </plugin>

+ 10 - 0
server-service-impl/pom.xml

@@ -33,4 +33,14 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <finalName>${build.finalName.core}-${parent.version}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

+ 4 - 2
server-service-impl/src/main/java/cn/minbb/server/service/impl/UserServiceImpl.java

@@ -1,8 +1,10 @@
 package cn.minbb.server.service.impl;
 
 import cn.minbb.server.beans.User;
+import cn.minbb.server.dao.UserMapper;
 import cn.minbb.server.service.UserService;
 import com.alibaba.dubbo.config.annotation.Service;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -10,8 +12,8 @@ import java.util.List;
 @Service
 public class UserServiceImpl implements UserService {
 
-//    @Autowired
-//    private UserMapper userMapper;
+    @Autowired
+    private UserMapper userMapper;
 
     @Override
     public List<User> findAll() {

+ 6 - 3
server-service-impl/src/main/resources/application.yml

@@ -1,6 +1,5 @@
 server:
-  port: 9002
-
+  port: 8001
 dubbo:
   application:
     name: server-provider
@@ -10,9 +9,13 @@ dubbo:
     check: false
   protocol:
     name: dubbo
-    port: 20881
+    port: 12081
   monitor:
     protocol: register
   consumer:
     check: false
     timeout: 3000
+mybatis:
+  mapper-locations: classpath:mapper/*.xml
+  config-location: classpath:mybatis/mybatis-config.xml
+  check-config-location: true

+ 10 - 29
server-web/pom.xml

@@ -38,35 +38,16 @@
             <version>1.0-SNAPSHOT</version>
             <scope>compile</scope>
         </dependency>
-
-        <!-- Web -->
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-web</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-tomcat</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-test</artifactId>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.junit.vintage</groupId>
-                    <artifactId>junit-vintage-engine</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-undertow</artifactId>
-        </dependency>
     </dependencies>
 
+    <build>
+        <finalName>${build.finalName.control}-${parent.version}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

+ 2 - 2
server-web/src/main/resources/application.yml

@@ -1,10 +1,10 @@
 server:
-  port: 8001
+  port: 8000
 dubbo:
   application:
     name: server-consumer
   registry:
-    address: zookeeper://42.193.110.241:2182
+    address: zookeeper://42.193.110.241:2181
     protocol: zookeeper
     check: false
   monitor: