新完成了一些metaDetail函数
This commit is contained in:
parent
7783f78a95
commit
493f381586
@ -206,6 +206,68 @@ public class DBConnector {
|
|||||||
LOGGER.error(e.getMessage());
|
LOGGER.error(e.getMessage());
|
||||||
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||||
}
|
}
|
||||||
return new JsonObject();
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static JsonObject queryMapRuleByOffset(int offset, int count, String localDoId) {
|
||||||
|
String sql = "select * from registry.map_rule where \"localMetadata\" = ? limit ? offset ? ;";
|
||||||
|
|
||||||
|
// execute sql
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
try {
|
||||||
|
connect();
|
||||||
|
pstmt = jdbcConnection.prepareStatement(sql);
|
||||||
|
pstmt.setString(1, localDoId);
|
||||||
|
pstmt.setInt(2, count);
|
||||||
|
pstmt.setInt(3, offset);
|
||||||
|
|
||||||
|
String[] columns = {
|
||||||
|
"name",
|
||||||
|
"localMetadata",
|
||||||
|
"remoteMetadata",
|
||||||
|
"mapRule",
|
||||||
|
"version",
|
||||||
|
"createTime",
|
||||||
|
"updateTime",
|
||||||
|
"creator",
|
||||||
|
"updater",
|
||||||
|
"status"
|
||||||
|
};
|
||||||
|
|
||||||
|
System.out.println(pstmt);
|
||||||
|
|
||||||
|
ResultSet rs = null;
|
||||||
|
int total = 0;
|
||||||
|
JsonObject ret = new JsonObject();
|
||||||
|
JsonArray data = new JsonArray();
|
||||||
|
rs = pstmt.executeQuery();
|
||||||
|
while (rs.next()) {
|
||||||
|
total ++;
|
||||||
|
JsonObject row = new JsonObject();
|
||||||
|
for (String col : columns) {
|
||||||
|
if (col.equals("createTime") || col.equals("updateTime"))
|
||||||
|
row.addProperty(col, rs.getTimestamp(col).toString());
|
||||||
|
else if (col.equals("status"))
|
||||||
|
row.addProperty(col, rs.getBoolean(col));
|
||||||
|
else
|
||||||
|
row.addProperty(col, rs.getString(col));
|
||||||
|
}
|
||||||
|
data.add(row);
|
||||||
|
}
|
||||||
|
ret.addProperty("total", total);
|
||||||
|
ret.add("data", data);
|
||||||
|
rs.close();
|
||||||
|
|
||||||
|
pstmtClose(pstmt);
|
||||||
|
connClose(jdbcConnection);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
LOGGER.error(e.getMessage());
|
||||||
|
LOGGER.debug(ExceptionUtil.exceptionToString(e));
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,22 @@ public class RegistryDB {
|
|||||||
stateCode = 0;
|
stateCode = 0;
|
||||||
return JSONTool.convertJsonElementToMirror(ret);
|
return JSONTool.convertJsonElementToMirror(ret);
|
||||||
}
|
}
|
||||||
return null;
|
return new JsonObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Object queryMapRuleByOffset(ScriptObjectMirror scriptMirrorObject) {
|
||||||
|
JsonObject jo = convertMirrorToJson(scriptMirrorObject).getAsJsonObject();
|
||||||
|
int offset = jo.get("offset").getAsInt();
|
||||||
|
int count = jo.get("count").getAsInt();
|
||||||
|
String localMetaStandardDoid = jo.get("localMetaStandardDoid").getAsString();
|
||||||
|
JsonObject ret = DBConnector.queryMapRuleByOffset(offset, count, localMetaStandardDoid);
|
||||||
|
if(ret == null) {
|
||||||
|
stateCode = -1;
|
||||||
|
} else {
|
||||||
|
stateCode = 0;
|
||||||
|
return JSONTool.convertJsonElementToMirror(ret);
|
||||||
|
}
|
||||||
|
return new JsonObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getLastExecuteStatus() {
|
public static int getLastExecuteStatus() {
|
||||||
|
@ -13,6 +13,7 @@ module metaStandardDetail {
|
|||||||
// };
|
// };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//{"localDataSample":{"owner":"abcdef","size":"1234"},"mapRule":{"所有者":"${val.owner}","大小":"${val.size*1000}","偏移过的大小":"${edp(val.size,30.0)}" }}
|
||||||
export function verifyRule(arg) {
|
export function verifyRule(arg) {
|
||||||
arg = convertArgToJson(arg);
|
arg = convertArgToJson(arg);
|
||||||
var ret = {};
|
var ret = {};
|
||||||
@ -80,7 +81,6 @@ module metaStandardDetail {
|
|||||||
|
|
||||||
export function listRemoteRegistry() {
|
export function listRemoteRegistry() {
|
||||||
arg = convertArgToJson(arg);
|
arg = convertArgToJson(arg);
|
||||||
var ret = [];
|
|
||||||
|
|
||||||
var ret = [{
|
var ret = [{
|
||||||
"registryID":"macjw",
|
"registryID":"macjw",
|
||||||
@ -124,25 +124,10 @@ module metaStandardDetail {
|
|||||||
|
|
||||||
//{"offset":..,"count":,"localMetaStandardDoid":}
|
//{"offset":..,"count":,"localMetaStandardDoid":}
|
||||||
export function listMetaStandardRelaction(arg) {
|
export function listMetaStandardRelaction(arg) {
|
||||||
var ret = [];
|
arg = convertArgToJson(arg);
|
||||||
ret.push({
|
var ret = org.bdware.sc.registry.RegistryDB.queryMapRuleByOffset(arg);
|
||||||
"name":"煤矿传感数据映射",
|
ret.code = org.bdware.sc.registry.RegistryDB.getLastExecuteStatus();
|
||||||
"localMetaStandardDoid":"xx.xx/adfa",
|
return ret;
|
||||||
"remoteMetaStandardDoid":"ab.ccd/aaaaa-aaa",
|
|
||||||
"createDate":167227222,
|
|
||||||
"updateDate":1111111,
|
|
||||||
"creator":"aabbcc",
|
|
||||||
"updater":"aabbcc",
|
|
||||||
"mapRule":{
|
|
||||||
"owner":"${val.大小}",
|
|
||||||
"pubkey":"function(val){}",
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return {
|
|
||||||
"total":10,
|
|
||||||
"data":ret,
|
|
||||||
"code":0
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//{"localMetaID":"xxx","mapRule":{},"remoteMetaID":"xxx"}
|
//{"localMetaID":"xxx","mapRule":{},"remoteMetaID":"xxx"}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user