diff options
| author | tanghao <[email protected]> | 2024-11-08 15:13:17 +0800 |
|---|---|---|
| committer | tanghao <[email protected]> | 2024-11-08 15:13:17 +0800 |
| commit | d4cc99438fd9b1be573daba8276cd6fc57b1bfa3 (patch) | |
| tree | db372d1d12f1518ea742584c779e8d0d6f6096f2 | |
| parent | 5841ab40d2b13f069d24f2769f5f585564c0a0b4 (diff) | |
fix: entity profiles查询接口增加返回参数
3 files changed, 28 insertions, 15 deletions
diff --git a/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java b/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java index f6c3ec0..a062977 100644 --- a/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java +++ b/cn-admin/src/main/java/net/geedge/modules/entity/entity/EntityProfiles.java @@ -1,5 +1,6 @@ package net.geedge.modules.entity.entity; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -20,4 +21,7 @@ public class EntityProfiles { private Date ctime; private Date utime; + + @TableField(exist = false) + private EntitySources entitySource; } diff --git a/cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql b/cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql index 1b73c22..df33187 100644 --- a/cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql +++ b/cn-admin/src/main/resources/db/V24.11.06__add entity profiles sources table.sql @@ -1,23 +1,23 @@ DROP TABLE IF EXISTS `entity_profiles`; CREATE TABLE `entity_profiles` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `source_id` int(11) NULL DEFAULT NULL, - `entities` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `relations` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `ctime` datetime(0) NULL DEFAULT NULL, - `utime` datetime(0) NULL DEFAULT NULL, + `source_id` int(11) NOT NULL, + `entities` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `relations` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `ctime` datetime(0) NOT NULL, + `utime` datetime(0) NOT NULL, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; DROP TABLE IF EXISTS `entity_sources`; CREATE TABLE `entity_sources` ( `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `data_format` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `fields` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `lookups` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, + `name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `data_format` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `fields` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, + `lookups` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL, `description` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `ctime` datetime(0) NULL DEFAULT NULL, - `utime` datetime(0) NULL DEFAULT NULL, + `ctime` datetime(0) NOT NULL, + `utime` datetime(0) NOT NULL, PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; +) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
\ No newline at end of file diff --git a/cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml b/cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml index d99a82c..2015dc8 100644 --- a/cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml +++ b/cn-admin/src/main/resources/mapper/entity/EntityProfilesDao.xml @@ -10,15 +10,24 @@ <result property="relations" column="relations"></result> <result property="ctime" column="ctime"></result> <result property="utime" column="utime"></result> + <association columnPrefix="es_" property="entitySource" javaType="net.geedge.modules.entity.entity.EntitySources"> + <result column="id" property="id"/> + <result column="name" property="name"/> + </association> </resultMap> <select id="queryPage" resultMap="entityProfiles"> - select * from entity_profiles + select + ep.*, + es.id as es_id, + es.name as es_name + from entity_profiles ep + left join entity_sources es on ep.source_id = es.id <where> <if test="param.sourceId !=null"> - and source_id = #{param.sourceId} + and ep.source_id = #{param.sourceId} </if> <if test="param.ids !=null and param.ids.size()>0"> - and id in + and ep.id in <foreach item="id" collection="param.ids" separator="," open="(" close=")" index=""> #{id} </foreach> |
