|
@ -10,7 +10,8 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
10
|
10
|
import com.ai.ipu.data.JMap;
|
11
|
11
|
import com.ai.ipu.data.impl.JsonMap;
|
12
|
12
|
import com.ai.ipu.database.dao.IpuDaoManager;
|
13
|
|
import com.ai.ipu.sql.mgmt.SqlMgmtDao;
|
|
13
|
import com.ai.ipu.sql.mgmt.DbSqlMgmtDao;
|
|
14
|
import com.ai.ipu.sql.mgmt.FileSqlMgmtDao;
|
14
|
15
|
|
15
|
16
|
@Controller
|
16
|
17
|
@RequestMapping("/db/mgmt")
|
|
@ -18,12 +19,25 @@ public class DbSqlMgmtController {
|
18
|
19
|
private String connName = "test";
|
19
|
20
|
|
20
|
21
|
@ResponseBody
|
21
|
|
@RequestMapping("/select")
|
22
|
|
public JMap executeSqlByRepository(JMap param) throws Exception {
|
|
22
|
@RequestMapping("/selectByFile")
|
|
23
|
public JMap executeSqlByFileRepository(JMap param) throws Exception {
|
23
|
24
|
// TODO Auto-generated method stub
|
24
|
25
|
JMap params = new JsonMap();
|
25
|
|
params.put("id", 1);
|
26
|
|
SqlMgmtDao dao = IpuDaoManager.takeDao(SqlMgmtDao.class, connName);
|
|
26
|
params.put("id", param.getInt("id", 1));
|
|
27
|
FileSqlMgmtDao dao = IpuDaoManager.takeDao(FileSqlMgmtDao.class, connName);
|
|
28
|
List<Map<String, Object>> dataResult = dao.executeSelect("com.ai.ipu.user.user", "select", params);
|
|
29
|
JMap result = new JsonMap();
|
|
30
|
result.put("result", dataResult);
|
|
31
|
return result;
|
|
32
|
}
|
|
33
|
|
|
34
|
@ResponseBody
|
|
35
|
@RequestMapping("/selectByDb")
|
|
36
|
public JMap executeSqlByDbRepository(JMap param) throws Exception {
|
|
37
|
// TODO Auto-generated method stub
|
|
38
|
JMap params = new JsonMap();
|
|
39
|
params.put("id", param.getInt("id", 1));
|
|
40
|
DbSqlMgmtDao dao = IpuDaoManager.takeDao(DbSqlMgmtDao.class, connName);
|
27
|
41
|
List<Map<String, Object>> dataResult = dao.executeSelect("com.ai.ipu.UserMapper", "select", params);
|
28
|
42
|
JMap result = new JsonMap();
|
29
|
43
|
result.put("result", dataResult);
|