feature(db自动构建)增加db自动构建脚本及maven依赖包。

This commit is contained in:
doufenghu
2018-11-02 16:45:31 +08:00
parent 6673cedd1a
commit 678560dc09
12 changed files with 1789 additions and 49 deletions

View File

@@ -1,7 +1,26 @@
maat rest service for web
#NTC Galaxy 服务
##应用简介
Galaxy 基于Springmvc 搭建 Restful 服务平台使用方可通过Swagger API 友好界面方式了解与调试服务所提供的接口。
##内置功能
<resources>
###配置加载
1. 配置解析基于applicationConfig-parser 配置文件提供基于MAAT结构和非MAAT结构的配置还原、规则验证处理。
2. 配置转换基于applicationConfig-maatXX 配置文件对解析数据根据maat规则进行格式转换根据存储库oracle\redis)不同,形成不同的转换规则。
3. 业务规则处理基于applicationConfig-rule 配置文件对处理的配置规则进行详细定义。包含业务动作关系、MAAT配置域关系、存储关系、多分发关系及域自定义关系。
###数据获取
1. 基础日志服务接口:对原始业务日志数据封装,内置性能优化、超时重试机制。
2. 报表日志服务接口:对报表进行数据进行统一封装,内置统计、多源处理机制。
3. 流量构成服务接口:对流量格式转换数据进行统一封装,内置统计、多源处理机制。
##安装部署
###ide 环境
需将如下内容放置在\<build>\</build>里。
```
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
@@ -19,6 +38,9 @@ maat rest service for web
<includes>
<include>**/*.mmdb</include>
<include>**/*.dat</include>
<include>**/*.sh</include>
<include>**/*.bat</include>
<include>**/*.sql</include>
</includes>
</resource>
@@ -31,4 +53,26 @@ maat rest service for web
<filtering>true</filtering>
</resource>
</resources>
</resources>
```
###数据库初始化
1. 打开 my.cnf 给 [mysqld] 增加如下配置:
```
sql_mode="ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
```
2. linux 系统下运行bin\init-db.sh
###数据库更新
1. 更新pom.xml
```
<id>init-db</id> 内部增加一个更新sql语句
**注意**初始化后需把初始化sql注释掉否则将对整个库进行更新
```
2. 可通过xls、csv 进行动态数据导入
参看operation 标签的例子进行增加。

29
bin/init-db.bat Normal file
View File

@@ -0,0 +1,29 @@
@echo off
rem /**
rem * Copyright &copy; All rights reserved.
rem *
rem * Author: darnell
rem */
echo.
echo [info] rebuilding your DB and clearing data......
echo.
pause
echo.
echo [INFO] This operation will clear your data and restore initial state
echo.
echo [WARN] Do you confirm the continuation ? Otherwise, please close the window
echo.
pause
echo.
echo [WARN] Do you confirm the continuation? Otherwise, please close the window
echo.
pause
echo.
cd %~dp0
cd ..
call mvn antrun:run -Pinit-db
cd db
pause

32
bin/init-db.sh Normal file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# /**
# * Copyright (c) All rights reserved.
# *
# * Author: darnell
# *
# */
echo ""
echo "[info] rebuilding your DB and clearing data......"
read -s -n1 -p "请按任意键继续 ... "
echo ""
echo "[INFO] This operation will clear your data and restore initial state"
read -s -n1 -p "请按任意键继续 ... "
echo ""
echo "[WARN] Do you confirm the continuation ? Otherwise, please close the window5"
read -s -n1 -p "请按任意键继续 ... "
echo ""
echo "[WARN] Do you confirm the continuation ? Otherwise, please close the window4"
read -s -n1 -p "请按任意键继续 ... "
echo ""
echo "[WARN] Do you confirm the continuation ? Otherwise, please close the window3"
read -s -n1 -p "请按任意键继续 ... "
echo ""
echo "[WARN] Do you confirm the continuation ? Otherwise, please close the window2"
read -s -n1 -p "请按任意键继续 ... "
echo ""
echo "[WARN] Do you confirm the continuation ? Otherwise, please close the window。1"
read -s -n1 -p "请按任意键继续 ... "
echo ""
cd ..
mvn antrun:run -Pinit-db

22
db/galaxy_user_mysql.sql Normal file
View File

@@ -0,0 +1,22 @@
-- 打开 my.ini 给 [mysqld] 增加如下配置:
-- sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
set global read_only=0;
create user 'galaxy'@'%' identified by 'ceiec2018!';
create database galaxy_test DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
grant all privileges on galaxy_test.* to 'galaxy'@'%' identified by 'ceiec2018!';
flush privileges;
-- 显示mariadb 目前支持引擎
show engines;
-- mariadb运行命令下增加federated引擎用于跨库获取标签表 ---
INSTALL PLUGIN federated SONAME 'ha_federatedx.so';

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,265 @@
/*Table structure for table ui -from ntc ui */
drop table if exists ui_asn_ip_cfg;
drop table if exists ui_sys_dict_info;
drop table if exists ui_code_app_dic;
drop table if exists ui_cfg_num_statistics;
drop table if exists ui_request_num_statistics;
drop table if exists ui_sys_data_dictionary_item;
drop table if exists ui_code_behavior_type_dic;
drop table if exists ui_code_browser_type_dic;
drop table if exists ui_code_os_type_dic;
drop table if exists ui_code_protocol_type_dic;
drop table if exists ui_code_service_type_dic;
drop table if exists ui_code_web_service_dic;
drop table if exists ui_service_dict_info;
drop table if exists ui_request_info;
drop table if exists ui_task_info;
drop table if exists ui_config_group_info;
drop table if exists ui_website_domain_topic;
CREATE TABLE `ui_asn_ip_cfg` (
`cfg_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键,自增',
`cfg_desc` varchar(128) DEFAULT NULL,
`ip_type` int(11) NOT NULL COMMENT 'IPV4=4,IPV6=6',
`direction` int(11) NOT NULL COMMENT '0双向1单向默认缺省为双向。',
`protocol` int(11) NOT NULL COMMENT '6表示tcp,17表示udp0表示任意',
`protocol_id` int(11) NOT NULL COMMENT '非0时maat规范需写入通用IP配置表与通用协议类型配置表 此表固定写0',
`action` int(11) NOT NULL COMMENT '1:阻断2监测 5 FD 白名单6监测白名单7: FD 监测都白名单应与业务ID所代表的逻辑相匹配8-灰名单',
`is_valid` int(11) NOT NULL COMMENT '0无效1有效-1删除;1 未审核时配置可删除;2 审核通过此字段置1;3 取消审核通过此字段置0',
`is_audit` int(11) NOT NULL COMMENT '0未审核1审核通过2审核未通过3取消审核通过;1 审核未通过,配置可修改;2 审核通过,配置不可删除,只能取消审核通过',
`creator_id` int(11) NOT NULL COMMENT '取自sys_user.id',
`create_time` datetime NOT NULL,
`editor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`edit_time` datetime DEFAULT NULL,
`auditor_id` int(11) DEFAULT NULL COMMENT '取自sys_user.id',
`audit_time` datetime DEFAULT NULL,
`service_id` int(11) NOT NULL COMMENT '参考系统业务类型管理表',
`request_id` int(11) NOT NULL COMMENT '取自request_info.id',
`region_id` int(11) NOT NULL COMMENT '取自服务接口返回的maat配置的域id配置初始入库时获取',
`is_area_effective` int(11) NOT NULL COMMENT '0否1是',
`classify` varchar(128) DEFAULT NULL COMMENT '分类id多个用英文逗号分隔',
`attribute` varchar(128) DEFAULT NULL COMMENT '性质id多个用英文逗号分隔',
`lable` varchar(128) DEFAULT NULL COMMENT '标签id,多个用英文逗号分隔',
`area_effective_ids` varchar(1024) DEFAULT NULL COMMENT '多个英文逗号分隔',
`function_id` int(11) DEFAULT NULL,
`cfg_region_code` int(11) DEFAULT NULL,
`cfg_type` varchar(64) DEFAULT NULL,
`ip_pattern` int(11) NOT NULL,
`src_ip_address` varchar(128) NOT NULL,
`port_pattern` int(11) NOT NULL,
`src_port` varchar(16) NOT NULL,
`dest_ip_address` varchar(128) DEFAULT NULL,
`dest_port` varchar(16) DEFAULT NULL,
`ratelimit` varchar(10) DEFAULT NULL,
`asn_ip_group` int(11) DEFAULT NULL,
`user_region1` varchar(1024) DEFAULT '' COMMENT '预留自定义域1',
`user_region2` varchar(1024) DEFAULT '' COMMENT '预留自定义域2',
`user_region3` varchar(1024) DEFAULT '' COMMENT '预留自定义域3',
`user_region4` varchar(1024) DEFAULT '' COMMENT '预留自定义域4',
`user_region5` varchar(1024) DEFAULT '' COMMENT '预留自定义域5',
PRIMARY KEY (`cfg_id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/asn_ip_cfg';
CREATE TABLE `ui_sys_dict_info` (
`sys_dict_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '字典ID',
`item_type` int(11) DEFAULT NULL COMMENT '数据类型\r\n1地域\r\n2运营商\r\n3app强特征作用域item_code为service_iditem_value为作用域描述\r\n',
`item_code` varchar(64) DEFAULT NULL COMMENT '编码',
`item_value` varchar(64) DEFAULT NULL COMMENT '英文用于界面国际化配置文件的code',
`item_desc` varchar(128) DEFAULT NULL COMMENT '描述信息',
`parent_id` int(11) DEFAULT NULL COMMENT '父ID 无父属性默认填0',
`is_leaf` int(11) DEFAULT NULL COMMENT '是否叶子节点0-否 1-是只有一级填0',
`level_no` int(11) DEFAULT NULL,
`is_valid` int(11) DEFAULT NULL COMMENT '有效标志 1-有效 0-无效',
`creator_id` int(11) DEFAULT NULL COMMENT '创建人员 取自sys_user.id',
`create_time` datetime DEFAULT NULL COMMENT '配置时间',
`editor_id` int(11) DEFAULT NULL COMMENT '修改人员取自sys_user.id',
`edit_time` datetime DEFAULT NULL COMMENT '修改时间',
`is_initianlize` int(11) NOT NULL DEFAULT 0 COMMENT '是否是初始化数据1是0否',
PRIMARY KEY (`sys_dict_id`)
) ENGINE=FEDERATED AUTO_INCREMENT=448 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/sys_dict_info';
CREATE TABLE `ui_code_app_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`app_name` varchar(255) DEFAULT '',
`app_name_zh` varchar(255) DEFAULT NULL,
`view_code` varchar(255) DEFAULT '' COMMENT '应用编码',
`icon` varchar(255) DEFAULT '',
`behavior` varchar(255) DEFAULT '' COMMENT '行为细分',
`core_app` int(11) DEFAULT NULL COMMENT '是否是核心应用10',
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=399 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_app_dic';
CREATE TABLE `ui_cfg_num_statistics` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`function_id` int(11) NOT NULL,
`service_id` int(11) NOT NULL,
`action` int(11) NOT NULL,
`cfg_state` int(11) NOT NULL COMMENT '0未审核1已审核2审核未通过3审核取消-1删除',
`compile_id` int(11) DEFAULT 0,
`statistic_time` datetime DEFAULT NULL COMMENT '统计时间',
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/cfg_num_statistics';
CREATE TABLE `ui_request_num_statistics` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`function_id` int(11) NOT NULL,
`service_id` int(11) NOT NULL,
`request_id` int(11) NOT NULL COMMENT '来函信息',
`statistic_time` datetime DEFAULT NULL COMMENT '统计时间',
`compile_id` int(11) DEFAULT 0,
PRIMARY KEY (`id`)
)ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/request_num_statistics';
CREATE TABLE `ui_sys_data_dictionary_item` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`item_code` varchar(128) NOT NULL COMMENT '编码数据表中存储的值如0、1、2、3',
`item_value` varchar(256) NOT NULL COMMENT '编码对应的值(页面上展现的具体意义)',
`item_desc` varchar(256) DEFAULT NULL COMMENT '编码描述信息',
`item_sort` int(2) NOT NULL COMMENT '排序序号',
`status` int(11) DEFAULT 1 COMMENT '该条数据是否可用1可用 0禁用',
`type` int(11) DEFAULT 1 COMMENT '该条记录页面是否可维护1可维护 0不可维护',
`dictionary_id` int(11) DEFAULT NULL COMMENT '关联数据字典外键',
PRIMARY KEY (`id`)
)ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/sys_data_dictionary_item';
CREATE TABLE `ui_code_behavior_type_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`behavior_type` varchar(255) DEFAULT NULL,
`view_code` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_behavior_type_dic';
CREATE TABLE `ui_code_browser_type_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`browser_type` varchar(255) DEFAULT NULL,
`view_code` varchar(255) DEFAULT NULL,
`icon` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_browser_type_dic';
CREATE TABLE `ui_code_os_type_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`os_type` varchar(255) DEFAULT NULL,
`view_code` varchar(255) DEFAULT NULL,
`icon` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_os_type_dic';
CREATE TABLE `ui_code_protocol_type_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`protocol_type` varchar(255) DEFAULT '',
`view_code` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_protocol_type_dic';
CREATE TABLE `ui_code_service_type_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`service_type` varchar(255) DEFAULT '' COMMENT '业务类型',
`view_code` varchar(255) DEFAULT NULL COMMENT '界面编码',
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_service_type_dic';
CREATE TABLE `ui_code_web_service_dic` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '序号',
`website` varchar(255) DEFAULT '',
`domain_name` varchar(255) DEFAULT '' COMMENT '域名',
`view_code` varchar(255) DEFAULT '',
`icon` varchar(255) DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/code_web_service_dic';
CREATE TABLE `ui_service_dict_info` (
`service_dict_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '字典ID',
`item_type` int(11) DEFAULT NULL COMMENT '数据类型\r\n1分类\r\n2性质\r\n3标签\r\n',
`item_code` varchar(64) DEFAULT NULL COMMENT '编码',
`item_value` varchar(64) DEFAULT NULL COMMENT '编码对应值',
`item_desc` varchar(128) DEFAULT NULL COMMENT '描述信息',
`parent_id` int(11) DEFAULT NULL COMMENT '父ID无父属性默认填0',
`is_leaf` int(11) DEFAULT NULL COMMENT '是否叶子节点0-否 1-是只有一级填0',
`level_no` int(11) DEFAULT NULL,
`is_valid` int(11) DEFAULT NULL COMMENT '有效标志1-有效 0-无效',
`creator_id` int(11) DEFAULT NULL COMMENT '创建人员取自sys_user.id',
`create_time` datetime DEFAULT NULL COMMENT '配置时间',
`editor_id` int(11) DEFAULT NULL COMMENT '修改人员取自sys_user.id',
`edit_time` datetime DEFAULT NULL COMMENT '修改时间',
PRIMARY KEY (`service_dict_id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/service_dict_info';
CREATE TABLE `ui_request_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '配置ID',
`request_number` varchar(512) DEFAULT NULL COMMENT 'request_number字段与request_title互换使用request_number当来函标题使用',
`request_org` varchar(128) NOT NULL COMMENT '来函单位',
`request_time` date NOT NULL COMMENT '来函时间',
`request_title` varchar(512) NOT NULL COMMENT 'request_number字段与request_title互换使用request_title当来函函号使用',
`request_content` varchar(4000) NOT NULL COMMENT '来函内容',
`is_valid` int(11) NOT NULL COMMENT '0无效1有效-1删除',
`is_audit` int(11) NOT NULL COMMENT '是否审核',
`creator_id` int(11) NOT NULL COMMENT '创建人员',
`create_time` date NOT NULL COMMENT '配置时间',
`editor_id` int(11) DEFAULT NULL COMMENT '修改人员',
`edit_time` date DEFAULT NULL COMMENT '修改时间',
`auditor_id` int(11) DEFAULT NULL COMMENT '审核人员',
`audit_time` date DEFAULT NULL COMMENT '审核时间',
`task_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `request_info_request_number` (`request_number`) USING BTREE
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/request_info';
CREATE TABLE `ui_task_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '配置ID',
`task_name` varchar(64) NOT NULL,
`task_org` varchar(128) NOT NULL,
`task_time` date NOT NULL,
`task_desc` varchar(512) DEFAULT NULL,
`is_valid` int(11) NOT NULL,
`is_audit` int(11) NOT NULL,
`creator_id` int(11) NOT NULL,
`create_time` date NOT NULL,
`editor_id` int(11) DEFAULT NULL,
`edit_time` date DEFAULT NULL,
`auditor_id` int(11) DEFAULT NULL,
`audit_time` date DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `task_info_task_name` (`task_name`) USING BTREE
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/task_info';
CREATE TABLE `ui_config_group_info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`group_id` bigint(20) NOT NULL,
`group_name` varchar(128) NOT NULL,
`is_issued` int(11) NOT NULL COMMENT '0否1是',
`insert_time` datetime NOT NULL,
`update_time` datetime DEFAULT NULL,
`group_type` int(11) DEFAULT NULL COMMENT '1:协议2内容3区域 ,4 asn',
`compile_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/config_group_info';
CREATE TABLE `ui_website_domain_topic` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`website_service_id` bigint(20) DEFAULT NULL COMMENT '网站服务Id',
`domain` varchar(200) DEFAULT NULL COMMENT '域名',
`topic_id` bigint(20) DEFAULT NULL COMMENT '主题Id',
`create_time` timestamp NULL DEFAULT NULL ON UPDATE current_timestamp(),
`is_valid` int(1) DEFAULT 1,
`icon` varchar(200) DEFAULT NULL COMMENT '图标',
`desc` varchar(400) DEFAULT NULL COMMENT '描述信息',
`creator_id` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=FEDERATED AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 CONNECTION='mysql://root:111111@192.168.10.204:3306/gwall/website_domain_topic';

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,84 @@
SET SESSION FOREIGN_KEY_CHECKS=0;
/* Drop Tables */
DROP TABLE IF EXISTS test_data;
DROP TABLE IF EXISTS test_data_child;
DROP TABLE IF EXISTS test_tree;
/* Create Tables */
-- 测试数据
CREATE TABLE test_data
(
id varchar(64) NOT NULL COMMENT '编号',
test_input varchar(200) COMMENT '单行文本',
test_textarea varchar(200) COMMENT '多行文本',
test_select varchar(10) COMMENT '下拉框',
test_select_multiple varchar(200) COMMENT '下拉多选',
test_radio varchar(10) COMMENT '单选框',
test_checkbox varchar(200) COMMENT '复选框',
test_date datetime COMMENT '日期选择',
test_datetime datetime COMMENT '日期时间',
test_user_code varchar(64) COMMENT '用户选择',
test_office_code varchar(64) COMMENT '机构选择',
test_area_code varchar(64) COMMENT '区域选择',
test_area_name varchar(100) COMMENT '区域名称',
status char(1) DEFAULT '0' NOT NULL COMMENT '状态0正常 1删除 2停用',
create_by varchar(64) NOT NULL COMMENT '创建者',
create_date datetime NOT NULL COMMENT '创建时间',
update_by varchar(64) NOT NULL COMMENT '更新者',
update_date datetime NOT NULL COMMENT '更新时间',
remarks varchar(500) COMMENT '备注信息',
PRIMARY KEY (id)
) COMMENT = '测试数据';
-- 测试数据子表
CREATE TABLE test_data_child
(
id varchar(64) NOT NULL COMMENT '编号',
test_sort int COMMENT '排序号',
test_data_id varchar(64) COMMENT '父表主键',
test_input varchar(200) COMMENT '单行文本',
test_textarea varchar(200) COMMENT '多行文本',
test_select varchar(10) COMMENT '下拉框',
test_select_multiple varchar(200) COMMENT '下拉多选',
test_radio varchar(10) COMMENT '单选框',
test_checkbox varchar(200) COMMENT '复选框',
test_date datetime COMMENT '日期选择',
test_datetime datetime COMMENT '日期时间',
test_user_code varchar(64) COMMENT '用户选择',
test_office_code varchar(64) COMMENT '机构选择',
test_area_code varchar(64) COMMENT '区域选择',
test_area_name varchar(100) COMMENT '区域名称',
PRIMARY KEY (id)
) COMMENT = '测试数据子表';
-- 测试树表
CREATE TABLE test_tree
(
tree_code varchar(64) NOT NULL COMMENT '节点编码',
parent_code varchar(64) NOT NULL COMMENT '父级编号',
parent_codes varchar(1000) NOT NULL COMMENT '所有父级编号',
tree_sort decimal(10) NOT NULL COMMENT '本级排序号(升序)',
tree_sorts varchar(1000) NOT NULL COMMENT '所有级别排序号',
tree_leaf char(1) NOT NULL COMMENT '是否最末级',
tree_level decimal(4) NOT NULL COMMENT '层次级别',
tree_names varchar(1000) NOT NULL COMMENT '全节点名',
tree_name varchar(200) NOT NULL COMMENT '节点名称',
status char(1) DEFAULT '0' NOT NULL COMMENT '状态0正常 1删除 2停用',
create_by varchar(64) NOT NULL COMMENT '创建者',
create_date datetime NOT NULL COMMENT '创建时间',
update_by varchar(64) NOT NULL COMMENT '更新者',
update_date datetime NOT NULL COMMENT '更新时间',
remarks varchar(500) COMMENT '备注信息',
PRIMARY KEY (tree_code)
) COMMENT = '测试树表';

196
pom.xml
View File

@@ -17,7 +17,7 @@
<name>galaxy-service</name>
<groupId>com.nis.galaxy</groupId>
<artifactId>galaxy-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>Release-1.3</version>
<!-- 仓库地址构建 -->
<repositories>
@@ -37,54 +37,41 @@
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
<include>**/*.xsd</include>
<include>**/*.yml</include>
</includes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<includes>
<include>**/*.mmdb</include>
<include>**/*.dat</include>
<include>**/*.sh</include>
<include>**/*.bat</include>
<include>**/*.sql</include>
</includes>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
<filtering>true</filtering>
</resource>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</resources>
<!-- mybatis-generator-plugin -->
<!-- <pluginExecution> -->
<!-- <pluginExecutionFilter> -->
<!-- <groupId>org.mybatis.generator</groupId> -->
<!-- <artifactId>mybatis-generator-maven-plugin</artifactId> -->
<!-- <versionRange>[1.3.2,)</versionRange> -->
<!-- <goals> -->
<!-- <goal>generate</goal> -->
<!-- </goals> -->
<!-- </pluginExecutionFilter> -->
<!-- <action> -->
<!-- <ignore /> -->
<!-- </action> -->
<!-- </pluginExecution> -->
</pluginExecutions>
</lifecycleMappingMetadata>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- <plugin> -->
<!-- <groupId>org.mybatis.generator</groupId> -->
@@ -127,7 +114,7 @@
<!-- </plugin> -->
<plugin>
<!-- <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>jar</version>
@@ -142,6 +129,9 @@
<contextPath>/</contextPath>
</configuration>
</plugin>
-->
<!-- Compiler 插件, 设定JDK版本 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
@@ -152,6 +142,43 @@
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- resource插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
</plugin>
<!-- install插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<!-- clean插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
</plugin>
<!-- ant插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
</plugin>
<!-- dependency插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
</plugin>
</plugins>
</build>
@@ -572,4 +599,81 @@
</dependencies>
<profiles>
<!--init db-->
<profile>
<id>init-db</id>
<dependencies>
<dependency>
<groupId>org.dbunit</groupId>
<artifactId>dbunit</artifactId>
<version>2.4.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.2-FINAL</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<configuration>
<target>
<!-- mysql -->
<property name="dbunit.datatype" value="org.dbunit.ext.mysql.MySqlDataTypeFactory" />
<!-- mssql
<property name="dbunit.datatype" value="org.dbunit.ext.mssql.MsSqlDataTypeFactory" /> -->
<!-- oracle
<property name="dbunit.datatype" value="org.dbunit.ext.oracle.Oracle10DataTypeFactory" /> -->
<property file="src/main/resources/deploy-producer.properties" />
<sql driver="${jdbc.deploy.driver}" url="${jdbc.deploy.url}" userid="${jdbc.deploy.username}" password="${jdbc.deploy.password}"
onerror="continue" encoding="${maven.compiler.encoding}">
<classpath refid="maven.test.classpath" />
<!--<transaction src="db/init/galaxy_stru_${jdbc.type}.sql"/>
<transaction src="db/init/galaxy_stru_ui_${jdbc.type}.sql"/>
<transaction src="db/init/galaxy_data_${jdbc.type}.sql"/>-->
<transaction src="db/test/galaxy_test_${jdbc.type}.sql"/>
</sql>
<taskdef name="dbunit" classname="org.dbunit.ant.DbUnitTask" classpathref="maven.test.classpath" />
<!-- mysql、mssql -->
<dbunit driver="${jdbc.deploy.driver}" url="${jdbc.deploy.url}" userid="${jdbc.deploy.username}"
password="${jdbc.deploy.password}">
<!-- oracle
<dbunit driver="${jdbc.driver}" url="${jdbc.url}" userid="${jdbc.username}"
password="${jdbc.password}" schema="${jdbc.username}" > -->
<dbconfig>
<property name="datatypeFactory" value="${dbunit.datatype}" />
</dbconfig>
<classpath refid="maven.test.classpath" />
<operation type="INSERT" src="db/test/galaxy_test_data.xls" format="xls" transaction="true"/>
</dbunit>
</target>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,5 @@
jdbc.type=mysql
jdbc.deploy.driver=com.mysql.jdbc.Driver
jdbc.deploy.url=jdbc:mysql://192.168.10.204:3306/galaxy_test?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull
jdbc.deploy.username=galaxy
jdbc.deploy.password=ceiec2018!