Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
tcm-system
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TCM
tcm-system
Commits
5ba6bd1c
Commit
5ba6bd1c
authored
May 10, 2019
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
审核代码
parent
caa8b215
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
10 deletions
+19
-10
readme.md
readme.md
+19
-10
No files found.
readme.md
View file @
5ba6bd1c
# 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
.
add
Exist
(
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 = ?"
)
...
...
@@ -126,3 +125,13 @@ 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment