diff --git a/git.md b/git/git.md similarity index 100% rename from git.md rename to git/git.md diff --git a/git的使用.md b/git/git的使用.md similarity index 70% rename from git的使用.md rename to git/git的使用.md index 1ce3f37..f049fa7 100644 --- a/git的使用.md +++ b/git/git的使用.md @@ -6,3 +6,7 @@ # 接口文档的作用 https://blog.csdn.net/weixin_43252521/article/details/125603485 + +git 在idea中使用 +接口文档swpper3 +在项目中使用接口文档 diff --git a/markdown语法.md b/markdown语法.md deleted file mode 100644 index cb94006..0000000 --- a/markdown语法.md +++ /dev/null @@ -1,332 +0,0 @@ -Markdown的基本语法3.3 换行 -Markdown换行的方式有很多种: - -直接在一句话后敲两个空格 -两句话之间加一个空行 -如果你在编辑的时候,想让一行文字在显示的时候换行,就在中间加
-3.4 引用 -Markdown 中引用通过符号 > 来实现。> 符号后的空格,可有可无。 -在引用的区块内,允许换行存在,换行并不会终止引用的区块。如果要结束引用,需要一行空白行,来结束引用的区块。 -代码: - ->这是一个引用 -1 -效果 - -这是一个引用 -此外,引用还可以嵌套使用: -代码: - ->这是一个引用: ->>这是一个引用的引用 ->>>这是一个引用的引用的引用 -1 -2 -3 -效果: - -这是一个引用: - -这是一个引用的引用 - -这是一个引用的引用的引用 - -3.5 链接 -Markdown中插入链接的使用方式是: -代码: - -[链接名称](链接地址) -<链接地址> -即是: -[这是小白的主页](https://blog.csdn.net/qq_40818172?type=lately) -或者 - -1 -2 -3 -4 -5 -6 -效果: - -这是小白的主页 -https://blog.csdn.net/qq_40818172?type=lately - -3.6 图片 -Markdown中插入图片的使用方式是: -代码: - -![图片描述,可写可不写,但是中括号要有](图片地址,本地链接或者URL地址。) -比如我此文章的图片: -![卷不动的小白](https://img-blog.csdnimg.cn/8bbc653f3f854023856762ed2c8e43e9.png) -) -1 -2 -3 -4 -效果: - -也可以修改位置和图片大小: -代码: - -![图片描述,可写可不写,但是中括号要有](图片地址,本地链接或者URL地址#pic_center空格=长x宽) -比如我此文章的图片: -![卷不动的小白](https://img-blog.csdnimg.cn/8bbc653f3f854023856762ed2c8e43e9.png#pic_center =60x60) -) -1 -2 -3 -4 -效果: - -注意:等号前有空格,是x不是* - -博主自己经常Ctrl+v粘贴图片更为便捷 - -3.7 列表 -列表分为有序列表和无序列表 - -无序列表,使用*、+、-,再加一个空格作为列表的标记 -有序列表,使用数字并加上.号,再加一个空格作为列表的标记 -代码: -* 无序列表 1 -+ 无序列表 2 -- 无序列表 3 - -1. 有序列表 1 -2. 有序列表 2 -3. 有序列表 3 -1 -2 -3 -4 -5 -6 -7 -效果: - -无序列表 1 -无序列表 2 -无序列表 3 -有序列表 1 -有序列表 2 -有序列表 3 -如果想要控制列表的层级,则需要在列表符号前使用Tab -代码: - -+ 无序列表 1 -+ 无序列表 2 - + 无序列表 2.1 - + 无序列表 2.2 - -1. 有序列表 1 - 1.1 有序列表 1.1 -2. 有序列表 2 - 2.1 有序列表2.1 -1 -2 -3 -4 -5 -6 -7 -8 -9 -效果: - -无序列表 1 -无序列表 2 -无序列表 2.1 -无序列表 2.2 -有序列表 1 -有序列表 1.1 -有序列表 2 -有序列表2.1 -3.8 分割线 -Markdown中给出了多种分割线的样式,我们可以使用分割线让文章结构更加的清晰。 -分割线的使用,可以在一行中用三个-or*来建立一个分割线,但是注意:在分割线的上面空一行!!! - -代码: - -分割线: - ---- -*** -- - - -* * * -1 -2 -3 -4 -5 -6 -效果: - -注意:写分割线前,要空一行之后写,否则会导致前一行字体放大。 - -3.9 删除线 -删除线的的使用,可以在要添加删除线的文字前后添加两个~ -代码: - -~~这是要被删除的文字~~ -1 -效果: - -这是要被删除的文字 - -3.10 下划线 -下划线的使用和html中类似,在需要添加下划线的文字首尾添加文本 -代码: - -这行文字已被添加下划线 -1 -效果: - -这行文字已被添加下划线 - -3.11 代码块 -Markdown中代码块有两种: -如果在一行内需要引用代码,只需要用反引号`引起来就好了。 -代码: - -`Hello` World. -1 -效果: - -Hello World. - -如果是在一个块内需要引用代码,则在需要引用的代码块的前一行和后一行使用三个反引号,同时在前一个反引号后写入代码的语言。 -代码: - -效果: - -#include -int main(){ - printf("HelloWorld"); -} -1 -2 -3 -4 -支持以下语言: - -bash -c,clojure,cpp,cs,css -dart,dockerfile, diff -erlang -go,gradle,groovy -haskell -java,javascript,json,julia -kotlin -lisp,lua -makefile,markdown,matlab -objectivec -perl,php,python -r,ruby,rust -scala,shell,sql,swift -tex,typescript -verilog,vhdl -xml -yaml - -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -3.12 表格 -表格使用|来分割不同的单元格,使用-来分隔表头和其他行 - -:-:将表头及单元格内容左对齐 --::将表头及单元格内容右对齐 -:-::将表头及单元格内容居中 -代码: - -| 项目 | 价格 | 数量 | -| -------- | -----: | :----: | -| 计算机 | \$1600 | 5 | -| 手机 | \$12 | 12 | -| 管线 | \$1 | 234 | -1 -2 -3 -4 -5 -效果: - -项目 价格 数量 -计算机 $1600 5 -手机 $12 12 -管线 $1 234 -3.13 脚注 -脚注是对文本的备注,我们时长在论文中看到脚注,在Markdown中的使用方法 -代码: - -使用 Markdown[^1]可以效率的书写文档, 直接转换成 HTML[^2], 你可以使用 Typora[^T] 编辑器进行书写。 -[^1]:Markdown是一种纯文本标记语言 -[^2]:HyperText Markup Language 超文本标记语言 -[^T]:NEW WAY TO READ & WRITE MARKDOWN. -1 -2 -3 -4 -效果: -使用 Markdown1可以效率的书写文档, 直接转换成 HTML2, - -注意:脚注自动被搬运到最后面,请到文章末尾查看,并且脚注后方的链接可以直接跳转回到加注的地方。 - -3.14 特殊符号 -对于Markdown中的语法符号,前面家反斜线\即可以显示符号本身。 -代码: - -\\ -\* -\_ -\+ -\. -等等 -1 -2 -3 -4 -5 -6 -效果: - -\ -* -_ -+ -. - -四、Markdown的高级用法 -4.1 个人看法 -Markdown 是非常厉害的,但是我认为它建立的初衷是为了方便大家记笔记写博客,它具有很强大的功能,例如流程图、复杂的公式呈现,虽然看起来很有用,但是我认为这些功能与它创立的初衷是违背的,而且做流程图和复杂的公式是有专门的工具,而且十分便捷。所以个人认为,Markdown的一些高级用法了解一下即可,博主也不是很会使用参考了其他资料稍微来整理一下笔记。此处只简要提一下,如果想要了解更多详细的高级用法:菜鸟教程Markdown高级用法、Cmd Markdown 简明语法手册 - -4.2 制作待办事项 -我们可以使用Markdown来制作一个待办事项,格式为、-[] 表示未完成;-[x]表示已完成 -代码: - -- [ ] 支持以 PDF 格式导出文稿 -- [ ] 改进 Cmd 渲染算法,使用局部渲染技术提高渲染效率 -- [x] 新增 Todo 列表功能 -- [x] 修复 LaTex 公式渲染问题 -- [x] 新增 LaTex 公式编号功能 -———————————————— - - 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。 - -原文链接:https://blog.csdn.net/qq_40818172/article/details/126260661 \ No newline at end of file diff --git a/markdown语法笔记.md b/markdown语法/markdown语法笔记.md similarity index 100% rename from markdown语法笔记.md rename to markdown语法/markdown语法笔记.md diff --git a/工作内容/2024.5.27.md b/工作内容/2024.5.27.md new file mode 100644 index 0000000..f3c6163 --- /dev/null +++ b/工作内容/2024.5.27.md @@ -0,0 +1,5 @@ +1 运行springboot项目 +2 学习swagger并运用 +3 使用mybatiesx +4 下载apifox +5 熟练git使用 \ No newline at end of file diff --git a/工作内容/工作内容.md b/工作内容/工作内容.md new file mode 100644 index 0000000..514941d --- /dev/null +++ b/工作内容/工作内容.md @@ -0,0 +1,7 @@ +1. 运行springboot项目 +2. 学习swagger并运用 +3. 使用mybatiesx +4. 下载apifox +5. 熟练git使用 + + 10点只能整springboot运行和接口文档 \ No newline at end of file diff --git a/工作收获/2024.5.27.md b/工作收获/2024.5.27.md new file mode 100644 index 0000000..2607ce5 --- /dev/null +++ b/工作收获/2024.5.27.md @@ -0,0 +1,120 @@ +# swagger3使用文档: +https://blog.csdn.net/YXXXYX/article/details/124952856 +# swagger基本注解: +https://blog.csdn.net/qq_52774158/article/details/131081371 + + +# 各种mapping注解的含义: +1. @RequestMapping (Spring MVC) +用途: 用于映射HTTP请求到MVC和REST控制器的处理方法上。它可以应用于类级别(定义控制器处理的基路径)和方法级别(细化具体请求路径) +2. @GetMapping, @PostMapping, @PutMapping, @DeleteMapping (Spring MVC) +用途: 这些是@RequestMapping的特化版本,分别对应HTTP的GET、POST、PUT、DELETE方法,使代码更简洁易读。 +3. @RequestBody (Spring MVC) +用途: 用于将HTTP请求体中的数据绑定到方法参数上,通常用于接收JSON、XML等格式的数据。 +列如: +```java +public ResponseEntity createUser(@RequestBody User newUser) { ... } +``` +4. @ResponseBody (Spring MVC) +之前已解释: 将方法的返回值直接写入HTTP响应体中,常用于返回JSON、XML等数据。 +5. @PathVariable +用途: 用于从URL路径中提取变量值并绑定到方法参数上。 +列如: +```java +@GetMapping("/users/{id}") +public User getUser(@PathVariable Long id) { ... } +``` +6. @RequestParam + +用途: 用于将请求参数绑定到方法参数上。 +列入: +```java +@GetMapping("/users") +public List searchUsers(@RequestParam("name") String name) { ... } +``` +@Table 指定数据库表名及选项;@Column 定义实体字段与数据库表列的映射关系。 +```java +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name = "users") // 指定表名 +public class User { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) // 主键生成策略 + private Long id; + + @Column(name = "username") // 指定数据库列名 + private String username; + + @Column(name = "email", nullable = false) // 邮箱列,不允许为空 + private String email; + + @Column(length = 100) // 限制密码列长度为100字符 + private String password; + + // 省略getter和setter方法 +} +``` + +1. name: 指定数据库表中的列名。如果不提供,默认使用属性名。 +2. nullable: 指定该列是否允许null值,默认为true(允许)。 +3. length: 设置列的最大长度,适用于字符串类型。 +4. unique: 指定该列是否需要唯一约束,默认为false。 +5. updatable: 指定在更新操作时该字段是否可更新,默认为true。 +6. insertable: 指定在插入操作时该字段是否可插入,默认为true。 +7. columnDefinition: 允许直接提供SQL片段来定义列,覆盖默认的列定义。 +8. precision 和 scale: 用于数值类型,precision指总精度,scale指小数点后的精度。 + + +# 如果实体类中有应该属性在对应的数据库表中没有该字段 +1. 使用@Transient注解 +2. MyBatis Plus中的@TableField(exist = false): + +# 使用swagger3的步骤 +1. 添加依赖: +```java + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.5.0 + +``` +2. 写配置类: + +配置类文件 +3. 地址端口 +``` +springdoc.api-docs.path=/v3/api-docs +springdoc.api-docs.enabled=true +springdoc.swagger-ui.enabled=true +springdoc.swagger-ui.path=/swagger-ui/index.html + +``` + + +/** + * Swagger的配置类 + */ +/** + * Swagger配置类,该类里面的应该是固定的,主要用来设置文档的主题信息,比如文档的大标题,副标题,公司名 + */ +@Configuration//托管spring +public class SwaggerConfig { + + @Bean + public Docket createRestApi() { + return new Docket(DocumentationType.OAS_30) // v2 不同 + .select() + .apis(RequestHandlerSelectors.basePackage("com.example.springbootmybatisplus"))//扫描该包下面的API注解 + .build(); + } + + +} +``` \ No newline at end of file diff --git a/语法,git用法,git基本语法.md b/语法,git用法,git基本语法.md deleted file mode 100644 index c97a03d..0000000 --- a/语法,git用法,git基本语法.md +++ /dev/null @@ -1,2 +0,0 @@ -https://zhuanlan.zhihu.com/p/108984311 -https://blog.csdn.net/xdnxl/article/details/129518943 diff --git a/配置类文件/SqlStatementInterceptor.java b/配置类文件/SqlStatementInterceptor.java new file mode 100644 index 0000000..fba7e9e --- /dev/null +++ b/配置类文件/SqlStatementInterceptor.java @@ -0,0 +1,52 @@ +package com.dykj.config; + +import org.apache.ibatis.cache.CacheKey; +import org.apache.ibatis.executor.Executor; +import org.apache.ibatis.mapping.BoundSql; +import org.apache.ibatis.mapping.MappedStatement; +import org.apache.ibatis.plugin.*; +import org.apache.ibatis.session.ResultHandler; +import org.apache.ibatis.session.RowBounds; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Properties; + + +@Intercepts({ + @Signature(type = Executor.class, method = "update", args = {MappedStatement.class, + Object.class}), + @Signature(type = Executor.class, method = "query", args = {MappedStatement.class, + Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class})}) +public class SqlStatementInterceptor implements Interceptor { + + public static final Logger log = LoggerFactory.getLogger("sys-sql"); + + @Override + public Object intercept(Invocation invocation) throws Throwable { + long startTime = System.currentTimeMillis(); + try { + return invocation.proceed(); + } finally { + long timeConsuming = System.currentTimeMillis() - startTime; + log.info("执行SQL:{}ms", timeConsuming); + if (timeConsuming > 999 && timeConsuming < 5000) { + log.info("执行SQL大于1s:{}ms", timeConsuming); + } else if (timeConsuming >= 5000 && timeConsuming < 10000) { + log.info("执行SQL大于5s:{}ms", timeConsuming); + } else if (timeConsuming >= 10000) { + log.info("执行SQL大于10s:{}ms", timeConsuming); + } + } + } + + @Override + public Object plugin(Object target) { + return Plugin.wrap(target, this); + } + + @Override + public void setProperties(Properties properties) { + + } +} diff --git a/配置类文件/application.yml b/配置类文件/application.yml new file mode 100644 index 0000000..c40d729 --- /dev/null +++ b/配置类文件/application.yml @@ -0,0 +1,64 @@ +server: + port: 8001 + tomcat: + uri-encoding: UTF-8 +spring: + mvc: + static-path-pattern: /static/** + resources: + static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,classpath:/webjars/ + main: + allow-circular-references: true + datasource: + username: root + password: root + url: jdbc:mysql://localhost:3306/sys?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=true + type: com.alibaba.druid.pool.DruidDataSource + druid: + initial-size: 20 + min-idle: 20 + max-active: 100 + max-wait: 600 + stat-view-servlet: + enabled: true + url-pattern: /druid/* + login-username: admin + login-password: 123456 + filter: + stat: + enabled: true + slow-sql-millis: 2000 + log-slow-sql: true + wall: + enabled: true + config: + enabled: true + data: + redis: + host: localhost + port: 6379 +application: + security: + jwt: + secret-key: qwerty + expiration: 86400000 # a day + refresh-token: + expiration: 604800000 # 7 days +springdoc: + api-docs: + # 是否开启接口文档 + path: /v3/api-docs + enabled: true + swagger-ui: + # 持久化认证数据,如果设置为 true,它会保留授权数据并且不会在浏览器关闭/刷新时丢失 + enabled: true + path: /swagger-ui/index.html + + + + + + + + + diff --git a/配置类文件/pom.xml b/配置类文件/pom.xml new file mode 100644 index 0000000..adccffd --- /dev/null +++ b/配置类文件/pom.xml @@ -0,0 +1,173 @@ + + + 4.0.0 + + com.dykj + dykj-module-admin + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + 3.2.5 + + + + + + org.springframework.boot + spring-boot-starter-web + + + + + com.baomidou + mybatis-plus-boot-starter + 3.5.5 + + + + org.mybatis + mybatis-spring + + + + + + + com.baomidou + mybatis-plus-generator + 3.5.5 + + + + org.freemarker + freemarker + + + + + org.mybatis + mybatis-spring + 3.0.3 + + + + + org.apache.httpcomponents + httpcore + 4.3.3 + + + + com.mysql + mysql-connector-j + runtime + + + + com.alibaba + druid-spring-boot-starter + 1.1.21 + + + + org.projectlombok + lombok + true + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springdoc + springdoc-openapi-starter-webmvc-ui + 2.5.0 + + + + + com.google.guava + guava + 19.0 + + + + + org.mapstruct + mapstruct + 1.4.2.Final + + + org.mapstruct + mapstruct-processor + 1.4.2.Final + + + + org.springframework.boot + spring-boot-starter-data-redis + + + + redis.clients + jedis + + + io.lettuce + lettuce-core + + + + + + org.springframework.boot + spring-boot-dependencies + ${spring-boot.version} + pom + import + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.8.1 + + 17 + 17 + UTF-8 + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + org.example.shopping.ShopingApplication + true + + + + repackage + + repackage + + + + + + + + + \ No newline at end of file diff --git a/idea项目部署.md b/项目部署/idea项目部署.md similarity index 100% rename from idea项目部署.md rename to 项目部署/idea项目部署.md diff --git a/创建项目遇到的问题及知识点.md b/项目部署/创建项目遇到的问题及知识点.md similarity index 100% rename from 创建项目遇到的问题及知识点.md rename to 项目部署/创建项目遇到的问题及知识点.md