Mybatis3.2.8 使用

来源:互联网 发布:淘宝会员id在哪里查看 编辑:程序博客网 时间:2024/06/07 04:06

1.mybatis 默认支持的(typeAlias )别名

别名  映射的类型_byte ------ byte_long ------ long_short ------ short_int ------ int_integer ------ int_double ------ double_float ------ float_boolean ------ booleanstring ------ Stringbyte ------ Bytelong ------ Longshort ------ Shortint ------ Integerinteger ------ Integerdouble ------ Doublefloat ------ Floatboolean ------ Booleandate ------ Datedecimal ------ BigDecimalbigdecimal ------ BigDecimalobject ------ Objectmap ------ Maphashmap ------ HashMaplist ------ Listarraylist ------ ArrayListcollection ------ Collectioniterator ------ Iterator

2.insertOrUpdate(插入或者更新)

  <insert id="insertOrUpdateRestaurant" parameterType="URestaurant">    <selectKey keyProperty="count" resultType="int" order="BEFORE">        select count(*) from u_restaurant where USER_ID = #{userId}    </selectKey>    <if test="count > 0">        <include refid="update_inclue"></include>    </if>    <if test="count==0">        <include refid="insert_inclue"></include>    </if>  </insert>

3.官方参考文档

http://www.mybatis.org/mybatis-3/zh/configuration.html#typeAliases