diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java index 5393dbef..c3be373f 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/BaseMapper.java @@ -85,10 +85,21 @@ public interface BaseMapper { /** * 插入带有主键的实体类。 * - * @param entity 实体类 + * @param entity 实体类,不忽略 {@code null} 值 * @return 受影响的行数 */ default int insertWithPk(T entity) { + return insertWithPk(entity, false); + } + + + /** + * 插入带有主键的实体类。 + * + * @param entity 实体类,忽略 {@code null} 值 + * @return 受影响的行数 + */ + default int insertSelectiveWithPk(T entity) { return insertWithPk(entity, true); }