fix(security): 字典过滤条件 SQL 注入加固 GHSA-jgwm/GHSA-xmw4/GHSA-g87f

- DictSqlConditionCheckUtil: 禁止反斜杠(JSqlParser 与 MySQL 转义理解不一致可绕过)、# 视为注释、条件字段名只允许普通标识符
- SysDictServiceImpl.queryTableDataForLinkRecord: keyValues/keyword 改为参数绑定,不再拼接 filterSql
- SensitiveTableCheckUtil / DictTableWhiteListHandlerImpl: 字面量 null 表名不再放行
- 前端 demo 新增"字典条件示例"tab:合法用法示例 + SQL注入拦截验证

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
scott 2026-10-27 23:11:48 -04:00
parent f7eb9f38dc
commit 7af725ca27
9 changed files with 424 additions and 39 deletions

View File

@ -27,6 +27,7 @@ import net.sf.jsqlparser.schema.Column;
import java.util.LinkedHashSet;
import java.util.Set;
import java.util.regex.Pattern;
/**
* 前端字典条件 SQL 结构校验工具。
@ -36,6 +37,12 @@ import java.util.Set;
*/
public final class DictSqlConditionCheckUtil {
/**
* 条件字段名:字母/数字/下划线组成的标识符,可带反引号或双引号,可带表别名前缀
*/
private static final Pattern COLUMN_NAME_PATTERN = Pattern.compile(
"[`\"]?[\\p{L}_][\\p{L}\\p{N}_]*[`\"]?(\\.[`\"]?[\\p{L}_][\\p{L}\\p{N}_]*[`\"]?)*");
private DictSqlConditionCheckUtil() {
}
@ -53,6 +60,11 @@ public final class DictSqlConditionCheckUtil {
String trimmed = value.trim();
Set<String> conditionFields = new LinkedHashSet<>();
try {
//update-begin---author:scott ---date:20261027 for:【GHSA-jgwm-2xxm-mmm4/GHSA-xmw4-rx44-4jcp】禁止反斜杠,JSqlParser不把\当转义符而MySQL会,两者对字符串边界理解不一致可绕过校验-----------
if (trimmed.indexOf('\\') >= 0) {
throw new IllegalArgumentException("字典过滤条件不允许包含反斜杠");
}
//update-end---author:scott ---date:20261027 for:【GHSA-jgwm-2xxm-mmm4/GHSA-xmw4-rx44-4jcp】禁止反斜杠,JSqlParser不把\当转义符而MySQL会,两者对字符串边界理解不一致可绕过校验-----------
if (containsSqlComment(trimmed)) {
throw new IllegalArgumentException("字典过滤条件不允许包含SQL注释");
}
@ -172,6 +184,11 @@ public final class DictSqlConditionCheckUtil {
quote = current;
continue;
}
//update-begin---author:scott ---date:20261027 for:【GHSA-xmw4-rx44-4jcp】MySQL的#也是行注释-----------
if (current == '#') {
return true;
}
//update-end---author:scott ---date:20261027 for:【GHSA-xmw4-rx44-4jcp】MySQL的#也是行注释-----------
if (i + 1 < value.length()
&& ((current == '-' && value.charAt(i + 1) == '-')
|| (current == '/' && value.charAt(i + 1) == '*'))) {
@ -228,6 +245,11 @@ public final class DictSqlConditionCheckUtil {
if (!(expression instanceof Column column)) {
return false;
}
//update-begin---author:scott ---date:20261027 for:【GHSA-xmw4-rx44-4jcp】字段名只允许普通标识符,防止password#之类绕过敏感字段检查-----------
if (!COLUMN_NAME_PATTERN.matcher(column.getFullyQualifiedName()).matches()) {
return false;
}
//update-end---author:scott ---date:20261027 for:【GHSA-xmw4-rx44-4jcp】字段名只允许普通标识符,防止password#之类绕过敏感字段检查-----------
conditionFields.add(column.getFullyQualifiedName());
return true;
}

View File

@ -34,6 +34,12 @@ public final class SensitiveTableCheckUtil {
* @param fields 查询字段
*/
public static void checkForbiddenFields(String table, String... fields) {
//update-begin---author:scott ---date:20261027 for:【GHSA-g87f-mgx5-wj9c】isEmpty会把字面量null当空直接放行,改为拒绝-----------
if (table != null && "null".equalsIgnoreCase(table.trim())) {
log.error("字典查询表名非法:{}", table);
throw new JeecgSqlInjectionException(SQL_INJECTION_TIP + table);
}
//update-end---author:scott ---date:20261027 for:【GHSA-g87f-mgx5-wj9c】isEmpty会把字面量null当空直接放行,改为拒绝-----------
if (oConvertUtils.isEmpty(table) || fields == null || fields.length == 0) {
return;
}

View File

@ -0,0 +1,73 @@
package org.jeecg.test.security;
import org.jeecg.common.exception.JeecgSqlInjectionException;
import org.jeecg.common.util.SensitiveTableCheckUtil;
import org.jeecg.common.util.SqlInjectionUtil;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
/**
* 字典过滤条件 SQL 注入绕过 — 单元测试
*
* GHSA-jgwm-2xxm-mmm4:反斜杠导致 JSqlParser 与 MySQL 对字符串边界理解不一致
* GHSA-xmw4-rx44-4jcp:MySQL 的 # 注释、password# 字段名绕过敏感字段检查
* GHSA-g87f-mgx5-wj9c:字面量 null 表名被当成空表名放行
*
* @author scott
* @since 2026-10-27 GHSA-jgwm/GHSA-xmw4/GHSA-g87f 字典条件注入加固
*/
@ExtendWith(PrintTestResultExtension.class)
public class DictSqlConditionBypassTest {
private static void check(String filterSql) {
SqlInjectionUtil.filterDictConditionSqlFromRequest("sys_user", filterSql);
}
@Test
@DisplayName("jgwm:反斜杠闭合引号的 IN 列表被拦截")
void backslashInListBlocked() {
assertThrows(JeecgSqlInjectionException.class, () -> check("id IN ('a\\',') or 1=1#')"));
assertThrows(JeecgSqlInjectionException.class,
() -> check("id IN ('a\\',') or (select ascii(substring(password from 1 for 1)) from sys_user where username=0x61646d696e)>0#')"));
}
@Test
@DisplayName("jgwm:不带 # 的反斜杠变体同样被拦截")
void backslashWithoutCommentBlocked() {
assertThrows(JeecgSqlInjectionException.class, () -> check("username = 'a\\'' or username = ''"));
}
@Test
@DisplayName("xmw4:password# 字段名与 # 注释被拦截")
void hashCommentBlocked() {
assertThrows(JeecgSqlInjectionException.class, () -> check("username='admin' and password# like '\nlike \"c%\"#'"));
assertThrows(JeecgSqlInjectionException.class, () -> check("username='admin' # comment"));
}
@Test
@DisplayName("回归:引号内的 # 与正常条件放行")
void normalConditionAllowed() {
assertDoesNotThrow(() -> check("username = 'a#b'"));
assertDoesNotThrow(() -> check("status = '1' and sex in ('1','2') order by create_time desc"));
assertDoesNotThrow(() -> check("u.username like 'adm%' and `realname` is not null"));
}
@Test
@DisplayName("回归:直接使用敏感字段仍被拦截")
void sensitiveFieldBlocked() {
assertThrows(JeecgSqlInjectionException.class, () -> check("username='admin' and password like 'c%'"));
}
@Test
@DisplayName("g87f:字面量 null 表名不再放行")
void literalNullTableBlocked() {
assertThrows(JeecgSqlInjectionException.class, () -> SensitiveTableCheckUtil.checkForbiddenFields("null", "password"));
assertThrows(JeecgSqlInjectionException.class, () -> SensitiveTableCheckUtil.checkForbiddenFields(" NULL ", "password"));
assertDoesNotThrow(() -> SensitiveTableCheckUtil.checkForbiddenFields("", "password"));
assertDoesNotThrow(() -> SensitiveTableCheckUtil.checkForbiddenFields("sys_user", "username"));
}
}

View File

@ -118,6 +118,11 @@ public class DictTableWhiteListHandlerImpl implements IDictTableWhiteListHandler
@Override
public boolean isPassByDict(String tableName, String... fields) {
//update-begin---author:scott ---date:20261027 for:【GHSA-g87f-mgx5-wj9c】字面量null表名不能当空表名放行-----------
if (tableName != null && "null".equalsIgnoreCase(tableName.trim())) {
return false;
}
//update-end---author:scott ---date:20261027 for:【GHSA-g87f-mgx5-wj9c】字面量null表名不能当空表名放行-----------
if (oConvertUtils.isEmpty(tableName)) {
return true;
}

View File

@ -200,20 +200,33 @@ public interface SysDictMapper extends BaseMapper<SysDict> {
* @param page 分页参数
* @param table 表名(已转义)
* @param fields SELECT 字段列表(已转义,逗号分隔)
* @param filterSql WHERE 子句内容(不含 WHERE 关键字,已注入校验)
* @param valueField 回显字段(已转义)
* @param keyValues 回显值,参数绑定
* @param likeFields 模糊搜索字段(已转义)
* @param likeKeyword 模糊搜索关键词(含%),参数绑定
*/
IPage<Map<String, Object>> queryPageTableWithFields(Page<Map<String, Object>> page,
@Param("table") String table,
@Param("fields") String fields,
@Param("filterSql") String filterSql);
@Param("valueField") String valueField,
@Param("keyValues") List<String> keyValues,
@Param("likeFields") List<String> likeFields,
@Param("likeKeyword") String likeKeyword);
/**
* 关联记录专用:统计满足条件的记录总数
*
* @param table 表名(已转义)
* @param filterSql WHERE 子句内容(不含 WHERE 关键字,已注入校验)
* @param valueField 回显字段(已转义)
* @param keyValues 回显值,参数绑定
* @param likeFields 模糊搜索字段(已转义)
* @param likeKeyword 模糊搜索关键词(含%),参数绑定
*/
Long countTableWithFields(@Param("table") String table, @Param("filterSql") String filterSql);
Long countTableWithFields(@Param("table") String table,
@Param("valueField") String valueField,
@Param("keyValues") List<String> keyValues,
@Param("likeFields") List<String> likeFields,
@Param("likeKeyword") String likeKeyword);
/**
* 根据应用id获取字典列表和详情

View File

@ -209,21 +209,37 @@
</if>
</select>
<!-- 关联记录专用:多字段分页查询任意表数据【已加入SQL注入check】 -->
<!-- update-begin author:scott date:20261027 for:【GHSA-jgwm-2xxm-mmm4】回显值和关键词改为参数绑定,不再拼接 filterSql -->
<!-- 关联记录专用:多字段分页查询任意表数据(表名、字段已在 Service 层转义,值走参数绑定) -->
<select id="queryPageTableWithFields" resultType="java.util.Map">
SELECT ${fields} FROM ${table}
<if test="filterSql != null and filterSql != ''">
WHERE ${filterSql}
</if>
<where>
<if test="keyValues != null and keyValues.size() > 0">
${valueField} IN
<foreach collection="keyValues" item="kv" open="(" separator="," close=")">#{kv}</foreach>
</if>
<if test="likeKeyword != null and likeFields != null and likeFields.size() > 0">
AND
<foreach collection="likeFields" item="lf" open="(" separator=" OR " close=")">${lf} LIKE #{likeKeyword}</foreach>
</if>
</where>
</select>
<!-- 关联记录专用:统计满足条件的记录总数 -->
<select id="countTableWithFields" resultType="long">
SELECT COUNT(*) FROM ${table}
<if test="filterSql != null and filterSql != ''">
WHERE ${filterSql}
</if>
<where>
<if test="keyValues != null and keyValues.size() > 0">
${valueField} IN
<foreach collection="keyValues" item="kv" open="(" separator="," close=")">#{kv}</foreach>
</if>
<if test="likeKeyword != null and likeFields != null and likeFields.size() > 0">
AND
<foreach collection="likeFields" item="lf" open="(" separator=" OR " close=")">${lf} LIKE #{likeKeyword}</foreach>
</if>
</where>
</select>
<!-- update-end author:scott date:20261027 for:【GHSA-jgwm-2xxm-mmm4】回显值和关键词改为参数绑定,不再拼接 filterSql -->
<!-- *****************以上方法写法存在SQL注入风险***************** -->

View File

@ -939,38 +939,22 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
}
String selectFields = String.join(", ", fieldSet);
// ---------- 3. 构造 WHERE 条件 ----------
List<String> conditionParts = new ArrayList<>();
// ---------- 3. 构造 WHERE 条件(参数绑定) ----------
//update-begin---author:scott ---date:20261027 for:【GHSA-jgwm-2xxm-mmm4】keyValues/keyword改为参数绑定,不再拼接SQL字符串(原写法只转义单引号,MySQL下可用反斜杠闭合引号注入)-----------
// 3.1 按 keyValues 精确查询(回显用),-1 保留空项,避免 keyValues="," 时列表为空导致不加条件查出全表
List<String> keyValueList = oConvertUtils.isNotEmpty(keyValues) ? Arrays.asList(keyValues.split(",", -1)) : null;
//update-begin---author:liusq ---date:2026-05-27 for:【优化】去掉无用参数searchFields、condition-----------
// 3.1 按 keyValues 精确查询(回显用)
if (oConvertUtils.isNotEmpty(keyValues)) {
keyValues = keyValues.replace("'", "''");
String inValues = "'" + String.join("','", keyValues.split(",")) + "'";
conditionParts.add(safeValueField + " IN (" + inValues + ")");
}
//update-end---author:liusq ---date:2026-05-27 for:【优化】去掉无用参数searchFields、condition-----------
// 3.2 关键词模糊搜索
// 3.2 关键词模糊搜索字段
List<String> likeFields = new ArrayList<>();
String likeKeyword = null;
if (oConvertUtils.isNotEmpty(keyword)) {
keyword = keyword.replace("'", "''");
String[] searchArr = showFields.split(",");
List<String> likeParts = new ArrayList<>();
for (String sf : searchArr) {
for (String sf : showFields.split(",")) {
sf = sf.trim();
if (oConvertUtils.isNotEmpty(sf)) {
String safeSf = SqlInjectionUtil.getSqlInjectField(sf);
likeParts.add(safeSf + " like '%" + keyword + "%'");
likeFields.add(SqlInjectionUtil.getSqlInjectField(sf));
}
}
if (!likeParts.isEmpty()) {
conditionParts.add("(" + String.join(" or ", likeParts) + ")");
}
}
String filterSql = conditionParts.isEmpty() ? "" : String.join(" and ", conditionParts);
if (oConvertUtils.isNotEmpty(filterSql)) {
SqlInjectionUtil.filterDictConditionSqlFromRequest(tableName, filterSql);
likeKeyword = likeFields.isEmpty() ? null : "%" + keyword + "%";
}
// ---------- 4. 分页查询 ----------
@ -979,8 +963,10 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
Page<Map<String, Object>> page = new Page<>(current, size);
page.setSearchCount(false); // 手动 count,避免 MyBatis Plus 自动 count 与 ${} 语法冲突
IPage<Map<String, Object>> pageResult = baseMapper.queryPageTableWithFields(page, safeTable, selectFields, filterSql);
long total = baseMapper.countTableWithFields(safeTable, filterSql);
IPage<Map<String, Object>> pageResult = baseMapper.queryPageTableWithFields(page, safeTable, selectFields,
safeValueField, keyValueList, likeFields, likeKeyword);
long total = baseMapper.countTableWithFields(safeTable, safeValueField, keyValueList, likeFields, likeKeyword);
//update-end---author:scott ---date:20261027 for:【GHSA-jgwm-2xxm-mmm4】keyValues/keyword改为参数绑定,不再拼接SQL字符串(原写法只转义单引号,MySQL下可用反斜杠闭合引号注入)-----------
// ---------- 5. 组装返回值 ----------
Map<String, Object> result = new HashMap<>(4);

View File

@ -0,0 +1,261 @@
<template>
<a-card title="SQL注入拦截验证(GHSA-jgwm / GHSA-xmw4 / GHSA-g87f)" size="small" style="margin-bottom: 16px">
<a-alert
message="以下按钮会用漏洞 payload 调用字典相关接口,修复生效时应全部被拦截(success=false)。"
type="warning"
show-icon
/>
<a-space direction="vertical" style="width: 100%; margin-top: 12px">
<div v-for="(c, i) in cases" :key="i">
<a-space>
<a-button danger size="small" :loading="c.loading" @click="runCase(c)">{{ c.title }}</a-button>
<a-tag v-if="c.status === 'blocked'" color="success">已拦截</a-tag>
<a-tag v-else-if="c.status === 'leak'" color="error">未拦截,存在风险</a-tag>
</a-space>
<div style="margin: 4px 0 0 4px; color: #999; font-size: 12px">{{ c.desc }}</div>
<div v-if="c.msg" style="margin: 2px 0 0 4px; font-family: monospace; font-size: 12px; color: #d4380d">{{ c.msg }}</div>
</div>
</a-space>
</a-card>
<a-alert type="info" show-icon style="margin-bottom: 16px">
<template #message>表字典过滤条件写法(合法用法)</template>
<template #description>
<div>1. 下拉 / 搜索:dictCode 写成「表名,文本字段,编码字段,过滤条件」</div>
<div>2. 下拉树:dict 写成「表名 where 过滤条件,文本字段,编码字段」,过滤条件里不能有逗号(dict 按逗号拆分)</div>
<div>3. 过滤条件只支持「字段 比较 常量」组合(=、!=、&gt;、&lt;、like、in、between、is null、and/or、order by),不支持注释、反斜杠、子查询和函数</div>
<div>4. 关联记录按 id 回显、关键词搜索均为参数绑定,不需要也不允许传条件 SQL</div>
</template>
</a-alert>
<BasicForm
:labelCol="{ span: 6 }"
:wrapperCol="{ span: 14 }"
:showResetButton="false"
:showSubmitButton="false"
:schemas="schemas"
:actionColOptions="{ span: 24 }"
/>
</template>
<script lang="ts" setup>
/**
* 表字典过滤条件 / 关联记录 示例 + SQL注入拦截验证
*
* @author scott
* @since 2026-10-27 GHSA-jgwm/GHSA-xmw4/GHSA-g87f 字典条件校验加固后补充用法示例与回归验证
*/
import { reactive } from 'vue';
import { BasicForm, FormSchema } from '/@/components/Form';
import { defHttp } from '/@/utils/http/axios';
import { useMessage } from '/@/hooks/web/useMessage';
const { createMessage } = useMessage();
interface InjectCase {
title: string;
desc: string;
request: () => Promise<any>;
// 参数化类注入(jgwm)不会报错而是查不到数据,需按返回数据量判断是否被当作纯值处理
leakWhenData?: boolean;
loading: boolean;
status: '' | 'blocked' | 'leak';
msg: string;
}
// 注入 payload 仅用于验证拦截,经前端发出时会自动带上 X-Sign 签名
const cases = reactive<InjectCase[]>([
{
title: 'jgwm:关联记录 keyValues 反斜杠闭合引号',
desc: "/sys/dict/queryTableDataForLinkRecord keyValues=a\\,) or 1=1#(参数化后应查出0条)",
leakWhenData: true,
loading: false,
status: '',
msg: '',
request: () =>
defHttp.get(
{
url: '/sys/dict/queryTableDataForLinkRecord',
params: { tableName: 'sys_user', showFields: 'realname,username', valueField: 'id', keyValues: 'a\\,) or 1=1#', pageNo: 1, pageSize: -1 },
},
{ isTransformResponse: false },
),
},
{
title: 'xmw4:表字典 # 注释 + password# 字段',
desc: "/sys/dict/loadDict 条件=username='admin' and password# like '%'",
loading: false,
status: '',
msg: '',
request: () =>
defHttp.get(
{ url: "/sys/dict/loadDict/" + encodeURIComponent("sys_user,realname,username,username='admin' and password# like '%'"), params: { pageNo: 1, pageSize: 10 } },
{ isTransformResponse: false },
),
},
{
title: 'xmw4:下拉树表名注入子查询',
desc: '/sys/dict/loadTreeData tableName=sys_permission where 1=1 or (select 1 from sys_user)>0#',
loading: false,
status: '',
msg: '',
request: () =>
defHttp.get(
{
url: '/sys/dict/loadTreeData',
params: { pid: '', condition: '', pidField: 'parent_id', hasChildField: 'is_leaf', converIsLeafVal: 0, text: 'name', code: 'id', tableName: 'sys_permission where 1=1 or (select 1 from sys_user)>0#' },
},
{ isTransformResponse: false },
),
},
{
title: 'g87f:queryTableData 字面量 null 旁路',
desc: '/sys/dict/queryTableData table=null&text=sys_user&code=password',
loading: false,
status: '',
msg: '',
request: () =>
defHttp.get(
{ url: '/sys/dict/queryTableData', params: { table: 'null', text: 'sys_user', code: 'password', keyword: '%', pageSize: 10 } },
{ isTransformResponse: false },
),
},
{
title: '敏感字段直取 sys_user.password',
desc: '/sys/dict/loadDict/sys_user,password,id',
loading: false,
status: '',
msg: '',
request: () => defHttp.get({ url: '/sys/dict/loadDict/sys_user,password,id', params: { pageNo: 1, pageSize: 10 } }, { isTransformResponse: false }),
},
]);
async function runCase(c: InjectCase) {
c.loading = true;
c.status = '';
c.msg = '';
try {
const res = await c.request();
if (c.leakWhenData) {
// 参数化类:payload 被当纯值处理时查不到数据(total=0)为安全;若 or 1=1 生效则查出数据
const r = res?.result || {};
const total = r.total ?? (r.records ? r.records.length : 0);
if (res?.success && total === 0) {
c.status = 'blocked';
c.msg = '注入字符串被当作参数值,查出 0 条,注入未生效';
createMessage.success('已防护');
} else {
c.status = 'leak';
c.msg = `注入生效,查出 ${total} 条数据!`;
createMessage.error(c.title + ' 未拦截');
}
} else if (res?.success) {
c.status = 'leak';
c.msg = '响应 success=true,注入未被拦截!';
createMessage.error(c.title + ' 未拦截');
} else {
c.status = 'blocked';
c.msg = res?.message || '后端已拒绝';
createMessage.success('已拦截');
}
} catch (e: any) {
c.status = 'blocked';
c.msg = e?.message || e?.response?.data?.message || '请求被拒绝';
createMessage.success('已拦截');
} finally {
c.loading = false;
}
}
const schemas: FormSchema[] = [
{
field: 'condDictSelect',
component: 'JDictSelectTag',
label: '字典表下拉(带条件)',
helpMessage: ["sys_user,realname,username,status = '1' and del_flag = 0"],
componentProps: {
dictCode: "sys_user,realname,username,status = '1' and del_flag = 0",
},
colProps: { span: 12 },
},
{
field: 'condDictSelect',
component: 'JEllipsis',
label: '选中值',
colProps: { span: 12 },
},
{
field: 'condDictOrder',
component: 'JDictSelectTag',
label: '字典表下拉(条件+排序)',
helpMessage: ['sys_user,realname,username,del_flag = 0 order by create_time desc'],
componentProps: {
dictCode: 'sys_user,realname,username,del_flag = 0 order by create_time desc',
},
colProps: { span: 12 },
},
{
field: 'condDictOrder',
component: 'JEllipsis',
label: '选中值',
colProps: { span: 12 },
},
{
field: 'condSearchSelect',
component: 'JSearchSelect',
label: '字典搜索(异步带条件)',
helpMessage: ['输入关键字后,在过滤条件范围内分页搜索'],
componentProps: {
dict: "sys_user,realname,username,status = '1' and del_flag = 0",
pageSize: 6,
async: true,
},
colProps: { span: 12 },
},
{
field: 'condSearchSelect',
component: 'JEllipsis',
label: '选择值',
colProps: { span: 12 },
},
{
field: 'condTreeSelect',
component: 'JTreeSelect',
label: '下拉树(表名带条件)',
helpMessage: ['sys_permission where menu_type != 2,name,id', '只显示菜单,不显示按钮'],
componentProps: {
dict: 'sys_permission where menu_type != 2,name,id',
pidField: 'parent_id',
hasChildField: 'is_leaf',
converIsLeafVal: 0,
},
colProps: { span: 12 },
},
{
field: 'condTreeSelect',
component: 'JEllipsis',
label: '选中值',
colProps: { span: 12 },
},
{
field: 'linkRecord',
component: 'JLinkTableCard',
label: '关联记录(按id回显)',
helpMessage: ['调用 /sys/dict/queryTableDataForLinkRecord', '默认值为 admin 的 id,打开页面即按 keyValues 回显', '弹窗内关键词搜索走 keyword 参数'],
defaultValue: 'e9ca23d68d884d4ebb19d07889727dae',
componentProps: {
queryMode: 'table',
tableName: 'sys_user',
valueField: 'id',
textField: 'realname,username,sex',
imageField: 'avatar',
multi: true,
},
colProps: { span: 12 },
},
{
field: 'linkRecord',
component: 'JEllipsis',
label: '选中值(id逗号分隔)',
colProps: { span: 12 },
},
];
</script>

View File

@ -9,6 +9,7 @@
<a-tab-pane key="ImgTurnPage" tab="图片翻页"></a-tab-pane>
<a-tab-pane key="JeecgPdfView" tab="PDF预览"></a-tab-pane>
<a-tab-pane key="JUploadDemo" tab="文件上传"></a-tab-pane>
<a-tab-pane key="DictConditionDemo" tab="字典条件示例"></a-tab-pane>
</a-tabs>
<component :is="currentComponent"></component>
</a-card>
@ -23,6 +24,7 @@
import ImgTurnPage from './ImgTurnPage.vue';
import JeecgPdfView from './JeecgPdfView.vue';
import JUploadDemo from './JUploadDemo.vue';
import DictConditionDemo from './DictConditionDemo.vue';
export default defineComponent({
name: 'comp-jeecg-basic',
setup() {
@ -36,6 +38,7 @@
ImgTurnPage: ImgTurnPage,
JeecgPdfView: JeecgPdfView,
JUploadDemo: JUploadDemo,
DictConditionDemo: DictConditionDemo,
};
return componentType[activeKey.value];
});