123456789101112131415161718192021222324252627282930313233 |
- /*
- * 爱组搭 http://aizuda.com 低代码组件化开发平台
- * ------------------------------------------
- * 受知识产权保护,请勿删除版权申明
- */
- package com.aizuda.boot.system.mapper;
- import com.aizuda.service.mapper.CrudMapper;
- import com.aizuda.boot.system.entity.SysDepartment;
- import org.apache.ibatis.annotations.Mapper;
- import org.apache.ibatis.annotations.Param;
- import org.apache.ibatis.annotations.Select;
- import java.util.List;
- /**
- * <p>
- * 部门 Mapper 接口
- * </p>
- *
- * @author 青苗
- * @since 2021-11-07
- */
- @Mapper
- public interface SysDepartmentMapper extends CrudMapper<SysDepartment> {
- /**
- * 根据 id 递归子类集合
- */
- @Select("WITH RECURSIVE r AS (SELECT id FROM sys_department WHERE id=#{id} UNION ALL SELECT c.id FROM sys_department c JOIN r ON c.pid=r.id) SELECT id FROM r")
- List<Long> selectIdsRecursive(@Param("id") Long id);
- }
|