- 字符串拼接(需要用单引号引起来) ${}
- 插值表达式 #{}
-
Map键插值
-
org或者param原生插值
-
@Param注解插值
-
JavaBean的成员变量,即属性名
后端大部分在做CRUD和DevOps
常用CRUD标签
- where/if
<where>
<if test="键名=='' and 键名 != ''">
</if>
</where>
- trim/when/choose/otherchoose
- when至少有一个,otherwise最多只能有一个
<trim prefix="内容前面是什么内容" suffix="内容后面添加什么内容" suffixOverrides="前面去掉什么内容" suffixOverrides="后面去掉什么内容">
<when>
<choose test="键名=='' and 键名 !=''">
</choose>
</when>
</trim>
- forEach
<foreach collection="键名" iteam="集合元素形参" separator="分隔符" open="循环开始标签" close="循环结束标签">
</foreach>
SQL标签
- sql/include
<sql id="xxxx">sql语句</sql>
<select id="方法名" resultType="方法类型">
<include refid="sql标签id" />
</select>
二级缓存标签
- cache
<!--开启二级缓存-->
<cache/>
映射标签
<resultMap id="resultMap的id" >
<id property="java字段" column="sql主键id"/>
<result property="java字段" column="sql字段"/>
<!--多对一--->
<association property="java字段" javaType="jav字段的对应的JavaBean"></association>
<!--一对多-->
<collection property="java字段" oftype="集合中的数据类型"></collection>
</resultMap>