映射器Sql元素

<sql id="roleClos">

id,role_name as roleName,note

<sql>


select   <include refid="roleClos"></include>

 from role  where role_name like concat('%', #{rn},'%')

and note like concat('%', #{note},'%')



<sql id="roleAlias">

${ali}.id,${ali}.role_name ,${ali}.note

</sql>


select   

<inlcule refid="roleAlias">

<properte name="ali"  value="r">

</include>

from role  r

 where role_name like concat('%', #{rn},'%')

and note like concat('%', #{note},'%')


在 include 中定义了一个名为ali的变量,其值为SQL表role的表名r,然后Sql元素就行使用这个变量名了

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容