From ffcc0480607058d7fc921de62a9333255d031865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=96=87?= <289222346@qq.com> Date: Sat, 7 May 2022 00:01:07 +0800 Subject: [PATCH] =?UTF-8?q?refactor(delete):=E9=87=8D=E8=BD=BD=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++-- .../java/com/myjdbc/web/mongodb/BaseMongoDao.java | 11 +++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 02f65e6..1e9ec51 100644 --- a/pom.xml +++ b/pom.xml @@ -7,12 +7,12 @@ com.myjdbc myjdbc-dependencies - 1.0 + 1.0.4 com.myjdbc.web myjdbc-web-mongodb - 1.0.1 + 1.0.2 8 @@ -51,6 +51,7 @@ org.apache.maven.plugins maven-source-plugin + 3.2.1 attach-sources diff --git a/src/main/java/com/myjdbc/web/mongodb/BaseMongoDao.java b/src/main/java/com/myjdbc/web/mongodb/BaseMongoDao.java index 7bdd743..0181a43 100644 --- a/src/main/java/com/myjdbc/web/mongodb/BaseMongoDao.java +++ b/src/main/java/com/myjdbc/web/mongodb/BaseMongoDao.java @@ -139,6 +139,17 @@ public abstract class BaseMongoDao { return mongoTemplate.remove(query, clazz).wasAcknowledged(); } + /** + * 删除数据 + * + * @param data 待删除对象 + * + * @return + */ + public boolean delete(T data) { + return mongoTemplate.remove(data).wasAcknowledged(); + } + /** * 自动注入MongoId *

-- Gitee