|
|
|
@ -1,10 +1,10 @@
|
|
|
|
|
package com.fr.plugin.db.redis; |
|
|
|
|
|
|
|
|
|
import com.fanruan.api.cal.FormulaKit; |
|
|
|
|
import com.fanruan.api.data.ConnectionKit; |
|
|
|
|
import com.fanruan.api.data.TableDataKit; |
|
|
|
|
import com.fanruan.api.util.StringKit; |
|
|
|
|
import com.fr.data.impl.Connection; |
|
|
|
|
import com.fr.data.impl.NameDatabaseConnection; |
|
|
|
|
import com.fr.decision.fun.impl.AbstractUniversalServerTableDataProvider; |
|
|
|
|
import com.fr.json.JSONObject; |
|
|
|
|
import com.fr.plugin.db.redis.bean.ParameterBean; |
|
|
|
@ -15,6 +15,7 @@ import com.fr.plugin.db.redis.core.order.impl.NumberOrderValue;
|
|
|
|
|
import com.fr.plugin.db.redis.core.script.EngineType; |
|
|
|
|
import com.fr.plugin.db.redis.util.RedisUtils; |
|
|
|
|
import com.fr.script.Calculator; |
|
|
|
|
import com.fr.stable.NameReference; |
|
|
|
|
import com.fr.web.struct.Atom; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -38,7 +39,7 @@ public class RedisScriptUniversalTableDataImpl extends AbstractUniversalServerTa
|
|
|
|
|
public JSONObject serialize(RedisScriptTableData redisScriptTableData) { |
|
|
|
|
JSONObject data = new JSONObject(); |
|
|
|
|
Connection database = redisScriptTableData.getDatabase(); |
|
|
|
|
data.put(RedisConstants.DATABASE, database instanceof NameDatabaseConnection ? ((NameDatabaseConnection) database).getName() : StringKit.EMPTY); |
|
|
|
|
data.put(RedisConstants.DATABASE, database instanceof NameReference ? ((NameReference) database).getName() : StringKit.EMPTY); |
|
|
|
|
data.put(RedisConstants.ORDER, redisScriptTableData.getOrderValue().toString()); |
|
|
|
|
data.put(RedisConstants.SCRIPT, redisScriptTableData.getScript()); |
|
|
|
|
data.put(RedisConstants.ENGINE, redisScriptTableData.getEngineType().getType()); |
|
|
|
@ -52,7 +53,7 @@ public class RedisScriptUniversalTableDataImpl extends AbstractUniversalServerTa
|
|
|
|
|
String databaseName = data.getString(RedisConstants.DATABASE); |
|
|
|
|
String script = data.getString(RedisConstants.SCRIPT); |
|
|
|
|
if (!StringKit.isEmpty(databaseName) && TableDataKit.findTableData(databaseName) != null) { |
|
|
|
|
newTableData.setDatabase(new NameDatabaseConnection(databaseName)); |
|
|
|
|
newTableData.setDatabase(ConnectionKit.createNameConnection(databaseName)); |
|
|
|
|
} |
|
|
|
|
newTableData.setEngineType(EngineType.parse(data.getInt(RedisConstants.ENGINE))); |
|
|
|
|
newTableData.setScript(script); |
|
|
|
|