From ca180e18a4cb5ff01a4958c2faa7a63b0a5955d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=80=E6=BA=90=E6=B5=B7=E5=93=A5?= Date: Thu, 2 Mar 2023 15:06:52 +0800 Subject: [PATCH] update comments --- .../src/main/java/com/mybatisflex/annotation/Column.java | 1 + .../src/main/java/com/mybatisflex/core/row/Row.java | 9 ++++----- .../main/java/com/mybatisflex/core/row/RowMapper.java | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/Column.java b/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/Column.java index fb29d793..f006aaa8 100644 --- a/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/Column.java +++ b/mybatis-flex-annotation/src/main/java/com/mybatisflex/annotation/Column.java @@ -49,6 +49,7 @@ public @interface Column { /** * 是否是逻辑删除字段,一张表中只能存在 1 一个逻辑删除字段 + * 逻辑删除的字段,被删除时,会设置为 1,正常状态为 0 */ boolean isLogicDelete() default false; diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Row.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Row.java index 504dc54b..d7b80bf7 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Row.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/Row.java @@ -59,14 +59,13 @@ public class Row extends HashMap implements ModifyAttrsRecord { return row; } - public static Row ofKey(RowKey ...rowKeys) { + public static Row ofKey(RowKey... rowKeys) { Row row = new Row(); row.primaryKeys = rowKeys; return row; } - public static Row ofKey(RowKey rowKey, Object value) { Row row = new Row(); row.primaryKeys = new RowKey[]{rowKey}; @@ -88,16 +87,16 @@ public class Row extends HashMap implements ModifyAttrsRecord { public Row set(String key, Object value) { put(key, value); boolean isPrimaryKey = false; - if (this.primaryKeys != null){ + if (this.primaryKeys != null) { for (RowKey rowKey : primaryKeys) { - if (rowKey.getKeyColumn().equals(key)){ + if (rowKey.getKeyColumn().equals(key)) { isPrimaryKey = true; break; } } } - if (!isPrimaryKey){ + if (!isPrimaryKey) { addModifyAttr(key); } diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java index fbf83835..87325aa4 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/row/RowMapper.java @@ -92,7 +92,6 @@ public interface RowMapper { * @param row id 和 值的数据,可以通过 {@link Row#ofKey(String, Object)} 来创建 * @return 执行影响的行数 */ - default int deleteById(@Param(FlexConsts.TABLE_NAME) String tableName, @Param(FlexConsts.ROW) Row row) { return deleteById(tableName, StringUtil.join(",", row.obtainsPrimaryKeyStrings()), row.obtainsPrimaryValues()); }