update 为表添加租户标识

V0.5.x
jay 2024-06-14 13:53:30 +08:00
parent ebbcbc14a3
commit 4f9a91712d
62 changed files with 221 additions and 71 deletions

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.alert; package cc.iotkit.model.alert;
import cc.iotkit.model.Owned; import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -35,7 +36,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class AlertConfig implements Owned<Long> { public class AlertConfig extends TenantModel implements Owned<Long> {
private Long id; private Long id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.alert; package cc.iotkit.model.alert;
import cc.iotkit.model.Owned; import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -35,7 +36,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class AlertRecord implements Owned<Long> { public class AlertRecord extends TenantModel implements Owned<Long> {
private Long id; private Long id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.device; package cc.iotkit.model.device;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -35,7 +36,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class DeviceConfig implements Id<String> { public class DeviceConfig extends TenantModel implements Id<String> {
private String id; private String id;

View File

@ -23,13 +23,14 @@
package cc.iotkit.model.device; package cc.iotkit.model.device;
import cc.iotkit.model.Owned; import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
/** /**
* *
*/ */
@Data @Data
public class DeviceGroup implements Owned<String> { public class DeviceGroup extends TenantModel implements Owned<String> {
/** /**
* id * id

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.device; package cc.iotkit.model.device;
import cc.iotkit.model.Owned; import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -37,7 +38,7 @@ import java.util.Map;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class DeviceInfo implements Owned<String> { public class DeviceInfo extends TenantModel implements Owned<String> {
private String id; private String id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.device; package cc.iotkit.model.device;
import cc.iotkit.model.Owned; import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -38,7 +39,7 @@ import java.util.List;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class VirtualDevice implements Owned<String> { public class VirtualDevice extends TenantModel implements Owned<String> {
public static final String STATE_STOPPED = "stopped"; public static final String STATE_STOPPED = "stopped";
public static final String STATE_RUNNING = "running"; public static final String STATE_RUNNING = "running";

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.notify; package cc.iotkit.model.notify;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -38,7 +39,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class Channel implements Id<Long> { public class Channel extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.notify; package cc.iotkit.model.notify;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -38,7 +39,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ChannelConfig implements Id<Long> { public class ChannelConfig extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.notify; package cc.iotkit.model.notify;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -38,7 +39,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ChannelTemplate implements Id<Long> { public class ChannelTemplate extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.notify; package cc.iotkit.model.notify;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -38,7 +39,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class NotifyMessage implements Id<Long> { public class NotifyMessage extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.ota; package cc.iotkit.model.ota;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
/** /**
@ -31,7 +32,7 @@ import lombok.Data;
* @Description: * @Description:
*/ */
@Data @Data
public class DeviceOta { public class DeviceOta extends TenantModel {
private String currentVersion; private String currentVersion;
private String deviceId; private String deviceId;
} }

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.ota; package cc.iotkit.model.ota;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -39,7 +40,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class DeviceOtaDetail implements Id<Long> { public class DeviceOtaDetail extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.ota; package cc.iotkit.model.ota;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.*; import lombok.*;
/** /**
@ -36,7 +37,7 @@ import lombok.*;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class DeviceOtaInfo implements Id<Long> { public class DeviceOtaInfo extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.ota; package cc.iotkit.model.ota;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -38,7 +39,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class OtaDevice implements Id<Long> { public class OtaDevice extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.ota; package cc.iotkit.model.ota;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -33,6 +34,6 @@ import java.io.Serializable;
* @Description: * @Description:
*/ */
@Data @Data
public class OtaInfo implements Serializable { public class OtaInfo extends TenantModel implements Serializable {
} }

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.ota; package cc.iotkit.model.ota;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -40,7 +41,7 @@ import java.util.Map;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class OtaPackage implements Id<Long> { public class OtaPackage extends TenantModel implements Id<Long> {
private Long id; private Long id;

View File

@ -25,6 +25,7 @@ package cc.iotkit.model.plugin;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -37,7 +38,7 @@ import java.io.Serializable;
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
public class PluginInfo extends BaseModel implements Id<Long>, Serializable { public class PluginInfo extends TenantModel implements Id<Long>, Serializable {
/** /**
* - * -

View File

@ -25,6 +25,7 @@ package cc.iotkit.model.plugin;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.*; import lombok.*;
import java.io.Serializable; import java.io.Serializable;
@ -39,7 +40,7 @@ import java.io.Serializable;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@Builder @Builder
public class PluginInstance extends BaseModel implements Id<Long>, Serializable { public class PluginInstance extends TenantModel implements Id<Long>, Serializable {
private Long id; private Long id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.product; package cc.iotkit.model.product;
import cc.iotkit.model.Owned; import cc.iotkit.model.Owned;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -32,7 +33,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class AppDesign implements Owned<String> { public class AppDesign extends TenantModel implements Owned<String> {
private String id; private String id;

View File

@ -23,10 +23,11 @@
package cc.iotkit.model.product; package cc.iotkit.model.product;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
@Data @Data
public class Category implements Id<String> { public class Category extends TenantModel implements Id<String> {
private String id; private String id;

View File

@ -23,6 +23,7 @@
package cc.iotkit.model.product; package cc.iotkit.model.product;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -32,7 +33,7 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class ProductModel implements Id<String> { public class ProductModel extends TenantModel implements Id<String> {
public static final String TYPE_JS = "JavaScript"; public static final String TYPE_JS = "JavaScript";
public static final String TYPE_LUA = "LuaScript"; public static final String TYPE_LUA = "LuaScript";

View File

@ -24,6 +24,7 @@
package cc.iotkit.model.system; package cc.iotkit.model.system;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -36,7 +37,7 @@ import java.util.Date;
* @date 2023-02-07 * @date 2023-02-07
*/ */
@Data @Data
public class SysLoginInfo implements Id<Long>,Serializable { public class SysLoginInfo extends TenantModel implements Id<Long>,Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**

View File

@ -25,6 +25,7 @@ package cc.iotkit.model.system;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -37,7 +38,7 @@ import java.io.Serializable;
**/ **/
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
public class SysRoleDept extends BaseModel implements Id<Long>, Serializable { public class SysRoleDept extends TenantModel implements Id<Long>, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -25,6 +25,7 @@ package cc.iotkit.model.system;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -38,7 +39,7 @@ import java.io.Serializable;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
public class SysRoleMenu extends BaseModel implements Id<Long>, Serializable { public class SysRoleMenu extends TenantModel implements Id<Long>, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;

View File

@ -26,6 +26,8 @@ package cc.iotkit.model.system;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import java.io.Serializable; import java.io.Serializable;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -37,7 +39,7 @@ import lombok.EqualsAndHashCode;
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
public class SysUserPost extends BaseModel implements Id<Long>, Serializable { public class SysUserPost extends TenantModel implements Id<Long>, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long id; private Long id;

View File

@ -26,6 +26,8 @@ package cc.iotkit.model.system;
import cc.iotkit.model.BaseModel; import cc.iotkit.model.BaseModel;
import cc.iotkit.model.Id; import cc.iotkit.model.Id;
import java.io.Serializable; import java.io.Serializable;
import cc.iotkit.model.TenantModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -37,7 +39,7 @@ import lombok.EqualsAndHashCode;
*/ */
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
public class SysUserRole extends BaseModel implements Id<Long>, Serializable { public class SysUserRole extends TenantModel implements Id<Long>, Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private Long id; private Long id;

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -30,13 +32,15 @@ import lombok.NoArgsConstructor;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
public class DeviceIdGroup { public class DeviceIdGroup extends BaseEntity implements TenantAware {
@ApiModelProperty(value = "设备组id") @ApiModelProperty(value = "设备组id")
private String id; private Long id;
@ApiModelProperty(value = "设备id") @ApiModelProperty(value = "设备id")
private String deviceId; private String deviceId;
@ApiModelProperty(value = "组名称") @ApiModelProperty(value = "组名称")
private String name; private String name;
private Long tenantId;
} }

View File

@ -28,6 +28,8 @@ import javax.persistence.GeneratedValue;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.alert.AlertConfig; import cc.iotkit.model.alert.AlertConfig;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -38,7 +40,7 @@ import org.hibernate.annotations.GenericGenerator;
@Entity @Entity
@Table(name = "alert_config") @Table(name = "alert_config")
@AutoMapper(target = AlertConfig.class) @AutoMapper(target = AlertConfig.class)
public class TbAlertConfig { public class TbAlertConfig extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -94,4 +96,6 @@ public class TbAlertConfig {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.alert.AlertRecord; import cc.iotkit.model.alert.AlertRecord;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -38,7 +40,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "alert_record") @Table(name = "alert_record")
@AutoMapper(target = AlertRecord.class) @AutoMapper(target = AlertRecord.class)
public class TbAlertRecord { public class TbAlertRecord extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -82,4 +84,5 @@ public class TbAlertRecord {
@ApiModelProperty(value = "是否已读") @ApiModelProperty(value = "是否已读")
private Boolean readFlg; private Boolean readFlg;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.product.Category; import cc.iotkit.model.product.Category;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -37,7 +39,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "category") @Table(name = "category")
@AutoMapper(target = Category.class) @AutoMapper(target = Category.class)
public class TbCategory { public class TbCategory extends BaseEntity implements TenantAware {
@ApiModelProperty(value = "分类id") @ApiModelProperty(value = "分类id")
@Id @Id
@ -51,5 +53,5 @@ public class TbCategory {
@ApiModelProperty(value = "分类描述") @ApiModelProperty(value = "分类描述")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.notify.Channel; import cc.iotkit.model.notify.Channel;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -43,7 +45,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "channel") @Table(name = "channel")
@AutoMapper(target= Channel.class) @AutoMapper(target= Channel.class)
public class TbChannel { public class TbChannel extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator") @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ -61,4 +63,6 @@ public class TbChannel {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.notify.ChannelConfig; import cc.iotkit.model.notify.ChannelConfig;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -42,7 +44,7 @@ import javax.persistence.*;
@Table(name = "channel_config") @Table(name = "channel_config")
@ApiModel(value = "通道配置") @ApiModel(value = "通道配置")
@AutoMapper(target = ChannelConfig.class) @AutoMapper(target = ChannelConfig.class)
public class TbChannelConfig { public class TbChannelConfig extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator") @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ -61,4 +63,6 @@ public class TbChannelConfig {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.notify.ChannelTemplate; import cc.iotkit.model.notify.ChannelTemplate;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -45,7 +47,7 @@ import javax.persistence.Table;
@Table(name = "channel_template") @Table(name = "channel_template")
@ApiModel(value = "通道模板") @ApiModel(value = "通道模板")
@AutoMapper(target= ChannelTemplate.class) @AutoMapper(target= ChannelTemplate.class)
public class TbChannelTemplate { public class TbChannelTemplate extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator") @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ -63,4 +65,6 @@ public class TbChannelTemplate {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.device.DeviceConfig; import cc.iotkit.model.device.DeviceConfig;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
@ -38,7 +40,7 @@ import javax.persistence.*;
@ApiModel(value = "设备配置") @ApiModel(value = "设备配置")
@Table(name = "device_config") @Table(name = "device_config")
@AutoMapper(target = DeviceConfig.class) @AutoMapper(target = DeviceConfig.class)
public class TbDeviceConfig { public class TbDeviceConfig extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -68,4 +70,6 @@ public class TbDeviceConfig {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.device.DeviceGroup; import cc.iotkit.model.device.DeviceGroup;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -39,7 +41,7 @@ import javax.persistence.Table;
@Table(name = "device_group") @Table(name = "device_group")
@ApiModel(value = "设备组") @ApiModel(value = "设备组")
@AutoMapper(target = DeviceGroup.class) @AutoMapper(target = DeviceGroup.class)
public class TbDeviceGroup { public class TbDeviceGroup extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -74,4 +76,5 @@ public class TbDeviceGroup {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private long createAt; private long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -39,7 +41,7 @@ import javax.persistence.Table;
@AllArgsConstructor @AllArgsConstructor
@Entity @Entity
@Table(name = "device_group_mapping") @Table(name = "device_group_mapping")
public class TbDeviceGroupMapping { public class TbDeviceGroupMapping extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -53,4 +55,5 @@ public class TbDeviceGroupMapping {
@ApiModelProperty(value = "设备组id") @ApiModelProperty(value = "设备组id")
private String groupId; private String groupId;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.listener.TenantListener;
import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.device.DeviceInfo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.AutoMapping;
@ -30,19 +32,22 @@ import io.github.linpeilie.annotations.ReverseAutoMapping;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.ParamDef;
import javax.persistence.Entity; import javax.persistence.*;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
@Data @Data
@Entity @Entity
@Table(name = "device_info") @Table(name = "device_info")
@ApiModel(value = "设备信息") @ApiModel(value = "设备信息")
@AutoMapper(target = DeviceInfo.class) @AutoMapper(target = DeviceInfo.class)
public class TbDeviceInfo { @FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "long")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class)
public class TbDeviceInfo extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -90,4 +95,10 @@ public class TbDeviceInfo {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
/**
*
*/
@ApiModelProperty(value = "租户编号")
private Long tenantId;
} }

View File

@ -23,12 +23,18 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.common.tenant.listener.TenantListener;
import cc.iotkit.model.ota.DeviceOtaDetail; import cc.iotkit.model.ota.DeviceOtaDetail;
import cc.iotkit.model.ota.DeviceOtaInfo; import cc.iotkit.model.ota.DeviceOtaInfo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.ParamDef;
import javax.persistence.*; import javax.persistence.*;
@ -42,7 +48,8 @@ import javax.persistence.*;
@Table(name = "device_ota_detail") @Table(name = "device_ota_detail")
@ApiModel(value = "设备升级明细") @ApiModel(value = "设备升级明细")
@AutoMapper(target = DeviceOtaDetail.class) @AutoMapper(target = DeviceOtaDetail.class)
public class TbDeviceOtaDetail { @EntityListeners(TenantListener.class)
public class TbDeviceOtaDetail extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator") @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ -66,4 +73,6 @@ public class TbDeviceOtaDetail {
private String deviceName; private String deviceName;
private Long otaInfoId; private Long otaInfoId;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.ota.DeviceOtaInfo; import cc.iotkit.model.ota.DeviceOtaInfo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -42,7 +44,7 @@ import javax.persistence.*;
@Table(name = "device_ota_info") @Table(name = "device_ota_info")
@ApiModel(value = "设备信息") @ApiModel(value = "设备信息")
@AutoMapper(target = DeviceOtaInfo.class) @AutoMapper(target = DeviceOtaInfo.class)
public class TbDeviceOtaInfo { public class TbDeviceOtaInfo extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator") @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ -66,4 +68,6 @@ public class TbDeviceOtaInfo {
private String productKey; private String productKey;
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -37,7 +39,7 @@ import javax.persistence.Table;
@Table(name = "device_sub_user") @Table(name = "device_sub_user")
@ApiModel(value = "设备用户映射") @ApiModel(value = "设备用户映射")
public class TbDeviceSubUser { public class TbDeviceSubUser extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -51,4 +53,6 @@ public class TbDeviceSubUser {
@ApiModelProperty(value = "设备用户id") @ApiModelProperty(value = "设备用户id")
private String uid; private String uid;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -39,7 +41,7 @@ import javax.persistence.*;
@Entity @Entity
@Table(name = "device_tag") @Table(name = "device_tag")
@ApiModel(value = "设备标签") @ApiModel(value = "设备标签")
public class TbDeviceTag { public class TbDeviceTag extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -69,4 +71,5 @@ public class TbDeviceTag {
@Column(name = "[value]") @Column(name = "[value]")
private String value; private String value;
private Long tenantId;
} }

View File

@ -23,6 +23,7 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware; import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.common.tenant.listener.TenantListener; import cc.iotkit.common.tenant.listener.TenantListener;
import cc.iotkit.model.product.Icon; import cc.iotkit.model.product.Icon;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
@ -42,9 +43,7 @@ import javax.persistence.*;
@ApiModel(value = "图标") @ApiModel(value = "图标")
@Table(name = "icon") @Table(name = "icon")
@AutoMapper(target = Icon.class) @AutoMapper(target = Icon.class)
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "string")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class)
public class TbIcon extends BaseEntity implements TenantAware { public class TbIcon extends BaseEntity implements TenantAware {
@Id @Id

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.notify.NotifyMessage; import cc.iotkit.model.notify.NotifyMessage;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -45,7 +47,7 @@ import javax.persistence.Table;
@ApiModel(value = "通知消息") @ApiModel(value = "通知消息")
@Table(name = "notify_message") @Table(name = "notify_message")
@AutoMapper(target= NotifyMessage.class) @AutoMapper(target= NotifyMessage.class)
public class TbNotifyMessage { public class TbNotifyMessage extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator") @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
@ -61,4 +63,6 @@ public class TbNotifyMessage {
private Long createAt; private Long createAt;
private Long updateAt; private Long updateAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import lombok.Data; import lombok.Data;
import org.hibernate.annotations.GenericGenerator; import org.hibernate.annotations.GenericGenerator;
@ -39,7 +41,7 @@ import javax.persistence.Table;
@Data @Data
@Entity @Entity
@Table(name = "ota_device") @Table(name = "ota_device")
public class TbOtaDevice { public class TbOtaDevice extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -55,4 +57,6 @@ public class TbOtaDevice {
private Integer status; private Integer status;
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.ota.OtaPackage; import cc.iotkit.model.ota.OtaPackage;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
@ -39,7 +41,7 @@ import javax.persistence.*;
@Entity @Entity
@Table(name = "ota_package") @Table(name = "ota_package")
@AutoMapper(target = OtaPackage.class) @AutoMapper(target = OtaPackage.class)
public class TbOtaPackage { public class TbOtaPackage extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -72,4 +74,6 @@ public class TbOtaPackage {
private String extData; private String extData;
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.plugin.PluginInstance; import cc.iotkit.model.plugin.PluginInstance;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -42,7 +44,7 @@ import javax.persistence.Table;
@ApiModel(value = "插件实例") @ApiModel(value = "插件实例")
@Table(name = "plugin_instance") @Table(name = "plugin_instance")
@AutoMapper(target = PluginInstance.class) @AutoMapper(target = PluginInstance.class)
public class TbPluginInstance extends BaseEntity { public class TbPluginInstance extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -81,4 +83,6 @@ public class TbPluginInstance extends BaseEntity {
@ApiModelProperty(value = "心跳时间") @ApiModelProperty(value = "心跳时间")
private Long heartbeatAt; private Long heartbeatAt;
private Long tenantId;
} }

View File

@ -23,6 +23,7 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware; import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.common.tenant.listener.TenantListener; import cc.iotkit.common.tenant.listener.TenantListener;
import cc.iotkit.model.product.Product; import cc.iotkit.model.product.Product;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
@ -44,7 +45,7 @@ import javax.persistence.*;
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "string")}) @FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "string")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId") @Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class) @EntityListeners(TenantListener.class)
public class TbProduct implements TenantAware { public class TbProduct extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.product.ProductModel; import cc.iotkit.model.product.ProductModel;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -37,7 +39,7 @@ import javax.persistence.*;
@ApiModel(value = "产品型号") @ApiModel(value = "产品型号")
@Table(name = "product_model") @Table(name = "product_model")
@AutoMapper(target = ProductModel.class) @AutoMapper(target = ProductModel.class)
public class TbProductModel { public class TbProductModel extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -75,4 +77,6 @@ public class TbProductModel {
private String state; private String state;
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Long modifyAt; private Long modifyAt;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.rule.RuleInfo; import cc.iotkit.model.rule.RuleInfo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.AutoMapping;
@ -38,7 +40,7 @@ import javax.persistence.*;
@Table(name = "rule_info") @Table(name = "rule_info")
@ApiModel(value = "规则") @ApiModel(value = "规则")
@AutoMapper(target = RuleInfo.class) @AutoMapper(target = RuleInfo.class)
public class TbRuleInfo { public class TbRuleInfo extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -83,4 +85,5 @@ public class TbRuleInfo {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.system.SysOss; import cc.iotkit.model.system.SysOss;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
@ -47,7 +49,7 @@ import javax.persistence.Table;
@Table(name = "sys_oss") @Table(name = "sys_oss")
@ApiModel(value = "OSS对象存储对象") @ApiModel(value = "OSS对象存储对象")
@AutoMapper(target = SysOss.class) @AutoMapper(target = SysOss.class)
public class TbSysOss extends BaseEntity { public class TbSysOss extends BaseEntity implements TenantAware {
/** /**
* *

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.system.SysRoleDept; import cc.iotkit.model.system.SysRoleDept;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -44,7 +46,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "sys_role_dept") @Table(name = "sys_role_dept")
@AutoMapper(target = SysRoleDept.class) @AutoMapper(target = SysRoleDept.class)
public class TbSysRoleDept { public class TbSysRoleDept extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -64,4 +66,6 @@ public class TbSysRoleDept {
@ApiModelProperty(value = "部门ID") @ApiModelProperty(value = "部门ID")
private Long deptId; private Long deptId;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.system.SysRoleMenu; import cc.iotkit.model.system.SysRoleMenu;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -44,7 +46,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "sys_role_menu") @Table(name = "sys_role_menu")
@AutoMapper(target = SysRoleMenu.class) @AutoMapper(target = SysRoleMenu.class)
public class TbSysRoleMenu { public class TbSysRoleMenu extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -64,4 +66,6 @@ public class TbSysRoleMenu {
@ApiModelProperty(value = "菜单ID") @ApiModelProperty(value = "菜单ID")
private Long menuId; private Long menuId;
private Long tenantId;
} }

View File

@ -44,7 +44,6 @@ import java.util.Date;
* @author Michelle.Chung * @author Michelle.Chung
*/ */
@Data @Data
@EqualsAndHashCode(callSuper = true)
@Entity @Entity
@Table(name = "sys_tenant") @Table(name = "sys_tenant")
@AutoMapper(target = SysTenant.class) @AutoMapper(target = SysTenant.class)

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -43,7 +45,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "sys_user_post") @Table(name = "sys_user_post")
@AutoMapper(target = cc.iotkit.model.system.SysUserPost.class) @AutoMapper(target = cc.iotkit.model.system.SysUserPost.class)
public class TbSysUserPost extends BaseEntity { public class TbSysUserPost extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -62,4 +64,6 @@ public class TbSysUserPost extends BaseEntity {
@ApiModelProperty(value = "岗位ID") @ApiModelProperty(value = "岗位ID")
private Long postId; private Long postId;
private Long tenantId;
} }

View File

@ -23,6 +23,8 @@
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
@ -43,7 +45,7 @@ import javax.persistence.Table;
@Entity @Entity
@Table(name = "sys_user_role") @Table(name = "sys_user_role")
@AutoMapper(target = cc.iotkit.model.system.SysUserRole.class) @AutoMapper(target = cc.iotkit.model.system.SysUserRole.class)
public class TbSysUserRole extends BaseEntity { public class TbSysUserRole extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -62,4 +64,5 @@ public class TbSysUserRole extends BaseEntity {
@ApiModelProperty(value = "角色ID") @ApiModelProperty(value = "角色ID")
private Long roleId; private Long roleId;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.rule.TaskInfo; import cc.iotkit.model.rule.TaskInfo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.AutoMapping;
@ -36,7 +38,7 @@ import javax.persistence.*;
@Entity @Entity
@Table(name = "task_info") @Table(name = "task_info")
@AutoMapper(target = TaskInfo.class) @AutoMapper(target = TaskInfo.class)
public class TbTaskInfo { public class TbTaskInfo extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -98,4 +100,6 @@ public class TbTaskInfo {
@ApiModelProperty(value = "操作备注") @ApiModelProperty(value = "操作备注")
private String reason; private String reason;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.product.ThingModel; import cc.iotkit.model.product.ThingModel;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.AutoMapping;
@ -36,7 +38,7 @@ import javax.persistence.*;
@Entity @Entity
@Table(name = "thing_model") @Table(name = "thing_model")
@AutoMapper(target = ThingModel.class) @AutoMapper(target = ThingModel.class)
public class TbThingModel { public class TbThingModel extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -53,4 +55,5 @@ public class TbThingModel {
@ReverseAutoMapping(ignore = true) @ReverseAutoMapping(ignore = true)
private String model; private String model;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import cc.iotkit.model.device.VirtualDevice; import cc.iotkit.model.device.VirtualDevice;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
@ -34,7 +36,7 @@ import javax.persistence.*;
@Entity @Entity
@Table(name = "virtual_device") @Table(name = "virtual_device")
@AutoMapper(target = VirtualDevice.class) @AutoMapper(target = VirtualDevice.class)
public class TbVirtualDevice { public class TbVirtualDevice extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -97,4 +99,6 @@ public class TbVirtualDevice {
@ApiModelProperty(value = "创建时间") @ApiModelProperty(value = "创建时间")
private Long createAt; private Long createAt;
private Long tenantId;
} }

View File

@ -22,6 +22,8 @@
*/ */
package cc.iotkit.data.model; package cc.iotkit.data.model;
import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.entiry.BaseTenantEntity;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
@ -38,7 +40,7 @@ import javax.persistence.Table;
@AllArgsConstructor @AllArgsConstructor
@Entity @Entity
@Table(name = "virtual_device_mapping") @Table(name = "virtual_device_mapping")
public class TbVirtualDeviceMapping { public class TbVirtualDeviceMapping extends BaseEntity implements TenantAware {
@Id @Id
@GeneratedValue(generator = "SnowflakeIdGenerator") @GeneratedValue(generator = "SnowflakeIdGenerator")
@ -51,4 +53,5 @@ public class TbVirtualDeviceMapping {
@ApiModelProperty(value = "设备ID") @ApiModelProperty(value = "设备ID")
private String deviceId; private String deviceId;
private Long tenantId;
} }

View File

@ -25,6 +25,7 @@ package cc.iotkit.data.service;
import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.PageRequest;
import cc.iotkit.common.api.Paging; import cc.iotkit.common.api.Paging;
import cc.iotkit.common.satoken.utils.LoginHelper;
import cc.iotkit.common.utils.MapstructUtils; import cc.iotkit.common.utils.MapstructUtils;
import cc.iotkit.common.utils.ReflectUtil; import cc.iotkit.common.utils.ReflectUtil;
import cc.iotkit.data.dao.*; import cc.iotkit.data.dao.*;
@ -368,7 +369,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
@Transactional @Transactional
public void addToGroup(String deviceId, DeviceInfo.Group group) { public void addToGroup(String deviceId, DeviceInfo.Group group) {
String groupId = UUID.randomUUID().toString(); String groupId = UUID.randomUUID().toString();
deviceGroupMappingRepository.save(new TbDeviceGroupMapping(groupId, deviceId, group.getId())); deviceGroupMappingRepository.save(new TbDeviceGroupMapping(groupId, deviceId, group.getId(), LoginHelper.getTenantId()));
//更新设备数量 //更新设备数量
updateGroupDeviceCount(groupId); updateGroupDeviceCount(groupId);
@ -462,7 +463,8 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData<DeviceI
deviceGroupMappingRepository.save(new TbDeviceGroupMapping( deviceGroupMappingRepository.save(new TbDeviceGroupMapping(
UUID.randomUUID().toString(), UUID.randomUUID().toString(),
data.getDeviceId(), data.getDeviceId(),
id id,
LoginHelper.getTenantId()
)); ));
} }
}); });

View File

@ -75,7 +75,7 @@ public class SysTenantDataImpl implements ISysTenantData, IJPACommData<SysTenant
@Override @Override
public List<SysTenant> findAllByCondition(SysTenant data) { public List<SysTenant> findAllByCondition(SysTenant data) {
List<TbSysTenant> ret=jpaQueryFactory.selectFrom(tbSysTenant).where(PredicateBuilder.instance() List<TbSysTenant> ret=jpaQueryFactory.selectFrom(tbSysTenant).where(PredicateBuilder.instance()
.and(ObjectUtil.isNotNull(data.getTenantId()),()->tbSysTenant.tenantId.eq(data.getTenantId()))
.and(StringUtils.isNotBlank(data.getContactUserName()),()->tbSysTenant.contactUserName.like(data.getContactUserName())) .and(StringUtils.isNotBlank(data.getContactUserName()),()->tbSysTenant.contactUserName.like(data.getContactUserName()))
.and(StringUtils.isNotBlank(data.getContactPhone()),()->tbSysTenant.contactPhone.eq(data.getContactPhone())) .and(StringUtils.isNotBlank(data.getContactPhone()),()->tbSysTenant.contactPhone.eq(data.getContactPhone()))
.and(StringUtils.isNotBlank(data.getCompanyName()),()->tbSysTenant.companyName.like(data.getCompanyName())) .and(StringUtils.isNotBlank(data.getCompanyName()),()->tbSysTenant.companyName.like(data.getCompanyName()))

View File

@ -22,6 +22,7 @@
*/ */
package cc.iotkit.data.service; package cc.iotkit.data.service;
import cc.iotkit.common.satoken.utils.LoginHelper;
import cc.iotkit.data.dao.IJPACommData; import cc.iotkit.data.dao.IJPACommData;
import cc.iotkit.data.manager.IVirtualDeviceData; import cc.iotkit.data.manager.IVirtualDeviceData;
import cc.iotkit.data.dao.VirtualDeviceMappingRepository; import cc.iotkit.data.dao.VirtualDeviceMappingRepository;
@ -130,7 +131,7 @@ public class VirtualDeviceDataImpl implements IVirtualDeviceData, IJPACommData<V
data.getDevices().stream().map(d -> new TbVirtualDeviceMapping( data.getDevices().stream().map(d -> new TbVirtualDeviceMapping(
IdUtil.simpleUUID(), IdUtil.simpleUUID(),
data.getId(), data.getId(),
d d, LoginHelper.getTenantId()
)).collect(Collectors.toList()) )).collect(Collectors.toList())
); );
return data; return data;