-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
160 additions
and
63 deletions.
There are no files selected for viewing
34 changes: 0 additions & 34 deletions
34
api/src/main/java/com/iotpack/api/entity/device/BuildInDeviceTypeEnum.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
api/src/main/java/com/iotpack/api/entity/device/DeviceLogEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.iotpack.api.entity.device; | ||
|
||
import lombok.Data; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import org.hibernate.annotations.SQLDelete; | ||
import org.hibernate.annotations.Where; | ||
|
||
import javax.persistence.*; | ||
|
||
@Data | ||
@SQLDelete(sql = "update `device_log` SET deleted_at = unix_timestamp(now()) WHERE id = ?") | ||
@Entity | ||
@Table(name = "device_log") | ||
@Where(clause = "deleted_at is null") | ||
@DynamicUpdate | ||
@Cacheable | ||
public class DeviceLogEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
Long id; | ||
/** | ||
* 设备id | ||
*/ | ||
Long deviceId; | ||
/** | ||
* 设备原始日志 | ||
*/ | ||
String raw; | ||
/** | ||
* 创建时间 | ||
*/ | ||
Long createdAt; | ||
} |
32 changes: 32 additions & 0 deletions
32
api/src/main/java/com/iotpack/api/entity/device/DeviceMetaEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.iotpack.api.entity.device; | ||
|
||
import lombok.Data; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import org.hibernate.annotations.SQLDelete; | ||
import org.hibernate.annotations.Where; | ||
|
||
import javax.persistence.*; | ||
|
||
/** | ||
* 设备表 | ||
*/ | ||
@Data | ||
@SQLDelete(sql = "update `device_meta` SET deleted_at = unix_timestamp(now()) WHERE id = ?") | ||
@Entity | ||
@Table(name = "device_meta") | ||
@Where(clause = "deleted_at is null") | ||
@DynamicUpdate | ||
@Cacheable | ||
public class DeviceMetaEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
Long id; | ||
|
||
String name; | ||
/** | ||
* 设备的非检索配置信息 | ||
*/ | ||
@Column(columnDefinition = "json" ) | ||
String meta; | ||
} |
22 changes: 8 additions & 14 deletions
22
...api/entity/product/ProductRepository.java → ...k/api/entity/device/DeviceTypeEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,29 @@ | ||
package com.iotpack.api.entity.product; | ||
package com.iotpack.api.entity.device; | ||
|
||
|
||
import com.iotpack.api.entity.base.BaseUserEntity; | ||
import lombok.Data; | ||
import org.hibernate.annotations.DynamicUpdate; | ||
import org.hibernate.annotations.SQLDelete; | ||
import org.hibernate.annotations.Where; | ||
|
||
import javax.persistence.*; | ||
|
||
|
||
@Data | ||
@SQLDelete(sql = "update `product` SET deleted_at = unix_timestamp(now()) WHERE id = ?") | ||
@SQLDelete(sql = "update `device_type` SET deleted_at = unix_timestamp(now()) WHERE id = ?") | ||
@Entity | ||
@Table(name = "product") | ||
@Table(name = "device_type") | ||
@Where(clause = "deleted_at is null") | ||
@DynamicUpdate | ||
@Cacheable | ||
public class ProductRepository extends BaseUserEntity { | ||
public class DeviceTypeEntity { | ||
|
||
/** | ||
* 设备类型id | ||
*/ | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
Long id; | ||
|
||
/** | ||
* 产品名称 | ||
* 设备id | ||
*/ | ||
String name; | ||
|
||
/** | ||
* 应用使用的协议 | ||
*/ | ||
String applicationProtocol; | ||
} |
3 changes: 2 additions & 1 deletion
3
...ity/device/DeviceCheckListRepository.java → ...evice/repo/DeviceCheckListRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
api/src/main/java/com/iotpack/api/entity/device/repo/DeviceLogRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package com.iotpack.api.entity.device.repo; | ||
|
||
import com.iotpack.api.entity.device.DeviceEntity; | ||
import com.iotpack.api.entity.device.DeviceLogEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DeviceLogRepository extends CrudRepository<DeviceLogEntity, Long>, | ||
JpaSpecificationExecutor<DeviceLogEntity>, | ||
JpaRepository<DeviceLogEntity, Long> { | ||
} |
12 changes: 12 additions & 0 deletions
12
api/src/main/java/com/iotpack/api/entity/device/repo/DeviceMetaRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.iotpack.api.entity.device.repo; | ||
|
||
import com.iotpack.api.entity.device.DeviceEntity; | ||
import com.iotpack.api.entity.device.DeviceMetaEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DeviceMetaRepository extends CrudRepository<DeviceMetaEntity, Long>, JpaSpecificationExecutor<DeviceMetaEntity>, JpaRepository<DeviceMetaEntity, Long> { | ||
} |
11 changes: 11 additions & 0 deletions
11
api/src/main/java/com/iotpack/api/entity/device/repo/DeviceRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.iotpack.api.entity.device.repo; | ||
|
||
import com.iotpack.api.entity.device.DeviceEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DeviceRepository extends CrudRepository<DeviceEntity, Long>, JpaSpecificationExecutor<DeviceEntity>, JpaRepository<DeviceEntity, Long> { | ||
} |
12 changes: 12 additions & 0 deletions
12
api/src/main/java/com/iotpack/api/entity/device/repo/DeviceTypeRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.iotpack.api.entity.device.repo; | ||
|
||
import com.iotpack.api.entity.device.DeviceEntity; | ||
import com.iotpack.api.entity.device.DeviceTypeEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface DeviceTypeRepository extends CrudRepository<DeviceTypeEntity, Long>, JpaSpecificationExecutor<DeviceTypeEntity>, JpaRepository<DeviceTypeEntity, Long> { | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/com/iotpack/api/entity/product/repo/ProductRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.iotpack.api.entity.product.repo; | ||
|
||
import com.iotpack.api.entity.device.DeviceEntity; | ||
import com.iotpack.api.entity.device.DeviceLogEntity; | ||
import com.iotpack.api.entity.product.ProductEntity; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
import org.springframework.data.repository.CrudRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
@Repository | ||
public interface ProductRepository extends CrudRepository<ProductEntity, Long>, | ||
JpaSpecificationExecutor<ProductEntity>, | ||
JpaRepository<ProductEntity, Long> { | ||
} |
2 changes: 1 addition & 1 deletion
2
api/src/main/java/com/iotpack/api/service/impl/PlatformGatewayImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters