diff --git a/mall-pms/pms-boot/src/main/resources/mapper/CategoryMapper.xml b/mall-pms/pms-boot/src/main/resources/mapper/CategoryMapper.xml new file mode 100644 index 000000000..dbdf04cfe --- /dev/null +++ b/mall-pms/pms-boot/src/main/resources/mapper/CategoryMapper.xml @@ -0,0 +1,25 @@ + + + + + + + WITH RECURSIVE subcategories AS ( + SELECT + id + FROM + pms_category + WHERE + id = #{categoryId} + UNION ALL + · SELECT + c.id + FROM + pms_category c + JOIN subcategories sc ON c.parent_id = sc.id + ) UPDATE pms_category + SET is_deleted = 1 + WHERE + id IN ( SELECT id FROM subcategories) + +