Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

添加注解避免不安全的分页 #787

Open
1 task done
sc-xy opened this issue Dec 12, 2023 · 1 comment
Open
1 task done

添加注解避免不安全的分页 #787

sc-xy opened this issue Dec 12, 2023 · 1 comment

Comments

@sc-xy
Copy link

sc-xy commented Dec 12, 2023

  • 我已在 issues 搜索类似问题,并且不存在相同的问题.

功能建议

PageHelper.startPage(1, 10);
List<User> list;
if(param1 != null){
    list = userMapper.selectIf(param1);
} else {
    list = new ArrayList<User>();
}

不安全的分页是因为调用了静态方法,能否新增一个注解例如@StartPage使其定义在mapper的方法上

@StartPage
@Select("select * from user")
PageInfo<User> selectByStartPage(PageInfo pageinfo);

调用方法类似于

PageInfo<User> users;
if(param1 != null){
    users = userMapper.selectByStartPage(new PageInfo(@Param("pageNum") pageNum, @Param("pageSize") pageSize));
} else {
    users = new PageInfo<User>();
}
@abel533
Copy link
Collaborator

abel533 commented Dec 12, 2023

支持方法参数查询,这种方式更安全,不需要加注解。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants