CentOS7在线安装Node.js
查看旧版Node.js查看是否已经安装了旧的Node.js,如果安装过Node.js就把它卸载
1yum remove nodejs
获取Node.js资源1curl --silent --location https://rpm.nodesource.com/setup_16.x | bash -
可以安装的Node.js版本如下图所示,分别为:12、14、16三个版本
安装Node.js1yum install -y nodejs
安装淘宝镜像cnpm1npm install -g cnpm --registry=https://registry.npm.taobao.org
查看安装版本输入以下3条命令都可以看到安装的版本号说明安装已经成功
123node -vnpm -vcnpm -v
PS.用安装包安装Node.js查看博客:CentOS7 使用安装包安装 Node.js | LeDao 的博客 (zoutl.cn)
在IntelliJ IDEA中使用Git命令
打开设置打开idea的设置界面,找到Tools -> Terminal
设置本地Git在上图的Shell path中选择本地Git的bash.exe安装路径
使用Git命令点击idea最下面的Terminal,即可打开Git命令行界面,然后就可以使用Git命令了
Java继承的super和this关键字
介绍在Java继承中,super关键字用于调用父类的属性和方法,而this则用于调用子类自身的属性和方法,this也可以省略不写
Java代码123456789101112131415161718192021222324252627282930313233343536373839404142/** * @author LeDao * @company * @create 2021-06-21 12:38 */public class Test { public static void main(String[] args) { Dog dog = new Dog(); dog.eatTest(); }}class Animal { String name = "Animal"; void eat() { System.out.println("动物吃饭"); }}class Dog extends ...
Java实现从Excel读取数据
引入依赖123456789101112<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel --><dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>3.1.5</version></dependency><!-- https://mvnrepository.com/artifact/com.alibaba/fastjson --><dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>2.0.22</version></dependen ...
Java实现写数据到Excel
引入依赖123456<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel --><dependency> <groupId>com.alibaba</groupId> <artifactId>easyexcel</artifactId> <version>3.1.5</version></dependency>
实现过程一般数据插入12345678910111213141516171819202122232425262728293031323334353637383940414243444546import com.alibaba.excel.EasyExcel;import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;import java.util.ArrayList;import j ...
MySQL使用存储过程
概述介绍存储过程简单来说,就是为以后的使用而保存的一条或多条MySQL语句的集合。可将其视为批文件,虽然它们的作用不仅限于批处理。
优点
通过把处理封装在容易使用的单元中,简化复杂的操作。
由于不要求反复建立一系列处理步骤,这保证了数据的完整性。如果所有开发人员和应用程序都使用同一(试验和测试)存储过程,则所使用的代码都是相同的。 这一点的延伸就是防止错误。需要执行的步骤越多,出错的可能性就越大。防止错误保证了数据的一致性。
简化对变动的管理。如果表名、列名或业务逻辑(或别的内容)有变化,只需要更改存储过程的代码。使用它的人员甚至不需要知道这些变化。这一点的延伸就是安全性。通过存储过程限制对基础数据的访问减少了数据讹误(无意识的或别的原因所导致的数据讹误)的机会。
提高性能。因为使用存储过程比使用单独的SQL语句要快。
存在一些只能用在单个请求中的MySQL元素和特性,存储过程可以使用它们来编写功能更强更灵活的代码。
换句话说,使用存储过程有3个主要的好处,即简单、安全、高性能。
缺点
一般来说,存储过程的编写比基本SQL语句复杂,编写存储过程需要更高的技能,更丰富的经验。
可能没有 ...
Swagger3的Docket开关&过滤&分组配置
概述通过设置Docket,还可以配置很多功能,比如是否开启swagger,过滤,分组等
开启和关闭swagger开发环境开启swagger,生产环境就关闭swagger
123456789101112131415161718192021222324252627282930313233package com.ledao.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import springfox.documentation.service.ApiInfo;import springfox.documentation.service.Contact;import springfox.documentation.spi.DocumentationType;import springfox.documentation.spring.web.plugins.Docket;import java.util.A ...
Swagger3的API信息配置
概述通过修改API信息配置,可以让前端开发人员更方便地知道API文档是谁编写的,以方便联系
配置类代码12345678910111213141516171819202122232425262728293031323334353637383940414243444546package com.ledao.config;import org.springframework.context.annotation.Bean;import org.springframework.context.annotation.Configuration;import springfox.documentation.service.ApiInfo;import springfox.documentation.service.Contact;import springfox.documentation.spi.DocumentationType;import springfox.documentation.spring.web.plugins.Docket;import java.util.ArrayList ...
Swagger3常用注解
@EnableOpenApi该注解添加在Spring Boot项目的启动类上,然后在整个项目上使用Swagger3了
123456789101112131415161718package com.ledao;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import springfox.documentation.oas.annotations.EnableOpenApi;/** * @author LeDao */@EnableOpenApi@SpringBootApplicationpublic class SwaggerTestApplication { public static void main(String[] args) { SpringApplication.run(SwaggerTestApplication.class, args); ...
Spring Boot使用Swagger3
引入依赖12345<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-boot-starter</artifactId> <version>3.0.0</version></dependency>
添加注解在启动类添加@EnableOpenApi
123456789101112131415161718package com.ledao;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import springfox.documentation.oas.annotations.EnableOpenApi;/** * @author LeDao */@EnableOpenApi@SpringBootApplic ...