1.oracle批量插入
1<insert id="save"> 2 insert into t_ac_user_role 3 ( 4 userroleid,<!--主键--> 5 roleid, 6 userid 7 ) 8 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 分页
1 select * from( 2 SELECT ROWNUM AS rowno,r.* FROM ( 3 4 ) r 5 <if test="entity.offset != null and entity.limit != null"> 6 <![CDATA[ where ROWNUM <= ${entity.offset}+${entity.limit} ]]> 7 </if> 8 ) table_alias 9 <if test="entity.offset != null and entity.limit != null"> 10 <![CDATA[ WHERE table_alias.rowno > #{entity.offset} ]]> 11 </if>
3.装换成货币金额
select to_char(tax_amount,'FM999,999,999,999,990.00') from dual
4.代替mysql的truncate
1ROUND(sum(tax_amount),2) 代替 2truncate(SUM(tax_amount),2)