| @@ -1,50 +0,0 @@ | |||||
| package com.iformall.migration; | |||||
| import org.flywaydb.core.api.migration.BaseJavaMigration; | |||||
| import org.flywaydb.core.api.migration.Context; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import java.sql.ResultSet; | |||||
| import java.sql.Statement; | |||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| public class V201904271650__Update_User_Role extends BaseJavaMigration { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| private final String getTenantIdList = "SELECT tenant_id FROM wx_mall WHERE tenant_id like '%100%'"; | |||||
| public void migrate(Context context) throws Exception { | |||||
| // 获取 tenantId list | |||||
| // 获取 现有的 mall_user_role | |||||
| // 删除已有的用户role | |||||
| // 添加所有的权限到数据库 | |||||
| /* | |||||
| try (Statement select = context.getConnection().createStatement()) { | |||||
| try (ResultSet rows = select.executeQuery(getTenantIdList)) { | |||||
| while (rows.next()) { | |||||
| int id = rows.getInt(1); | |||||
| String anonymizedName = "Anonymous" + id; | |||||
| try (Statement update = context.getConnection().createStatement()) { | |||||
| update.execute("UPDATE person SET name='" + anonymizedName + "' WHERE id=" + id); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| */ | |||||
| } | |||||
| private List<String> getTenantList(Context context) throws Exception { | |||||
| List<String> tlist = new ArrayList<String>(); | |||||
| try (Statement select = context.getConnection().createStatement()) { | |||||
| try (ResultSet rows = select.executeQuery(getTenantIdList)) { | |||||
| while (rows.next()) { | |||||
| tlist.add(rows.getString(0)); | |||||
| } | |||||
| } | |||||
| } | |||||
| return tlist; | |||||
| } | |||||
| } | |||||