Showing
6 changed files
with
11 additions
and
30 deletions
@@ -394,6 +394,7 @@ CREATE TABLE "public"."qg_brain_device_category" ( | @@ -394,6 +394,7 @@ CREATE TABLE "public"."qg_brain_device_category" ( | ||
394 | "name" varchar(100), | 394 | "name" varchar(100), |
395 | "code" varchar(100), | 395 | "code" varchar(100), |
396 | "status" varchar(50), | 396 | "status" varchar(50), |
397 | +"tenant_id" varchar(36), | ||
397 | "notes" varchar(500), | 398 | "notes" varchar(500), |
398 | "create_time" timestamp(6), | 399 | "create_time" timestamp(6), |
399 | "creator" varchar(36), | 400 | "creator" varchar(36), |
common/data/src/main/java/org/thingsboard/server/common/data/yunteng/dto/BrainDeviceCategoryDTO.java
@@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; | @@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode; | ||
6 | 6 | ||
7 | @EqualsAndHashCode(callSuper = true) | 7 | @EqualsAndHashCode(callSuper = true) |
8 | @Data | 8 | @Data |
9 | -public class BrainDeviceCategoryDTO extends BaseDTO { | 9 | +public class BrainDeviceCategoryDTO extends TenantDTO { |
10 | 10 | ||
11 | @ApiModelProperty(value = "设备类型名称") | 11 | @ApiModelProperty(value = "设备类型名称") |
12 | private String name; | 12 | private String name; |
@@ -16,4 +16,6 @@ public class BrainDeviceCategoryDTO extends BaseDTO { | @@ -16,4 +16,6 @@ public class BrainDeviceCategoryDTO extends BaseDTO { | ||
16 | private String status; | 16 | private String status; |
17 | @ApiModelProperty(value = "备注") | 17 | @ApiModelProperty(value = "备注") |
18 | private String notes; | 18 | private String notes; |
19 | + @ApiModelProperty(value = "创建用户名称") | ||
20 | + private String creatorName; | ||
19 | } | 21 | } |
dao/src/main/java/org/thingsboard/server/dao/yunteng/entities/BrainBaseEntity.java
deleted
100644 → 0
1 | -package org.thingsboard.server.dao.yunteng.entities; | ||
2 | - | ||
3 | -import com.baomidou.mybatisplus.annotation.FieldFill; | ||
4 | -import com.baomidou.mybatisplus.annotation.TableField; | ||
5 | -import lombok.Getter; | ||
6 | -import lombok.Setter; | ||
7 | - | ||
8 | -import java.time.LocalDateTime; | ||
9 | - | ||
10 | -@Getter | ||
11 | -@Setter | ||
12 | -public class BrainBaseEntity extends BaseEntity { | ||
13 | - | ||
14 | - private static final long serialVersionUID = -4315734960161684909L; | ||
15 | - | ||
16 | - @TableField(fill = FieldFill.INSERT) | ||
17 | - private String creator; | ||
18 | - | ||
19 | - @TableField(fill = FieldFill.UPDATE) | ||
20 | - private String updater; | ||
21 | - | ||
22 | - @TableField(fill = FieldFill.INSERT) | ||
23 | - private LocalDateTime createTime; | ||
24 | - | ||
25 | - @TableField(fill = FieldFill.UPDATE) | ||
26 | - private LocalDateTime updateTime; | ||
27 | - | ||
28 | -} |
@@ -11,7 +11,7 @@ import org.thingsboard.server.dao.model.ModelConstants; | @@ -11,7 +11,7 @@ import org.thingsboard.server.dao.model.ModelConstants; | ||
11 | @Data | 11 | @Data |
12 | @EqualsAndHashCode(callSuper = true) | 12 | @EqualsAndHashCode(callSuper = true) |
13 | @TableName(value = ModelConstants.BRAINDEVICECAGEGORY_TABLE_NAME, autoResultMap = true) | 13 | @TableName(value = ModelConstants.BRAINDEVICECAGEGORY_TABLE_NAME, autoResultMap = true) |
14 | -public class BrainDeviceCategoryEntity extends BrainBaseEntity { | 14 | +public class BrainDeviceCategoryEntity extends TenantBaseEntity { |
15 | /** | 15 | /** |
16 | * 设备类型名称 | 16 | * 设备类型名称 |
17 | */ | 17 | */ |
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; | @@ -11,6 +11,7 @@ import org.springframework.stereotype.Service; | ||
11 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 11 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
12 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; | 12 | import org.thingsboard.server.common.data.yunteng.core.exception.TkDataValidationException; |
13 | import org.thingsboard.server.common.data.yunteng.dto.BrainDeviceCategoryDTO; | 13 | import org.thingsboard.server.common.data.yunteng.dto.BrainDeviceCategoryDTO; |
14 | +import org.thingsboard.server.common.data.yunteng.utils.SpringBeanUtils; | ||
14 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; | 15 | import org.thingsboard.server.common.data.yunteng.utils.tools.TkPageData; |
15 | import org.thingsboard.server.dao.yunteng.entities.BrainDeviceCategoryEntity; | 16 | import org.thingsboard.server.dao.yunteng.entities.BrainDeviceCategoryEntity; |
16 | import org.thingsboard.server.dao.yunteng.mapper.BrainDeviceCategoryMapper; | 17 | import org.thingsboard.server.dao.yunteng.mapper.BrainDeviceCategoryMapper; |
@@ -29,6 +30,7 @@ public class BrainDeviceCategoryServiceImpl extends AbstractBaseService<BrainDev | @@ -29,6 +30,7 @@ public class BrainDeviceCategoryServiceImpl extends AbstractBaseService<BrainDev | ||
29 | 30 | ||
30 | @Override | 31 | @Override |
31 | public TkPageData<BrainDeviceCategoryDTO> page(Map<String, Object> params) throws ThingsboardException { | 32 | public TkPageData<BrainDeviceCategoryDTO> page(Map<String, Object> params) throws ThingsboardException { |
33 | + params.put("tenantId", SpringBeanUtils.getTenantId().getId().toString()); | ||
32 | TkPageData<BrainDeviceCategoryDTO> result = new TkPageData<>(); | 34 | TkPageData<BrainDeviceCategoryDTO> result = new TkPageData<>(); |
33 | IPage<BrainDeviceCategoryEntity> page = | 35 | IPage<BrainDeviceCategoryEntity> page = |
34 | getPage(params, "create_time", false); | 36 | getPage(params, "create_time", false); |
@@ -8,6 +8,7 @@ | @@ -8,6 +8,7 @@ | ||
8 | <result property="code" column="code"/> | 8 | <result property="code" column="code"/> |
9 | <result property="status" column="status"/> | 9 | <result property="status" column="status"/> |
10 | <result property="notes" column="notes"/> | 10 | <result property="notes" column="notes"/> |
11 | + <result property="tenantId" column="tenant_id"/> | ||
11 | <result property="createTime" column="create_time"/> | 12 | <result property="createTime" column="create_time"/> |
12 | <result property="updater" column="updater"/> | 13 | <result property="updater" column="updater"/> |
13 | <result property="updateTime" column="update_time"/> | 14 | <result property="updateTime" column="update_time"/> |
@@ -18,6 +19,9 @@ | @@ -18,6 +19,9 @@ | ||
18 | o.id,o.name,o.code,o.status,o.notes,o.create_time,o.updater,o.update_time,o.creator | 19 | o.id,o.name,o.code,o.status,o.notes,o.create_time,o.updater,o.update_time,o.creator |
19 | from qg_brain_device_category o | 20 | from qg_brain_device_category o |
20 | <where> | 21 | <where> |
22 | + <if test="queryMap.tenantId !=null and queryMap.tenantId !=''"> | ||
23 | + AND o.tenant_id = #{queryMap.tenantId} | ||
24 | + </if> | ||
21 | <if test="queryMap.code !=null and queryMap.code !=''"> | 25 | <if test="queryMap.code !=null and queryMap.code !=''"> |
22 | AND o.code ILIKE concat('%',#{queryMap.code}::TEXT,'%') | 26 | AND o.code ILIKE concat('%',#{queryMap.code}::TEXT,'%') |
23 | </if> | 27 | </if> |