|
|
|
@ -111,8 +111,14 @@ public class DataShareModel {
|
|
|
|
|
public void subscribe(int system_id, String subscribe_system_ids) {
|
|
|
|
|
Record record = getSystemById(system_id);
|
|
|
|
|
for (String s : subscribe_system_ids.split(",")) {
|
|
|
|
|
int sub_system_id = Integer.parseInt(s);
|
|
|
|
|
String user_name = record.getStr("user_name");
|
|
|
|
|
PgUtil.grantUserPrivilege(user_name, s, PgUtil.READ);
|
|
|
|
|
//获取此系统的所有表
|
|
|
|
|
List<Record> records = getShareTable(sub_system_id);
|
|
|
|
|
for (Record r : records) {
|
|
|
|
|
String table_name = r.getStr("table_name");
|
|
|
|
|
PgUtil.grantUserPrivilege(user_name, table_name, PgUtil.READ);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
String sql = "update t_datashare_system set subscribe_system_ids=? where system_id=?";
|
|
|
|
|
Db.update(sql, subscribe_system_ids, system_id);
|
|
|
|
|