1.oracle批量插入
<insert id="save">
insert into t_ac_user_role
(
userroleid,<!--主键-->
roleid,
userid
)
select seq_ac_user_role.nextval <!--主键自增序列--> ,cd.* from( <foreach collection="entity.ids" item="item" index="index" separator="union all"> SELECT #{entity.roleid}, #{item} from dual </foreach> )cd </insert>
2.oracle 分页
select * from(
SELECT ROWNUM AS rowno,r.* FROM (
) r
<if test="entity.offset != null and entity.limit != null">
<![CDATA[ where ROWNUM <= ${entity.offset}+${entity.limit} ]]>
</if>
) table_alias
<if test="entity.offset != null and entity.limit != null">
<![CDATA[ WHERE table_alias.rowno > #{entity.offset} ]]>
</if>
3.装换成货币金额
select to_char(tax_amount,'FM999,999,999,999,990.00') from dual
4.代替mysql的truncate
ROUND(sum(tax_amount),2) 代替
truncate(SUM(tax_amount),2)