Skip to content

游标cursor查询(query cursor)

Mapper 内置方法

  • cursor(Where):动态条件,游标查询

动态where查询

java
public class Demo {
    @Autowired
    private SysUserMapper sysUserMapper;
    
    public void cursor() {
        Cursor<SysUser> cursor= sysUserMapper.cursor(where->{
           where.like(SysUser::getUserName,"abc");
       });
    }
}

基于QueryChain(强大)

可构建复杂的场景 链路查询 - QueryChain

java
public class Demo {
    @Autowired
    private SysUserMapper sysUserMapper;

    public void cursor() {
        Cursor<SysUser> cursor= QueryChain.of(sysUserMapper)
                .like(SysUser::getUserName,"abc")
                .limit(10)
                .cursor();
    }
}