# wiki **Repository Path**: li-xi39/wiki ## Basic Information - **Project Name**: wiki - **Description**: springboot+vue3项目 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: http://wiki39.cn/ - **GVP Project**: No ## Statistics - **Stars**: 2 - **Forks**: 1 - **Created**: 2022-03-14 - **Last Updated**: 2024-06-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## 接口 ### 电子书 - 电子书列表查询接口:/ebook/queryAll -> get请求 - 电子书分页列表查询接口:/ebook/queryAll -> post请求,分页接口。参数:pageNum, pageSize - 电子书模糊查询接口(restful风格):/ebook/queryByName/{name} -> get请求 - 电子书根据分类ID查询指定数据的接口(restful风格):/ebook/queryByCategory/{category2_id} -> get请求 - 电子书根据ID查询指定数据的接口(restful风格):/ebook/queryById/{id} -> get请求 - 电子书管理页面数据修改接口(restful风格):/ebook/update -> put请求, 参数:id、 cover、 name、 category1_id、 category2_id、 description - 电子书管理页面数据删除接口(restful风格):/ebook/delete -> delete请求, 参数: id - 电子书管理页面数据添加接口(restful风格):/ebook/ebook -> post请求, 参数: cover、 name、 category1_id、 category2_id、 description ### 分类 - 分类管理列表查询接口:/category/queryAll -> get请求 - 分类管理数据添加接口(restful风格):/category/save -> post请求 参数:parent、 name、 sort - 分类管理数据修改接口(restful风格):/category/update -> update请求 参数:parentparent、 name、 sort - 分类管理数据删除接口(restful风格):/category/delete/{id} -> delete请求 参数:id ### 文档 - 文档管理列表查询接口:/doc/queryById/{id} -> get请求 - 分类管理数据添加或更新接口(restful风格):/doc/saveAndUpdate -> post请求 参数:id、 content 说明: id如果在文档表中不存在,则添加数。存在则更新数据 ### 用户 - 用户管理列表查询接口(restful风格):/user/queryAll -> get请求 - 用户管理根据LonginName查询指定数据的接口(restful风格):/user/queryByLonginName/{longinName} -> get请求 参数:longinName - 用户管理数据添加接口(restful风格):/user/save -> post请求 参数:loginName、 name、 password - 用户管理数据删除接口(restful风格):/user/delete/{id} -> delete请求 参数:id - 用户管理名称修改接口(restful风格):/user/updateUserName -> put请求 参数:id、 name - 用户管理密码修改接口(restful风格):/user/updateUserPassword -> put请求 参数:id、 password - 用户登录接口(restful风格):/user/userLongin -> post请求 参数:loginName、 password ## 参数校验validation 1. 对使用接口请求进来的参数进行参数校验,在专门的包(req)中创建专门的实体类进行参数校验 2. 在实体类上某个属性使用参数校验需要在Controller层上的实体对象前搭配@Valid注解使用 ```xml org.springframework.boot spring-boot-starter-validation ``` ## 集成七牛云 - 上传接口: /qiniu/uploading - pom.xml ```xml com.qiniu qiniu-java-sdk [7.2.0, 7.2.99] ``` - application.yml ```yaml qiniu: access-key: 公钥 secret-key: 私钥 bucket: 空间名 prefix: url ``` ## 集成Redis ```yaml spring: redis: host: lhmx-539.redis.rds.aliyuncs.com password: Qq3303629 username: ldx port: 6379 ``` ## 配置SSL证书 ```yaml server: port: 8088 # 配置ssl证书 ssl: key-store: classpath:7701888_www.lhmx.xyz.pfx key-store-type: PKCS12 key-store-password: LX832JMu ``` **http转https** ```java /** * 配置http转https */ @Configuration public class HttpsConfig { @Bean TomcatServletWebServerFactory tomcatEmbeddedServletContainerFactory() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(){ @Override protected void postProcessContext(Context context) { SecurityConstraint constraint = new SecurityConstraint(); constraint.setUserConstraint("CONFIDENTIAL"); SecurityCollection collection = new SecurityCollection(); collection.addPattern("/*"); constraint.addCollection(collection); context.addConstraint(constraint); } }; factory.addAdditionalTomcatConnectors(createTomcatConnector()); return factory; } // 设置重定向端口 private Connector createTomcatConnector() { Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol"); connector.setScheme("http"); connector.setPort(8089); // 监听HTTP端口号 connector.setSecure(false); connector.setRedirectPort(8088); // 监听的到HTTP端口号后,重定向到https端口号 return connector; } } ```