Skip to content

[Bug] [File Manage] queryResourcePaging : An error occurs when an authorized user accesses a resource #6854

@sqxiayaoshun

Description

@sqxiayaoshun

Search before asking

  • I had searched in the issues and found no similar issues.

What happened

There is an error in ResourceMapper.xml (line:66)

This will cause authorized users not to read the file list;

What you expected to happen

An unnecessary ”and“ was written

logs:

Caused by: com.baomidou.mybatisplus.core.exceptions.MybatisPlusException: Error: Method queryTotal execution error of sql :
SELECT COUNT(1) FROM ( select

   d.id, d.alias, d.file_name, d.description, d.user_id, d.type, d.size, d.create_time, d.update_time,
   d.pid, d.full_name, d.is_directory

    from t_ds_resources d
    where d.type=? and d.pid=?

        and (

            and d.id in
             (
                ?
             ,
                ?
             ) or

        d.user_id=? )


    order by d.update_time desc ) TOTAL

    at com.baomidou.mybatisplus.core.toolkit.ExceptionUtils.mpe(ExceptionUtils.java:39)
    at com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor.queryTotal(PaginationInterceptor.java:248)
    at com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor.intercept(PaginationInterceptor.java:202)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61)
    at com.sun.proxy.$Proxy182.prepare(Unknown Source)
    at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.prepareStatement(MybatisSimpleExecutor.java:94)
    at com.baomidou.mybatisplus.core.executor.MybatisSimpleExecutor.doQuery(MybatisSimpleExecutor.java:66)
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:324)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:136)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:147)
    ... 110 common frames omitted

How to reproduce

Use the super/root/admin account to create a folder and file, and then authorize it to ordinary users. When ordinary users view it, there will be no data, and the above error will appear in the log file.

Anything else

No response

Version

2.0.0-alpha

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Waiting for replyWaiting for replybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions