MockingOrmInitService + MockingOperateTableMapper 自动建表
This commit is contained in:
parent
8307595063
commit
5e6f0dadbe
@ -3,7 +3,7 @@ package cn.skcks.docking.gb28181.mocking.orm.mybatis.operation;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface OperateTableMapper {
|
public interface MockingOperateTableMapper {
|
||||||
// int createNewTable(@Param("tableName")String tableName);
|
// int createNewTable(@Param("tableName")String tableName);
|
||||||
void createDeviceTable();
|
void createDeviceTable();
|
||||||
}
|
}
|
@ -2,9 +2,9 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="cn.skcks.docking.gb28181.orm.mybatis.operation.OperateTableMapper">
|
<mapper namespace="cn.skcks.docking.gb28181.mocking.orm.mybatis.operation.MockingOperateTableMapper">
|
||||||
<update id="createDeviceTable">
|
<update id="createDeviceTable">
|
||||||
CREATE TABLE `mocking_device` (
|
CREATE TABLE IF NOT EXISTS `mocking_device` (
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||||
`device_code` varchar(50) NOT NULL,
|
`device_code` varchar(50) NOT NULL,
|
||||||
`gb_device_id` varbinary(50) NOT NULL,
|
`gb_device_id` varbinary(50) NOT NULL,
|
@ -19,6 +19,12 @@
|
|||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.skcks.docking.gb28181</groupId>
|
||||||
|
<artifactId>gb28181-mocking-orm</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.skcks.docking.gb28181</groupId>
|
<groupId>cn.skcks.docking.gb28181</groupId>
|
||||||
<artifactId>common</artifactId>
|
<artifactId>common</artifactId>
|
||||||
@ -28,5 +34,80 @@
|
|||||||
<groupId>cn.skcks.docking</groupId>
|
<groupId>cn.skcks.docking</groupId>
|
||||||
<artifactId>zlmediakit-service</artifactId>
|
<artifactId>zlmediakit-service</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- sip协议栈 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.sip</groupId>
|
||||||
|
<artifactId>jain-sip-ri</artifactId>
|
||||||
|
<version>1.3.0-91</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- xml解析库 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.dom4j</groupId>
|
||||||
|
<artifactId>dom4j</artifactId>
|
||||||
|
<version>2.1.4</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--MapStruct-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mapstruct</groupId>
|
||||||
|
<artifactId>mapstruct-processor</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--lombok-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--hutool-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.hutool</groupId>
|
||||||
|
<artifactId>hutool-all</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework</groupId>
|
||||||
|
<artifactId>spring-web</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/**</include>
|
||||||
|
</includes>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.skcks.docking.gb28181.mocking.orm;
|
||||||
|
|
||||||
|
import cn.skcks.docking.gb28181.mocking.orm.mybatis.operation.MockingOperateTableMapper;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
|
import org.mybatis.spring.annotation.MapperScans;
|
||||||
|
import org.springframework.core.annotation.Order;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@Order(0)
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@MapperScans({
|
||||||
|
@MapperScan("cn.skcks.docking.gb28181.mocking.orm.mybatis.dynamic"),
|
||||||
|
@MapperScan("cn.skcks.docking.gb28181.mocking.orm.mybatis.operation"),
|
||||||
|
})
|
||||||
|
public class MockingOrmInitService {
|
||||||
|
private final MockingOperateTableMapper mapper;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init(){
|
||||||
|
log.info("[orm] 自动建表");
|
||||||
|
mapper.createDeviceTable();
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,5 @@
|
|||||||
server:
|
server:
|
||||||
port: 28181
|
port: 18182
|
||||||
|
|
||||||
project:
|
project:
|
||||||
version: @project.version@
|
version: @project.version@
|
Loading…
Reference in New Issue
Block a user