Procházet zdrojové kódy

商品类型查询树结构时 数据库存在垃圾数据报错问题

zjy před 2 měsíci
rodič
revize
309a875954

+ 16 - 15
alien-entity/src/main/resources/mapper/second/SecondGoodsCategoryMapper.xml

@@ -52,24 +52,25 @@
     <!-- 根据上级ID查询二手商品类别表 -->
     <select id="querySecondGoodsInfo" resultType="shop.alien.entity.second.SecondGoodsCategory">
         SELECT
-        id,
-        category_name,
-        category_url,
-        parent_id,
-        delete_flag,
-        created_time,
-        created_user_id,
-        updated_time,
-        updated_user_id,
-        category_sort,
-        case when category_state = 0 then '显示'
-        when category_state = 1 then '隐藏'
-        else '未知'
-        end as category_state
+            id,
+            category_name,
+            category_url,
+            parent_id,
+            delete_flag,
+            created_time,
+            created_user_id,
+            updated_time,
+            updated_user_id,
+            category_sort,
+            case when category_state = 0 then '显示'
+            when category_state = 1 then '隐藏'
+            else '未知'
+            end as category_state
         FROM
         second_goods_category
         WHERE
-        delete_flag = 0
+            delete_flag = 0
+            and parent_id is not null and parent_id != ''
         ORDER BY category_sort, created_time
     </select>
 </mapper>