package jnpf.dmsMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import jnpf.dmsEntity.print.DmsPrintOperationLogEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; @Mapper public interface DmsPrintOperationLogMapper extends BaseMapper { @Select("SELECT NULLIF(btrim(f_full_name), '') FROM public.base_module " + "WHERE f_id = #{menuId} AND (f_delete_mark IS NULL OR f_delete_mark <> 1) LIMIT 1") String selectMenuNameById(@Param("menuId") String menuId); @Select("WITH RECURSIVE ancestors AS (" + " SELECT f_id, f_parent_id, f_system_id, f_category, f_type," + " f_is_parent_biz_module, f_full_name, 0 AS depth FROM public.base_module" + " WHERE f_id = #{menuId} AND f_enabled_mark = 1" + " AND (f_delete_mark IS NULL OR f_delete_mark <> 1)" + " UNION ALL" + " SELECT parent.f_id, parent.f_parent_id, parent.f_system_id, parent.f_category," + " parent.f_type, parent.f_is_parent_biz_module, parent.f_full_name, child.depth + 1" + " FROM ancestors child JOIN public.base_module parent ON parent.f_id = child.f_parent_id" + " AND parent.f_system_id = child.f_system_id AND parent.f_category = child.f_category" + " WHERE child.depth < 32 AND parent.f_enabled_mark = 1" + " AND (parent.f_delete_mark IS NULL OR parent.f_delete_mark <> 1)" + ") SELECT LEFT(NULLIF(btrim(f_full_name), ''), 200) FROM ancestors" + " WHERE depth > 0 AND f_type = 1 AND f_is_parent_biz_module = 1" + " AND f_id = #{parentId} AND depth = (SELECT MIN(depth) FROM ancestors" + " WHERE depth > 0 AND f_type = 1 AND f_is_parent_biz_module = 1) LIMIT 1") String selectParentBizModuleName(@Param("menuId") String menuId, @Param("parentId") String parentId); }