feat(admin): 添加列表显示字段配置功能
- 新增 list_field_config 表及后端接口,支持查询、保存、恢复默认字段配置 - 管理后台新增“列表字段配置”页签,可增删字段、调整顺序、修改显示名与可见性 - version_resource 表新增作者单位、来源资源库名字段及升级脚本 - 引入 xlsx 依赖以支持列表导出
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
package com.banben.modules.admin.controller;
|
||||
|
||||
import com.banben.common.Result;
|
||||
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||
import com.banben.modules.admin.service.ListFieldConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 后台管理 - 列表显示字段配置。
|
||||
*
|
||||
* <p>控制检索结果列表展示哪些字段、显示名与顺序。</p>
|
||||
*/
|
||||
@Tag(name = "后台管理-列表字段配置")
|
||||
@RestController
|
||||
@RequestMapping("/api/admin/list-fields")
|
||||
@RequiredArgsConstructor
|
||||
public class ListFieldConfigController {
|
||||
|
||||
private final ListFieldConfigService listFieldConfigService;
|
||||
|
||||
@Operation(summary = "查询场景的展示字段配置(为空时返回并写入默认配置)")
|
||||
@GetMapping("/{scene}")
|
||||
public Result<List<ListFieldConfig>> list(@PathVariable String scene) {
|
||||
return Result.success(listFieldConfigService.listScene(scene));
|
||||
}
|
||||
|
||||
@Operation(summary = "全量覆盖保存展示字段配置")
|
||||
@PutMapping("/{scene}")
|
||||
public Result<Void> save(@PathVariable String scene, @RequestBody List<ListFieldConfig> items) {
|
||||
listFieldConfigService.saveScene(scene, items);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@Operation(summary = "恢复场景默认展示字段")
|
||||
@PostMapping("/{scene}/reset")
|
||||
public Result<List<ListFieldConfig>> reset(@PathVariable String scene) {
|
||||
return Result.success(listFieldConfigService.resetScene(scene));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.banben.modules.admin.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 列表显示字段配置(检索结果列表展示哪些字段、显示名与顺序)。
|
||||
*/
|
||||
@Data
|
||||
@TableName("list_field_config")
|
||||
@Schema(description = "列表显示字段配置")
|
||||
public class ListFieldConfig implements Serializable {
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配置场景:SEARCH 检索结果列表")
|
||||
private String scene;
|
||||
|
||||
@Schema(description = "字段键,对应 VersionResource 的驼峰属性名")
|
||||
private String fieldKey;
|
||||
|
||||
@Schema(description = "列表与导出时的显示名")
|
||||
private String fieldLabel;
|
||||
|
||||
@Schema(description = "展示顺序,数值小的靠前")
|
||||
private Integer sortNo;
|
||||
|
||||
@Schema(description = "是否显示:1显示 0隐藏")
|
||||
private Integer visible;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@TableLogic
|
||||
private Integer deleted;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.banben.modules.admin.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||
|
||||
/** 列表显示字段配置 Mapper。 */
|
||||
public interface ListFieldConfigMapper extends BaseMapper<ListFieldConfig> {
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.banben.modules.admin.service;
|
||||
|
||||
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 列表显示字段配置服务。
|
||||
*
|
||||
* <p>管理员可在后台调整检索结果列表展示的字段、显示名与顺序。</p>
|
||||
*/
|
||||
public interface ListFieldConfigService {
|
||||
|
||||
/** 查询场景配置(为空时自动写入默认字段),按 sort_no 升序 */
|
||||
List<ListFieldConfig> listScene(String scene);
|
||||
|
||||
/** 全量覆盖保存场景配置 */
|
||||
void saveScene(String scene, List<ListFieldConfig> items);
|
||||
|
||||
/** 恢复场景默认配置 */
|
||||
List<ListFieldConfig> resetScene(String scene);
|
||||
}
|
||||
+94
@@ -0,0 +1,94 @@
|
||||
package com.banben.modules.admin.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.banben.modules.admin.entity.ListFieldConfig;
|
||||
import com.banben.modules.admin.mapper.ListFieldConfigMapper;
|
||||
import com.banben.modules.admin.service.ListFieldConfigService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 列表显示字段配置服务实现。
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class ListFieldConfigServiceImpl implements ListFieldConfigService {
|
||||
|
||||
private final ListFieldConfigMapper listFieldConfigMapper;
|
||||
|
||||
/** 默认展示字段:字段键 / 显示名 */
|
||||
private static final List<String[]> DEFAULT_SEARCH_FIELDS = Arrays.asList(
|
||||
new String[]{"title", "文献题名"},
|
||||
new String[]{"publishYear", "发行时间"},
|
||||
new String[]{"author", "作者"},
|
||||
new String[]{"authorOrg", "作者单位"},
|
||||
new String[]{"publisher", "来源刊名/出版社"},
|
||||
new String[]{"mediaType", "资源类型"},
|
||||
new String[]{"sourceLibrary", "来源院校"},
|
||||
new String[]{"sourceRepo", "来源资源库名"}
|
||||
);
|
||||
|
||||
@Override
|
||||
public List<ListFieldConfig> listScene(String scene) {
|
||||
List<ListFieldConfig> list = queryScene(scene);
|
||||
if (list.isEmpty()) {
|
||||
return resetScene(scene);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveScene(String scene, List<ListFieldConfig> items) {
|
||||
// 场景内全量覆盖:先删除旧配置(物理删除,避免历史脏数据堆积)
|
||||
listFieldConfigMapper.delete(new LambdaQueryWrapper<ListFieldConfig>().eq(ListFieldConfig::getScene, scene));
|
||||
if (items == null || items.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
int no = 1;
|
||||
for (ListFieldConfig item : items) {
|
||||
ListFieldConfig cfg = new ListFieldConfig();
|
||||
cfg.setScene(scene);
|
||||
cfg.setFieldKey(item.getFieldKey());
|
||||
cfg.setFieldLabel(item.getFieldLabel());
|
||||
cfg.setSortNo(item.getSortNo() != null ? item.getSortNo() : no * 10);
|
||||
cfg.setVisible(item.getVisible() == null ? 1 : item.getVisible());
|
||||
listFieldConfigMapper.insert(cfg);
|
||||
no++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<ListFieldConfig> resetScene(String scene) {
|
||||
listFieldConfigMapper.delete(new LambdaQueryWrapper<ListFieldConfig>().eq(ListFieldConfig::getScene, scene));
|
||||
List<ListFieldConfig> defaults = new ArrayList<>();
|
||||
int no = 1;
|
||||
for (String[] kv : DEFAULT_SEARCH_FIELDS) {
|
||||
ListFieldConfig cfg = new ListFieldConfig();
|
||||
cfg.setScene(scene);
|
||||
cfg.setFieldKey(kv[0]);
|
||||
cfg.setFieldLabel(kv[1]);
|
||||
cfg.setSortNo(no * 10);
|
||||
cfg.setVisible(1);
|
||||
listFieldConfigMapper.insert(cfg);
|
||||
defaults.add(cfg);
|
||||
no++;
|
||||
}
|
||||
return defaults;
|
||||
}
|
||||
|
||||
private List<ListFieldConfig> queryScene(String scene) {
|
||||
return listFieldConfigMapper.selectList(
|
||||
new LambdaQueryWrapper<ListFieldConfig>()
|
||||
.eq(ListFieldConfig::getScene, scene)
|
||||
.orderByAsc(ListFieldConfig::getSortNo)
|
||||
.orderByAsc(ListFieldConfig::getId)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -149,6 +149,12 @@ public class VersionResource implements Serializable {
|
||||
@Schema(description = "管理状态:0正常 1屏蔽 2下架")
|
||||
private Integer manageStatus;
|
||||
|
||||
@Schema(description = "作者单位(责任者所属机构)")
|
||||
private String authorOrg;
|
||||
|
||||
@Schema(description = "来源资源库名")
|
||||
private String sourceRepo;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@@ -1,62 +1,86 @@
|
||||
-- =====================================================================
|
||||
-- 版本资源联合服务系统 - 扩展表结构(v7)
|
||||
-- 主键改为「数据库自增序列」,废弃雪花 ID(IdType.ASSIGN_ID)
|
||||
--
|
||||
-- 背景:雪花 ID 为 19 位(如 2112722202279440385),
|
||||
-- 超过 JS Number 安全整数上限 9007199254740991,
|
||||
-- 前端拿到的 id 会发生精度丢失(…440385 变成 …440400),
|
||||
-- 导致「查询单个资源 / 回填 / 编辑保存」时 id 对不上。
|
||||
-- 改为序列自增后,id 为 1、2、3… 连续小整数,前端不再失真。
|
||||
--
|
||||
-- 幂等:全部使用 IF NOT EXISTS,可重复执行
|
||||
-- v7 增量脚本(幂等,可重复执行)
|
||||
-- 1. version_resource 新增「作者单位」「来源资源库名」
|
||||
-- 2. 新增 list_field_config(检索结果列表显示字段,管理员可增减)
|
||||
-- 3. 初始化 SEARCH 场景默认展示字段
|
||||
-- =====================================================================
|
||||
|
||||
-- 1. 为各表创建序列并设为主键默认值
|
||||
CREATE SEQUENCE IF NOT EXISTS version_resource_id_seq;
|
||||
ALTER TABLE version_resource ALTER COLUMN id SET DEFAULT nextval('version_resource_id_seq');
|
||||
ALTER TABLE version_resource ADD COLUMN IF NOT EXISTS author_org VARCHAR(256);
|
||||
ALTER TABLE version_resource ADD COLUMN IF NOT EXISTS source_repo VARCHAR(256);
|
||||
CREATE INDEX IF NOT EXISTS idx_vr_source_repo ON version_resource (source_repo);
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS special_resource_id_seq;
|
||||
ALTER TABLE special_resource ALTER COLUMN id SET DEFAULT nextval('special_resource_id_seq');
|
||||
COMMENT ON COLUMN version_resource.author_org IS '作者单位(责任者所属机构)';
|
||||
COMMENT ON COLUMN version_resource.source_repo IS '来源资源库名';
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS sensitive_word_id_seq;
|
||||
ALTER TABLE sensitive_word ALTER COLUMN id SET DEFAULT nextval('sensitive_word_id_seq');
|
||||
CREATE TABLE IF NOT EXISTS list_field_config
|
||||
(
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
scene VARCHAR(64) NOT NULL, -- 配置场景:SEARCH 检索结果列表
|
||||
field_key VARCHAR(64) NOT NULL, -- 字段键(VersionResource 驼峰属性名)
|
||||
field_label VARCHAR(64) NOT NULL, -- 显示名
|
||||
sort_no INT DEFAULT 0, -- 展示顺序(小在前)
|
||||
visible SMALLINT DEFAULT 1, -- 1显示 0隐藏
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted SMALLINT DEFAULT 0
|
||||
);
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS resource_node_id_seq;
|
||||
ALTER TABLE resource_node ALTER COLUMN id SET DEFAULT nextval('resource_node_id_seq');
|
||||
CREATE INDEX IF NOT EXISTS idx_lfc_scene ON list_field_config (scene, sort_no);
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS governance_job_id_seq;
|
||||
ALTER TABLE governance_job ALTER COLUMN id SET DEFAULT nextval('governance_job_id_seq');
|
||||
-- 修复 v6 遗留问题:sensitive_word / resource_node 主键无默认值(实体为 IdType.AUTO,插入会报 null)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_class WHERE relkind = 'S' AND relname = 'seq_sensitive_word') THEN
|
||||
CREATE SEQUENCE seq_sensitive_word START 1000;
|
||||
END IF;
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_class WHERE relkind = 'S' AND relname = 'seq_resource_node') THEN
|
||||
CREATE SEQUENCE seq_resource_node START 1000;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS search_log_id_seq;
|
||||
ALTER TABLE search_log ALTER COLUMN id SET DEFAULT nextval('search_log_id_seq');
|
||||
ALTER TABLE sensitive_word ALTER COLUMN id SET DEFAULT nextval('seq_sensitive_word');
|
||||
ALTER TABLE resource_node ALTER COLUMN id SET DEFAULT nextval('seq_resource_node');
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS collect_task_id_seq;
|
||||
ALTER TABLE collect_task ALTER COLUMN id SET DEFAULT nextval('collect_task_id_seq');
|
||||
COMMENT ON TABLE list_field_config IS '列表显示字段配置表(管理员控制检索结果展示字段)';
|
||||
COMMENT ON COLUMN list_field_config.scene IS '配置场景:SEARCH 检索结果列表';
|
||||
COMMENT ON COLUMN list_field_config.field_key IS '字段键,对应 VersionResource 的驼峰属性名';
|
||||
COMMENT ON COLUMN list_field_config.field_label IS '列表与导出时的显示名';
|
||||
COMMENT ON COLUMN list_field_config.sort_no IS '展示顺序,数值小的靠前';
|
||||
COMMENT ON COLUMN list_field_config.visible IS '是否显示:1显示 0隐藏';
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS deposit_record_id_seq;
|
||||
ALTER TABLE deposit_record ALTER COLUMN id SET DEFAULT nextval('deposit_record_id_seq');
|
||||
-- 初始化 SEARCH 场景默认 8 个展示字段(按 sort_no 排序)
|
||||
INSERT INTO list_field_config (id, scene, field_key, field_label, sort_no, visible, deleted)
|
||||
SELECT v.* FROM (
|
||||
VALUES
|
||||
(90001::bigint, 'SEARCH'::varchar, 'title'::varchar, '文献题名'::varchar, 10, 1::smallint, 0::smallint),
|
||||
(90002::bigint, 'SEARCH'::varchar, 'publishYear'::varchar, '发行时间'::varchar, 20, 1::smallint, 0::smallint),
|
||||
(90003::bigint, 'SEARCH'::varchar, 'author'::varchar, '作者'::varchar, 30, 1::smallint, 0::smallint),
|
||||
(90004::bigint, 'SEARCH'::varchar, 'authorOrg'::varchar, '作者单位'::varchar, 40, 1::smallint, 0::smallint),
|
||||
(90005::bigint, 'SEARCH'::varchar, 'publisher'::varchar, '来源刊名/出版社'::varchar, 50, 1::smallint, 0::smallint),
|
||||
(90006::bigint, 'SEARCH'::varchar, 'mediaType'::varchar, '资源类型'::varchar, 60, 1::smallint, 0::smallint),
|
||||
(90007::bigint, 'SEARCH'::varchar, 'sourceLibrary'::varchar, '来源院校'::varchar, 70, 1::smallint, 0::smallint),
|
||||
(90008::bigint, 'SEARCH'::varchar, 'sourceRepo'::varchar, '来源资源库名'::varchar, 80, 1::smallint, 0::smallint)
|
||||
) v
|
||||
WHERE NOT EXISTS (SELECT 1 FROM list_field_config WHERE scene = 'SEARCH');
|
||||
|
||||
CREATE SEQUENCE IF NOT EXISTS sys_user_id_seq;
|
||||
ALTER TABLE sys_user ALTER COLUMN id SET DEFAULT nextval('sys_user_id_seq');
|
||||
-- 样例数据补填「作者单位 / 来源资源库名」(军事样例 0101~0118)
|
||||
UPDATE version_resource SET author_org = '中国人民解放军军事科学院军事思想研究所', source_repo = '军事科学学位论文资源库'
|
||||
WHERE process_no IN ('MIL-2026-0101', 'MIL-2026-0103', 'MIL-2026-0107', 'MIL-2026-0114');
|
||||
|
||||
-- 2. 序列起点对齐现有「小整数」主键,避免与已有数据冲突
|
||||
SELECT setval('version_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM version_resource WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('special_resource_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM special_resource WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('sensitive_word_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM sensitive_word WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('resource_node_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM resource_node WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('governance_job_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM governance_job WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('search_log_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM search_log WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('collect_task_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM collect_task WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('deposit_record_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM deposit_record WHERE id < 1000000000), 0), 1), true);
|
||||
SELECT setval('sys_user_id_seq', GREATEST(COALESCE((SELECT MAX(id) FROM sys_user WHERE id < 1000000000), 0), 1), true);
|
||||
UPDATE version_resource SET author_org = '国防大学研究生院', source_repo = '国防大学书目文献资源库'
|
||||
WHERE process_no IN ('MIL-2026-0102', 'MIL-2026-0108', 'MIL-2026-0115');
|
||||
|
||||
-- 3. 把历史上生成的超大雪花 ID 重编为连续小 ID(数据内容不变)
|
||||
UPDATE version_resource SET id = nextval('version_resource_id_seq') WHERE id > 1000000000;
|
||||
UPDATE special_resource SET id = nextval('special_resource_id_seq') WHERE id > 1000000000;
|
||||
UPDATE sensitive_word SET id = nextval('sensitive_word_id_seq') WHERE id > 1000000000;
|
||||
UPDATE resource_node SET id = nextval('resource_node_id_seq') WHERE id > 1000000000;
|
||||
UPDATE governance_job SET id = nextval('governance_job_id_seq') WHERE id > 1000000000;
|
||||
UPDATE search_log SET id = nextval('search_log_id_seq') WHERE id > 1000000000;
|
||||
UPDATE collect_task SET id = nextval('collect_task_id_seq') WHERE id > 1000000000;
|
||||
UPDATE deposit_record SET id = nextval('deposit_record_id_seq') WHERE id > 1000000000;
|
||||
UPDATE sys_user SET id = nextval('sys_user_id_seq') WHERE id > 1000000000;
|
||||
UPDATE version_resource SET author_org = '海军指挥学院战术研究中心', source_repo = '海军院校联合书目库'
|
||||
WHERE process_no = 'MIL-2026-0104';
|
||||
|
||||
UPDATE version_resource SET author_org = '空军指挥学院空天防御研究组', source_repo = '空军院校资源联合库'
|
||||
WHERE process_no IN ('MIL-2026-0105', 'MIL-2026-0118');
|
||||
|
||||
UPDATE version_resource SET author_org = '陆军装甲兵学院作战理论教研室', source_repo = '陆军院校联合书目库'
|
||||
WHERE process_no IN ('MIL-2026-0106', 'MIL-2026-0112', 'MIL-2026-0113');
|
||||
|
||||
UPDATE version_resource SET author_org = '陆军步兵学院图书馆', source_repo = '陆军院校联合书目库'
|
||||
WHERE process_no IN ('MIL-2026-0109', 'MIL-2026-0116');
|
||||
|
||||
UPDATE version_resource SET author_org = '国防科技大学国际关系研究所', source_repo = '国防科技大学知识资源库'
|
||||
WHERE process_no IN ('MIL-2026-0110', 'MIL-2026-0111', 'MIL-2026-0117');
|
||||
|
||||
@@ -51,6 +51,8 @@ CREATE TABLE IF NOT EXISTS version_resource
|
||||
sensitive_flag SMALLINT DEFAULT 0, -- 敏感标记 0正常 1敏感
|
||||
is_special SMALLINT DEFAULT 0, -- 是否特藏版本 0否 1是
|
||||
manage_status SMALLINT DEFAULT 0, -- 管理状态 0正常 1屏蔽 2下架
|
||||
author_org VARCHAR(256), -- 作者单位(责任者所属机构)
|
||||
source_repo VARCHAR(256), -- 来源资源库名
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted SMALLINT DEFAULT 0 -- 逻辑删除 0未删 1已删
|
||||
@@ -65,6 +67,10 @@ CREATE INDEX IF NOT EXISTS idx_vr_source_lib ON version_resource (source_libra
|
||||
CREATE INDEX IF NOT EXISTS idx_vr_publish_year ON version_resource (publish_year);
|
||||
CREATE INDEX IF NOT EXISTS idx_vr_cdoi ON version_resource (cdoi);
|
||||
CREATE INDEX IF NOT EXISTS idx_vr_manage_status ON version_resource (manage_status);
|
||||
CREATE INDEX IF NOT EXISTS idx_vr_source_repo ON version_resource (source_repo);
|
||||
|
||||
COMMENT ON COLUMN version_resource.author_org IS '作者单位(责任者所属机构)';
|
||||
COMMENT ON COLUMN version_resource.source_repo IS '来源资源库名';
|
||||
|
||||
COMMENT ON TABLE version_resource IS '版本资源元数据表';
|
||||
COMMENT ON COLUMN version_resource.media_type IS '媒体类型:纸质/电子';
|
||||
@@ -123,3 +129,29 @@ COMMENT ON COLUMN resource_node.link_url IS '访问链接';
|
||||
COMMENT ON COLUMN resource_node.sort_no IS '展示顺序,数值小的靠前';
|
||||
COMMENT ON COLUMN resource_node.status IS '状态:1启用 0停用';
|
||||
COMMENT ON COLUMN resource_node.deleted IS '逻辑删除:0未删 1已删';
|
||||
|
||||
-- =====================================================================
|
||||
-- 列表显示字段配置
|
||||
-- 检索结果列表 / 资源列表展示哪些字段、显示名与顺序,由管理员在此配置
|
||||
-- =====================================================================
|
||||
CREATE TABLE IF NOT EXISTS list_field_config
|
||||
(
|
||||
id BIGSERIAL NOT NULL PRIMARY KEY,
|
||||
scene VARCHAR(64) NOT NULL, -- 配置场景:SEARCH 检索结果列表
|
||||
field_key VARCHAR(64) NOT NULL, -- 字段键(VersionResource 的驼峰属性名)
|
||||
field_label VARCHAR(64) NOT NULL, -- 列表/导出表头显示名
|
||||
sort_no INT DEFAULT 0, -- 展示顺序(小在前)
|
||||
visible SMALLINT DEFAULT 1, -- 是否显示 1显示 0隐藏
|
||||
create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
||||
deleted SMALLINT DEFAULT 0 -- 逻辑删除 0未删 1已删
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_lfc_scene ON list_field_config (scene, sort_no);
|
||||
|
||||
COMMENT ON TABLE list_field_config IS '列表显示字段配置表(管理员控制检索结果展示字段)';
|
||||
COMMENT ON COLUMN list_field_config.scene IS '配置场景:SEARCH 检索结果列表';
|
||||
COMMENT ON COLUMN list_field_config.field_key IS '字段键,对应 VersionResource 的驼峰属性名';
|
||||
COMMENT ON COLUMN list_field_config.field_label IS '列表与导出时的显示名';
|
||||
COMMENT ON COLUMN list_field_config.sort_no IS '展示顺序,数值小的靠前';
|
||||
COMMENT ON COLUMN list_field_config.visible IS '是否显示:1显示 0隐藏';
|
||||
|
||||
Reference in New Issue
Block a user