public class SelectSortMapperTemplate extends AbstractMapperTemplate
xmlLanguageDriver| Constructor and Description |
|---|
SelectSortMapperTemplate() |
| Modifier and Type | Method and Description |
|---|---|
String |
selectListWithSort(TableInfo tableInfo,
org.apache.ibatis.mapping.MappedStatement ms)
查询记录,生成 select 语句。
|
String |
selectListWithSort2(TableInfo tableInfo,
org.apache.ibatis.mapping.MappedStatement ms)
查询记录,生成 select 语句。
|
dynamicSql, getNodeContent, getWhereExtraConditionpublic String selectListWithSort(TableInfo tableInfo, org.apache.ibatis.mapping.MappedStatement ms)
示例如下:
SELECT id,... FROM table_name
<where>
<if test="condition.id != null">
and id = #{condition.id}
</if>
and is_deleted = 'N'
</where>
<if test="orders != null and orders.size > 0">
order by
<foreach collection="orders" item="item" separator=",">
${item.property} ${item.direction}
</foreach>
</if>
tableInfo - 数据库表结构信息ms - sql语句节点信息,会将生成的sql语句替换掉原有的 MappedStatement.sqlSourceSelectListMapper.selectListWithSort(Object, List)public String selectListWithSort2(TableInfo tableInfo, org.apache.ibatis.mapping.MappedStatement ms)
示例如下:
SELECT id,... FROM table_name
<where>
<if test="condition.id != null">
and id = #{condition.id}
</if>
and is_deleted = 'N'
<if test="extraCondition != null">
<include refid="Where_Extra_Condition" />
</if>
</where>
<if test="orders != null and orders.size > 0">
order by
<foreach collection="orders" item="item" separator=",">
${item.property} ${item.direction}
</foreach>
</if>
tableInfo - 数据库表结构信息ms - sql语句节点信息,会将生成的sql语句替换掉原有的 MappedStatement.sqlSourceSelectListMapper.selectListWithSort2(Object, Map, List)Copyright © 2018–2019. All rights reserved.