数据表如下:
image.png image.png
package wht.core.db
import com.hand.hap.db.excel.ExcelDataLoader
import com.hand.hap.liquibase.MigrationHelper
def mhi = MigrationHelper.getInstance()
dbType = MigrationHelper.getInstance().dbType()
databaseChangeLog(logicalFilePath:"wht/core/db/2018-08-01-03-init-data.groovy"){
changeSet(author: "ora_20796", id: "20180801-ora-20796csz-3") {
//sqlFile(path: MigrationHelper.getInstance().dataPath("com/hand/hap/db/data/"+dbType+"/demo.sql"), encoding: "UTF-8")
}
//Milestone , excel data, runAlways=true
changeSet(author: "ora_20796", id: "20180801-ora-20796csz-3", runAlways:"true"){
customChange(class:ExcelDataLoader.class.name){
param(name:"filePath",value:MigrationHelper.getInstance().dataPath("wht/core/db/data/2018-08-01-init-data.xlsx"))
}
}
}
然后打包
mvn clean instrall
初始化数据:
mvn process-resources -D skipLiquibaseRun=false -D db.driver=com.mysql.jdbc.Driver -D db.url=jdbc:[mysql://localhost:3306/wht_dev](mysql://localhost:3306/wht_dev) -D db.user=root -D db.password=root -D db.skipUpdateTables="sys_config,sys_user"
网友评论