Compare commits

..

No commits in common. "8497f61842d392d360c3b031951ab949a3f79449" and "3fca9c0b45bea4eec15118ccd3412546e99f24a3" have entirely different histories.

1 changed files with 20 additions and 11 deletions

View File

@ -49,19 +49,28 @@ public class DcxServiceImpl implements DcxService {
+ "it.name"
+ " from Item it ";
sql += ") AS subquery ";
String sqlCount = "select count(id) as nums " + sql;
String sqlCount = "select count(id) " + sql;
sql = "select * " + sql + " WHERE RowNum BETWEEN " + (pageNum-1) * pageSize + " AND " + (pageNum) * pageSize;
//查询单数据
Map<String,Object> listCount = jdbcTemplate.queryForMap(sqlCount, new HashMap<>());
log.info("sqlCount:"+sqlCount);
log.info("sql:"+sql);
//查询单挑数据
Map<String,Object> userMap2 = jdbcTemplate.queryForMap("select * from Container where ID=1", new HashMap<>());
//查询多条数据据
List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql, new HashMap<>());
List<Map<String,Object>> userMap = jdbcTemplate.queryForList("select * from Container ", new HashMap<>());
System.out.println(userMap);
/*List<Object[]> list=entity.createNativeQuery(sql).getResultList();
List listCount=entity.createNativeQuery(sqlCount).getResultList();
JSONArray data = new JSONArray();
for(Map<String,Object> m:maps){
for(Object[] obj:list){
int i=0;
JSONObject d = new JSONObject();
d.put("id",m.get("id"));
d.put("userNo",m.get("code"));
d.put("userName", m.get("name"));
d.put("id",obj[i++]==null?"":obj[i-1]);
d.put("userNo",obj[i++]==null?"":obj[i-1]);
d.put("userName", obj[i++]==null?"":obj[i-1]);
d.put("passWord","123456");
d.put("age",19);
d.put("sex",1);
@ -69,8 +78,8 @@ public class DcxServiceImpl implements DcxService {
d.put("roleId", 2);
d.put("isValid", false);
data.add(d);
}
return Result.success(Long.parseLong(listCount.get("nums").toString()),data);
}*/
return Result.success(userMap.size(),userMap);
}
}