feat(jd): 京东数据库页分类状态快筛(已分类/未分类)——classified 参数按当前分组在 SQL 侧 EXISTS/NOT EXISTS 下推(铁律20同形,判据与读侧填分类列同形);后管工具栏「全部分类」旁三档下拉选中即查;与 11-16 撤掉的旧 grouped/ungrouped 无关(那两档读已停用列,控制器仍拒收)。判据:XML 两分支谓词/成对直传/classified 参数在册绊线+纯测试三档+挂载 2 例

This commit is contained in:
2026-11-17 16:58:28 +08:00
parent 20ee73349e
commit d25c91f6da
10 changed files with 220 additions and 43 deletions
@@ -122,6 +122,29 @@
WHERE a.product_id = p.id AND a.category_id = #{groupId}
)
</if>
<!-- 分类状态快筛(2026-11-17 用户口径「加个已分类和未分类的筛选」):已分类=在
「当前数据权限分组」(owner_group_id)下有 category_id 非空的归属行——与读侧
fillGroupNames 把分类列填出来的条件同形;未分类=NOT EXISTS。谓词 SQL 侧下推
(铁律 20 同形,不得 Java 侧对已取页 filter)。owner_group_id 为 NULL(作用域
无可分组)时 EXISTS 恒假、NOT EXISTS 恒真——与列表「分类列全空」口径天然一致,
不需要服务侧特判。与 2026-11-16 撤掉的旧 grouped/ungrouped 不是一回事:那两档
读的是已停用的 biz_jd_product.group_id 列,本档读 V203 归属表。 -->
<if test="classified != null">
<choose>
<when test="classified == true">
AND EXISTS (
SELECT 1 FROM biz_jd_product_group_assign cs
WHERE cs.product_id = p.id AND cs.owner_group_id = #{ownerGroupId} AND cs.category_id IS NOT NULL
)
</when>
<otherwise>
AND NOT EXISTS (
SELECT 1 FROM biz_jd_product_group_assign cs
WHERE cs.product_id = p.id AND cs.owner_group_id = #{ownerGroupId} AND cs.category_id IS NOT NULL
)
</otherwise>
</choose>
</if>
<if test="syncedFrom != null">AND p.synced_at &gt;= #{syncedFrom}</if>
<if test="syncedTo != null">AND p.synced_at &lt;= #{syncedTo}</if>
</sql>