master
commit
621cae3693
|
@ -0,0 +1,38 @@
|
||||||
|
target/
|
||||||
|
!.mvn/wrapper/maven-wrapper.jar
|
||||||
|
!**/src/main/**/target/
|
||||||
|
!**/src/test/**/target/
|
||||||
|
|
||||||
|
### IntelliJ IDEA ###
|
||||||
|
.idea/modules.xml
|
||||||
|
.idea/jarRepositories.xml
|
||||||
|
.idea/compiler.xml
|
||||||
|
.idea/libraries/
|
||||||
|
*.iws
|
||||||
|
*.iml
|
||||||
|
*.ipr
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.apt_generated
|
||||||
|
.classpath
|
||||||
|
.factorypath
|
||||||
|
.project
|
||||||
|
.settings
|
||||||
|
.springBeans
|
||||||
|
.sts4-cache
|
||||||
|
|
||||||
|
### NetBeans ###
|
||||||
|
/nbproject/private/
|
||||||
|
/nbbuild/
|
||||||
|
/dist/
|
||||||
|
/nbdist/
|
||||||
|
/.nb-gradle/
|
||||||
|
build/
|
||||||
|
!**/src/main/**/build/
|
||||||
|
!**/src/test/**/build/
|
||||||
|
|
||||||
|
### VS Code ###
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
### Mac OS ###
|
||||||
|
.DS_Store
|
|
@ -0,0 +1,8 @@
|
||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# Editor-based HTTP Client requests
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
<file url="PROJECT" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
|
@ -0,0 +1,70 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>org.example</groupId>
|
||||||
|
<artifactId>day_exam7.26</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<version>2.6.2</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- lombok依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.32</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- mybatis依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis.spring.boot</groupId>
|
||||||
|
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||||
|
<version>2.1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- mysql数据库依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.32</version>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
<!-- 添加servlet依赖模块 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.servlet</groupId>
|
||||||
|
<artifactId>javax.servlet-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Spring Boot WEB依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- 嵌入tomcat 依赖 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.example;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(Main.class,args);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package org.example.controller;
|
||||||
|
|
||||||
|
import org.example.service.BillService;
|
||||||
|
import org.example.pojo.Bill;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
|
||||||
|
public class BillController {
|
||||||
|
@Resource
|
||||||
|
private BillService billService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/selectAll")
|
||||||
|
public List<Bill> selectAll() {
|
||||||
|
return billService.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/add")
|
||||||
|
public Integer add(@RequestBody Bill bill) {
|
||||||
|
return billService.add(bill);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.example.mapper;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.example.pojo.Bill;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BillMapper {
|
||||||
|
List<Bill> selectAll();
|
||||||
|
|
||||||
|
Integer add(Bill bill);
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package org.example.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class Bill {
|
||||||
|
private Integer billId;
|
||||||
|
private String billDate;
|
||||||
|
private BigDecimal billMoney;
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package org.example.service;
|
||||||
|
|
||||||
|
import org.example.pojo.Bill;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BillService {
|
||||||
|
List<Bill> selectAll();
|
||||||
|
|
||||||
|
Integer add(Bill bill);
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package org.example.service;
|
||||||
|
|
||||||
|
import org.example.mapper.BillMapper;
|
||||||
|
import org.example.pojo.Bill;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
@Service
|
||||||
|
public class BillServiceImpl implements BillService{
|
||||||
|
@Resource
|
||||||
|
private BillMapper billMapper;
|
||||||
|
@Override
|
||||||
|
public List<Bill> selectAll() {
|
||||||
|
return billMapper.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer add(Bill bill) {
|
||||||
|
return billMapper.add(bill);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,102 @@
|
||||||
|
# 服务器相关
|
||||||
|
|
||||||
|
server:
|
||||||
|
port: 10001
|
||||||
|
|
||||||
|
spring:
|
||||||
|
mvc:
|
||||||
|
pathmatch:
|
||||||
|
matching-strategy: ant_path_matcher
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
|
url: jdbc:mysql://60.204.243.96:3306/day_exam7.26?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false&useSSL=false&allowPublicKeyRetrieval=true
|
||||||
|
username: root
|
||||||
|
password: sx001231
|
||||||
|
druid:
|
||||||
|
# 下面为连接池的补充设置,应用到上面所有数据源中
|
||||||
|
# 初始化大小,最小,最大
|
||||||
|
initial-size: 5
|
||||||
|
min-idle: 5
|
||||||
|
max-active: 20
|
||||||
|
# 配置获取连接等待超时的时间
|
||||||
|
max-wait: 60000
|
||||||
|
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||||
|
time-between-eviction-runs-millis: 60000
|
||||||
|
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||||
|
min-evictable-idle-time-millis: 300000
|
||||||
|
validation-query: SELECT 1 FROM DUAL
|
||||||
|
test-while-idle: true
|
||||||
|
test-on-borrow: false
|
||||||
|
test-on-return: false
|
||||||
|
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||||
|
pool-prepared-statements: true
|
||||||
|
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||||
|
max-pool-prepared-statement-per-connection-size: 20
|
||||||
|
filters: stat,wall
|
||||||
|
use-global-data-source-stat: true
|
||||||
|
# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
|
||||||
|
connect-properties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
|
||||||
|
application:
|
||||||
|
name: shop-server
|
||||||
|
redis:
|
||||||
|
host: 1.12.254.213
|
||||||
|
port: 6381
|
||||||
|
mail:
|
||||||
|
host: smtp.qq.com
|
||||||
|
username: 358795815@qq.com
|
||||||
|
password: uuyemjigqlhvbgcj
|
||||||
|
port: 587 # 这个端口根据实际情况配置,一般都是465
|
||||||
|
protocol: smtp # 这里应该是不用改的,我没试过其他的配置
|
||||||
|
test-connection: false
|
||||||
|
default-encoding: UTF-8
|
||||||
|
properties:
|
||||||
|
mail:
|
||||||
|
debug: true
|
||||||
|
smtp:
|
||||||
|
auth: true
|
||||||
|
connectiontimeout: 10000
|
||||||
|
timeout: 10000
|
||||||
|
writetimeout: 10000
|
||||||
|
socketFactory:
|
||||||
|
class: javax.net.ssl.SSLSocketFactory
|
||||||
|
port: 587
|
||||||
|
starttls:
|
||||||
|
enable: true
|
||||||
|
required: true
|
||||||
|
select:
|
||||||
|
multipart:
|
||||||
|
max-file-size: 100MB # 最大支持文件大小
|
||||||
|
max-request-size: 100MB # 最大请求大小
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
|
||||||
|
# mybatis
|
||||||
|
mybatis:
|
||||||
|
configuration:
|
||||||
|
map-underscore-to-camel-case: true
|
||||||
|
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
mapper-locations: classpath*:mapper/*Mapper.xml
|
||||||
|
global-config:
|
||||||
|
db-config:
|
||||||
|
id-type: auto
|
||||||
|
|
||||||
|
|
||||||
|
aliyun:
|
||||||
|
end-point: oss-cn-shanghai.aliyuncs.com
|
||||||
|
access-key-id: LTAI5tSFAGrms29r1xwEFtRM
|
||||||
|
access-key-secret: rztMfqxdYlsMUtIoy9bIOSGEKCWQT7
|
||||||
|
access-pre: https://dongxiaojie.oss-cn-shanghai.aliyuncs.com
|
||||||
|
bucket-name: dongxiaojie
|
||||||
|
|
||||||
|
fdfs:
|
||||||
|
so-timeout: 1500 # socket 连接时长
|
||||||
|
connect-timeout: 600 # 连接 tracker 服务器超时时长
|
||||||
|
# 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||||
|
tracker-list: 1.12.254.213:22122
|
||||||
|
web-server-url: 1.12.254.213:8888
|
||||||
|
pool:
|
||||||
|
jmx-enabled: false
|
||||||
|
# 生成缩略图
|
||||||
|
thumb-image:
|
||||||
|
height: 500
|
||||||
|
width: 500
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?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="org.example.mapper.BillMapper">
|
||||||
|
<insert id="add">
|
||||||
|
INSERT INTO `bill`
|
||||||
|
(`bill_date`, `bill_money`)
|
||||||
|
VALUES (#{billDate}, #{billMoney});
|
||||||
|
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectAll" resultType="org.example.pojo.Bill">
|
||||||
|
select * from bill
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue