数据库初始化工具完善,执行init-db.bat自动建表和导入初始数据
This commit is contained in:
@@ -3,8 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.jeesite.modules.sys.db;
|
package com.jeesite.modules.sys.db;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
import com.jeesite.common.callback.MethodCallback;
|
import com.jeesite.common.callback.MethodCallback;
|
||||||
@@ -50,12 +48,19 @@ import com.jeesite.modules.sys.service.UserService;
|
|||||||
* @version 2017-10-22
|
* @version 2017-10-22
|
||||||
*/
|
*/
|
||||||
public class InitCoreData extends BaseInitDataTests {
|
public class InitCoreData extends BaseInitDataTests {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void begin() {
|
public void begin() {
|
||||||
super.begin();
|
super.begin();
|
||||||
dataFile = new File(InitCoreData.class.getResource(
|
excelFile = InitCoreData.class.getName().replaceAll("\\.", "/")+".xlsx";
|
||||||
InitCoreData.class.getSimpleName() + ".xlsx").getFile());
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 建表语句执行
|
||||||
|
*/
|
||||||
|
public void createTable() throws Exception{
|
||||||
|
runScript("core.sql");
|
||||||
|
runScript("job.sql");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,5 +25,6 @@ cd %~dp0
|
|||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
call mvn test -Dtest=com.jeesite.test.InitCoreData
|
call mvn test -Dtest=com.jeesite.test.InitCoreData
|
||||||
|
call mvn test -Dtest=com.jeesite.test.InitGenData
|
||||||
|
|
||||||
pause
|
pause
|
||||||
@@ -18,7 +18,8 @@ title %cd%
|
|||||||
|
|
||||||
set currPath=%cd%
|
set currPath=%cd%
|
||||||
|
|
||||||
set MAVEN_OPTS=%MAVEN_OPTS% -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m
|
rem set MAVEN_OPTS=%MAVEN_OPTS% -Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m
|
||||||
|
set MAVEN_OPTS=%MAVEN_OPTS% -Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
if exist "../package/pom.xml" (
|
if exist "../package/pom.xml" (
|
||||||
cd ../package
|
cd ../package
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
|
|
||||||
MAVEN_OPTS=$MAVEN_OPTS -Xms256m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=256m
|
# MAVEN_OPTS=$MAVEN_OPTS -Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m
|
||||||
|
MAVEN_OPTS=$MAVEN_OPTS -Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||||
|
|
||||||
exec mvn clean spring-boot:run -U
|
exec mvn clean spring-boot:run -U
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ rem *
|
|||||||
rem * Author: ThinkGem@163.com
|
rem * Author: ThinkGem@163.com
|
||||||
rem */
|
rem */
|
||||||
echo.
|
echo.
|
||||||
echo [<EFBFBD><EFBFBD>Ϣ] <20><><EFBFBD><EFBFBD> Web <20><><EFBFBD>̡<EFBFBD>
|
echo [信息] 运行Web工程。
|
||||||
echo.
|
echo.
|
||||||
rem pause
|
rem pause
|
||||||
rem echo.
|
rem echo.
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import org.springframework.boot.SpringApplication;
|
|||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||||
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
import org.springframework.boot.web.support.SpringBootServletInitializer;
|
||||||
import org.springframework.context.annotation.Profile;
|
|
||||||
|
|
||||||
import com.jeesite.common.io.PropertiesUtils;
|
import com.jeesite.common.io.PropertiesUtils;
|
||||||
|
|
||||||
@@ -16,7 +15,6 @@ import com.jeesite.common.io.PropertiesUtils;
|
|||||||
* @author ThinkGem
|
* @author ThinkGem
|
||||||
* @version 2018-1-8
|
* @version 2018-1-8
|
||||||
*/
|
*/
|
||||||
@Profile("default")
|
|
||||||
@SpringBootApplication(scanBasePackages={"com.jeesite.modules"})
|
@SpringBootApplication(scanBasePackages={"com.jeesite.modules"})
|
||||||
public class Application extends SpringBootServletInitializer {
|
public class Application extends SpringBootServletInitializer {
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package com.jeesite.test;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.annotation.Rollback;
|
import org.springframework.test.annotation.Rollback;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
import com.jeesite.modules.config.Application;
|
import com.jeesite.modules.config.Application;
|
||||||
|
|
||||||
@@ -14,12 +15,14 @@ import com.jeesite.modules.config.Application;
|
|||||||
* @author ThinkGem
|
* @author ThinkGem
|
||||||
* @version 2017-10-22
|
* @version 2017-10-22
|
||||||
*/
|
*/
|
||||||
|
@ActiveProfiles("test")
|
||||||
@SpringBootTest(classes=Application.class)
|
@SpringBootTest(classes=Application.class)
|
||||||
@Rollback(false)
|
@Rollback(false)
|
||||||
public class InitCoreData extends com.jeesite.modules.sys.db.InitCoreData {
|
public class InitCoreData extends com.jeesite.modules.sys.db.InitCoreData {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void initCoreData() throws Exception{
|
public void initCoreData() throws Exception{
|
||||||
|
createTable();
|
||||||
initLog();
|
initLog();
|
||||||
initConfig();
|
initConfig();
|
||||||
initModule();
|
initModule();
|
||||||
|
|||||||
@@ -6,21 +6,23 @@ package com.jeesite.test;
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.annotation.Rollback;
|
import org.springframework.test.annotation.Rollback;
|
||||||
|
import org.springframework.test.context.ActiveProfiles;
|
||||||
|
|
||||||
import com.jeesite.modules.config.Application;
|
import com.jeesite.modules.config.Application;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化代码生成表测试数据
|
* 初始化代码生成表测试数据
|
||||||
* @author ThinkGem
|
* @author ThinkGem
|
||||||
* @version 2017-10-22
|
* @version 2017-10-22
|
||||||
*/
|
*/
|
||||||
|
@ActiveProfiles("test")
|
||||||
@SpringBootTest(classes=Application.class)
|
@SpringBootTest(classes=Application.class)
|
||||||
@Rollback(false)
|
@Rollback(false)
|
||||||
public class InitGenData extends com.jeesite.modules.gen.db.InitGenData {
|
public class InitGenData extends com.jeesite.modules.gen.db.InitGenData {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void initGenData() throws Exception{
|
public void initGenData() throws Exception{
|
||||||
|
createGenTable();
|
||||||
initGenTreeData();
|
initGenTreeData();
|
||||||
initGenTestData();
|
initGenTestData();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user