parent
8fa40e0042
commit
82f8a30191
@ -1,45 +0,0 @@
|
||||
package com.dsideal.base.Tools;
|
||||
|
||||
import com.dsideal.base.Plugin.YamlProp;
|
||||
import com.jfinal.kit.Prop;
|
||||
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
||||
import com.jfinal.plugin.activerecord.Db;
|
||||
import com.jfinal.plugin.hikaricp.HikariCpPlugin;
|
||||
|
||||
import static com.dsideal.base.BaseApplication.getEnvPrefix;
|
||||
|
||||
public class ClearDataBase {
|
||||
public static Prop PropKit;
|
||||
public static void main(String[] args) {
|
||||
//1、配置数据库
|
||||
String configFile = "application_{?}.yaml".replace("{?}", getEnvPrefix());
|
||||
PropKit = new YamlProp(configFile);
|
||||
|
||||
HikariCpPlugin druid = new HikariCpPlugin(PropKit.get("mysql.jdbcUrl"), PropKit.get("mysql.user"),
|
||||
PropKit.get("mysql.password").trim(), PropKit.get("mysql.driverClassName"));
|
||||
druid.start();
|
||||
// 配置ActiveRecord插件
|
||||
ActiveRecordPlugin arp = new ActiveRecordPlugin(druid);
|
||||
arp.start();
|
||||
|
||||
//2、清空班级表
|
||||
String sql = "truncate table t_base_class";
|
||||
Db.update(sql);
|
||||
|
||||
sql = "truncate table t_base_organization";
|
||||
Db.update(sql);
|
||||
|
||||
sql = "truncate table t_import_student_by_excel";
|
||||
Db.update(sql);
|
||||
|
||||
sql = "truncate table t_import_teacher_by_excel";
|
||||
Db.update(sql);
|
||||
|
||||
sql = "truncate table t_person_duty_charge";
|
||||
Db.update(sql);
|
||||
|
||||
//3、人员表
|
||||
sql = "delete from t_sys_loginperson where identity_id not in (1,2,3)";
|
||||
Db.update(sql);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue