feat(system): 添加组织机构ID集合查询功能

- 在OrganizationParam中新增organizationIds字段用于存储机构ID集合
- 为organizationIds字段添加Schema注解描述和TableField注解标记为非数据库字段
- 在OrganizationMapper.xml中添加IN查询条件支持organizationIds参数
- 使用foreach标签实现动态SQL的IN查询逻辑
- 支持通过多个机构ID进行批量查询操作
This commit is contained in:
2026-01-13 16:53:57 +08:00
parent 43d1d26787
commit 182d6fff0e
2 changed files with 11 additions and 0 deletions

View File

@@ -29,6 +29,12 @@
<if test="param.organizationId != null"> <if test="param.organizationId != null">
AND a.organization_id = #{param.organizationId} AND a.organization_id = #{param.organizationId}
</if> </if>
<if test="param.organizationIds != null and param.organizationIds.size() &gt; 0">
AND a.organization_id IN
<foreach collection="param.organizationIds" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
<if test="param.organizationIdWithChildren != null"> <if test="param.organizationIdWithChildren != null">
AND (a.organization_id = #{param.organizationIdWithChildren} OR a.parent_id = #{param.organizationIdWithChildren}) AND (a.organization_id = #{param.organizationIdWithChildren} OR a.parent_id = #{param.organizationIdWithChildren})
</if> </if>

View File

@@ -12,6 +12,7 @@ import lombok.EqualsAndHashCode;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.Set;
/** /**
* 组织机构查询参数 * 组织机构查询参数
@@ -30,6 +31,10 @@ public class OrganizationParam extends BaseParam {
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer organizationId; private Integer organizationId;
@Schema(description = "机构id合集")
@TableField(exist = false)
private Set<Integer> organizationIds;
@Schema(description = "上级id, 0是顶级") @Schema(description = "上级id, 0是顶级")
@QueryField(type = QueryType.EQ) @QueryField(type = QueryType.EQ)
private Integer parentId; private Integer parentId;