package com.fgkj.actions;
|
|
import java.util.List;
|
|
import com.fgkj.db.DBUtil;
|
import com.fgkj.db.DBUtil;
|
import com.fgkj.db.DBUtil1;
|
import com.fgkj.dto.App_Param;
|
import com.fgkj.dto.ServiceModel;
|
import com.fgkj.services.App_ParamService;
|
import com.google.gson.reflect.TypeToken;
|
|
public class App_ParamAction extends ActionUtil{
|
private App_ParamService service = new App_ParamService();
|
private String json;
|
private String result;
|
|
//根据discharge/charge/poweroff查询
|
public String serchByInfo() {
|
App_Param param = getGson().fromJson(json, App_Param.class);
|
ServiceModel model = service.serchByInfo(param);
|
result = tojson(model);
|
return SUCCESS;
|
}
|
|
//修改参数
|
public String update() {
|
List<App_Param> params = getGson().fromJson(json, new TypeToken<List<App_Param>>(){}.getType());
|
ServiceModel model = service.update(params);
|
result = ActionUtil.tojson(model);
|
return SUCCESS;
|
}
|
|
/**
|
* 获取连接数据库的ip地址
|
* @return
|
*/
|
public String seaechIp(){
|
String ip = DBUtil1.getIp();
|
ServiceModel model = new ServiceModel();
|
if(ip != null && ip.length() > 0){
|
model.setCode(1);
|
model.setMsg(ip);
|
}else{
|
model.setMsg("获取失败");
|
}
|
result = tojson(model);
|
return SUCCESS;
|
}
|
|
/**
|
* 设置服务器ip地址
|
* @return
|
*/
|
public String updataIp(){
|
ServiceModel model = DBUtil1.setIp(json);
|
result = tojson(model);
|
return SUCCESS;
|
}
|
|
public String getJson() {
|
return json;
|
}
|
|
public void setJson(String json) {
|
this.json = json;
|
}
|
|
public String getResult() {
|
return result;
|
}
|
|
public void setResult(String result) {
|
this.result = result;
|
}
|
}
|