From 29f62168643af3ffcc1f722e47a605b30db07bca Mon Sep 17 00:00:00 2001 From: wangliwen Date: Wed, 15 Jun 2022 16:56:06 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E6=BA=90=E6=8C=82=E8=BD=BD=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E4=BD=BF=E7=94=A8mybatis=20json=E5=AD=97=E6=AE=B5=20?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E8=B5=84=E6=BA=90=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resourceMountApply/dto/TResourceMountApplyDTO.java | 3 +++ .../entity/TResourceMountApplyEntity.java | 7 ++++++- .../src/main/resources/db/V1.2__resource_mount_addcol.sql | 1 + .../mapper/resourceMountApply/TResourceMountApplyDao.xml | 3 +++ 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 renren-admin/src/main/resources/db/V1.2__resource_mount_addcol.sql diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java index 0a700ac9..2af12627 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/dto/TResourceMountApplyDTO.java @@ -48,6 +48,9 @@ public class TResourceMountApplyDTO extends AuditingBaseDTO implements Serializa private Long resourceId; public ResourceDTO getResourceDTO() { + if (this.resourceDTO != null) { + return this.resourceDTO; + } if (this.parameterContent != null) { return JSON.parseObject(this.parameterContent, ResourceDTO.class); } diff --git a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java index 45a285e6..b3b20833 100644 --- a/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resourceMountApply/entity/TResourceMountApplyEntity.java @@ -3,7 +3,9 @@ package io.renren.modules.resourceMountApply.entity; import com.baomidou.mybatisplus.annotation.FieldFill; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler; import io.renren.common.entity.BaseEntity; +import io.renren.modules.resource.dto.ResourceDTO; import lombok.Data; import lombok.EqualsAndHashCode; @@ -15,7 +17,7 @@ import lombok.EqualsAndHashCode; */ @Data @EqualsAndHashCode(callSuper = false) -@TableName("t_resource_mount_apply") +@TableName(value = "t_resource_mount_apply", autoResultMap = true) public class TResourceMountApplyEntity extends BaseEntity { private static final long serialVersionUID = 1L; @@ -63,4 +65,7 @@ public class TResourceMountApplyEntity extends BaseEntity { * 资源id */ private Long resourceId; + + @TableField(typeHandler = FastjsonTypeHandler.class) + private ResourceDTO resourceDTO; } \ No newline at end of file diff --git a/renren-admin/src/main/resources/db/V1.2__resource_mount_addcol.sql b/renren-admin/src/main/resources/db/V1.2__resource_mount_addcol.sql new file mode 100644 index 00000000..308c4476 --- /dev/null +++ b/renren-admin/src/main/resources/db/V1.2__resource_mount_addcol.sql @@ -0,0 +1 @@ +ALTER TABLE `share_platform`.`t_resource_mount_apply` ADD COLUMN `resource_dto` json NULL COMMENT '挂载资源对象' AFTER `resource_id`; \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml b/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml index 0dd84baf..d5857b20 100644 --- a/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml +++ b/renren-admin/src/main/resources/mapper/resourceMountApply/TResourceMountApplyDao.xml @@ -13,6 +13,9 @@ + +