常见代码

MySQL

命令

# 清空表自增
truncate table table_name

DOS

命令

# 跨盘符进入文件夹
cd /d target_path

#新建一个文件
cd >filename	# 格式是命令行格式

浏览器

刷新

清除缓存刷新使用ctrl + F5,要想清楚JS等缓存,需要在开发者模式的Network中设置Disable Cache


npm

# 解决安装依赖时慢的问题
npm install --registry=https://registry.npm.taobao.org

git

IDEA SpringBoot项目ignore文件

HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
.log

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
.mvn
mvnw*

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/

### VS Code ###
.vscode/

### generated files ###
bin/
gen/

### MAC ###
.DS_Store

### Other ###
logs/
log
temp/

远程仓库关联:

git init
git add .
git commit -m "first commit"
git remote add origin xxx
git push -u origin 分支名称  # -u 参数会将本地分支与之关联,后续的 push 不需要再指定分支名称

maven

DAO配置

依赖:

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
</dependency>

<dependency>
    <groupId>com.alibaba</groupId>
    <artifactId>druid</artifactId>
    <version>1.2.6</version>
</dependency>

<dependency>
    <groupId>org.mybatis.spring.boot</groupId>
    <artifactId>mybatis-spring-boot-starter</artifactId>
    <version>2.2.0</version>
</dependency>

数据库配置:

spring:
  datasource:
    username: root
    password: wal14.
    url: jdbc:mysql://localhost:3306/springboot?useSSL=false&serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
    driver-class-name: com.mysql.cj.jdbc.Driver
    type: com.alibaba.druid.pool.DruidDataSource	# 主要是这一项

	# 以下为Druid连接池的配置
    initialSsize: 5
    minIdle: 5
    maxActive: 20
    maxWait: 60_000
    testWhileIdle: true
    testOnRun: false
    poolPreparedStatements: true
mybatis:
  mapper-locations: classpath:com/ermao/mapper/*.xml
  type-aliases-package: com.ermao.pojo
  configuration:
    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl	# 启用日志方便 debug

映射器模板:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="">

</mapper>

一些奇怪的依赖

thymeleaf-shiro

<!-- https://mvnrepository.com/artifact/com.github.theborakompanioni/thymeleaf-extras-shiro -->
<dependency>
    <groupId>com.github.theborakompanioni</groupId>
    <artifactId>thymeleaf-extras-shiro</artifactId>
    <version>2.1.0</version>
</dependency>

Emoji

上一篇:谷粒商城P173【商城业务】【检索服务】~搭建页面环境


下一篇:.NET Attributes