mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
style: code format
This commit is contained in:
parent
c5fb1fbea8
commit
bc6694a8a6
@ -49,6 +49,7 @@ import static com.mybatisflex.core.query.QueryMethods.count;
|
||||
* @author 王帅
|
||||
* @author yangs
|
||||
* @author lhzsdnu
|
||||
* @author 王超
|
||||
*/
|
||||
@SuppressWarnings({"varargs", "unchecked", "unused"})
|
||||
public interface BaseMapper<T> {
|
||||
@ -378,7 +379,6 @@ public interface BaseMapper<T> {
|
||||
int updateByQuery(@Param(FlexConsts.ENTITY) T entity, @Param(FlexConsts.IGNORE_NULLS) boolean ignoreNulls, @Param(FlexConsts.QUERY) QueryWrapper queryWrapper);
|
||||
|
||||
|
||||
|
||||
// === 查(select) ===
|
||||
|
||||
/**
|
||||
@ -387,7 +387,7 @@ public interface BaseMapper<T> {
|
||||
* @param entity 实体对象,必须包含有主键
|
||||
* @return 实体类数据
|
||||
*/
|
||||
default T selectOneByEntity(T entity){
|
||||
default T selectOneByEntityId(T entity) {
|
||||
FlexAssert.notNull(entity, "entity can not be null");
|
||||
TableInfo tableInfo = TableInfoFactory.ofEntityClass(entity.getClass());
|
||||
Object[] pkArgs = tableInfo.buildPkSqlArgs(entity);
|
||||
|
||||
@ -300,8 +300,8 @@ public interface IService<T> {
|
||||
* @param entity 实体对象,必须包含有主键
|
||||
* @return 查询结果数据
|
||||
*/
|
||||
default T getOneByEntity(T entity) {
|
||||
return getMapper().selectOneByEntity(entity);
|
||||
default T getOneByEntityId(T entity) {
|
||||
return getMapper().selectOneByEntityId(entity);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -311,8 +311,8 @@ public interface IService<T> {
|
||||
* @return 查询结果数据
|
||||
* @apiNote 该方法会将查询结果封装为 {@link Optional} 类进行返回,方便链式操作。
|
||||
*/
|
||||
default Optional<T> getByEntityOpt(T entity) {
|
||||
return Optional.ofNullable(getOneByEntity(entity));
|
||||
default Optional<T> getByEntityIdOpt(T entity) {
|
||||
return Optional.ofNullable(getOneByEntityId(entity));
|
||||
}
|
||||
/**
|
||||
* <p>根据数据主键查询一条数据。
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user