public class DeleteMapperTemplate extends AbstractMapperTemplate
xmlLanguageDriver| Constructor and Description |
|---|
DeleteMapperTemplate() |
| Modifier and Type | Method and Description |
|---|---|
String |
deleteByCondition(TableInfo tableInfo,
org.apache.ibatis.mapping.MappedStatement ms)
删除记录,生成 delete 语句。
|
String |
deleteByConditionAndUpdate(TableInfo tableInfo,
org.apache.ibatis.mapping.MappedStatement ms)
删除记录,生成 delete 语句。
|
String |
deleteByPrimaryKey(TableInfo tableInfo,
org.apache.ibatis.mapping.MappedStatement ms)
删除记录,生成 delete 语句。
|
String |
deleteWithPrimaryKey(TableInfo tableInfo,
org.apache.ibatis.mapping.MappedStatement ms)
删除记录,生成 delete 语句;如果数据库表支持"逻辑删除",则会生成 update 语句。
|
dynamicSql, getNodeContent, getWhereExtraConditionpublic String deleteByPrimaryKey(TableInfo tableInfo, org.apache.ibatis.mapping.MappedStatement ms)
delete 语句示例如下:
DELETE FROM table_name
<where>
AND id = #{id}
AND is_deleted = 'N'
</where>
update 语句示例如下:
UPDATE table_name
<set>
is_deleted = 'Y',
</set>
<where>
AND id = #{id}
AND is_deleted = 'N'
</where>
tableInfo - 数据库表结构信息ms - sql语句节点信息,会将生成的sql语句替换掉原有的 MappedStatement.sqlSourceDeleteByPrimaryKeyMapper.deleteByPrimaryKey(Serializable)public String deleteWithPrimaryKey(TableInfo tableInfo, org.apache.ibatis.mapping.MappedStatement ms)
delete 语句示例如下:
DELETE FROM table_name
<where>
AND id = #{id}
AND is_deleted = 'N'
</where>
update 语句示例如下:
UPDATE table_name
<set>
is_deleted = 'Y',
modifier = #{modifier},
gmt_modified = #{gmtModified},
</set>
<where>
AND id = #{id}
AND is_deleted = 'N'
</where>
tableInfo - 数据库表结构信息ms - sql语句节点信息,会将生成的sql语句替换掉原有的 MappedStatement.sqlSourceDeleteByPrimaryKeyMapper.deleteWithPrimaryKey(Object)public String deleteByCondition(TableInfo tableInfo, org.apache.ibatis.mapping.MappedStatement ms)
delete 语句示例如下:
DELETE FROM table_name
<where>
<if test="id != null">
and id = #{id}
</if>
</where>
update 语句示例如下:
UPDATE table_name
<set>
is_deleted = 'Y',
modifier = #{modifier},
gmt_modified = #{gmtModified},
</set>
<where>
<if test="id != null">
and id = #{id}
</if>
AND is_deleted = 'N'
</where>
tableInfo - 数据库表结构信息ms - sql语句节点信息,会将生成的sql语句替换掉原有的 MappedStatement.sqlSourceDeleteByConditionMapper.deleteByCondition(Object)public String deleteByConditionAndUpdate(TableInfo tableInfo, org.apache.ibatis.mapping.MappedStatement ms)
delete 语句示例如下:
DELETE FROM table_name
<where>
<if test="id != null">
and id = #{id}
</if>
</where>
update 语句示例如下:
UPDATE table_name
<set>
is_deleted = 'Y',
<if test="record.creator != null">
creator = #{record.creator},
</if>
modifier = #{record.modifier},
</set>
<where>
<if test="condition != null">
<if test="condition.creator != null">
and creator = #{condition.creator}
</if>
<if test="condition.modifier != null">
and modifier = #{condition.modifier}
</if>
<if test="condition.id != null">
and id = #{condition.id}
</if>
</if>
and is_deleted = 'N'
</where>
tableInfo - 数据库表结构信息ms - sql语句节点信息,会将生成的sql语句替换掉原有的 MappedStatement.sqlSourceDeleteByConditionMapper.deleteByConditionAndUpdate(Object, Object)Copyright © 2018–2020. All rights reserved.