首页 > 代码库 > Java1

Java1

1、分页查询

SELECT * FROM(

     SELECT A.* ,ROWNUM RN FROM

          (SELECT * FROM tableName) A  WHERE ROWNUM<=40

) WHERE RN>=21

2、批量删除

<delete id="deleteBatchByxxx" parameterType="list">

      delete from 表名 where groupid in

      <foreach collection="list" item="item" index="index" open="(" colse=")" separator=",">

              #{item}

     </foreach>

</delete>

3、批量插入

<insert id="insertBatch">

     insert into 表名 (uid,create_time) values

      <foreach collection="list" item="item" index="index" separator=",">

           (#{item.uid,jdbcType=BIGINT},#{item.create_time,jdbcType=INTEGER})

      </foreach>

</insert>

4、批量更新

<update id="updateSubmitTimeByUid" parameterType="map">

       update 表名 set submit_time=#{submit_time,jdbcType=BIGINT} where uid in

       <foreach  collection="list" item="uid" index="index" open="(" colse=")" separator=",">

            #{uid}

       </foreach>

</update>

5、Java类加载先后顺序

父类静态代码块---子类静态代码块----父类非静态代码块----父类构造方法

----子类非静态代码块----子类构造方法

Java1