From 0063546e5ee9ce644f2c5cd84b2460dce3e822d3 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 20 Jun 2022 10:23:37 +0800 Subject: [PATCH] =?UTF-8?q?ResourceEntity=20=E5=A2=9E=E5=8A=A0infoList=20j?= =?UTF-8?q?son=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/db/V1.4__resource_add_infolist.sql | 1 + .../resource/entity/ResourceEntity.java | 9 +- .../db/V1.4__resource_add_infolist.sql | 1 + .../resources/mapper/resource/ResourceDao.xml | 442 +++++++++--------- 4 files changed, 234 insertions(+), 219 deletions(-) create mode 100644 config/db/V1.4__resource_add_infolist.sql create mode 100644 renren-admin/src/main/resources/db/V1.4__resource_add_infolist.sql diff --git a/config/db/V1.4__resource_add_infolist.sql b/config/db/V1.4__resource_add_infolist.sql new file mode 100644 index 00000000..7ea8d219 --- /dev/null +++ b/config/db/V1.4__resource_add_infolist.sql @@ -0,0 +1 @@ +ALTER TABLE `share_platform`.`tb_data_resource` ADD COLUMN `info_list` json NULL COMMENT '属性信息'; \ No newline at end of file diff --git a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java index 47403a58..92100b79 100644 --- a/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java +++ b/renren-admin/src/main/java/io/renren/modules/resource/entity/ResourceEntity.java @@ -1,11 +1,15 @@ package io.renren.modules.resource.entity; -import com.baomidou.mybatisplus.annotation.*; +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 lombok.Data; import lombok.EqualsAndHashCode; import java.util.Date; +import java.util.List; /** * 资源表 @@ -130,4 +134,7 @@ public class ResourceEntity extends BaseEntity { * 提起下架人员 */ private String undercarriageUserName; + + @TableField(value = "info_list", typeHandler = FastjsonTypeHandler.class) + private List infoList; } \ No newline at end of file diff --git a/renren-admin/src/main/resources/db/V1.4__resource_add_infolist.sql b/renren-admin/src/main/resources/db/V1.4__resource_add_infolist.sql new file mode 100644 index 00000000..7ea8d219 --- /dev/null +++ b/renren-admin/src/main/resources/db/V1.4__resource_add_infolist.sql @@ -0,0 +1 @@ +ALTER TABLE `share_platform`.`tb_data_resource` ADD COLUMN `info_list` json NULL COMMENT '属性信息'; \ No newline at end of file diff --git a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml index 8afc0729..2118dc8d 100644 --- a/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml +++ b/renren-admin/src/main/resources/mapper/resource/ResourceDao.xml @@ -33,6 +33,8 @@ + @@ -89,7 +91,7 @@ - + UPDATE tb_data_resource SET del_flag = 1, @@ -103,7 +105,7 @@ SELECT - dept_id + dept_id FROM - ( - SELECT - COUNT( id ) AS "count", - dept_id - FROM - tb_data_resource - WHERE - 1 = 1 - AND del_flag = 0 - AND dept_id IS NOT NULL - GROUP BY - dept_id - ) temp1 + ( + SELECT + COUNT( id ) AS "count", + dept_id + FROM + tb_data_resource WHERE - temp1.count = ( - SELECT - MAX( count ) AS "total" - FROM - ( - SELECT - COUNT( id ) AS "count" - FROM - tb_data_resource - WHERE - 1 = 1 - AND del_flag = 0 - AND dept_id IS NOT NULL - GROUP BY - dept_id - ) temp2 - ) + 1 = 1 + AND del_flag = 0 + AND dept_id IS NOT NULL + GROUP BY + dept_id + ) temp1 + WHERE + temp1.count = ( + SELECT + MAX( count ) AS "total" + FROM + ( + SELECT + COUNT( id ) AS "count" + FROM + tb_data_resource + WHERE + 1 = 1 + AND del_flag = 0 + AND dept_id IS NOT NULL + GROUP BY + dept_id + ) temp2 + ) SELECT - tdr.id, - tdr.name + tdr.id, + tdr.name FROM - tb_data_resource tdr, - tb_data_attr tda + tb_data_resource tdr, + tb_data_attr tda WHERE - 1 = 1 - AND tdr.del_flag = 0 - AND tda.del_flag = 0 - AND tdr.id = tda.data_resource_id - AND attr_value LIKE CONCAT('%', #{type}, '%') + 1 = 1 + AND tdr.del_flag = 0 + AND tda.del_flag = 0 + AND tdr.id = tda.data_resource_id + AND attr_value LIKE CONCAT('%', #{type}, '%') SELECT - tdr.id AS "resourceId", - tdr.NAME AS "name", - IFNULL(COUNT( taa.id ), 0) AS "count" + tdr.id AS "resourceId", + tdr.NAME AS "name", + IFNULL(COUNT( taa.id ), 0) AS "count" FROM - tb_data_resource tdr - LEFT JOIN t_ability_application taa ON tdr.id = taa.resource_id AND taa.del_flag = 0 + tb_data_resource tdr + LEFT JOIN t_ability_application taa ON tdr.id = taa.resource_id AND taa.del_flag = 0 WHERE - 1 = 1 - AND tdr.del_flag = 0 - AND tdr.type = '组件服务' + 1 = 1 + AND tdr.del_flag = 0 + AND tdr.type = '组件服务' GROUP BY - tdr.id + tdr.id ORDER BY - count DESC + count DESC LIMIT 5