public interface Behavior<T> extends SimplePileline
User behavior interface.
By default, it provides users with the basic function of insert, delete, update and select singlecases.
To keep coding styles consistent, static methods implement common set
operations (although Bootstrap instances can still be used, we
recommend this approach).
All result sets correspond to subclass class name fields, class names correspond to table names, object fields correspond to table fields, and object field types correspond to table field types.
By default, the query is associated with the class name field name, or
aliased using the Table Column annotation.
Note that this interface cannot execute SQL statements.
Bootstrap| 限定符和类型 | 接口和说明 |
|---|---|
static interface |
Behavior.Perfect<T> |
static interface |
Behavior.PerfectList<T> |
DEFAULT_CACHE, Keywords, Keywords2, Keywords3| 限定符和类型 | 方法和说明 |
|---|---|
default Bootstrap |
bootstrap()
Get the
Bootstrap instance corresponding to the current model. |
default void |
checkPrimary() |
default int |
createTable()
Create tables based on data structures
|
default int |
delete()
Delete in the database according to the
Id |
default int |
dropTable()
Delete table
|
default Behavior.Perfect<T> |
exceptFields(String... fields) |
default Behavior.Perfect<T> |
fields(String... fields) |
default Optional<T> |
findByFields(String... fields) |
default Optional<T> |
findByPk()
Gets an instance from the database through the primary key
|
default int |
insert()
Inserts the current instance to the database
|
default Behavior.Perfect<T> |
perfect(Bootstrap $bootstrap,
Behavior<T> $bean,
String[] $fields,
String[] $excepts) |
static <T> Behavior.PerfectList<T> |
perfectList(Bootstrap $bootstrap,
Class<T> $class) |
static <T> Behavior.PerfectList<T> |
specify(Class<T> cls)
Tell
Behavior the type of instance the interface is about to operate
on, which is a constructed start function |
static Bootstrap |
staticBootstrap(Class<?> cls) |
default int |
update(String... fields)
Specify field modification
|
default int |
updateBy(String column) |
formatSql, getPrimaryKey, getSql, initFetchSize, modifiedTableName, noticeAdd, noticeUpdate, translateParamerInSql, tryReadFromCachedefault Behavior.Perfect<T> fields(String... fields)
fields - default Behavior.Perfect<T> exceptFields(String... fields)
fields - default int insert()
default int delete()
throws QueryException
IdQueryExceptiondefault void checkPrimary()
default int update(String... fields)
fields - - Only the specified fields in the entity class are modifiedfields(String...),
update(String...)default int updateBy(String column)
default Optional<T> findByPk()
default Optional<T> findByFields(String... fields) throws QueryException
fields - QueryExceptiondefault int createTable()
default int dropTable()
default Bootstrap bootstrap()
Bootstrap instance corresponding to the current model. Note
that new Bootstrap should not be constructed here, but should be
obtained from the created object pool or cache container.static <T> Behavior.PerfectList<T> specify(Class<T> cls)
Behavior the type of instance the interface is about to operate
on, which is a constructed start functioncls - static <T> Behavior.PerfectList<T> perfectList(Bootstrap $bootstrap, Class<T> $class)
$bootstrap - $class - Copyright © 2023. All rights reserved.