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