|
|
|
@ -61,10 +61,32 @@ public class DataShareModel {
|
|
|
|
|
* @param system_id
|
|
|
|
|
*/
|
|
|
|
|
public void delSystem(int system_id) {
|
|
|
|
|
//此系统的用户
|
|
|
|
|
//1、删除此系统的用户
|
|
|
|
|
String user_name = getSystemById(system_id).getStr("user_name");
|
|
|
|
|
PgUtil.delUser(user_name);
|
|
|
|
|
//2、删除数据表记录
|
|
|
|
|
Db.deleteById("t_datashare_system", "system_id", system_id);
|
|
|
|
|
//3、删除此系统共享表
|
|
|
|
|
String sql = "delete from t_datashare_table where system_id=?";
|
|
|
|
|
Db.update(sql, system_id);
|
|
|
|
|
//4、删除所有其它系统对此系统的订阅
|
|
|
|
|
sql = "select * from t_datashare_system";
|
|
|
|
|
List<Record> list = Db.find(sql);
|
|
|
|
|
for (Record record : list) {
|
|
|
|
|
int sub_system_id = record.getInt("system_id");
|
|
|
|
|
String subscribe_system_ids = record.getStr("subscribe_system_ids");
|
|
|
|
|
String new_subscribe_system_ids = "";
|
|
|
|
|
if (!StrKit.isBlank(subscribe_system_ids)) {
|
|
|
|
|
for (String s : subscribe_system_ids.split(",")) {
|
|
|
|
|
if (!s.equals(system_id + "")) new_subscribe_system_ids += s + ",";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!new_subscribe_system_ids.isEmpty()) {
|
|
|
|
|
new_subscribe_system_ids = new_subscribe_system_ids.substring(0, new_subscribe_system_ids.length() - 1);//去最后的逗号
|
|
|
|
|
}
|
|
|
|
|
sql = "update t_datashare_system set subscribe_system_ids=? where system_id=?";
|
|
|
|
|
Db.update(sql, new_subscribe_system_ids, sub_system_id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|