添加 docking_device_channel 表
This commit is contained in:
parent
67c3875ffb
commit
7dec62b229
@ -24,5 +24,6 @@ public class DockingOrmInitService {
|
||||
public void init() {
|
||||
log.info("[orm] 自动建表");
|
||||
mapper.createDeviceTable();
|
||||
mapper.createDeviceChannelTable();
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.mybatis.dynamic.sql.SqlBuilder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.sip.message.Response;
|
||||
|
||||
@ -48,6 +49,7 @@ public class DockingDeviceService {
|
||||
return onlineCacheService.isOnline(deviceId);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void online(DockingDevice device, Response response) {
|
||||
String deviceId = device.getDeviceId();
|
||||
log.info("[设备上线] deviceId => {}, {}://{}:{}", deviceId, device.getTransport(), device.getIp(), device.getPort());
|
||||
|
@ -0,0 +1,98 @@
|
||||
package cn.skcks.docking.gb28181.orm.mybatis.basic.mapper;
|
||||
|
||||
import cn.skcks.docking.gb28181.orm.mybatis.basic.model.DockingDeviceChannel;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Result;
|
||||
import org.apache.ibatis.annotations.Results;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
|
||||
public interface DockingDeviceChannelMapper {
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table docking_device_channel
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Delete({
|
||||
"delete from docking_device_channel",
|
||||
"where id = #{id,jdbcType=BIGINT}"
|
||||
})
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table docking_device_channel
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Insert({
|
||||
"insert into docking_device_channel (id, gb_device_id, ",
|
||||
"gb_device_channel_id, name, ",
|
||||
"address)",
|
||||
"values (#{id,jdbcType=BIGINT}, #{gbDeviceId,jdbcType=VARCHAR}, ",
|
||||
"#{gbDeviceChannelId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
|
||||
"#{address,jdbcType=VARCHAR})"
|
||||
})
|
||||
int insert(DockingDeviceChannel row);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table docking_device_channel
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Select({
|
||||
"select",
|
||||
"id, gb_device_id, gb_device_channel_id, name, address",
|
||||
"from docking_device_channel",
|
||||
"where id = #{id,jdbcType=BIGINT}"
|
||||
})
|
||||
@Results({
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@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)
|
||||
})
|
||||
DockingDeviceChannel selectByPrimaryKey(Long id);
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table docking_device_channel
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Select({
|
||||
"select",
|
||||
"id, gb_device_id, gb_device_channel_id, name, address",
|
||||
"from docking_device_channel"
|
||||
})
|
||||
@Results({
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@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<DockingDeviceChannel> selectAll();
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method corresponds to the database table docking_device_channel
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
@Update({
|
||||
"update docking_device_channel",
|
||||
"set gb_device_id = #{gbDeviceId,jdbcType=VARCHAR},",
|
||||
"gb_device_channel_id = #{gbDeviceChannelId,jdbcType=VARCHAR},",
|
||||
"name = #{name,jdbcType=VARCHAR},",
|
||||
"address = #{address,jdbcType=VARCHAR}",
|
||||
"where id = #{id,jdbcType=BIGINT}"
|
||||
})
|
||||
int updateByPrimaryKey(DockingDeviceChannel row);
|
||||
}
|
@ -0,0 +1,173 @@
|
||||
package cn.skcks.docking.gb28181.orm.mybatis.basic.model;
|
||||
|
||||
/**
|
||||
*
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table docking_device_channel
|
||||
*/
|
||||
public class DockingDeviceChannel {
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column docking_device_channel.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column docking_device_channel.gb_device_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String gbDeviceId;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column docking_device_channel.gb_device_channel_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String gbDeviceChannelId;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column docking_device_channel.name
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
*
|
||||
* This field was generated by MyBatis Generator.
|
||||
* This field corresponds to the database column docking_device_channel.address
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
private String address;
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column docking_device_channel.id
|
||||
*
|
||||
* @return the value of docking_device_channel.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column docking_device_channel.id
|
||||
*
|
||||
* @param id the value for docking_device_channel.id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column docking_device_channel.gb_device_id
|
||||
*
|
||||
* @return the value of docking_device_channel.gb_device_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getGbDeviceId() {
|
||||
return gbDeviceId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column docking_device_channel.gb_device_id
|
||||
*
|
||||
* @param gbDeviceId the value for docking_device_channel.gb_device_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setGbDeviceId(String gbDeviceId) {
|
||||
this.gbDeviceId = gbDeviceId == null ? null : gbDeviceId.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column docking_device_channel.gb_device_channel_id
|
||||
*
|
||||
* @return the value of docking_device_channel.gb_device_channel_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getGbDeviceChannelId() {
|
||||
return gbDeviceChannelId;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column docking_device_channel.gb_device_channel_id
|
||||
*
|
||||
* @param gbDeviceChannelId the value for docking_device_channel.gb_device_channel_id
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setGbDeviceChannelId(String gbDeviceChannelId) {
|
||||
this.gbDeviceChannelId = gbDeviceChannelId == null ? null : gbDeviceChannelId.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column docking_device_channel.name
|
||||
*
|
||||
* @return the value of docking_device_channel.name
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column docking_device_channel.name
|
||||
*
|
||||
* @param name the value for docking_device_channel.name
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method returns the value of the database column docking_device_channel.address
|
||||
*
|
||||
* @return the value of docking_device_channel.address
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method was generated by MyBatis Generator.
|
||||
* This method sets the value of the database column docking_device_channel.address
|
||||
*
|
||||
* @param address the value for docking_device_channel.address
|
||||
*
|
||||
* @mbg.generated
|
||||
*/
|
||||
public void setAddress(String address) {
|
||||
this.address = address == null ? null : address.trim();
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.skcks.docking.gb28181.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 DockingDeviceChannelDynamicSqlSupport {
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
public static final DockingDeviceChannel dockingDeviceChannel = new DockingDeviceChannel();
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.id")
|
||||
public static final SqlColumn<Long> id = dockingDeviceChannel.id;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.gb_device_id")
|
||||
public static final SqlColumn<String> gbDeviceId = dockingDeviceChannel.gbDeviceId;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.gb_device_channel_id")
|
||||
public static final SqlColumn<String> gbDeviceChannelId = dockingDeviceChannel.gbDeviceChannelId;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.name")
|
||||
public static final SqlColumn<String> name = dockingDeviceChannel.name;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.address")
|
||||
public static final SqlColumn<String> address = dockingDeviceChannel.address;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
public static final class DockingDeviceChannel extends AliasableSqlTable<DockingDeviceChannel> {
|
||||
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||
|
||||
public final SqlColumn<String> gbDeviceId = column("gb_device_id", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> gbDeviceChannelId = column("gb_device_channel_id", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> name = column("name", JDBCType.VARCHAR);
|
||||
|
||||
public final SqlColumn<String> address = column("address", JDBCType.VARCHAR);
|
||||
|
||||
public DockingDeviceChannel() {
|
||||
super("docking_device_channel", DockingDeviceChannel::new);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,169 @@
|
||||
package cn.skcks.docking.gb28181.orm.mybatis.dynamic.mapper;
|
||||
|
||||
import static cn.skcks.docking.gb28181.orm.mybatis.dynamic.mapper.DockingDeviceChannelDynamicSqlSupport.*;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
||||
|
||||
import cn.skcks.docking.gb28181.orm.mybatis.dynamic.model.DockingDeviceChannel;
|
||||
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 DockingDeviceChannelMapper extends CommonCountMapper, CommonDeleteMapper, CommonInsertMapper<DockingDeviceChannel>, CommonUpdateMapper {
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
BasicColumn[] selectList = BasicColumn.columnList(id, gbDeviceId, gbDeviceChannelId, name, address);
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@Results(id="DockingDeviceChannelResult", value = {
|
||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||
@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<DockingDeviceChannel> selectMany(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||
@ResultMap("DockingDeviceChannelResult")
|
||||
Optional<DockingDeviceChannel> selectOne(SelectStatementProvider selectStatement);
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default long count(CountDSLCompleter completer) {
|
||||
return MyBatis3Utils.countFrom(this::count, dockingDeviceChannel, completer);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int delete(DeleteDSLCompleter completer) {
|
||||
return MyBatis3Utils.deleteFrom(this::delete, dockingDeviceChannel, completer);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int deleteByPrimaryKey(Long id_) {
|
||||
return delete(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int insert(DockingDeviceChannel row) {
|
||||
return MyBatis3Utils.insert(this::insert, row, dockingDeviceChannel, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(gbDeviceId).toProperty("gbDeviceId")
|
||||
.map(gbDeviceChannelId).toProperty("gbDeviceChannelId")
|
||||
.map(name).toProperty("name")
|
||||
.map(address).toProperty("address")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int insertMultiple(Collection<DockingDeviceChannel> records) {
|
||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, dockingDeviceChannel, c ->
|
||||
c.map(id).toProperty("id")
|
||||
.map(gbDeviceId).toProperty("gbDeviceId")
|
||||
.map(gbDeviceChannelId).toProperty("gbDeviceChannelId")
|
||||
.map(name).toProperty("name")
|
||||
.map(address).toProperty("address")
|
||||
);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int insertSelective(DockingDeviceChannel row) {
|
||||
return MyBatis3Utils.insert(this::insert, row, dockingDeviceChannel, c ->
|
||||
c.map(id).toPropertyWhenPresent("id", row::getId)
|
||||
.map(gbDeviceId).toPropertyWhenPresent("gbDeviceId", row::getGbDeviceId)
|
||||
.map(gbDeviceChannelId).toPropertyWhenPresent("gbDeviceChannelId", row::getGbDeviceChannelId)
|
||||
.map(name).toPropertyWhenPresent("name", row::getName)
|
||||
.map(address).toPropertyWhenPresent("address", row::getAddress)
|
||||
);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default Optional<DockingDeviceChannel> selectOne(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectOne(this::selectOne, selectList, dockingDeviceChannel, completer);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default List<DockingDeviceChannel> select(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectList(this::selectMany, selectList, dockingDeviceChannel, completer);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default List<DockingDeviceChannel> selectDistinct(SelectDSLCompleter completer) {
|
||||
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, dockingDeviceChannel, completer);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default Optional<DockingDeviceChannel> selectByPrimaryKey(Long id_) {
|
||||
return selectOne(c ->
|
||||
c.where(id, isEqualTo(id_))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int update(UpdateDSLCompleter completer) {
|
||||
return MyBatis3Utils.update(this::update, dockingDeviceChannel, completer);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
static UpdateDSL<UpdateModel> updateAllColumns(DockingDeviceChannel row, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalTo(row::getId)
|
||||
.set(gbDeviceId).equalTo(row::getGbDeviceId)
|
||||
.set(gbDeviceChannelId).equalTo(row::getGbDeviceChannelId)
|
||||
.set(name).equalTo(row::getName)
|
||||
.set(address).equalTo(row::getAddress);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(DockingDeviceChannel row, UpdateDSL<UpdateModel> dsl) {
|
||||
return dsl.set(id).equalToWhenPresent(row::getId)
|
||||
.set(gbDeviceId).equalToWhenPresent(row::getGbDeviceId)
|
||||
.set(gbDeviceChannelId).equalToWhenPresent(row::getGbDeviceChannelId)
|
||||
.set(name).equalToWhenPresent(row::getName)
|
||||
.set(address).equalToWhenPresent(row::getAddress);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int updateByPrimaryKey(DockingDeviceChannel row) {
|
||||
return update(c ->
|
||||
c.set(gbDeviceId).equalTo(row::getGbDeviceId)
|
||||
.set(gbDeviceChannelId).equalTo(row::getGbDeviceChannelId)
|
||||
.set(name).equalTo(row::getName)
|
||||
.set(address).equalTo(row::getAddress)
|
||||
.where(id, isEqualTo(row::getId))
|
||||
);
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source Table: docking_device_channel")
|
||||
default int updateByPrimaryKeySelective(DockingDeviceChannel row) {
|
||||
return update(c ->
|
||||
c.set(gbDeviceId).equalToWhenPresent(row::getGbDeviceId)
|
||||
.set(gbDeviceChannelId).equalToWhenPresent(row::getGbDeviceChannelId)
|
||||
.set(name).equalToWhenPresent(row::getName)
|
||||
.set(address).equalToWhenPresent(row::getAddress)
|
||||
.where(id, isEqualTo(row::getId))
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package cn.skcks.docking.gb28181.orm.mybatis.dynamic.model;
|
||||
|
||||
import jakarta.annotation.Generated;
|
||||
|
||||
/**
|
||||
*
|
||||
* This class was generated by MyBatis Generator.
|
||||
* This class corresponds to the database table docking_device_channel
|
||||
*/
|
||||
public class DockingDeviceChannel {
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.id")
|
||||
private Long id;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.gb_device_id")
|
||||
private String gbDeviceId;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.gb_device_channel_id")
|
||||
private String gbDeviceChannelId;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.name")
|
||||
private String name;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.address")
|
||||
private String address;
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.id")
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.id")
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.gb_device_id")
|
||||
public String getGbDeviceId() {
|
||||
return gbDeviceId;
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.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: docking_device_channel.gb_device_channel_id")
|
||||
public String getGbDeviceChannelId() {
|
||||
return gbDeviceChannelId;
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.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: docking_device_channel.name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.name")
|
||||
public void setName(String name) {
|
||||
this.name = name == null ? null : name.trim();
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.address")
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
@Generated(value="org.mybatis.generator.api.MyBatisGenerator", comments="Source field: docking_device_channel.address")
|
||||
public void setAddress(String address) {
|
||||
this.address = address == null ? null : address.trim();
|
||||
}
|
||||
}
|
@ -6,4 +6,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface OperateTableMapper {
|
||||
// int createNewTable(@Param("tableName")String tableName);
|
||||
void createDeviceTable();
|
||||
|
||||
void createDeviceChannelTable();
|
||||
}
|
||||
|
@ -43,4 +43,17 @@
|
||||
UNIQUE KEY `uk_device_device` (`device_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
</update>
|
||||
|
||||
<update id="createDeviceChannelTable">
|
||||
CREATE TABLE IF NOT EXISTS `docking_device_channel` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT,
|
||||
`gb_device_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`gb_device_channel_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `gb_device_id_2` (`gb_device_id`,`gb_device_channel_id`) USING BTREE,
|
||||
KEY `gb_device_id` (`gb_device_id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||
</update>
|
||||
</mapper>
|
||||
|
@ -178,7 +178,7 @@
|
||||
|
||||
注意,table里面很多参数都是对javaModelGenerator,context等元素的默认属性的一个复写;
|
||||
-->
|
||||
<table tableName="%">
|
||||
<table tableName="docking_%">
|
||||
|
||||
<!-- 参考 javaModelGenerator 的 constructorBased属性-->
|
||||
<property name="constructorBased" value="false"/>
|
||||
|
@ -21,5 +21,6 @@ public class GenerateSchemaTest {
|
||||
@Test
|
||||
void contextLoads(){
|
||||
operateTableMapper.createDeviceTable();
|
||||
operateTableMapper.createDeviceChannelTable();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user