1. ibatis automatically caches the column name ing of each query statement. If you dynamically generate a column name, it may cause invalid column names.
Ibaits caches the meta information to be queried. When generating dynamic columns, you must add
Remapresults = "true ".
2. When you want to use numbers or special characters as column aliases in Oracle SQL queries, you can use.
3. for Oracle row-to-column conversion, you must determine the queried column information in advance and use the sum and decode functions to summarize the column information.
For example:
<select id="queryZjhHzByRq" parameterClass="com.athena.paicjh.entity.paiczjhjs.Paiczjhjs" resultClass="java.util.HashMap" remapResults="true">select zcwlh || '(' || sum(sl) || ')' zcwlh<iterate property="beanList"> ,sum(decode(rksj, #beanList[].rksj#, sl, 0)) "$beanList[].rksj$" </iterate> from (select to_char(jz.rksj, 'yyyy-mm-dd') rksj, jz.zcwlh, sum(nvl(jz.sl, 0)) sl, jz.ptbz from jh_zjh jz where jz.usercenter = #usercenter# and jz.rksj >= to_date(#start#, 'yyyy-mm-dd') and jz.rksj <![CDATA[<=]]> to_date(#end#, 'yyyy-mm-dd') <isNotEmpty prepend="and" property="zcwlh">zcwlh like $zcwlh$</isNotEmpty> group by jz.rksj, jz.zcwlh, jz.ptbz union all select to_char(to_date(rksj, 'yyyymm'), 'yyyy-mm') rksj, zcwlh, sum(nvl(sl, 0)) sl, '2' ptbz from jh_yzjh where usercenter = #usercenter# and drbz = '0' and to_date(rksj || '01', 'yyyymmdd') >= to_date(#start#, 'yyyy-mm-dd') and to_date(rksj || '01', 'yyyymmdd') <![CDATA[<=]]> to_date(#end#, 'yyyy-mm-dd') <isNotEmpty prepend="and" property="zcwlh">zcwlh like $zcwlh$</isNotEmpty> group by rksj, zcwlh) t group by zcwlh order by zcwlh</select>