数据库->dao->service->controller 这样链式调用那么我们可以将接口名称保持一致
当然不止在这种场景可以使用在很多场景下都可以…
这样可阅读性非常好,通过接口名称就能知道整体干了啥事情…,然后后期的扩展维护也
Assign : 是查询指定列的时候使用,查询全部的时候可以省略
查询指定一个列: Assign{列}
查询多个列: AssignMap
Map代表显示多个指定列 ,或者使用Dto
名称 | 介绍 | 返回类型 |
---|---|---|
getStudentAll | 查询Student表显示全部数据和字段 | List<Object> |
getStudentAssignName | 查询Student表只显示name列 | List<String> |
getStudentAssignNameOne | 查询Student表只显示name列 | String |
getStudentAssignMap | 查询Student表多个字段 | List<Map<String, Object>> |
getStudentAssignMapOne | 查询Student表多个字段 | Map<String, Object> |
getStudentAssignMapByAge | 查询Student表多个字段,赛选条件是age=age | List<Map<String, Object>> |
getStudentById | 查询Student表显示全部字段,赛选条件是id=id | Object |
getStudentByNameAndAge | 查询Student表显示全部字段,赛选条件是id=id and name=name | Object |
可以使用的赛选关键字:
关键字 | 方法名 | sql |
---|---|---|
And | get{表名}ByNameAndPwd | where name= ? and pwd =? |
Or | get{表名}ByNameOrSex | where name= ? or sex=? |
Equals | get{表名}ByIdEquals | where id= ? |
Between | get{表名}ByIdBetween | where id between ? and ? |
LessThan | get{表名}IdLessThan | where id < ? |
LessThanEquals | get{表名}ByIdLessThanEquals | where id <= ? |
GreaterThan | get{表名}ByIdGreaterThan | where id > ? |
GreaterThanEquals | get{表名}ByIdGreaterThanEquals | where id > = ? |
After | get{表名}ByIdAfter | where id > ? |
Before | get{表名}ByIdBefore | where id < ? |
IsNull | get{表名}ByNameIsNull | where name is null |
isNotNull,NotNull | get{表名}ByNameNotNull | where name is not null |
Like | get{表名}ByNameLike | where name like ? |
NotLike | get{表名}ByNameNotLike | where name not like ? |
StartingWith | get{表名}ByNameStartingWith | where name like ‘?%’ |
EndingWith | get{表名}ByNameEndingWith | where name like ‘%?’ |
Containing | get{表名}ByNameContaining | where name like ‘%?%’ |
OrderBy | get{表名}ByIdOrderByXDesc | where id=? order by x desc |
Not | get{表名}ByNameNot | where name <> ? |
In | get{表名}ByIdIn(Collection<?> c) | where id in (?) |
NotIn | get{表名}ByIdNotIn(Collection<?> c) | where id not in (?) |
TRUE | get{表名}ByAaaTue | where aaa = true |
FALSE | get{表名}ByAaaFalse | where aaa = false |
IgnoreCase | get{表名}ByNameIgnoreCase | where UPPER(name)=UPPER(?) |
添加这个就比较简单了,来回也就几种
关键字 | 介绍 | 方法名 |
---|---|---|
add | 添加一行 | add{表名} |
batchAdd | 添加多行 | batchAdd(表名) |
名称 | 介绍 | SQL |
---|---|---|
del{表名}ById | 删除指定ID数据 | delete from 表 where id=id |
batchDel{表名}ByAge | 删除指定Age数据 | delete from 表 where age>10 |
batchDel{表名}All | 删除全部 | delete from 表 |
赛选的关键字可以参考查询
名称 | 介绍 | SQL |
---|---|---|
alter{表名}ById | 修改指定ID数据 | delete from 表 where id=id |
alter{表名}ByAge | 删除多个 | delete from 表 where age>10 |
赛选的关键字可以参考查询,修改的具体内容依据do
版权说明 : 本文为转载文章, 版权归原作者所有 版权申明
原文链接 : https://blog.csdn.net/weixin_45203607/article/details/120238523
内容来源于网络,如有侵权,请联系作者删除!