查询关键字
| 关键字 | 例子 | sql |
|---|---|---|
| and | findByNameAndAddress | Where s.name = ?1 And s.address= ?2 |
| Or | findByNameOrAddress | Where s.name = ?1 Or s.address= ?2 |
| Like | findByNameLike | Where s.name like ? 1 |
| NotLike | findByNameNotLike | Where s.name not like ?1 |
| Between | findByAgeBetween | Where s.age between ?1 and ?2 |
| LessThan | findByAgeLessThan | Where s.age < ?1 |
| LessThanEqual | findByAgeLessThanEqual | Where s.age <= ?1 |
| GreaterThan | findByAgeGreaterThan | Where s.age > ?1 |
| GreaterThanEqual | findByAgeGreaterThanEqual | Where s.age >= ?1 |
| OrderBy | findSexOrderByAgeDesc | Where s.sex=?1 order by s.agedesc |
| In | findByAgeIn(Collectionages) | Where s.age in ?1 |
| IsNull | findByAgeIsNull | Where s.age is null |
| After | findByStartDateAfter | Where s.startDate > ?1 |
| Before | findByStartDateBefore | Where s.startDate < ?1 |
创建一个Maven项目,名字自己取
1)File>New>project>Spring Initializr>Next
在上图中选择 Web,之后再点击 SQL,然后再点击 Next 按扭,设置项目保存
目录,然后 Finish。