ibatis中的查询语句中循环一个List作为参数,报错,求高手帮忙!!!
<isNotNullproperty="rightMonNumList"><iterateproperty="rightMonNumList">sum(CASEWHENT...
<isNotNull property="rightMonNumList" >
<iterate property="rightMonNumList">
sum( CASE
WHEN T1.ACCT_MONTH = TO_CHAR(ADD_MONTHS(TO_DATE(#monthId#, 'YYYYMM'), -(#rightMonNum#-$rightMonNumList[]$)), 'YYYYMM') THEN
T1.USER_NUM
ELSE
0
END) USER_NUM_$rightMonNumList[]$,
sum(CASE
WHEN T1.ACCT_MONTH = TO_CHAR(ADD_MONTHS(TO_DATE(#monthId#, 'YYYYMM'), -(#rightMonNum#-$rightMonNumList[]$)), 'YYYYMM') THEN
T1.USER_GPRS_NUM
ELSE
0
END) USER_GPRS_NUM_$rightMonNumList[]$
</iterate>
</isNotNull>
这是select语句中的循环处,rightMonNumList中存的是整型的11,10,9....这样的数据,目的是查处每个月这些指标的总和 并返回一个List 在页面上显示多个月份的各项数据和总和。但是运行到sql语句是却报错,去掉循环部分查询的话是没有问题的,求高手帮帮忙啊。报错代码:
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
--- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
--- Cause: java.lang.NullPointerException
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
--- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
真正是毫无头绪。。。。求高手帮忙! 展开
<iterate property="rightMonNumList">
sum( CASE
WHEN T1.ACCT_MONTH = TO_CHAR(ADD_MONTHS(TO_DATE(#monthId#, 'YYYYMM'), -(#rightMonNum#-$rightMonNumList[]$)), 'YYYYMM') THEN
T1.USER_NUM
ELSE
0
END) USER_NUM_$rightMonNumList[]$,
sum(CASE
WHEN T1.ACCT_MONTH = TO_CHAR(ADD_MONTHS(TO_DATE(#monthId#, 'YYYYMM'), -(#rightMonNum#-$rightMonNumList[]$)), 'YYYYMM') THEN
T1.USER_GPRS_NUM
ELSE
0
END) USER_GPRS_NUM_$rightMonNumList[]$
</iterate>
</isNotNull>
这是select语句中的循环处,rightMonNumList中存的是整型的11,10,9....这样的数据,目的是查处每个月这些指标的总和 并返回一个List 在页面上显示多个月份的各项数据和总和。但是运行到sql语句是却报错,去掉循环部分查询的话是没有问题的,求高手帮帮忙啊。报错代码:
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
--- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
--- Cause: java.lang.NullPointerException
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
--- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in config/vass/flowanalysis/sqlmap-flowanalysis.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the flowanalysis.select3gOnline.
--- Check the parameter map.
真正是毫无头绪。。。。求高手帮忙! 展开
1个回答
展开全部
例子:
<isNotEmpty prepend="AND" property="adminLevelList">
m.ADMIN_LEVEL in
<iterate property="adminLevelList" open="(" close=")"
conjunction=",">亩橘
<升耐芹![CDATA[
#adminLevelList[]#
]]>
</iterate>吵毕
</isNotEmpty>
<isNotEmpty prepend="AND" property="adminLevelList">
m.ADMIN_LEVEL in
<iterate property="adminLevelList" open="(" close=")"
conjunction=",">亩橘
<升耐芹![CDATA[
#adminLevelList[]#
]]>
</iterate>吵毕
</isNotEmpty>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询