SQL拼接
- concat
- 如下:
<if test="pickslipCode != null">
<bind name="pickslipCodeLike" value="'%' + pickslipCode + '%'"/>
and PickslipCode LIKE #{pickslipCodeLike}
</if>
调用外部方法
<if test="!@org.springframework.util.StringUtils@isEmpty(name)">
AND name like #{name}
</if>
一对多
<resultMap type="com.kerwin.mybatis.pojo.Person" id="personreSultMap">
<id column="p_id" property="id"/>
<result column="name" property="name"/>
<collection property="orderList" ofType="com.kerwin.mybatis.pojo.Orders" column="pid">
<id column="o_id" property="id"/>
<result column="price" property="price"/>
</collection>
</resultMap>
多对一
<resultMap type="com.kerwin.mybatis.pojo.Orders" id="OrdersResultMap">
<id column="o_id" property="id"/>
<result column="price" property="price"/>
<association property="person" javaType="com.kerwin.mybatis.pojo.Person">
<id column="p_id" property="id"/>
<result column="name" property="name"/>
</association>
</resultMap>









网友评论