首页 新闻 会员 周边

最难bug,请准备好心态再打开

0
悬赏园豆:200 [已解决问题] 解决于 2016-06-25 10:18

错误提示:Malformed OGNL expression: beginTime != null and beginTime !=''

org.apache.ibatis.ognl.TokenMgrError: Lexical error at line 1, column 22.

这个异常我怎么也改不出来

另外还有个疑问,map返回值应该怎么写?代码如下,

//图形统计
public Map<String, Object> userGraph(Map<String, Object> map){
try {
super.sqlSessionTemplate.selectList("com.kinglo.im.pojo.User.userGraph",map);

// super.sqlSessionTemplate.selectMap("com.kinglo.im.pojo.User.userGraph", map);

} catch (Exception e) {
e.printStackTrace();
}
return null; 
}

根目录97的主页 根目录97 | 初学一级 | 园豆:8
提问于:2016-06-24 18:37
< >
分享
最佳答案
2

问题1同意楼上的。

问题2:

如果是返回Map对象

//图形统计
public Map<String, Object> userGraph(Map<String, Object> map){
try {
//super.sqlSessionTemplate.selectList("com.kinglo.im.pojo.User.userGraph",map);

super.sqlSessionTemplate.selectMap("com.kinglo.im.pojo.User.userGraph", map);

} catch (Exception e) {
e.printStackTrace();
}
return null; 
}

 

如果是返回Map集合

//图形统计
public List<Map<String, Object>> userGraph(Map<String, Object> map){
try {
//super.sqlSessionTemplate.selectList("com.kinglo.im.pojo.User.userGraph",map);

super.sqlSessionTemplate.selectMap("com.kinglo.im.pojo.User.userGraph", map);

} catch (Exception e) {
e.printStackTrace();
}
return null; 
}

 

另外,super.sqlSessionTemplate.selectList("com.kinglo.im.pojo.User.userGraph",map);返回的是List<Object>

收获园豆:200
CodeHsu | 大侠五级 |园豆:5468 | 2016-06-24 23:52

这个key指的是啥。。。

根目录97 | 园豆:8 (初学一级) | 2016-06-25 11:06

@根目录97: 你可以在项目里运行一下看看吗?谢谢了,我这问题没解决

根目录97 | 园豆:8 (初学一级) | 2016-06-25 11:08

@根目录97: 

不好意思,现在不是做java开发的,演示不了。

sqlSessionTemplate.selectMap("com.kinglo.im.pojo.User.userGraph", map, key);

selectMap方法返回指定列为key的map集合或对象,它的value值得类型可以为Object或map

CodeHsu | 园豆:5468 (大侠五级) | 2016-06-25 11:25

@SeayXu: 好,谢谢你了

根目录97 | 园豆:8 (初学一级) | 2016-06-25 11:44
其他回答(2)
1

 beginTime != null and beginTime !='' 可能是第2个beginTime之前的中文全角空格引起的

dudu | 园豆:31007 (高人七级) | 2016-06-24 18:48

谢谢 非常感谢

支持(0) 反对(0) 根目录97 | 园豆:8 (初学一级) | 2016-06-25 10:03
1

当时我就吓傻了,真的点进来看,发现并没有标题那么夸张...

 

根据这种错误信息,数到第22个字符,就是你的全角空格。

幻天芒 | 园豆:37175 (高人七级) | 2016-06-25 09:15

标题真的不好意思,我悬赏100都没人帮我,不得已出的这样下策呀

支持(0) 反对(0) 根目录97 | 园豆:8 (初学一级) | 2016-06-25 10:02

@根目录97: 话说,昨天就看到了。不过看到标题那么吓人,当时就没敢点进来........

支持(0) 反对(0) 幻天芒 | 园豆:37175 (高人七级) | 2016-06-25 10:23

@幻天芒: 嗯,这是我第一次为我的不细心(一个空格)付出了惨重代价,修改两天,请教总监两次,都没给我看,也都无所谓了,总监出bug,我也不给他看,哈哈

支持(0) 反对(0) 根目录97 | 园豆:8 (初学一级) | 2016-06-25 10:29
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册