h5 动态表单,支持多租户

This commit is contained in:
lizhengwei 2026-02-20 01:21:22 +08:00
parent 399e8cbaee
commit 37979ffb73
6 changed files with 16 additions and 10 deletions

View File

@ -1,3 +1,3 @@
### 查询所有H5项目
GET http://localhost:19200/h5/works/page?page=1&size=10&status=1&isTemplate=true
GET http://localhost:19200/h5/works/page?page=1&size=10&status=2&isTemplate=true
Accept: application/json

View File

@ -2,13 +2,13 @@ package com.luban.api.config;
import cn.hutool.core.collection.ListUtil;
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
import com.dromara.md.form.utils.TenantHelper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.NullValue;
import net.sf.jsqlparser.expression.StringValue;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.tenant.helper.TenantHelper;
import org.dromara.common.tenant.properties.TenantProperties;
import java.util.List;
@ -31,7 +31,7 @@ public class PlusTenantLineHandler implements TenantLineHandler {
@Override
public Expression getTenantId() {
String tenantId = TenantHelper.getTenantId();
String tenantId = TenantHelper.getTenantId() + "";
if (StringUtils.isBlank(tenantId)) {
log.error("无法获取有效的租户id -> Null");
return new NullValue();
@ -42,7 +42,7 @@ public class PlusTenantLineHandler implements TenantLineHandler {
@Override
public boolean ignoreTable(String tableName) {
String tenantId = TenantHelper.getTenantId();
String tenantId = TenantHelper.getTenantId() + "";
// 判断是否有租户
if (StringUtils.isNotBlank(tenantId)) {
// 不需要过滤租户的表

View File

@ -23,6 +23,9 @@ public class H5ProjectQueryDTO extends PageDtoBase {
@Schema(description = "项目标题")
private String title;
@Schema(description = "type")
private String type;
@Schema(description = "是否发布")
private Integer status;

View File

@ -20,6 +20,7 @@
<select id="selectH5ProjectPage" resultMap="BaseResultMap">
SELECT
id,
type,
title,
preview_url,
preview_url_watermark,
@ -27,13 +28,15 @@
preview_height
FROM h5_project
<where>
type = 'web_page'
<if test="queryDTO.title != null and queryDTO.title != ''">
AND MATCH(title) AGAINST(#{queryDTO.title} IN NATURAL LANGUAGE MODE)
</if>
<if test="queryDTO.status != null">
AND status = #{queryDTO.status}
</if>
<if test="queryDTO.type != null">
AND type = #{queryDTO.type}
</if>
<if test="queryDTO.groupIds != null and queryDTO.groupIds.size() > 0">
AND EXISTS (
SELECT 1

View File

@ -47,9 +47,9 @@ services:
- /docker/postgres/data:/var/lib/postgresql/data
network_mode: "host"
postgres13:
image: postgres:13.6
container_name: postgres13
postgres16:
image: postgres:16.1
container_name: postgres16
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
@ -57,5 +57,5 @@ services:
ports:
- "5433:5432"
volumes:
- /docker/postgres13/data:/var/lib/postgresql/data
- "/D/Program Files/docker/path/pg16:/var/lib/postgresql/data"
network_mode: "host"

View File

@ -10,7 +10,7 @@ services:
# root 密码
MYSQL_ROOT_PASSWORD: root
# 初始化数据库(后续的初始化sql会在这个库执行)
MYSQL_DATABASE: ry-vue
MYSQL_DATABASE: root
ports:
- "3306:3306"
volumes: