style: code format

This commit is contained in:
开源海哥 2023-10-08 18:49:13 +08:00
parent c5fb1fbea8
commit bc6694a8a6
2 changed files with 9 additions and 9 deletions

View File

@ -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> {
@ -197,10 +198,10 @@ public interface BaseMapper<T> {
/**
* 根据实体主键来删除数据
*
* @param entity 实体对象必须包含有主键
* @param entity 实体对象必须包含有主键
* @return 受影响的行数
*/
default int delete( T entity){
default int delete(T entity) {
FlexAssert.notNull(entity, "entity can not be null");
TableInfo tableInfo = TableInfoFactory.ofEntityClass(entity.getClass());
Object[] pkArgs = tableInfo.buildPkSqlArgs(entity);
@ -378,16 +379,15 @@ public interface BaseMapper<T> {
int updateByQuery(@Param(FlexConsts.ENTITY) T entity, @Param(FlexConsts.IGNORE_NULLS) boolean ignoreNulls, @Param(FlexConsts.QUERY) QueryWrapper queryWrapper);
// === select ===
/**
* 根据实体主键查询数据
*
* @param entity 实体对象必须包含有主键
* @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);

View File

@ -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>根据数据主键查询一条数据