Commit 5ba6bd1c authored by Administrator's avatar Administrator

审核代码

parent caa8b215
# SQL语句没有空格
"where 1=1"后面增加空格改成"where 1=1 ",要不然后面的and会导致错误
# 参数请符合实体,而不是单独的参数,专注于参数内容,专注于参数顺序
``` java
Table.add(CHECK_VALID,"select count(a.id) from pd_authority a where 1=1")
.add("name","and a.name = ?")
.add("url","and a.url = ?")
.add("id","and a.id <> ?");
{
id: "1"
}
```
# 参数请符合实体,而不是单独的参数
如:
```java
public List<String> getRoleTrightPKListByRoleId(String roleId) {
......@@ -46,7 +42,9 @@ table.add(CHECK_NAME_EXIST,"select count(r.id) from pd_role r where 1=1 ")
table.addExist(CHECK_NAME_EXIST,"name");
```
调用时
``` java
this.checkExist(CHECK_NAME_EXIST,roleVo,"橘色名称已经存在");
```
# 请确定语句主表,比如说和 pd_role_authority表和pd_authority表的查询,请另外新建dao层,符合三层架构规范
``` java
......@@ -84,7 +82,7 @@ table.add(GET_ROLE_TRIGHT_PKLIST_BY_ROLEID,"select id from pd_role_authority whe
```
改为:
``` java
table.add(CHECK_VALID,"name","url");
table.addExist(CHECK_VALID,"name","url");
```
# 将如下SQL语句合并
......@@ -103,6 +101,7 @@ table.add(GET_CHILDID_LIST,"select id from pd_authority where 1=1 ")
.add("id","and pid = ?");
```
如:
is null, is not null , ifnull(field,'')=''
```java
table.add(GET_TRIGHT_BY_ID,"select * from pd_authority where 1=1 ")
.add("id","and id = ?")
......@@ -125,4 +124,14 @@ table.add(GET_USER_BY_ID,"select id,account,phone,status,remark,create_time,crea
table.add(GET_ROLE_BY_ROLEID,"select name from pd_role where 1=1 ")
.add("roleId","and id = ?");
```
# 如下语句可以删除
``` java
table.add(DELETE_USER_ROLE,"delete from pd_user_role_relation where 1=1 ")
.add("userId","and user_id = ?");
```
直接调用:
```
dao.remove({userId:"1"})
```
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment