init: stl-server project with mybatis
This commit is contained in:
commit
527f9cf9c7
14 changed files with 797 additions and 0 deletions
13
src/main/java/edu/situ/stlserver/StlServerApplication.java
Normal file
13
src/main/java/edu/situ/stlserver/StlServerApplication.java
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
package edu.situ.stlserver;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class StlServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(StlServerApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
19
src/main/java/edu/situ/stlserver/model/entity/Coach.java
Normal file
19
src/main/java/edu/situ/stlserver/model/entity/Coach.java
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package edu.situ.stlserver.model.entity;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class Coach {
|
||||
private Integer id;
|
||||
private String name;
|
||||
private Integer sex;
|
||||
private String avatar;
|
||||
private String remark;
|
||||
private String quitDate;
|
||||
}
|
||||
57
src/main/java/edu/situ/stlserver/model/vo/HttpResult.java
Normal file
57
src/main/java/edu/situ/stlserver/model/vo/HttpResult.java
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package edu.situ.stlserver.model.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class HttpResult {
|
||||
private Integer code;
|
||||
private String msg;
|
||||
private Object data;
|
||||
|
||||
public HttpResult(Integer code, String msg, Object data) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public static HttpResult success() {
|
||||
return new HttpResult(200, null, null);
|
||||
}
|
||||
|
||||
public static HttpResult success(String msg) {
|
||||
return new HttpResult(200, msg, null);
|
||||
}
|
||||
|
||||
public static HttpResult success(Object data) {
|
||||
return new HttpResult(200, null, data);
|
||||
}
|
||||
|
||||
public static HttpResult success(String msg, Object data) {
|
||||
return new HttpResult(200, msg, data);
|
||||
}
|
||||
|
||||
public static HttpResult error() {
|
||||
return new HttpResult(500, "服务器出错,请联系管理员!", null);
|
||||
}
|
||||
|
||||
public static HttpResult error(String msg) {
|
||||
return new HttpResult(500, msg, null);
|
||||
}
|
||||
|
||||
public static HttpResult notFound() {
|
||||
return new HttpResult(404, null, null);
|
||||
}
|
||||
|
||||
public static HttpResult unauthorized() {
|
||||
return new HttpResult(401, "未授权", null);
|
||||
}
|
||||
|
||||
public String toJsonStr(){
|
||||
return JSONUtil.toJsonStr(this)
|
||||
}
|
||||
}
|
||||
29
src/main/resources/application-dev.yaml
Normal file
29
src/main/resources/application-dev.yaml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
server:
|
||||
port: 3000
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/stl?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Syhg@4311
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
springdoc:
|
||||
api-docs:
|
||||
enabled: true # 开启OpenApi接口
|
||||
path: /v3/api-docs # 自定义路径,默认为/v3/api-docs
|
||||
swagger-ui:
|
||||
enabled: true
|
||||
path: /index.html
|
||||
|
||||
mybatis:
|
||||
configuration:
|
||||
map-underscore-to-camel-case: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
file:
|
||||
path: ???
|
||||
0
src/main/resources/application-prod.yaml
Normal file
0
src/main/resources/application-prod.yaml
Normal file
3
src/main/resources/application.yaml
Normal file
3
src/main/resources/application.yaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package edu.situ.stlserver;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class StlServerApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue