!9 【7.0.3】修改编码规范

Merge pull request !9 from William Hu/7.0.3-develop
pull/9/MERGE
stylefeng 2021-04-13 21:53:22 +08:00 committed by Gitee
commit e2f1b04ce3
15 changed files with 536 additions and 56 deletions

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -5,37 +29,51 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.Optional;
/**
* MongodbAPI
*
* @author huziyang
* @create 2021-03-30 11:06
* @date 2021/03/30 11:06
*/
public interface MongoFileApi<T,ID> {
/**
*
* @param file
* @return
*
* @param file
* @return
* @author huziyang
* @date 2021/03/30 11:06
*/
T saveFile(MultipartFile file);
/**
*
* @param id
* id
*
* @param id id
* @author huziyang
* @date 2021/03/30 11:06
*/
void removeFile(ID id);
/**
* id
* @param id
* @return
*
* @param id id
* @return Optional
* @author huziyang
* @date 2021/03/30 11:06
*/
Optional<T> getFileById(ID id);
/**
*
*
*
* @param fileDocument
* @return
* @return
* @author huziyang
* @date 2021/03/30 11:06
*/
PageResult<T> getFilesByPage(T fileDocument);

View File

@ -1,46 +1,85 @@
/*
* 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.
*
* GunsAPACHE 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;
/**
* Mongodbapimapguns_map
*
* @author huziyang
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
public interface MongodbApi<T,ID> {
/**
*
* @param gunsMapEntity
* @return
*
*
* @param gunsMapEntity
* @return
* @author huziyang
* @date 2020/10/27 17:38
*/
T insert(T gunsMapEntity);
/**
*
* @param gunsMapEntity
* @return
*
*
* @param gunsMapEntity
* @return
* @author huziyang
* @date 2020/10/27 17:38
*/
T update(T gunsMapEntity);
/**
* id
* @param id
*
* @param id id
* @author huziyang
* @date 2020/10/27 17:38
*/
void deleteById(ID id);
/**
* id
* @param id
* @return
*
* @param id id
* @return Optional
* @author huziyang
* @date 2020/10/27 17:38
*/
Optional<T> findById(ID id);
/**
*
* @return
*
*
* @return
* @author huziyang
* @date 2020/10/27 17:38
*/
List<T> findAll();
}

View File

@ -1,8 +1,34 @@
/*
* 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.
*
* GunsAPACHE 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
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
public interface MongodbConstants {

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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.scanner.api.annotation.ApiResource;
@ -5,14 +29,22 @@ import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import org.springframework.stereotype.Controller;
/**
* MongoDB
*
* @author huziyang
* @create 2021-03-30 15:21
* @date 2021/03/30 15:21
*/
@Controller
@ApiResource(name = "MongoDB文件管理界面渲染控制器")
public class ModelViewController {
/**
*
*
* @author huziyang
* @date 2021/03/30 15:21
*/
@GetResource(name = "Mongodb文件列表视图", path = "/view/mongodb/file")
public String mongodbFile() {
return "/modular/mongodb/fileList.html";

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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.mongodb.api.MongoFileApi;
@ -14,15 +38,16 @@ 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
* @create 2021-03-31 17:28
* @date 2021/03/31 17:28
*/
@RestController
@ApiResource(name = "Mongodb文件接口控制器")
@ -31,22 +56,46 @@ public class MongoFileController {
@Resource
private MongoFileApi<MongoFileEntity,String> mongoFileApi;
/**
*
*
* @author huziyang
* @date 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
* @date 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
* @date 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
* @date 2021/03/31 17:28
*/
@GetResource(name = "Mongodb文件下载", path = "/view/mongodb/file/down")
public ResponseEntity mongodbFileDown(@RequestParam String id) throws UnsupportedEncodingException {
Optional<MongoFileEntity> file = mongoFileApi.getFileById(id);

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -11,8 +35,10 @@ import org.springframework.data.mongodb.core.mapping.Document;
import java.util.Date;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-26 17:23
* @date 2021/03/26 17:23
*/
@Data
@NoArgsConstructor

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -5,8 +29,10 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
* Mongodb Mapper
*
* @author huziyang
* @create 2021-03-26 17:27
* @date 2021/03/26 17:27
*/
@Configuration
public interface MongoFileMapper extends MongoRepository<MongoFileEntity,String> {

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -6,37 +30,51 @@ import org.springframework.web.multipart.MultipartFile;
import java.util.Optional;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-26 17:28
* @date 2021/03/26 17:28
*/
public interface MongoFileService {
/**
*
* @param file
* @return
*
* @param file
* @return
* @author huziyang
* @date 2021/03/30 11:06
*/
MongoFileEntity saveFile(MultipartFile file);
/**
*
* @param id
* id
*
* @param id id
* @author huziyang
* @date 2021/03/30 11:06
*/
void removeFile(String id);
/**
* id
* @param id
* @return
*
* @param id id
* @return Optional
* @author huziyang
* @date 2021/03/30 11:06
*/
Optional<MongoFileEntity> getFileById(String id);
/**
*
*
*
* @param fileDocument
* @return
* @return
* @author huziyang
* @date 2021/03/30 11:06
*/
PageResult<MongoFileEntity> getFilesByPage(MongoFileEntity fileDocument);

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -28,8 +52,10 @@ import java.util.Date;
import java.util.Optional;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-26 17:29
* @date 2021/03/26 17:29
*/
@Slf4j
@Service

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -9,8 +33,10 @@ import java.util.HashMap;
import java.util.Map;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
@Data
@NoArgsConstructor

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -5,8 +29,10 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.data.mongodb.repository.MongoRepository;
/**
* Mongodb mapper
*
* @author huziyang
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
@Configuration
public interface GunsMapRepository extends MongoRepository<GunsMapEntity,String> {

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -6,41 +30,58 @@ import java.util.List;
import java.util.Optional;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
public interface GunsMapService {
/**
*
* @param gunsMapEntity
* @return
*
*
* @param gunsMapEntity
* @return
* @author huziyang
* @date 2021/03/20 16:24
*/
GunsMapEntity insert(GunsMapEntity gunsMapEntity);
/**
*
* @param gunsMapEntity
* @return
*
*
* @param gunsMapEntity
* @return
* @author huziyang
* @date 2021/03/20 16:24
*/
GunsMapEntity update(GunsMapEntity gunsMapEntity);
/**
* id
* @param id
*
* @param id id
* @author huziyang
* @date 2021/03/20 16:24
*/
void deleteById(String id);
/**
* id
* @param id
* @return
*
* @param id id
* @return Optional
* @author huziyang
* @date 2021/03/20 16:24
*/
Optional<GunsMapEntity> findById(String id);
/**
*
* @return
*
*
* @return
* @author huziyang
* @date 2021/03/20 16:24
*/
List<GunsMapEntity> findAll();

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -10,8 +34,10 @@ import java.util.List;
import java.util.Optional;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
@Service
public class GunsMapServiceImpl implements GunsMapService, MongodbApi<GunsMapEntity,String> {

View File

@ -1,3 +1,27 @@
/*
* 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.
*
* GunsAPACHE 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;
@ -8,19 +32,32 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* Mongodb
*
* @author huziyang
* @create 2021-03-20 16:24
* @date 2021/03/20 16:24
*/
@Configuration
public class GunsMongodbAutoConfiguration {
/**
* Mongodb
*
* @author huziyang
* @date 2021/03/20 16:24
*/
@Bean
public MongodbApi mongodbApi() {
return new GunsMapServiceImpl();
}
/**
* Mongodb
*
* @author huziyang
* @date 2021/03/20 16:24
*/
@Bean
public MongoFileApi mongoFileApi() {
return new MongoFileServiceImpl();