mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 01:25:28 +08:00
h5 动态表单,支持多租户
This commit is contained in:
parent
399e8cbaee
commit
37979ffb73
@ -1,3 +1,3 @@
|
|||||||
### 查询所有H5项目
|
### 查询所有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
|
Accept: application/json
|
||||||
|
|||||||
@ -2,13 +2,13 @@ package com.luban.api.config;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||||
|
import com.dromara.md.form.utils.TenantHelper;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.jsqlparser.expression.Expression;
|
import net.sf.jsqlparser.expression.Expression;
|
||||||
import net.sf.jsqlparser.expression.NullValue;
|
import net.sf.jsqlparser.expression.NullValue;
|
||||||
import net.sf.jsqlparser.expression.StringValue;
|
import net.sf.jsqlparser.expression.StringValue;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
|
||||||
import org.dromara.common.tenant.properties.TenantProperties;
|
import org.dromara.common.tenant.properties.TenantProperties;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -31,7 +31,7 @@ public class PlusTenantLineHandler implements TenantLineHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Expression getTenantId() {
|
public Expression getTenantId() {
|
||||||
String tenantId = TenantHelper.getTenantId();
|
String tenantId = TenantHelper.getTenantId() + "";
|
||||||
if (StringUtils.isBlank(tenantId)) {
|
if (StringUtils.isBlank(tenantId)) {
|
||||||
log.error("无法获取有效的租户id -> Null");
|
log.error("无法获取有效的租户id -> Null");
|
||||||
return new NullValue();
|
return new NullValue();
|
||||||
@ -42,7 +42,7 @@ public class PlusTenantLineHandler implements TenantLineHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean ignoreTable(String tableName) {
|
public boolean ignoreTable(String tableName) {
|
||||||
String tenantId = TenantHelper.getTenantId();
|
String tenantId = TenantHelper.getTenantId() + "";
|
||||||
// 判断是否有租户
|
// 判断是否有租户
|
||||||
if (StringUtils.isNotBlank(tenantId)) {
|
if (StringUtils.isNotBlank(tenantId)) {
|
||||||
// 不需要过滤租户的表
|
// 不需要过滤租户的表
|
||||||
|
|||||||
@ -23,6 +23,9 @@ public class H5ProjectQueryDTO extends PageDtoBase {
|
|||||||
@Schema(description = "项目标题")
|
@Schema(description = "项目标题")
|
||||||
private String title;
|
private String title;
|
||||||
|
|
||||||
|
@Schema(description = "type")
|
||||||
|
private String type;
|
||||||
|
|
||||||
@Schema(description = "是否发布")
|
@Schema(description = "是否发布")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
<select id="selectH5ProjectPage" resultMap="BaseResultMap">
|
<select id="selectH5ProjectPage" resultMap="BaseResultMap">
|
||||||
SELECT
|
SELECT
|
||||||
id,
|
id,
|
||||||
|
type,
|
||||||
title,
|
title,
|
||||||
preview_url,
|
preview_url,
|
||||||
preview_url_watermark,
|
preview_url_watermark,
|
||||||
@ -27,13 +28,15 @@
|
|||||||
preview_height
|
preview_height
|
||||||
FROM h5_project
|
FROM h5_project
|
||||||
<where>
|
<where>
|
||||||
type = 'web_page'
|
|
||||||
<if test="queryDTO.title != null and queryDTO.title != ''">
|
<if test="queryDTO.title != null and queryDTO.title != ''">
|
||||||
AND MATCH(title) AGAINST(#{queryDTO.title} IN NATURAL LANGUAGE MODE)
|
AND MATCH(title) AGAINST(#{queryDTO.title} IN NATURAL LANGUAGE MODE)
|
||||||
</if>
|
</if>
|
||||||
<if test="queryDTO.status != null">
|
<if test="queryDTO.status != null">
|
||||||
AND status = #{queryDTO.status}
|
AND status = #{queryDTO.status}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="queryDTO.type != null">
|
||||||
|
AND type = #{queryDTO.type}
|
||||||
|
</if>
|
||||||
<if test="queryDTO.groupIds != null and queryDTO.groupIds.size() > 0">
|
<if test="queryDTO.groupIds != null and queryDTO.groupIds.size() > 0">
|
||||||
AND EXISTS (
|
AND EXISTS (
|
||||||
SELECT 1
|
SELECT 1
|
||||||
|
|||||||
@ -47,9 +47,9 @@ services:
|
|||||||
- /docker/postgres/data:/var/lib/postgresql/data
|
- /docker/postgres/data:/var/lib/postgresql/data
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
|
|
||||||
postgres13:
|
postgres16:
|
||||||
image: postgres:13.6
|
image: postgres:16.1
|
||||||
container_name: postgres13
|
container_name: postgres16
|
||||||
environment:
|
environment:
|
||||||
POSTGRES_USER: root
|
POSTGRES_USER: root
|
||||||
POSTGRES_PASSWORD: root
|
POSTGRES_PASSWORD: root
|
||||||
@ -57,5 +57,5 @@ services:
|
|||||||
ports:
|
ports:
|
||||||
- "5433:5432"
|
- "5433:5432"
|
||||||
volumes:
|
volumes:
|
||||||
- /docker/postgres13/data:/var/lib/postgresql/data
|
- "/D/Program Files/docker/path/pg16:/var/lib/postgresql/data"
|
||||||
network_mode: "host"
|
network_mode: "host"
|
||||||
|
|||||||
@ -10,7 +10,7 @@ services:
|
|||||||
# root 密码
|
# root 密码
|
||||||
MYSQL_ROOT_PASSWORD: root
|
MYSQL_ROOT_PASSWORD: root
|
||||||
# 初始化数据库(后续的初始化sql会在这个库执行)
|
# 初始化数据库(后续的初始化sql会在这个库执行)
|
||||||
MYSQL_DATABASE: ry-vue
|
MYSQL_DATABASE: root
|
||||||
ports:
|
ports:
|
||||||
- "3306:3306"
|
- "3306:3306"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user