diff --git a/gb28181-wvp-proxy-orm/pom.xml b/gb28181-wvp-proxy-orm/pom.xml new file mode 100644 index 0000000..0c2ac4a --- /dev/null +++ b/gb28181-wvp-proxy-orm/pom.xml @@ -0,0 +1,132 @@ + + + 4.0.0 + + cn.skcks.docking + gb28181-wvp-proxy + 0.0.1-SNAPSHOT + + + gb28181-wvp-proxy-orm + + + 17 + 17 + UTF-8 + + + + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + + + + org.mybatis.spring.boot + mybatis-spring-boot-starter-test + 3.0.2 + test + + + + com.github.pagehelper + pagehelper-spring-boot-starter + + + + + org.mybatis.dynamic-sql + mybatis-dynamic-sql + + + + org.springframework.boot + spring-boot-starter + + + + com.mysql + mysql-connector-j + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.junit.jupiter + junit-jupiter-api + test + + + + + + + src/main/java + + **/** + + + + src/main/resources + + **/** + + + + + + + src/test/resources + + **/** + + true + + + + + + org.springframework.boot + spring-boot-maven-plugin + + true + + + + + org.mybatis.generator + mybatis-generator-maven-plugin + ${mybatis-generator-maven-plugin.version} + + + src/main/resources/config/generatorConfig.xml + true + true + + + + Generate MyBatis Artifacts + + generate + + + + + + com.mysql + mysql-connector-j + ${mysql.version} + + + + + + \ No newline at end of file diff --git a/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/mapper/WvpProxyDeviceDynamicSqlSupport.java b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/mapper/WvpProxyDeviceDynamicSqlSupport.java new file mode 100644 index 0000000..42218e2 --- /dev/null +++ b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/mapper/WvpProxyDeviceDynamicSqlSupport.java @@ -0,0 +1,48 @@ +package cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.mapper; + +import jakarta.annotation.Generated; +import java.sql.JDBCType; +import org.mybatis.dynamic.sql.AliasableSqlTable; +import org.mybatis.dynamic.sql.SqlColumn; + +public final class WvpProxyDeviceDynamicSqlSupport { + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + public static final WvpProxyDevice wvpProxyDevice = new WvpProxyDevice(); + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.id") + public static final SqlColumn id = wvpProxyDevice.id; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.device_code") + public static final SqlColumn deviceCode = wvpProxyDevice.deviceCode; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_id") + public static final SqlColumn gbDeviceId = wvpProxyDevice.gbDeviceId; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_channel_id") + public static final SqlColumn gbDeviceChannelId = wvpProxyDevice.gbDeviceChannelId; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.name") + public static final SqlColumn name = wvpProxyDevice.name; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.address") + public static final SqlColumn address = wvpProxyDevice.address; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + public static final class WvpProxyDevice extends AliasableSqlTable { + public final SqlColumn id = column("id", JDBCType.BIGINT); + + public final SqlColumn deviceCode = column("device_code", JDBCType.VARCHAR); + + public final SqlColumn gbDeviceId = column("gb_device_id", JDBCType.VARCHAR); + + public final SqlColumn gbDeviceChannelId = column("gb_device_channel_id", JDBCType.VARCHAR); + + public final SqlColumn name = column("name", JDBCType.VARCHAR); + + public final SqlColumn address = column("address", JDBCType.VARCHAR); + + public WvpProxyDevice() { + super("wvp_proxy_device", WvpProxyDevice::new); + } + } +} \ No newline at end of file diff --git a/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/mapper/WvpProxyDeviceMapper.java b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/mapper/WvpProxyDeviceMapper.java new file mode 100644 index 0000000..2496087 --- /dev/null +++ b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/mapper/WvpProxyDeviceMapper.java @@ -0,0 +1,176 @@ +package cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.mapper; + +import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo; + +import cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.model.WvpProxyDevice; +import jakarta.annotation.Generated; +import java.util.Collection; +import java.util.List; +import java.util.Optional; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Result; +import org.apache.ibatis.annotations.ResultMap; +import org.apache.ibatis.annotations.Results; +import org.apache.ibatis.annotations.SelectProvider; +import org.apache.ibatis.type.JdbcType; +import org.mybatis.dynamic.sql.BasicColumn; +import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter; +import org.mybatis.dynamic.sql.select.CountDSLCompleter; +import org.mybatis.dynamic.sql.select.SelectDSLCompleter; +import org.mybatis.dynamic.sql.select.render.SelectStatementProvider; +import org.mybatis.dynamic.sql.update.UpdateDSL; +import org.mybatis.dynamic.sql.update.UpdateDSLCompleter; +import org.mybatis.dynamic.sql.update.UpdateModel; +import org.mybatis.dynamic.sql.util.SqlProviderAdapter; +import org.mybatis.dynamic.sql.util.mybatis3.CommonCountMapper; +import org.mybatis.dynamic.sql.util.mybatis3.CommonDeleteMapper; +import org.mybatis.dynamic.sql.util.mybatis3.CommonInsertMapper; +import org.mybatis.dynamic.sql.util.mybatis3.CommonUpdateMapper; +import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils; + +@Mapper +public interface WvpProxyDeviceMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper, CommonUpdateMapper { + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + BasicColumn[] selectList = BasicColumn.columnList(WvpProxyDeviceDynamicSqlSupport.id, WvpProxyDeviceDynamicSqlSupport.deviceCode, WvpProxyDeviceDynamicSqlSupport.gbDeviceId, WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId, WvpProxyDeviceDynamicSqlSupport.name, WvpProxyDeviceDynamicSqlSupport.address); + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + @SelectProvider(type=SqlProviderAdapter.class, method="select") + @Results(id="WvpProxyDeviceResult", value = { + @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), + @Result(column="device_code", property="deviceCode", jdbcType=JdbcType.VARCHAR), + @Result(column="gb_device_id", property="gbDeviceId", jdbcType=JdbcType.VARCHAR), + @Result(column="gb_device_channel_id", property="gbDeviceChannelId", jdbcType=JdbcType.VARCHAR), + @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR), + @Result(column="address", property="address", jdbcType=JdbcType.VARCHAR) + }) + List selectMany(SelectStatementProvider selectStatement); + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + @SelectProvider(type=SqlProviderAdapter.class, method="select") + @ResultMap("WvpProxyDeviceResult") + Optional selectOne(SelectStatementProvider selectStatement); + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default long count(CountDSLCompleter completer) { + return MyBatis3Utils.countFrom(this::count, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, completer); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int delete(DeleteDSLCompleter completer) { + return MyBatis3Utils.deleteFrom(this::delete, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, completer); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int deleteByPrimaryKey(Long id_) { + return delete(c -> + c.where(WvpProxyDeviceDynamicSqlSupport.id, isEqualTo(id_)) + ); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int insert(WvpProxyDevice row) { + return MyBatis3Utils.insert(this::insert, row, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, c -> + c.map(WvpProxyDeviceDynamicSqlSupport.id).toProperty("id") + .map(WvpProxyDeviceDynamicSqlSupport.deviceCode).toProperty("deviceCode") + .map(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).toProperty("gbDeviceId") + .map(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).toProperty("gbDeviceChannelId") + .map(WvpProxyDeviceDynamicSqlSupport.name).toProperty("name") + .map(WvpProxyDeviceDynamicSqlSupport.address).toProperty("address") + ); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int insertMultiple(Collection records) { + return MyBatis3Utils.insertMultiple(this::insertMultiple, records, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, c -> + c.map(WvpProxyDeviceDynamicSqlSupport.id).toProperty("id") + .map(WvpProxyDeviceDynamicSqlSupport.deviceCode).toProperty("deviceCode") + .map(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).toProperty("gbDeviceId") + .map(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).toProperty("gbDeviceChannelId") + .map(WvpProxyDeviceDynamicSqlSupport.name).toProperty("name") + .map(WvpProxyDeviceDynamicSqlSupport.address).toProperty("address") + ); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int insertSelective(WvpProxyDevice row) { + return MyBatis3Utils.insert(this::insert, row, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, c -> + c.map(WvpProxyDeviceDynamicSqlSupport.id).toPropertyWhenPresent("id", row::getId) + .map(WvpProxyDeviceDynamicSqlSupport.deviceCode).toPropertyWhenPresent("deviceCode", row::getDeviceCode) + .map(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).toPropertyWhenPresent("gbDeviceId", row::getGbDeviceId) + .map(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).toPropertyWhenPresent("gbDeviceChannelId", row::getGbDeviceChannelId) + .map(WvpProxyDeviceDynamicSqlSupport.name).toPropertyWhenPresent("name", row::getName) + .map(WvpProxyDeviceDynamicSqlSupport.address).toPropertyWhenPresent("address", row::getAddress) + ); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default Optional selectOne(SelectDSLCompleter completer) { + return MyBatis3Utils.selectOne(this::selectOne, selectList, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, completer); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default List select(SelectDSLCompleter completer) { + return MyBatis3Utils.selectList(this::selectMany, selectList, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, completer); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default List selectDistinct(SelectDSLCompleter completer) { + return MyBatis3Utils.selectDistinct(this::selectMany, selectList, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, completer); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default Optional selectByPrimaryKey(Long id_) { + return selectOne(c -> + c.where(WvpProxyDeviceDynamicSqlSupport.id, isEqualTo(id_)) + ); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int update(UpdateDSLCompleter completer) { + return MyBatis3Utils.update(this::update, WvpProxyDeviceDynamicSqlSupport.wvpProxyDevice, completer); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + static UpdateDSL updateAllColumns(WvpProxyDevice row, UpdateDSL dsl) { + return dsl.set(WvpProxyDeviceDynamicSqlSupport.id).equalTo(row::getId) + .set(WvpProxyDeviceDynamicSqlSupport.deviceCode).equalTo(row::getDeviceCode) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).equalTo(row::getGbDeviceId) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).equalTo(row::getGbDeviceChannelId) + .set(WvpProxyDeviceDynamicSqlSupport.name).equalTo(row::getName) + .set(WvpProxyDeviceDynamicSqlSupport.address).equalTo(row::getAddress); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + static UpdateDSL updateSelectiveColumns(WvpProxyDevice row, UpdateDSL dsl) { + return dsl.set(WvpProxyDeviceDynamicSqlSupport.id).equalToWhenPresent(row::getId) + .set(WvpProxyDeviceDynamicSqlSupport.deviceCode).equalToWhenPresent(row::getDeviceCode) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).equalToWhenPresent(row::getGbDeviceId) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).equalToWhenPresent(row::getGbDeviceChannelId) + .set(WvpProxyDeviceDynamicSqlSupport.name).equalToWhenPresent(row::getName) + .set(WvpProxyDeviceDynamicSqlSupport.address).equalToWhenPresent(row::getAddress); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int updateByPrimaryKey(WvpProxyDevice row) { + return update(c -> + c.set(WvpProxyDeviceDynamicSqlSupport.deviceCode).equalTo(row::getDeviceCode) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).equalTo(row::getGbDeviceId) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).equalTo(row::getGbDeviceChannelId) + .set(WvpProxyDeviceDynamicSqlSupport.name).equalTo(row::getName) + .set(WvpProxyDeviceDynamicSqlSupport.address).equalTo(row::getAddress) + .where(WvpProxyDeviceDynamicSqlSupport.id, isEqualTo(row::getId)) + ); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: wvp_proxy_device") + default int updateByPrimaryKeySelective(WvpProxyDevice row) { + return update(c -> + c.set(WvpProxyDeviceDynamicSqlSupport.deviceCode).equalToWhenPresent(row::getDeviceCode) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceId).equalToWhenPresent(row::getGbDeviceId) + .set(WvpProxyDeviceDynamicSqlSupport.gbDeviceChannelId).equalToWhenPresent(row::getGbDeviceChannelId) + .set(WvpProxyDeviceDynamicSqlSupport.name).equalToWhenPresent(row::getName) + .set(WvpProxyDeviceDynamicSqlSupport.address).equalToWhenPresent(row::getAddress) + .where(WvpProxyDeviceDynamicSqlSupport.id, isEqualTo(row::getId)) + ); + } +} \ No newline at end of file diff --git a/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/model/WvpProxyDevice.java b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/model/WvpProxyDevice.java new file mode 100644 index 0000000..4540275 --- /dev/null +++ b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/dynamic/model/WvpProxyDevice.java @@ -0,0 +1,88 @@ +package cn.skcks.docking.gb28181.wvp.orm.mybatis.dynamic.model; + +import jakarta.annotation.Generated; + +/** + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table wvp_proxy_device + */ +public class WvpProxyDevice { + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.id") + private Long id; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.device_code") + private String deviceCode; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_id") + private String gbDeviceId; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_channel_id") + private String gbDeviceChannelId; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.name") + private String name; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.address") + private String address; + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.id") + public Long getId() { + return id; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.id") + public void setId(Long id) { + this.id = id; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.device_code") + public String getDeviceCode() { + return deviceCode; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.device_code") + public void setDeviceCode(String deviceCode) { + this.deviceCode = deviceCode == null ? null : deviceCode.trim(); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_id") + public String getGbDeviceId() { + return gbDeviceId; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_id") + public void setGbDeviceId(String gbDeviceId) { + this.gbDeviceId = gbDeviceId == null ? null : gbDeviceId.trim(); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_channel_id") + public String getGbDeviceChannelId() { + return gbDeviceChannelId; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.gb_device_channel_id") + public void setGbDeviceChannelId(String gbDeviceChannelId) { + this.gbDeviceChannelId = gbDeviceChannelId == null ? null : gbDeviceChannelId.trim(); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.name") + public String getName() { + return name; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.name") + public void setName(String name) { + this.name = name == null ? null : name.trim(); + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.address") + public String getAddress() { + return address; + } + + @Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: wvp_proxy_device.address") + public void setAddress(String address) { + this.address = address == null ? null : address.trim(); + } +} \ No newline at end of file diff --git a/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/operation/WvpProxyOperateTableMapper.java b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/operation/WvpProxyOperateTableMapper.java new file mode 100644 index 0000000..6154d65 --- /dev/null +++ b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/operation/WvpProxyOperateTableMapper.java @@ -0,0 +1,9 @@ +package cn.skcks.docking.gb28181.wvp.orm.mybatis.operation; + +import org.apache.ibatis.annotations.Mapper; + +@Mapper +public interface WvpProxyOperateTableMapper { + // int createNewTable(@Param("tableName")String tableName); + void createDeviceTable(); +} diff --git a/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/operation/WvpProxyOperateTableMapper.xml b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/operation/WvpProxyOperateTableMapper.xml new file mode 100644 index 0000000..b873aa8 --- /dev/null +++ b/gb28181-wvp-proxy-orm/src/main/java/cn/skcks/docking/gb28181/wvp/orm/mybatis/operation/WvpProxyOperateTableMapper.xml @@ -0,0 +1,23 @@ + + + + + + CREATE TABLE IF NOT EXISTS `wvp_proxy_device` + ( + `id` bigint NOT NULL AUTO_INCREMENT, + `device_code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, + `gb_device_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, + `gb_device_channel_id` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL, + `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + `address` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `gb_device_id` (`gb_device_id`), + UNIQUE KEY `device_code` (`device_code`), + UNIQUE KEY `gb_device_id_2` (`gb_device_id`, `gb_device_channel_id`) + ) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_unicode_ci; + + diff --git a/gb28181-wvp-proxy-orm/src/main/resources/config/generatorConfig.xml b/gb28181-wvp-proxy-orm/src/main/resources/config/generatorConfig.xml new file mode 100644 index 0000000..9d168a5 --- /dev/null +++ b/gb28181-wvp-proxy-orm/src/main/resources/config/generatorConfig.xml @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +
+
diff --git a/gb28181-wvp-proxy-service/pom.xml b/gb28181-wvp-proxy-service/pom.xml index fe4f3bd..0f6eb9b 100644 --- a/gb28181-wvp-proxy-service/pom.xml +++ b/gb28181-wvp-proxy-service/pom.xml @@ -18,6 +18,12 @@ + + cn.skcks.docking + gb28181-wvp-proxy-orm + ${project.version} + + cn.skcks.docking.gb28181 common diff --git a/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/orm/WvpProxyOrmInitService.java b/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/orm/WvpProxyOrmInitService.java new file mode 100644 index 0000000..4c4d00e --- /dev/null +++ b/gb28181-wvp-proxy-service/src/main/java/cn/skcks/docking/gb28181/wvp/orm/WvpProxyOrmInitService.java @@ -0,0 +1,28 @@ +package cn.skcks.docking.gb28181.wvp.orm; + +import cn.skcks.docking.gb28181.wvp.orm.mybatis.operation.WvpProxyOperateTableMapper; +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.wvp.orm.mybatis.dynamic"), + @MapperScan("cn.skcks.docking.gb28181.wvp.orm.mybatis.operation"), +}) +public class WvpProxyOrmInitService { + private final WvpProxyOperateTableMapper mapper; + + @PostConstruct + public void init(){ + log.info("[orm] 自动建表"); + mapper.createDeviceTable(); + } +} diff --git a/gb28181-wvp-proxy-service/src/main/resources/application.yaml b/gb28181-wvp-proxy-service/src/main/resources/application.yaml index 927b182..26dfe71 100644 --- a/gb28181-wvp-proxy-service/src/main/resources/application.yaml +++ b/gb28181-wvp-proxy-service/src/main/resources/application.yaml @@ -1,5 +1,5 @@ proxy: wvp: - url: http://192.168.3.12:18978 + url: http://192.168.3.13:18978 user: admin passwd: admin \ No newline at end of file diff --git a/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/WvpProxyTestApplication.java b/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/WvpProxyTestApplication.java index ea0cd0c..b2d07e5 100644 --- a/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/WvpProxyTestApplication.java +++ b/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/WvpProxyTestApplication.java @@ -3,11 +3,10 @@ package cn.skcks.docking.gb28181.wvp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.cloud.openfeign.EnableFeignClients; @EnableFeignClients -@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@SpringBootApplication public class WvpProxyTestApplication { public static void main(String[] args) { SpringApplication.run(WvpProxyTestApplication.class, args); diff --git a/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/test/WvpProxyTest.java b/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/test/WvpProxyTest.java index cd1abed..616f219 100644 --- a/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/test/WvpProxyTest.java +++ b/gb28181-wvp-proxy-service/src/test/java/cn/skcks/docking/gb28181/wvp/test/WvpProxyTest.java @@ -42,7 +42,7 @@ public class WvpProxyTest { log.info("{}", loginResp); String token = loginResp.getData().getAccessToken(); - String deviceId = "44050100001180000001"; + String deviceId = "44050100002000000001"; GetDeviceTreeReq getDeviceTreeReq = GetDeviceTreeReq.builder().build(); JsonResponse deviceTreeResp = wvpProxyClient.getDeviceTree(token, deviceId, getDeviceTreeReq); log.info("{}", deviceTreeResp); @@ -50,5 +50,9 @@ public class WvpProxyTest { GetDeviceChannelsReq getDeviceChannelsReq = GetDeviceChannelsReq.builder().build(); JsonResponse getDeviceChannelsResp = wvpProxyClient.getDeviceChannels(token, deviceId, getDeviceChannelsReq); log.info("{}", getDeviceChannelsResp); + + getDeviceChannelsResp.getData().getList().forEach(item -> { + log.info("{}", item); + }); } } diff --git a/gb28181-wvp-proxy-starter/src/main/java/cn/skcks/docking/gb28181/wvp/Gb28181WvpProxyStarter.java b/gb28181-wvp-proxy-starter/src/main/java/cn/skcks/docking/gb28181/wvp/Gb28181WvpProxyStarter.java index 42d1c9d..b7d4cae 100644 --- a/gb28181-wvp-proxy-starter/src/main/java/cn/skcks/docking/gb28181/wvp/Gb28181WvpProxyStarter.java +++ b/gb28181-wvp-proxy-starter/src/main/java/cn/skcks/docking/gb28181/wvp/Gb28181WvpProxyStarter.java @@ -2,7 +2,6 @@ package cn.skcks.docking.gb28181.wvp; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; @@ -10,7 +9,7 @@ import org.springframework.context.annotation.ComponentScan; "cn.skcks.docking.gb28181.media", "cn.skcks.docking.gb28181.wvp.proxy" }) -@SpringBootApplication(exclude = DataSourceAutoConfiguration.class) +@SpringBootApplication @ComponentScan(basePackages = { "cn.skcks.docking.gb28181.annotation", "cn.skcks.docking.gb28181.common", diff --git a/gb28181-wvp-proxy-starter/src/main/resources/application.yml b/gb28181-wvp-proxy-starter/src/main/resources/application.yml new file mode 100644 index 0000000..8dc184e --- /dev/null +++ b/gb28181-wvp-proxy-starter/src/main/resources/application.yml @@ -0,0 +1,40 @@ +server: + port: 18186 + +project: + version: @project.version@ + +spring: + data: + redis: + # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 + # host: 192.168.1.241 + host: 192.168.1.241 + # [必须修改] 端口号 + port: 6379 + # [可选] 数据库 DB + database: 15 + # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 + password: + # [可选] 超时时间 + timeout: 10000 + datasource: + type: com.zaxxer.hikari.HikariDataSource + driver-class-name: com.mysql.cj.jdbc.Driver + username: root + password: 123456a + url: jdbc:mysql://192.168.1.241:3306/gb28181_docking_platform?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai + +media: + ip: 192.168.3.12 + url: 'http://192.168.3.12:5081' + # url: 'http://10.10.10.200:12580/anything/' + id: amrWMKmbKqoBjRQ9 + # secret: 035c73f7-bb6b-4889-a715-d9eb2d1925cc + secret: 4155cca6-2f9f-11ee-85e6-8de4ce2e7333 + +proxy: + wvp: + url: http://192.168.3.13:18978 + user: admin + passwd: admin \ No newline at end of file diff --git a/pom.xml b/pom.xml index 38729ed..e8c96ad 100644 --- a/pom.xml +++ b/pom.xml @@ -18,6 +18,7 @@ gb28181-wvp-proxy-service gb28181-wvp-proxy-api gb28181-wvp-proxy-starter + gb28181-wvp-proxy-orm