zoukankan      html  css  js  c++  java
  • Mybatis常用标签

    mybatis常用的标签有:

    定义语句相关:insert、 delete、 update、 select

    查询结果集相关:resultMap

    控制sql动态拼接相关: if、 choose、 foreach

    格式化相关:where、 set、 trim

    关联关系相关: collection、 association

    select查询常量相关:sql、 include

    insert 标签:

    id:唯一标识

    parameterType:传入参数类型

    <insert id="xx" parameterType="java.lang.Integer">insert into ...</insert>

    delete 标签

    id:唯一标识

    parameterType:传入参数类型

    <delete id="xx" parameterType="java.lang.Integer">delete from ...</delete>

    update 标签

    id:唯一标识

    parameterType:传入参数类型

    <update id="xx" parameterType="java.lang.Integer" >update ...</update>

    selete 标签

    id:唯一标识

    parameterType:传入参数类型

    resultType: 返回值类型,当返回值为集合时,返回值类型为集合的泛型而不是集合本身

    resultMap:返回值类型,对应<resultMap>标签的id值

    <select id="xx" parameterType="java.lang.Integer" resultType="java.lang.String" > select ...</selete>

    <resultMap id="aa" type="xx.xx_entity"><id property="xx" column="xx" /> <result column="xx" property="xx" /></resultMap>

    <select id="xx" parameterType="java.lang.Integer" resultMap="aa" > select ...</selete>

    resultMap 标签

    将数据库表的字段和java对象属性对应

    <resultMap id="xx" type="xx.xx_entity"><id property="xx" column="xx" /> <result column="xx" property="xx" /></resultMap>

    property值为java对象属性,column值为数据库表的字段

    resultMap标签常用在select标签

    <resultMap id="aa" type="xx.xx_entity"><id property="xx" column="xx" /> <result column="xx" property="xx" /></resultMap>

    <select id="xx" parameterType="java.lang.Integer" resultMap="aa" > select ...</selete>

    引用:https://blog.csdn.net/qq_39623058/article/details/88779242

      https://blog.csdn.net/zhiguoliu11/article/details/82995444

      https://blog.csdn.net/qq_39623058/article/details/88779301

  • 相关阅读:
    Android Studio基本使用
    convlstm学习资料
    Java重写与重载
    Java继承的缺点
    long转int
    解决RubyMine中puts中文显示乱码的问题
    Ruby入门1
    Ruby学习笔记
    matplotlib绘制饼状图
    python强大的绘图模块matplotlib示例讲解
  • 原文地址:https://www.cnblogs.com/zj68/p/13019927.html
Copyright © 2011-2022 走看看