|
|
|
@ -8,6 +8,8 @@ import net.sf.json.JSONObject;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
import static com.dsideal.base.Tools.InitDataEaseDataSet.DB_NAME;
|
|
|
|
|
|
|
|
|
|
public class DataEaseModel {
|
|
|
|
|
/**
|
|
|
|
|
* 获取当前人员可以看到哪些数据集
|
|
|
|
@ -15,7 +17,7 @@ public class DataEaseModel {
|
|
|
|
|
* @param identity_id 身份id
|
|
|
|
|
* @return 数据集列表
|
|
|
|
|
*/
|
|
|
|
|
public List<com.jfinal.plugin.activerecord.Record> getDataSet(int identity_id) {
|
|
|
|
|
public List<Record> getDataSet(int identity_id) {
|
|
|
|
|
String sql = "select * from t_dp_dataset where owner_id=? order by dataset_name";
|
|
|
|
|
return Db.find(sql, identity_id);
|
|
|
|
|
}
|
|
|
|
@ -26,11 +28,12 @@ public class DataEaseModel {
|
|
|
|
|
* @param dataset_id 数据集id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<com.jfinal.plugin.activerecord.Record> getDataSetTableContent(int dataset_id) {
|
|
|
|
|
com.jfinal.plugin.activerecord.Record record = getTableName(dataset_id);
|
|
|
|
|
public List<Record> getDataSetTableContent(int dataset_id) {
|
|
|
|
|
Record record = getTableName(dataset_id);
|
|
|
|
|
if (record == null) return null;
|
|
|
|
|
String sql = "select * from dataease.`" + record.getStr("table_name") + "`";
|
|
|
|
|
return Db.find(sql);
|
|
|
|
|
String sql = "select * from `" + record.getStr("table_name") + "`";
|
|
|
|
|
List<Record> list=Db.use(DB_NAME).find(sql);
|
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -39,7 +42,7 @@ public class DataEaseModel {
|
|
|
|
|
* @param dataset_id 数据集id
|
|
|
|
|
* @return 表对象
|
|
|
|
|
*/
|
|
|
|
|
public com.jfinal.plugin.activerecord.Record getTableName(int dataset_id) {
|
|
|
|
|
public Record getTableName(int dataset_id) {
|
|
|
|
|
String sql = "select * from t_dp_dataset where id=?";
|
|
|
|
|
return Db.findFirst(sql, dataset_id);
|
|
|
|
|
}
|
|
|
|
@ -61,12 +64,12 @@ public class DataEaseModel {
|
|
|
|
|
String sql = "delete from dataease.`" + tableName + "`";
|
|
|
|
|
Db.update(sql);
|
|
|
|
|
}
|
|
|
|
|
List<com.jfinal.plugin.activerecord.Record> list = new ArrayList<>();
|
|
|
|
|
List<Record> list = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < ja.size(); i++) {
|
|
|
|
|
JSONObject jsonObject = ja.getJSONObject(i);
|
|
|
|
|
//遍历jo的每一个属性
|
|
|
|
|
// 或者使用keySet和for-each循环遍历
|
|
|
|
|
com.jfinal.plugin.activerecord.Record record = new Record();
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
for (Object key : jsonObject.keySet()) {
|
|
|
|
|
Object value = jsonObject.get(key);
|
|
|
|
|
if (value.equals("null")) value = null;
|
|
|
|
|