Package com.pugwoo.dbhelper.impl.part
Class P5_DeleteOp
- All Implemented Interfaces:
DBHelper,org.springframework.beans.factory.Aware,org.springframework.context.ApplicationContextAware
- Direct Known Subclasses:
P6_ExecuteOp
-
Field Summary
Fields inherited from class com.pugwoo.dbhelper.impl.part.P0_JdbcTemplateOp
applicationContext, features, fetchSize, interceptors, jdbcTemplate, LOGGER, maxPageSize, namedParameterJdbcTemplate, timeoutWarningValve -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> int自定义条件删除数据,该操作【会】自动使用软删除标记。 对于使用了拦截器和deleteValueScript的场景,该方法的实现是先根据条件查出数据,再批量删除,以便拦截器可以记录下实际被删的数据,此时删除性能可能比较差,请权衡使用。<T> intdelete(Collection<T> list) 删除数据库记录,返回数据库实际修改条数。 推荐使用单个主键的表使用该方法,当list所有对象都是同一个类时,将会拼凑为一条sql进行删除,效率提升多。 该操作【会】自动使用软删除进行删除<T> intdelete(T t) 删除数据库记录,返回数据库实际修改条数。 该操作【会】自动使用软删除进行删除<T> intdeleteHard(Class<T> clazz, String postSql, Object... args) 自定义条件删除数据(无论是否注解了软删除字段)。
对于使用了拦截器和deleteValueScript的场景,该方法的实现是先根据条件查出数据,再批量删除,以便拦截器可以记录下实际被删的数据,此时删除性能可能比较差,请权衡使用。<T> intdeleteHard(Collection<T> list) 硬删除数据库记录(无论是否注解了软删除字段),返回数据库实际修改条数。 推荐使用单个主键的表使用该方法,当list所有对象都是同一个类时,将会拼凑为一条sql进行删除,效率提升多。<T> intdeleteHard(T t) 硬删除数据库记录(无论是否注解了软删除字段),返回数据库实际修改条数。Methods inherited from class com.pugwoo.dbhelper.impl.part.P4_InsertOrUpdateOp
insertOrUpdate, insertOrUpdate, insertOrUpdateWithNullMethods inherited from class com.pugwoo.dbhelper.impl.part.P3_UpdateOp
update, update, update, updateAll, updateCustom, updateWithNull, updateWithNullMethods inherited from class com.pugwoo.dbhelper.impl.part.P2_InsertOp
insert, insert, insertBatchWithoutReturnId, insertBatchWithoutReturnId, insertBatchWithoutReturnId, insertWithNullMethods inherited from class com.pugwoo.dbhelper.impl.part.P1_QueryOp
getAll, getAll, getAllForStream, getAllForStream, getAllKey, getByExample, getByKey, getCount, getCount, getOne, getOne, getPage, getPage, getPageWithoutCount, getPageWithoutCount, getRaw, getRaw, getRawForStream, getRawForStream, getRawOne, getRawOne, handleRelatedColumn, handleRelatedColumn, handleRelatedColumn, handleRelatedColumn, isExist, isExistAtLeastMethods inherited from class com.pugwoo.dbhelper.impl.part.P0_JdbcTemplateOp
addComment, executeAfterCommit, getDatabaseType, getFeature, getJdbcTemplate, getNamedParameterJdbcTemplate, jdbcExecuteUpdate, log, logSlow, namedJdbcExecuteUpdate, namedJdbcExecuteUpdateWithLog, rollback, setApplicationContext, setFetchSize, setInterceptors, setJdbcTemplate, setMaxPageSize, setNamedParameterJdbcTemplate, setTimeoutWarningCallback, setTimeoutWarningValve, turnOffFeature, turnOnFeatureMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.pugwoo.dbhelper.DBHelper
executeRaw, executeRaw
-
Constructor Details
-
P5_DeleteOp
public P5_DeleteOp()
-
-
Method Details
-
delete
Description copied from interface:DBHelper删除数据库记录,返回数据库实际修改条数。 该操作【会】自动使用软删除进行删除- Parameters:
t- 要删除的对象- Returns:
- 实际删除的条数
- Throws:
NullKeyValueException
-
deleteHard
Description copied from interface:DBHelper硬删除数据库记录(无论是否注解了软删除字段),返回数据库实际修改条数。- Parameters:
t- 要删除的对象- Returns:
- 实际删除的条数
- Throws:
NullKeyValueException- 当对象的主键值为null时抛出
-
deleteHard
Description copied from interface:DBHelper硬删除数据库记录(无论是否注解了软删除字段),返回数据库实际修改条数。 推荐使用单个主键的表使用该方法,当list所有对象都是同一个类时,将会拼凑为一条sql进行删除,效率提升多。- Parameters:
list- 要更新的对象列表- Returns:
- 实际删除的条数
- Throws:
NullKeyValueException- 当任意一个值没有带key时,抛出异常
-
delete
Description copied from interface:DBHelper删除数据库记录,返回数据库实际修改条数。 推荐使用单个主键的表使用该方法,当list所有对象都是同一个类时,将会拼凑为一条sql进行删除,效率提升多。 该操作【会】自动使用软删除进行删除- Parameters:
list- 要更新的对象列表- Returns:
- 实际删除的条数
- Throws:
NullKeyValueException- 当任意一个值没有带key时,抛出异常
-
deleteHard
Description copied from interface:DBHelper自定义条件删除数据(无论是否注解了软删除字段)。
对于使用了拦截器和deleteValueScript的场景,该方法的实现是先根据条件查出数据,再批量删除,以便拦截器可以记录下实际被删的数据,此时删除性能可能比较差,请权衡使用。- Parameters:
clazz- 必须有默认构造方法postSql- 必须提供,必须写where,【不允许】留空args- postSql的参数- Returns:
- 实际删除的条数
-
delete
Description copied from interface:DBHelper自定义条件删除数据,该操作【会】自动使用软删除标记。 对于使用了拦截器和deleteValueScript的场景,该方法的实现是先根据条件查出数据,再批量删除,以便拦截器可以记录下实际被删的数据,此时删除性能可能比较差,请权衡使用。- Parameters:
clazz- 必须有默认构造方法postSql- 必须提供,必须写where,【不允许】留空args- postSql的参数- Returns:
- 实际删除的条数
-