🎉 init
This commit is contained in:
commit
e531af27d5
121
pom.xml
Normal file
121
pom.xml
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.7.17</version>
|
||||||
|
<relativePath/>
|
||||||
|
</parent>
|
||||||
|
<groupId>com</groupId>
|
||||||
|
<artifactId>darkness</artifactId>
|
||||||
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
|
<name>darkness</name>
|
||||||
|
<description>darkness</description>
|
||||||
|
<properties>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
|
<version>3.5.3.2</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jooq</groupId>
|
||||||
|
<artifactId>jooq</artifactId>
|
||||||
|
<version>3.14.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jooq</groupId>
|
||||||
|
<artifactId>jooq-meta-extensions</artifactId>
|
||||||
|
<version>3.14.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jooq</groupId>
|
||||||
|
<artifactId>jooq-codegen-maven</artifactId>
|
||||||
|
<version>3.14.8</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.validation</groupId>
|
||||||
|
<artifactId>validation-api</artifactId>
|
||||||
|
<version>2.0.1.Final</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>darkness</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<excludes>
|
||||||
|
<exclude>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
</exclude>
|
||||||
|
</excludes>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.jooq</groupId>
|
||||||
|
<artifactId>jooq-codegen-maven</artifactId>
|
||||||
|
<version>3.14.8</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<jdbc>
|
||||||
|
<driver>com.mysql.cj.jdbc.Driver</driver>
|
||||||
|
<url>jdbc:mysql://39.99.244.11:3306/konosuba</url>
|
||||||
|
<user>konosuba</user>
|
||||||
|
<password>kKWjPDYDMLtLaLwY</password>
|
||||||
|
</jdbc>
|
||||||
|
<generator>
|
||||||
|
<database>
|
||||||
|
<includes>.*</includes>
|
||||||
|
<inputSchema>konosuba</inputSchema>
|
||||||
|
</database>
|
||||||
|
<target>
|
||||||
|
<packageName>com.darkness.pojo.entity</packageName>
|
||||||
|
<directory>src/main/java</directory>
|
||||||
|
</target>
|
||||||
|
<generate>
|
||||||
|
<daos>true</daos>
|
||||||
|
<pojos>true</pojos>
|
||||||
|
<pojosToString>true</pojosToString>
|
||||||
|
<tables>true</tables>
|
||||||
|
<springAnnotations>true</springAnnotations>
|
||||||
|
<validationAnnotations>true</validationAnnotations>
|
||||||
|
</generate>
|
||||||
|
</generator>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
15
src/main/java/com/darkness/DarknessApplication.java
Normal file
15
src/main/java/com/darkness/DarknessApplication.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.darkness;
|
||||||
|
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
@MapperScan("com.darkness.mapper")
|
||||||
|
public class DarknessApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(DarknessApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
24
src/main/java/com/darkness/controller/DemoController.java
Normal file
24
src/main/java/com/darkness/controller/DemoController.java
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
package com.darkness.controller;
|
||||||
|
|
||||||
|
import com.darkness.service.DemoService;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("d")
|
||||||
|
public class DemoController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DemoService service;
|
||||||
|
|
||||||
|
@GetMapping("d")
|
||||||
|
public void demo(){
|
||||||
|
service.insertDemoUser();
|
||||||
|
System.out.println(service.selectDemoUser());
|
||||||
|
service.insertDemoUnit();
|
||||||
|
System.out.println(service.selectDemoUnit());
|
||||||
|
}
|
||||||
|
}
|
7
src/main/java/com/darkness/mapper/DemoUnitMapper.java
Normal file
7
src/main/java/com/darkness/mapper/DemoUnitMapper.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.darkness.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.darkness.pojo.entity.tables.pojos.DemoUnit;
|
||||||
|
|
||||||
|
public interface DemoUnitMapper extends BaseMapper<DemoUnit> {
|
||||||
|
}
|
7
src/main/java/com/darkness/mapper/DemoUserMapper.java
Normal file
7
src/main/java/com/darkness/mapper/DemoUserMapper.java
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
package com.darkness.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.darkness.pojo.entity.tables.pojos.DemoUser;
|
||||||
|
|
||||||
|
public interface DemoUserMapper extends BaseMapper<DemoUser> {
|
||||||
|
}
|
13
src/main/java/com/darkness/service/DemoService.java
Normal file
13
src/main/java/com/darkness/service/DemoService.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package com.darkness.service;
|
||||||
|
|
||||||
|
import com.darkness.pojo.entity.tables.pojos.DemoUnit;
|
||||||
|
import com.darkness.pojo.entity.tables.pojos.DemoUser;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface DemoService {
|
||||||
|
void insertDemoUser();
|
||||||
|
void insertDemoUnit();
|
||||||
|
List<DemoUser> selectDemoUser();
|
||||||
|
List<DemoUnit> selectDemoUnit();
|
||||||
|
}
|
46
src/main/java/com/darkness/service/impl/DemoServiceImpl.java
Normal file
46
src/main/java/com/darkness/service/impl/DemoServiceImpl.java
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package com.darkness.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.darkness.mapper.DemoUnitMapper;
|
||||||
|
import com.darkness.mapper.DemoUserMapper;
|
||||||
|
import com.darkness.pojo.entity.tables.pojos.DemoUnit;
|
||||||
|
import com.darkness.pojo.entity.tables.pojos.DemoUser;
|
||||||
|
import com.darkness.service.DemoService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class DemoServiceImpl implements DemoService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DemoUserMapper userMapper;
|
||||||
|
@Resource
|
||||||
|
private DemoUnitMapper unitMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertDemoUser() {
|
||||||
|
DemoUser demoUser = new DemoUser();
|
||||||
|
demoUser.setUserName(UUID.randomUUID().toString());
|
||||||
|
userMapper.insert(demoUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertDemoUnit() {
|
||||||
|
DemoUnit demoUnit = new DemoUnit();
|
||||||
|
demoUnit.setUnitName(UUID.randomUUID().toString());
|
||||||
|
unitMapper.insert(demoUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DemoUser> selectDemoUser() {
|
||||||
|
return userMapper.selectList(new QueryWrapper<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DemoUnit> selectDemoUnit() {
|
||||||
|
return unitMapper.selectList(new QueryWrapper<>());
|
||||||
|
}
|
||||||
|
}
|
10
src/main/resources/application.yml
Normal file
10
src/main/resources/application.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
server:
|
||||||
|
port: 8002
|
||||||
|
|
||||||
|
spring:
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://39.99.244.11:3306/konosuba?useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||||
|
username: konosuba
|
||||||
|
password: kKWjPDYDMLtLaLwY
|
||||||
|
type: com.zaxxer.hikari.HikariDataSource
|
Loading…
x
Reference in New Issue
Block a user