MybatisGenerator使用解密密码链接数据库

This commit is contained in:
shuzheng 2017-02-04 17:54:39 +08:00
parent beb85a8550
commit ed15a6f255
2 changed files with 3 additions and 2 deletions

View File

@ -45,7 +45,7 @@ public class MybatisGeneratorUtil {
Map<String, Object> table = null;
// 查询定制前缀项目的所有表
JdbcUtil jdbcUtil = new JdbcUtil(jdbc_driver, jdbc_url, jdbc_username, jdbc_password);
JdbcUtil jdbcUtil = new JdbcUtil(jdbc_driver, jdbc_url, jdbc_username, DESUtil.getDecryptString(jdbc_password));
List<Map> result = jdbcUtil.selectByParams(sql, null);
for (Map map : result) {
System.out.println(map.get("TABLE_NAME"));
@ -62,6 +62,7 @@ public class MybatisGeneratorUtil {
context.put("generator_sqlMapGenerator_targetPackage", "com." + PROJECT_NAME + "." + module_prefix_name + ".dao.mapper");
context.put("generator_javaClientGenerator_targetPackage", "com." + PROJECT_NAME + "." + module_prefix_name + ".dao.mapper");
context.put("targetProject", targetProject);
context.put("master_jdbc_password", DESUtil.getDecryptString(jdbc_password));
VelocityUtil.generate(VM_PATH, module_path, context);
// 删除旧代码
deleteDir(new File(targetProject + "/src/main/java/com/" + PROJECT_NAME + "/" + module_prefix_name.replaceAll("\\.", "/") + "/dao/model"));

View File

@ -49,7 +49,7 @@
<jdbcConnection driverClass="${master.jdbc.driver}"
connectionURL="${master.jdbc.url}"
userId="${master.jdbc.username}"
password="${master.jdbc.password}" />
password="${master_jdbc_password}" />
<!-- model生成 -->
<javaModelGenerator targetPackage="${generator_javaModelGenerator_targetPackage}" targetProject="${targetProject}/src/main/java" />