From 55e90876723f9b37c63aacb885aadcab80193f62 Mon Sep 17 00:00:00 2001 From: fengshuonan Date: Mon, 8 May 2023 13:54:56 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=907.6.0=E3=80=91=E3=80=90=E6=A1=86?= =?UTF-8?q?=E6=9E=B6=E6=94=B9=E9=80=A0=E3=80=91=E7=A7=BB=E9=99=A4mongo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel-d-mongodb/README.md | 65 -------- kernel-d-mongodb/mongodb-api/pom.xml | 35 ----- .../kernel/mongodb/api/MongoFileApi.java | 79 ---------- .../roses/kernel/mongodb/api/MongodbApi.java | 85 ----------- .../api/constants/MongodbConstants.java | 45 ------ .../api/exception/MongodbException.java | 43 ------ .../mongodb-integration-beetl/pom.xml | 37 ----- .../controller/ModelViewController.java | 53 ------- .../controller/MongoFileController.java | 115 -------------- .../assets/modular/mongodb/fileList.js | 99 ------------ .../pages/modular/mongodb/fileList.html | 35 ----- kernel-d-mongodb/mongodb-sdk-file/pom.xml | 47 ------ .../mongodb/file/entity/MongoFileEntity.java | 89 ----------- .../mongodb/file/mapper/MongoFileMapper.java | 39 ----- .../file/service/MongoFileService.java | 80 ---------- .../service/impl/MongoFileServiceImpl.java | 143 ------------------ .../mongodb-sdk-springboot/pom.xml | 37 ----- .../kernel/mongodb/entity/GunsMapEntity.java | 53 ------- .../mongodb/mapper/GunsMapRepository.java | 39 ----- .../mongodb/service/GunsMapService.java | 88 ----------- .../service/impl/GunsMapServiceImpl.java | 74 --------- .../mongodb-spring-boot-starter/pom.xml | 36 ----- .../starter/GunsMongodbAutoConfiguration.java | 68 --------- .../main/resources/META-INF/spring.factories | 2 - kernel-d-mongodb/pom.xml | 34 ----- pom.xml | 3 - 26 files changed, 1523 deletions(-) delete mode 100644 kernel-d-mongodb/README.md delete mode 100644 kernel-d-mongodb/mongodb-api/pom.xml delete mode 100644 kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongoFileApi.java delete mode 100644 kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongodbApi.java delete mode 100644 kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/constants/MongodbConstants.java delete mode 100644 kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/exception/MongodbException.java delete mode 100644 kernel-d-mongodb/mongodb-integration-beetl/pom.xml delete mode 100644 kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/ModelViewController.java delete mode 100644 kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/MongoFileController.java delete mode 100644 kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/assets/modular/mongodb/fileList.js delete mode 100644 kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/pages/modular/mongodb/fileList.html delete mode 100644 kernel-d-mongodb/mongodb-sdk-file/pom.xml delete mode 100644 kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/entity/MongoFileEntity.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/mapper/MongoFileMapper.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/MongoFileService.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/impl/MongoFileServiceImpl.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-springboot/pom.xml delete mode 100644 kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/entity/GunsMapEntity.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/mapper/GunsMapRepository.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/GunsMapService.java delete mode 100644 kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/impl/GunsMapServiceImpl.java delete mode 100644 kernel-d-mongodb/mongodb-spring-boot-starter/pom.xml delete mode 100644 kernel-d-mongodb/mongodb-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/mongodb/starter/GunsMongodbAutoConfiguration.java delete mode 100644 kernel-d-mongodb/mongodb-spring-boot-starter/src/main/resources/META-INF/spring.factories delete mode 100644 kernel-d-mongodb/pom.xml diff --git a/kernel-d-mongodb/README.md b/kernel-d-mongodb/README.md deleted file mode 100644 index 072c47436..000000000 --- a/kernel-d-mongodb/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Mongodb模块 - -## GridFS文件管理 - -### 部署的sql,并为角色配置菜单 - -```sql -INSERT INTO guns.sys_menu (menu_id, menu_parent_id, menu_pids, menu_name, menu_code, app_code, visible, menu_sort, status_flag, remark, layui_path, layui_icon, antdv_router, antdv_icon, antdv_component, antdv_link_open_type, antdv_link_url, del_flag, create_time, create_user, update_time, update_user) VALUES(1377141796257218561, 1339550467939639317, '[-1],[1339550467939639317],', 'Mongodb 文件存储', 'mongo_file', 'system', 'Y', 1000.00, 1, NULL, '/view/mongodb/file', 'layui-icon-star-fill', NULL, 'icon-default', NULL, 0, NULL, 'N', '2021-03-31 14:12:45', 1339550467939639299, NULL, NULL); -``` - -### application.yml添加mongodb配置 - -```yml -spring: - data: - mongodb: - uri: mongodb://localhost:8002 - database: test -``` - -### SpringBoot启动类上添加配置 - -```java -@EnableMongoRepositories(basePackages = {"cn.stylefeng.roses.kernel.mongodb.file.mapper"}) -``` - -### 添加GridFSBucket配置类 - -```java -import com.mongodb.client.MongoClient; -import com.mongodb.client.MongoDatabase; -import com.mongodb.client.gridfs.GridFSBucket; -import com.mongodb.client.gridfs.GridFSBuckets; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * @author huziyang - * @create 2021-03-26 17:28 - */ -@Configuration -public class MongodbConfig { - @Value("${spring.data.mongodb.database}") - String db; - - @Bean - public GridFSBucket getGridFSBucket(MongoClient mongoClient){ - MongoDatabase mongoDatabase = mongoClient.getDatabase(db); - return GridFSBuckets.create(mongoDatabase); - } -} -``` - -### pom中引用工作流的依赖 - -```xml - - - cn.stylefeng.roses - mongodb-integration-beetl - ${current.roses.version} - -``` - diff --git a/kernel-d-mongodb/mongodb-api/pom.xml b/kernel-d-mongodb/mongodb-api/pom.xml deleted file mode 100644 index 7f4151be9..000000000 --- a/kernel-d-mongodb/mongodb-api/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-mongodb - 7.6.0 - - - mongodb-api - - - 8 - 8 - - - - - - org.springframework.boot - spring-boot-starter-web - - - - - cn.stylefeng.roses - db-api - ${roses.version} - - - - diff --git a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongoFileApi.java b/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongoFileApi.java deleted file mode 100644 index 62a92a527..000000000 --- a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongoFileApi.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.api; - -import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; -import org.springframework.web.multipart.MultipartFile; - -import java.util.Optional; - -/** - * Mongodb文件管理API - * - * @author huziyang - * @since 2021/03/30 11:06 - */ -public interface MongoFileApi { - - /** - * 保存文件 - * - * @param file 上传的文件对象 - * @return 返回数据结果 - * @author huziyang - * @since 2021/03/30 11:06 - */ - T saveFile(MultipartFile file); - - /** - * 根据id删除文件 - * - * @param id 集合id - * @author huziyang - * @since 2021/03/30 11:06 - */ - void removeFile(ID id); - - /** - * 根据id获取文件 - * - * @param id 集合id - * @return 返回查询到数据的Optional - * @author huziyang - * @since 2021/03/30 11:06 - */ - Optional getFileById(ID id); - - /** - * 分页获取文件列表 - * - * @param fileDocument 查询条件 - * @return 返回查询文件的分页结果 - * @author huziyang - * @since 2021/03/30 11:06 - */ - PageResult getFilesByPage(T fileDocument); - -} diff --git a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongodbApi.java b/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongodbApi.java deleted file mode 100644 index 254606182..000000000 --- a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/MongodbApi.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.api; - -import java.util.List; -import java.util.Optional; - -/** - * Mongodb数据存储的api,适用于存map类型数据,存储在guns_map集合中 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -public interface MongodbApi { - - /** - * 新增数据 - * - * @param gunsMapEntity 数据存储的参数 - * @return 返回数据结果 - * @author huziyang - * @since 2020/10/27 17:38 - */ - T insert(T gunsMapEntity); - - /** - * 修改数据 - * - * @param gunsMapEntity 数据存储的参数 - * @return 返回数据结果 - * @author huziyang - * @since 2020/10/27 17:38 - */ - T update(T gunsMapEntity); - - /** - * 根据id删除 - * - * @param id 集合id - * @author huziyang - * @since 2020/10/27 17:38 - */ - void deleteById(ID id); - - /** - * 根据id查询 - * - * @param id 集合id - * @return 返回查询到数据的Optional - * @author huziyang - * @since 2020/10/27 17:38 - */ - Optional findById(ID id); - - /** - * 查询所有数据 - * - * @return 返回所有数据列表 - * @author huziyang - * @since 2020/10/27 17:38 - */ - List findAll(); -} diff --git a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/constants/MongodbConstants.java b/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/constants/MongodbConstants.java deleted file mode 100644 index d78f6f9fa..000000000 --- a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/constants/MongodbConstants.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.api.constants; - -/** - * Mongodb模块的常量 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -public interface MongodbConstants { - - /** - * mongodb模块的名称 - */ - String MONGODB_MODULE_NAME = "kernel-d-mongodb"; - - /** - * 异常枚举的步进值 - */ - String MONGODB_EXCEPTION_STEP_CODE = "70"; - -} diff --git a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/exception/MongodbException.java b/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/exception/MongodbException.java deleted file mode 100644 index 0ac6d1855..000000000 --- a/kernel-d-mongodb/mongodb-api/src/main/java/cn/stylefeng/roses/kernel/mongodb/api/exception/MongodbException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.api.exception; - -import cn.stylefeng.roses.kernel.mongodb.api.constants.MongodbConstants; -import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum; -import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException; - -/** - * Mongodb模块的异常 - * - * @author fengshuonan - * @since 2021/13/17 23:59 - */ -public class MongodbException extends ServiceException { - - public MongodbException(AbstractExceptionEnum exception) { - super(MongodbConstants.MONGODB_MODULE_NAME, exception); - } - -} diff --git a/kernel-d-mongodb/mongodb-integration-beetl/pom.xml b/kernel-d-mongodb/mongodb-integration-beetl/pom.xml deleted file mode 100644 index 7a6128fb2..000000000 --- a/kernel-d-mongodb/mongodb-integration-beetl/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-mongodb - 7.6.0 - - - mongodb-integration-beetl - - - 8 - 8 - - - - - - - cn.stylefeng.roses - scanner-api - ${roses.version} - - - - - cn.stylefeng.roses - mongodb-spring-boot-starter - ${roses.version} - - - - diff --git a/kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/ModelViewController.java b/kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/ModelViewController.java deleted file mode 100644 index c86e1429f..000000000 --- a/kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/ModelViewController.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.integration.controller; - -import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum; -import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; -import org.springframework.stereotype.Controller; - -/** - * MongoDB文件管理界面渲染控制器 - * - * @author huziyang - * @since 2021/03/30 15:21 - */ -@Controller -@ApiResource(name = "MongoDB文件管理界面渲染控制器", resBizType = ResBizTypeEnum.SYSTEM) -public class ModelViewController { - - /** - * 文件管理视图 - * - * @author huziyang - * @since 2021/03/30 15:21 - */ - @GetResource(name = "Mongodb文件列表视图", path = "/view/mongodb/file") - public String mongodbFile() { - return "/modular/mongodb/fileList.html"; - } - -} diff --git a/kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/MongoFileController.java b/kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/MongoFileController.java deleted file mode 100644 index c72c33d6d..000000000 --- a/kernel-d-mongodb/mongodb-integration-beetl/src/main/java/cn/stylefeng/roses/kernel/mongodb/integration/controller/MongoFileController.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.integration.controller; - -import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; -import cn.stylefeng.roses.kernel.mongodb.api.MongoFileApi; -import cn.stylefeng.roses.kernel.mongodb.file.entity.MongoFileEntity; -import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum; -import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData; -import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData; -import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource; -import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RequestPart; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.Optional; - -/** - * Mongodb文件管理接口控制器 - * - * @author huziyang - * @since 2021/03/31 17:28 - */ -@RestController -@ApiResource(name = "Mongodb文件接口控制器", resBizType = ResBizTypeEnum.SYSTEM) -public class MongoFileController { - - @Resource - private MongoFileApi mongoFileApi; - - /** - * 新增文件 - * - * @author huziyang - * @since 2021/03/31 17:28 - */ - @PostResource(name = "Mongodb文件新增", path = "/view/mongodb/file/add") - public ResponseData mongodbFileAdd(@RequestPart("file") MultipartFile file) { - return new SuccessResponseData<>(mongoFileApi.saveFile(file)); - } - - /** - * 根据id删除文件 - * - * @author huziyang - * @since 2021/03/31 17:28 - */ - @PostResource(name = "Mongodb文件删除", path = "/view/mongodb/file/del") - public ResponseData mongodbFileDel(@RequestParam String id) { - mongoFileApi.removeFile(id); - return new SuccessResponseData<>(); - } - - /** - * 获取分页文件列表 - * - * @author huziyang - * @since 2021/03/31 17:28 - */ - @GetResource(name = "Mongodb文件列表", path = "/view/mongodb/file/list") - public ResponseData> mongodbFileList(MongoFileEntity mongoFileEntity) { - return new SuccessResponseData<>(mongoFileApi.getFilesByPage(mongoFileEntity)); - } - - /** - * 根据id下载文件 - * - * @author huziyang - * @since 2021/03/31 17:28 - */ - @GetResource(name = "Mongodb文件下载", path = "/view/mongodb/file/down") - public ResponseEntity mongodbFileDown(@RequestParam String id) throws UnsupportedEncodingException { - Optional file = mongoFileApi.getFileById(id); - if (file.isPresent()) { - return ResponseEntity.ok() - .header(HttpHeaders.CONTENT_DISPOSITION, "attachment; fileName=" + URLEncoder.encode(file.get().getName(), "utf-8")) - .header(HttpHeaders.CONTENT_TYPE, "application/octet-stream") - .body(file.get().getContent()); - } else { - return ResponseEntity.status(HttpStatus.NOT_FOUND).body("not found"); - } - } - -} diff --git a/kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/assets/modular/mongodb/fileList.js b/kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/assets/modular/mongodb/fileList.js deleted file mode 100644 index ab7f05e78..000000000 --- a/kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/assets/modular/mongodb/fileList.js +++ /dev/null @@ -1,99 +0,0 @@ -layui.use(['table', 'form', 'func', 'HttpRequest', 'util', 'upload'], function () { - - var $ = layui.$; - var table = layui.table; - var form = layui.form; - var func = layui.func; - var HttpRequest = layui.HttpRequest; - var util = layui.util; - var upload = layui.upload; - - // 模型设计管理 - var MongoFile = { - tableId: "fileList" - }; - - // 初始化表格的列 - MongoFile.initColumn = function () { - return [[ - {type: 'checkbox'}, - {field: 'id', title: '文件编号', width: 200}, - {field: 'name', title: '文件名称', width: 200}, - {field: 'uploadUserId', title: '创建人编号'}, - {field: 'uploadDate', title: '创建日期'}, - {align: 'center', toolbar: '#tableBar', title: '操作', width: 250} - ]]; - }; - - // 点击查询按钮 - MongoFile.search = function () { - var queryData = {}; - queryData['name'] = $("#fileName").val(); - table.reload(MongoFile.tableId, { - where: queryData, - page: {curr: 1} - }); - }; - - // 点击删除 - MongoFile.delete = function (data) { - var operation = function () { - var httpRequest = new HttpRequest(Feng.ctxPath + "/view/mongodb/file/del?id="+data.id, 'post', function (data) { - Feng.success("删除成功!"); - table.reload(MongoFile.tableId); - }, function (data) { - Feng.error("删除失败!" + data.message + "!"); - }); - httpRequest.set(data); - httpRequest.start(true); - }; - Feng.confirm("是否删除文件" + data.name + "?", operation); - }; - - - // 渲染表格 - var tableResult = table.render({ - elem: '#' + MongoFile.tableId, - url: Feng.ctxPath + '/view/mongodb/file/list', - page: true, - request: {pageName: 'pageNo', limitName: 'pageSize'}, - height: "full-158", - cellMinWidth: 100, - cols: MongoFile.initColumn(), - parseData: Feng.parseData - }); - - // 搜索按钮点击事件 - $('#btnSearch').click(function () { - MongoFile.search(); - }); - - - // 上传文件的点击事件 - upload.render({ - elem: '#modelUpload', - url: Feng.ctxPath + '/view/mongodb/file/add', - accept: 'file', - size: 10000, // 单位kb - done: function (res) { - Feng.success("上传文件成功!"); - MongoFile.search(); - }, - error: function (err) { - Feng.error("上传文件失败!" + err.message); - } - }); - - // 工具条点击事件 - table.on('tool(' + MongoFile.tableId + ')', function (obj) { - var data = obj.data; - var event = obj.event; - - if (event === 'down') { - window.open(Feng.ctxPath + '/view/mongodb/file/down?id=' + data.id); - } else if (event === 'delete') { - MongoFile.delete(data); - } - }); - -}); diff --git a/kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/pages/modular/mongodb/fileList.html b/kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/pages/modular/mongodb/fileList.html deleted file mode 100644 index a8beb387a..000000000 --- a/kernel-d-mongodb/mongodb-integration-beetl/src/main/resources/pages/modular/mongodb/fileList.html +++ /dev/null @@ -1,35 +0,0 @@ -@layout("/layout/_container.html",{js:["/assets/modular/mongodb/fileList.js"]}){ - -
- Mongodb文件存储 -
- -
-
-
-
-
-
-
-
- -
-
- - -
-
-
-
-
-
-
-
-
- - - -@} diff --git a/kernel-d-mongodb/mongodb-sdk-file/pom.xml b/kernel-d-mongodb/mongodb-sdk-file/pom.xml deleted file mode 100644 index 51e8b795a..000000000 --- a/kernel-d-mongodb/mongodb-sdk-file/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-mongodb - 7.6.0 - - - mongodb-sdk-file - - - 8 - 8 - - - - - - - - - cn.stylefeng.roses - auth-api - ${roses.version} - true - - - - - - cn.stylefeng.roses - mongodb-api - ${roses.version} - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - - diff --git a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/entity/MongoFileEntity.java b/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/entity/MongoFileEntity.java deleted file mode 100644 index 59540aa10..000000000 --- a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/entity/MongoFileEntity.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.file.entity; - -import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest; -import lombok.*; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -import java.util.Date; - -/** - * Mongodb 文件存储集合实体 - * - * @author huziyang - * @since 2021/03/26 17:23 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@NoArgsConstructor -@AllArgsConstructor -@Builder -@Document("mongo_file") -public class MongoFileEntity extends BaseRequest { - - /** - * 集合id - */ - @Id - private String id; - - /** - * 文件名称 - */ - private String name; - - /** - * 上传文件日期 - */ - private Date uploadDate; - - /** - * 上传文件用户编号 - */ - private Long uploadUserId; - - /** - * 文件后缀名 - */ - private String suffix; - - /** - * 文件描述 - */ - private String description; - - /** - * Mongodb GridFS 中 fs.files集合编号 - */ - private String gridfsId; - - /** - * 下载文件的 响应字段 - */ - private byte[] content; - -} diff --git a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/mapper/MongoFileMapper.java b/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/mapper/MongoFileMapper.java deleted file mode 100644 index 7648a9b54..000000000 --- a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/mapper/MongoFileMapper.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.file.mapper; - -import cn.stylefeng.roses.kernel.mongodb.file.entity.MongoFileEntity; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.mongodb.repository.MongoRepository; - -/** - * Mongodb 文件存储Mapper - * - * @author huziyang - * @since 2021/03/26 17:27 - */ -@Configuration -public interface MongoFileMapper extends MongoRepository { -} diff --git a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/MongoFileService.java b/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/MongoFileService.java deleted file mode 100644 index deffd3bee..000000000 --- a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/MongoFileService.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.file.service; - -import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; -import cn.stylefeng.roses.kernel.mongodb.file.entity.MongoFileEntity; -import org.springframework.web.multipart.MultipartFile; - -import java.util.Optional; - -/** - * Mongodb 文件存储接口 - * - * @author huziyang - * @since 2021/03/26 17:28 - */ -public interface MongoFileService { - - /** - * 保存文件 - * - * @param file 上传的文件对象 - * @return 返回数据结果 - * @author huziyang - * @since 2021/03/30 11:06 - */ - MongoFileEntity saveFile(MultipartFile file); - - /** - * 根据id删除文件 - * - * @param id 集合id - * @author huziyang - * @since 2021/03/30 11:06 - */ - void removeFile(String id); - - /** - * 根据id获取文件 - * - * @param id 集合id - * @return 返回查询到数据的Optional - * @author huziyang - * @since 2021/03/30 11:06 - */ - Optional getFileById(String id); - - /** - * 分页获取文件列表 - * - * @param fileDocument 查询条件 - * @return 返回查询文件的分页结果 - * @author huziyang - * @since 2021/03/30 11:06 - */ - PageResult getFilesByPage(MongoFileEntity fileDocument); - -} diff --git a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/impl/MongoFileServiceImpl.java b/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/impl/MongoFileServiceImpl.java deleted file mode 100644 index 776d5bcae..000000000 --- a/kernel-d-mongodb/mongodb-sdk-file/src/main/java/cn/stylefeng/roses/kernel/mongodb/file/service/impl/MongoFileServiceImpl.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.file.service.impl; - -import cn.hutool.core.io.IoUtil; -import cn.hutool.core.util.IdUtil; -import cn.stylefeng.roses.kernel.auth.api.context.LoginContext; -import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser; -import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory; -import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult; -import cn.stylefeng.roses.kernel.mongodb.api.MongoFileApi; -import cn.stylefeng.roses.kernel.mongodb.file.entity.MongoFileEntity; -import cn.stylefeng.roses.kernel.mongodb.file.mapper.MongoFileMapper; -import cn.stylefeng.roses.kernel.mongodb.file.service.MongoFileService; -import com.mongodb.client.gridfs.GridFSBucket; -import com.mongodb.client.gridfs.GridFSDownloadStream; -import com.mongodb.client.gridfs.model.GridFSFile; -import lombok.extern.slf4j.Slf4j; -import org.bson.types.ObjectId; -import org.springframework.data.domain.*; -import org.springframework.data.mongodb.core.query.Criteria; -import org.springframework.data.mongodb.core.query.Query; -import org.springframework.data.mongodb.gridfs.GridFsResource; -import org.springframework.data.mongodb.gridfs.GridFsTemplate; -import org.springframework.stereotype.Service; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.Resource; -import java.io.IOException; -import java.util.Date; -import java.util.Optional; - -/** - * Mongodb 文件存储实现类 - * - * @author huziyang - * @since 2021/03/26 17:29 - */ -@Slf4j -@Service -public class MongoFileServiceImpl implements MongoFileService, MongoFileApi { - - @Resource - private MongoFileMapper mongoFileMapper; - - @Resource - private GridFsTemplate gridFsTemplate; - - @Resource - private GridFSBucket gridFSBucket; - - @Override - public MongoFileEntity saveFile(MultipartFile file) { - MongoFileEntity fileDocument = new MongoFileEntity(); - fileDocument.setName(file.getOriginalFilename()); - fileDocument.setUploadDate(new Date()); - try { - // 填充登录用户的userId - LoginUser loginUser = LoginContext.me().getLoginUser(); - fileDocument.setUploadUserId(loginUser.getUserId()); - } catch (Exception e) { - // 获取不到用户登录信息,就不填充 - } - fileDocument.setSuffix(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."))); - try { - ObjectId store = gridFsTemplate.store(file.getInputStream(), IdUtil.simpleUUID(), file.getContentType()); - fileDocument.setGridfsId(String.valueOf(store)); - return mongoFileMapper.save(fileDocument); - } catch (IOException ex) { - log.error(ex.getMessage()); - } - return fileDocument; - } - - @Override - public void removeFile(String id) { - Optional fileDocumentOptional = mongoFileMapper.findById(id); - if (fileDocumentOptional.isPresent()) { - mongoFileMapper.deleteById(id); - gridFsTemplate.delete(new Query().addCriteria(Criteria.where("_id").is(fileDocumentOptional.get().getGridfsId()))); - } - } - - @Override - public Optional getFileById(String id) { - Optional fileDocumentOptional = mongoFileMapper.findById(id); - if (fileDocumentOptional.isPresent()) { - MongoFileEntity fileDocument = fileDocumentOptional.get(); - Query gridQuery = new Query().addCriteria(Criteria.where("_id").is(fileDocument.getGridfsId())); - GridFSFile fsFile = gridFsTemplate.findOne(gridQuery); - GridFSDownloadStream in = gridFSBucket.openDownloadStream(fsFile.getObjectId()); - try { - if (in.getGridFSFile().getLength() > 0) { - GridFsResource resource = new GridFsResource(fsFile, in); - fileDocument.setContent(IoUtil.readBytes(resource.getInputStream())); - return Optional.of(fileDocument); - } else { - return Optional.empty(); - } - } catch (IOException e) { - log.error(e.getMessage()); - } - } - return Optional.empty(); - } - - @Override - public PageResult getFilesByPage(MongoFileEntity fileDocument) { - Integer pageIndex = fileDocument.getPageNo(); - Integer pageSize = fileDocument.getPageSize(); - Sort sort = Sort.by(Sort.Direction.DESC, "uploadDate"); - PageRequest pageRequest = PageRequest.of(pageIndex - 1, pageSize, sort); - Example example = Example.of(fileDocument, ExampleMatcher.matching() - .withIgnoreCase(true) - .withIgnorePaths("_class", "pageSize", "pageNo", "content") - ); - Page all = mongoFileMapper.findAll(example, pageRequest); - return PageResultFactory.createPageResult(all.getContent(), mongoFileMapper.count(example), pageSize, pageIndex); - } - -} diff --git a/kernel-d-mongodb/mongodb-sdk-springboot/pom.xml b/kernel-d-mongodb/mongodb-sdk-springboot/pom.xml deleted file mode 100644 index 3dae71dd3..000000000 --- a/kernel-d-mongodb/mongodb-sdk-springboot/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-mongodb - 7.6.0 - - - mongodb-sdk-springboot - - - 8 - 8 - - - - - - - cn.stylefeng.roses - mongodb-api - ${roses.version} - - - - - org.springframework.boot - spring-boot-starter-data-mongodb - - - - - diff --git a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/entity/GunsMapEntity.java b/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/entity/GunsMapEntity.java deleted file mode 100644 index 264e9bacc..000000000 --- a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/entity/GunsMapEntity.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.entity; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import org.springframework.data.annotation.Id; -import org.springframework.data.mongodb.core.mapping.Document; - -import java.util.HashMap; -import java.util.Map; - -/** - * Mongodb 数据存储集合实体 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Document(collection = "guns_map") -public class GunsMapEntity { - - @Id - private String _id; - - private Map data = new HashMap<>(); - -} diff --git a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/mapper/GunsMapRepository.java b/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/mapper/GunsMapRepository.java deleted file mode 100644 index 2cd55cf3d..000000000 --- a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/mapper/GunsMapRepository.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.mapper; - -import cn.stylefeng.roses.kernel.mongodb.entity.GunsMapEntity; -import org.springframework.context.annotation.Configuration; -import org.springframework.data.mongodb.repository.MongoRepository; - -/** - * Mongodb 数据存储mapper - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -@Configuration -public interface GunsMapRepository extends MongoRepository { -} \ No newline at end of file diff --git a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/GunsMapService.java b/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/GunsMapService.java deleted file mode 100644 index 8c1a30ebf..000000000 --- a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/GunsMapService.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.service; - -import cn.stylefeng.roses.kernel.mongodb.entity.GunsMapEntity; - -import java.util.List; -import java.util.Optional; - -/** - * Mongodb 数据存储接口 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -public interface GunsMapService { - - /** - * 新增数据 - * - * @param gunsMapEntity 数据参数 - * @return 返回新增数据结果 - * @author huziyang - * @since 2021/03/20 16:24 - */ - GunsMapEntity insert(GunsMapEntity gunsMapEntity); - - /** - * 修改数据 - * - * @param gunsMapEntity 数据参数 - * @return 返回修改数据结果 - * @author huziyang - * @since 2021/03/20 16:24 - */ - GunsMapEntity update(GunsMapEntity gunsMapEntity); - - /** - * 根据id删除 - * - * @param id 集合id - * @author huziyang - * @since 2021/03/20 16:24 - */ - void deleteById(String id); - - /** - * 根据id查询 - * - * @param id 集合id - * @return 返回查询到数据的Optional - * @author huziyang - * @since 2021/03/20 16:24 - */ - Optional findById(String id); - - /** - * 查询所有集合中数据 - * - * @return 返回所有数据集合 - * @author huziyang - * @since 2021/03/20 16:24 - */ - List findAll(); - -} \ No newline at end of file diff --git a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/impl/GunsMapServiceImpl.java b/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/impl/GunsMapServiceImpl.java deleted file mode 100644 index 155238e2f..000000000 --- a/kernel-d-mongodb/mongodb-sdk-springboot/src/main/java/cn/stylefeng/roses/kernel/mongodb/service/impl/GunsMapServiceImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.service.impl; - -import cn.stylefeng.roses.kernel.mongodb.api.MongodbApi; -import cn.stylefeng.roses.kernel.mongodb.entity.GunsMapEntity; -import cn.stylefeng.roses.kernel.mongodb.mapper.GunsMapRepository; -import cn.stylefeng.roses.kernel.mongodb.service.GunsMapService; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.List; -import java.util.Optional; - -/** - * Mongodb 数据存储实现类 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -@Service -public class GunsMapServiceImpl implements GunsMapService, MongodbApi { - - @Resource - private GunsMapRepository gunsMapRepository; - - @Override - public GunsMapEntity insert(GunsMapEntity gunsMapEntity) { - return gunsMapRepository.insert(gunsMapEntity); - } - - @Override - public GunsMapEntity update(GunsMapEntity gunsMapEntity) { - return gunsMapRepository.save(gunsMapEntity); - } - - @Override - public void deleteById(String id) { - gunsMapRepository.deleteById(id); - } - - @Override - public Optional findById(String id) { - return gunsMapRepository.findById(id); - } - - @Override - public List findAll() { - return gunsMapRepository.findAll(); - } - -} diff --git a/kernel-d-mongodb/mongodb-spring-boot-starter/pom.xml b/kernel-d-mongodb/mongodb-spring-boot-starter/pom.xml deleted file mode 100644 index ec2847963..000000000 --- a/kernel-d-mongodb/mongodb-spring-boot-starter/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - kernel-d-mongodb - 7.6.0 - - - mongodb-spring-boot-starter - - - 8 - 8 - - - - - - cn.stylefeng.roses - mongodb-sdk-springboot - ${roses.version} - - - - - cn.stylefeng.roses - mongodb-sdk-file - ${roses.version} - - - - diff --git a/kernel-d-mongodb/mongodb-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/mongodb/starter/GunsMongodbAutoConfiguration.java b/kernel-d-mongodb/mongodb-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/mongodb/starter/GunsMongodbAutoConfiguration.java deleted file mode 100644 index 6ebd2ee65..000000000 --- a/kernel-d-mongodb/mongodb-spring-boot-starter/src/main/java/cn/stylefeng/roses/kernel/mongodb/starter/GunsMongodbAutoConfiguration.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright [2020-2030] [https://www.stylefeng.cn] - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点: - * - * 1.请不要删除和修改根目录下的LICENSE文件。 - * 2.请不要删除和修改Guns源码头部的版权声明。 - * 3.请保留源码和相关描述文件的项目出处,作者声明等。 - * 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns - * 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns - * 6.若您的项目无法满足以上几点,可申请商业授权 - */ -package cn.stylefeng.roses.kernel.mongodb.starter; - -import cn.stylefeng.roses.kernel.mongodb.api.MongoFileApi; -import cn.stylefeng.roses.kernel.mongodb.api.MongodbApi; -import cn.stylefeng.roses.kernel.mongodb.entity.GunsMapEntity; -import cn.stylefeng.roses.kernel.mongodb.file.entity.MongoFileEntity; -import cn.stylefeng.roses.kernel.mongodb.file.service.impl.MongoFileServiceImpl; -import cn.stylefeng.roses.kernel.mongodb.service.impl.GunsMapServiceImpl; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -/** - * Mongodb模块自动配置 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ -@Configuration -public class GunsMongodbAutoConfiguration { - - /** - * Mongodb 数据存储 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ - @Bean - public MongodbApi mongodbApi() { - return new GunsMapServiceImpl(); - } - - /** - * Mongodb 文件管理 - * - * @author huziyang - * @since 2021/03/20 16:24 - */ - @Bean - public MongoFileApi mongoFileApi() { - return new MongoFileServiceImpl(); - } - -} - diff --git a/kernel-d-mongodb/mongodb-spring-boot-starter/src/main/resources/META-INF/spring.factories b/kernel-d-mongodb/mongodb-spring-boot-starter/src/main/resources/META-INF/spring.factories deleted file mode 100644 index df858df4d..000000000 --- a/kernel-d-mongodb/mongodb-spring-boot-starter/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,2 +0,0 @@ -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.stylefeng.roses.kernel.mongodb.starter.GunsMongodbAutoConfiguration \ No newline at end of file diff --git a/kernel-d-mongodb/pom.xml b/kernel-d-mongodb/pom.xml deleted file mode 100644 index 5998fd620..000000000 --- a/kernel-d-mongodb/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - 4.0.0 - - - cn.stylefeng.roses - roses-kernel - 7.6.0 - - - kernel-d-mongodb - pom - - mongodb-api - mongodb-sdk-springboot - mongodb-spring-boot-starter - mongodb-sdk-file - mongodb-integration-beetl - - - - - - - cn.stylefeng.roses - kernel-a-rule - ${roses.version} - - - - - diff --git a/pom.xml b/pom.xml index 8891cc2cd..19127ae92 100644 --- a/pom.xml +++ b/pom.xml @@ -103,9 +103,6 @@ kernel-s-message - - kernel-d-mongodb - kernel-s-system