package com.ideabobo.controller;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import com.ideabobo.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import com.alibaba.fastjson.JSON;
import com.ideabobo.model.Dbservice;
import com.ideabobo.model.Dbtablemapping;
import com.ideabobo.service.DatabaseService;
@CrossOrigin(origins="*")
@Controller
@RequestMapping(value = "/database")
public class DatabaseController {
//private static final Logger logger = Logger.getLogger(DatabaseController.class);
@Autowired
private DatabaseService databaseService;
@RequestMapping(value = "/list", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public List<Map<String,Object>> list(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String sql = dbm.list(table,objectObj);
list = databaseService.find(sql);
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
@RequestMapping(value = "/listJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public String listJ(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String sql = dbm.list(table,objectObj);
list = databaseService.find(sql);
} catch (Exception e) {
e.printStackTrace();
}
return renderJsonp(list, req);
}
@RequestMapping(value = "/find", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public Map<String,Object> find(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String sql = dbm.list(table,objectObj,true);
list = databaseService.find(sql);
} catch (Exception e) {
e.printStackTrace();
}
if (list!=null && list.size()>0) {
return list.get(0);
}else{
return null;
}
}
@RequestMapping(value = "/findJ", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public String findJ(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
Object objectObj = Common.getByRequest(Dbtablemapping.getModelByTable(table), req, false);
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String sql = dbm.list(table,objectObj,true);
list = databaseService.find(sql);
} catch (Exception e) {
e.printStackTrace();
}
if (list!=null && list.size()>0) {
return renderJsonp(list.get(0), req);
}else{
return renderJsonp(null, req);
}
}
@RequestMapping(value = "/listApp", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public List<Map<String,Object>> listApp(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String object = req.getParameter("object");
//if(StringUtil.isNotNullOrEmpty(object)){
Object objectObj = Dbtablemapping.parseStringModel(object, table);
String sql = dbm.list(table,objectObj);
list = databaseService.find(sql);
//robj.setData(databaseService.find(sql));
//}
} catch (Exception e) {
e.printStackTrace();
}
return list;
}
@RequestMapping(value = "/listC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public String listC(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String object = req.getParameter("object");
//if(StringUtil.isNotNullOrEmpty(object)){
Object objectObj = Dbtablemapping.parseStringModel(object, table);
String sql = dbm.list(table,objectObj);
list = databaseService.find(sql);
//robj.setData(databaseService.find(sql));
//}
} catch (Exception e) {
e.printStackTrace();
}
return renderJsonp(list, req);
}
@RequestMapping(value = "/findApp", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public Map<String,Object> findApp(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String object = req.getParameter("object");
//if(StringUtil.isNotNullOrEmpty(object)){
Object objectObj = Dbtablemapping.parseStringModel(object, table);
String sql = dbm.list(table,objectObj);
list = databaseService.find(sql);
//robj.setData(databaseService.find(sql));
//}
} catch (Exception e) {
e.printStackTrace();
}
if (list!=null && list.size()>0) {
return list.get(0);
}else{
return null;
}
}
@RequestMapping(value = "/findC", produces = "text/plain; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public String findC(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
String table = Dbservice.getTableName(req.getParameter("table"));
//Robj robj = new Robj();
List<Map<String,Object>> list = null;
try {
String object = req.getParameter("object");
//if(StringUtil.isNotNullOrEmpty(object)){
Object objectObj = Dbtablemapping.parseStringModel(object, table);
String sql = dbm.list(table,objectObj);
list = databaseService.find(sql);
//robj.setData(databaseService.find(sql));
//}
} catch (Exception e) {
e.printStackTrace();
}
if (list!=null && list.size()>0) {
return renderJsonp(list.get(0), req);
}else{
return renderJsonp(null, req);
}
}
@RequestMapping(value = "/listPage", produces = "application/json; charset=utf-8", method = { RequestMethod.GET,
RequestMethod.POST })
@ResponseBody
public Page listPage(HttpServletRequest req) {
Dbservice dbm = new Dbservice(databaseService);
岛上程序猿
- 粉丝: 5812
- 资源: 4248
最新资源
- 基于matlab的齿轮系统非线性动力学特性分析,综合考虑齿侧间隙、时变啮合刚度、综合啮合误差等因素下,参数阻尼比变化调节下,输出位移、相图、载荷、频率幅值结果 程序已调通,可直接运行
- 10kV线路微机继电保护装置源代码,配套pcb图纸和bom 适合自己学习的素材,也可作为基础版本工程,缩短开发周期 为源码和pcb图
- 无刷直流电机的调速 Matlab simulink仿真搭建模型 介绍:该模型展示了无刷直流电机的速度控制 无刷直流电机有完整的动态模型 将电机的实际转速与参考转速进行比较,以控制三相逆变器来调节端
- comsol枝晶生长 温度场相场溶质场三场耦合
- 水箱水位温度MCGS嵌入版7.7脚本程序动画仿真 带历史数据报表,实时数据报表,历史曲线,实时曲线 标价就是卖价
- 三相共直流母线式光储VSG 同步机 构网型 组网型逆变器 仿真包含前级光伏PV与Boost的扰动观察法最大功率追踪,共直流母线式储能Buck-boost变器,采用电压电流双闭环控制 三相VSG 同步
- TCP IP协议栈IP,纯RTL语言实现,包含tcp server,tcp client,icmp,ping 等,可移植任何平台
- 锂电池建模与热管理仿真 主要贡献: 1、 对并联或串联连接的任意所需数量的电池进行电池系统仿真; 2、拟串联电池的被动平衡; 3、自动将统计参数偏差分配给电池系统内的所有电池; 4、模拟不可逆和可逆电
- 燃料电池汽车参数匹配与能量管理 包含燃料电池汽车的燃料电池动力源功率选型,驱动电机参数匹配选型,蓄电池参数匹配选型,主减速比匹配,以满足最高车速,最大爬坡度,百公里加速时间等动力性要求 然后根据参
- 永磁同步电机三闭环控制Simulink仿真 电流内环 转速 位置外环 参数已经调好 原理与双闭环类似 有资料,仿真
- 无线电能传输仿真模型,电路采用S-S拓扑结构 闭环输出电压400v,输出效果良好 采用的是移相控制 另有主电路的参数设计过程
- 台达DVP 16ES2与3台 台达DT3系温控器通讯程序(TDES-3) 功能:采用台达DVP ES2型号PLC,对台达DT3温控器通过485方式,modbus协议,进行温度的设定,实际温度读
- comsol 激光抛光, 平顶激光,连续激光,高斯激光,都可以进行抛光,所用公式有文献参考处处
- seqlist-malloc
- dogstar-ui-html
- Maxwell和Simplorer联合仿真-永磁同步电机SVPWM控制 本仿真用AnsysEM实现永磁同步电机(PMSM)的仿真模拟,控制方式采用空间矢量控制,闭环方式采用电流环速度环双闭环控制
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈