diff --git a/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/OperateTableMapper.java b/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/MockingOperateTableMapper.java similarity index 82% rename from gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/OperateTableMapper.java rename to gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/MockingOperateTableMapper.java index 489a3e0..a52f5de 100644 --- a/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/OperateTableMapper.java +++ b/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/MockingOperateTableMapper.java @@ -3,7 +3,7 @@ package cn.skcks.docking.gb28181.mocking.orm.mybatis.operation; import org.apache.ibatis.annotations.Mapper; @Mapper -public interface OperateTableMapper { +public interface MockingOperateTableMapper { // int createNewTable(@Param("tableName")String tableName); void createDeviceTable(); } diff --git a/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/OperateTableMapper.xml b/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/MockingOperateTableMapper.xml similarity index 85% rename from gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/OperateTableMapper.xml rename to gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/MockingOperateTableMapper.xml index 11b0879..3bfec60 100644 --- a/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/OperateTableMapper.xml +++ b/gb28181-mocking-orm/src/main/java/cn/skcks/docking/gb28181/mocking/orm/mybatis/operation/MockingOperateTableMapper.xml @@ -2,9 +2,9 @@ - + - CREATE TABLE `mocking_device` ( + CREATE TABLE IF NOT EXISTS `mocking_device` ( `id` bigint NOT NULL AUTO_INCREMENT, `device_code` varchar(50) NOT NULL, `gb_device_id` varbinary(50) NOT NULL, diff --git a/gb28181-mocking-service/pom.xml b/gb28181-mocking-service/pom.xml index 26e87e8..e42641d 100644 --- a/gb28181-mocking-service/pom.xml +++ b/gb28181-mocking-service/pom.xml @@ -19,6 +19,12 @@ + + cn.skcks.docking.gb28181 + gb28181-mocking-orm + ${project.version} + + cn.skcks.docking.gb28181 common @@ -28,5 +34,80 @@ cn.skcks.docking zlmediakit-service + + + org.springframework.boot + spring-boot + + + + + javax.sip + jain-sip-ri + 1.3.0-91 + + + + + org.dom4j + dom4j + 2.1.4 + + + + + org.mapstruct + mapstruct + + + org.mapstruct + mapstruct-processor + compile + + + + + org.projectlombok + lombok + provided + + + + + cn.hutool + hutool-all + + + + org.junit.jupiter + junit-jupiter + test + + + org.springframework + spring-web + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + + + src/main/resources + + **/** + + true + + + diff --git a/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/orm/MockingOrmInitService.java b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/orm/MockingOrmInitService.java new file mode 100644 index 0000000..0e8a238 --- /dev/null +++ b/gb28181-mocking-service/src/main/java/cn/skcks/docking/gb28181/mocking/orm/MockingOrmInitService.java @@ -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(); + } +} diff --git a/starter/src/main/resources/application.yml b/gb28181-mocking-starter/src/main/resources/application.yml similarity index 99% rename from starter/src/main/resources/application.yml rename to gb28181-mocking-starter/src/main/resources/application.yml index 3297a48..feee9e4 100644 --- a/starter/src/main/resources/application.yml +++ b/gb28181-mocking-starter/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 28181 + port: 18182 project: version: @project.version@