raymond-yan

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)

 

分类:

技术点:

相关文章:

  • 2022-01-29
  • 2021-06-29
  • 2021-11-17
  • 2021-11-30
  • 2021-11-17
  • 2022-12-23
猜你喜欢
  • 2021-11-17
  • 2021-11-29
  • 2021-11-17
  • 2021-10-30
  • 2021-10-01
相关资源
相似解决方案