多租户与景区关系

This commit is contained in:
2025-09-29 19:29:41 +08:00
parent 4c154ec746
commit dbd4d4d198
37 changed files with 997 additions and 267 deletions
@@ -12,17 +12,28 @@
data_scope
</sql>
<sql id="where">
<where>
<if test="r.name != null and r.name != ''">
and t.name like concat('%', #{r.name}, '%')
</if>
<if test="r.searchKey != null and r.searchKey != '' and r.searchKey=='name'">
and t.name like concat('%', #{r.searchValue}, '%')
</if>
</where>
</sql>
<sql id="where">
<where>
<if test="r.name != null and r.name != ''">
and t.name like concat('%', #{r.name}, '%')
</if>
<if test="r.searchKey != null and r.searchKey != '' and r.searchKey=='name'">
and t.name like concat('%', #{r.searchValue}, '%')
</if>
<!-- 按租户过滤(以租户为主):优先使用租户ID集合,其次使用单个租户ID -->
<if test="r.tenantIds != null and r.tenantIds.size > 0">
and t.tenant_id in
<foreach collection="r.tenantIds" item="tid" open="(" separator="," close=")">
#{tid}
</foreach>
</if>
<if test="(r.tenantIds == null or r.tenantIds.size == 0) and r.tenantId != null and r.tenantId != ''">
and t.tenant_id = #{r.tenantId}
</if>
</where>
</sql>
<select id="findList" resultType="com.central.common.model.SysRole">
select <include refid="Column_List"/>
@@ -36,4 +47,4 @@
from sys_role
order by create_time desc
</select>
</mapper>
</mapper>
@@ -2,12 +2,18 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.central.user.mapper.SysUserMapper">
<sql id="where">
<where>
t.is_del=0
<if test="u.id != null and u.id != ''">
and t.id like concat('%', #{u.id}, '%')
</if>
<sql id="where">
<where>
t.is_del=0
<if test="u.tenantIds != null and u.tenantIds.size > 0">
and t.company in
<foreach collection="u.tenantIds" item="tid" open="(" separator="," close=")">
#{tid}
</foreach>
</if>
<if test="u.id != null and u.id != ''">
and t.id like concat('%', #{u.id}, '%')
</if>
<if test="u.username != null and u.username != ''">
and t.username like concat('%', #{u.username}, '%')
</if>
@@ -40,4 +46,4 @@
<include refid="where" />
order by t.id desc
</select>
</mapper>
</mapper>