Neo
  • 简介
  • 一、数据库连接
  • ​二、基本功能
    • 增加
    • 删除
    • 修改
    • 查询
    • 其他查询
  • 三、结构信息
  • 四、批量功能
  • 五、NeoMap类
    • NeoMap初始化
    • NeoMap和JavaBean转换
    • NeoMap和NeoMap转换
    • 其他功能
  • 六、命名转换
  • 七、Columns类
  • 八、单机事务
  • 九、sql监控
  • 十、主从
  • 十一、join
  • 十二、实体代码生成器
  • 十三、sql特殊处理
  • 十四、分布式
    • 全局id
    • 分布式锁
    • 分布式事务(待开发)
  • 十五、动态分库分表(待开发)
  • 十六、多数据源(待开发)
    • sqlLite
    • PostGresql
  • 十七、设计说明
  • 十八、版本记录
Powered by GitBook
On this page
  • 1.sql模糊查询
  • 2.sql大小比较查询

Was this helpful?

十三、sql特殊处理

对于sql里面增加了一些特殊处理,模糊搜索和大小比较。

1.sql模糊查询

在值中前面添加"like "即可,比如

/**
 * 查询大小匹配的查询
 * 条件通过NeoMap设置
 * 相当于:select `group`, `name` from neo_table1 where `group` like 'group%'
 */
@Test
@SneakyThrows
public void testList10(){
  // select `group`, `name` from neo_table1 where `group` like 'group%'
  show(neo.list(TABLE_NAME, Columns.of("group", "name"), NeoMap.of("group", "like group")));
}

2.sql大小比较查询

在值中前面添加比较符号即可,比如

/**
 * 查询大小匹配的查询
 * 条件通过NeoMap设置
 * 相当于:select `group`,`name` from neo_table1 where `name` < 'name' limit 1
 */
@Test
@SneakyThrows
public void testList9(){
  // select `group`, `name` from neo_table1 where `name` < ? ], {params => [name]
  show(neo.list(TABLE_NAME, Columns.of("group", "name"), NeoMap.of("name", "< name")));
  // select `group`, `name` from neo_table1 where `name` < ? ], {params => ['name']
  show(neo.list(TABLE_NAME, Columns.of("group", "name"), NeoMap.of("name", "< 'name'")));
  // select `group`, `name` from neo_table1 where `name` <= ? ], {params => [name']
  show(neo.list(TABLE_NAME, Columns.of("group", "name"), NeoMap.of("name", "<= name'")));
  // select `group`, `name` from neo_table1 where `name` > ? ], {params => ['name']
  show(neo.list(TABLE_NAME, Columns.of("group", "name"), NeoMap.of("name", "> 'name'")));
  // select `group`, `name` from neo_table1 where `name` >= ? ], {params => ['name']
  show(neo.list(TABLE_NAME, Columns.of("group", "name"), NeoMap.of("name", ">= 'name'")));
}
Previous十二、实体代码生成器Next十四、分布式

Last updated 5 years ago

Was this helpful?