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
c3d8ff70
Commit
c3d8ff70
authored
Apr 25, 2019
by
ranjun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user dao
parent
9f33d9f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
UserController.java
...va/com/pangding/web/tright/controller/UserController.java
+8
-0
UserDaoImpl.java
...in/java/com/pangding/web/tright/dao/impl/UserDaoImpl.java
+11
-4
UserServiceImpl.java
...com/pangding/web/tright/service/impl/UserServiceImpl.java
+2
-0
UserRoleRelation.java
...ain/java/com/pangding/web/tright/vo/UserRoleRelation.java
+3
-0
No files found.
src/main/java/com/pangding/web/tright/controller/UserController.java
View file @
c3d8ff70
...
@@ -11,7 +11,9 @@ import org.springframework.http.MediaType;
...
@@ -11,7 +11,9 @@ import org.springframework.http.MediaType;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
@RestController
@RestController
@RequestMapping
(
"/user"
)
@RequestMapping
(
"/user"
)
...
@@ -46,6 +48,12 @@ public class UserController {
...
@@ -46,6 +48,12 @@ public class UserController {
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
@RequestMapping
(
value
=
"/update"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_JSON_UTF8_VALUE
)
public
Object
updateUser
(){
//@RequestBody UserDto userDto
public
Object
updateUser
(){
//@RequestBody UserDto userDto
UserDto
userDto
=
new
UserDto
();
UserDto
userDto
=
new
UserDto
();
userDto
.
setTuId
(
11
l
);
List
<
Long
>
longs
=
new
ArrayList
<>();
longs
.
add
(
1
l
);
longs
.
add
(
11
l
);
longs
.
add
(
111
l
);
userDto
.
setRoleIds
(
longs
);
userDto
.
setUserName
(
"test11234111"
);
userDto
.
setUserName
(
"test11234111"
);
userDto
.
setPassword
(
"12345612"
);
userDto
.
setPassword
(
"12345612"
);
userDto
.
setPhoneNumber
(
"123456789110"
);
userDto
.
setPhoneNumber
(
"123456789110"
);
...
...
src/main/java/com/pangding/web/tright/dao/impl/UserDaoImpl.java
View file @
c3d8ff70
...
@@ -56,7 +56,8 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
...
@@ -56,7 +56,8 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
Table
.
add
(
GET_USER
,
"SELECT p.* FROM pd_user p WHERE 1=1 "
)
Table
.
add
(
GET_USER
,
"SELECT p.* FROM pd_user p WHERE 1=1 "
)
.
add
(
"username"
,
" AND p.user_name = ?"
);
.
add
(
"username"
,
" AND p.user_name = ?"
);
Table
.
add
(
DELETE_USER_ROLE
,
"delete from pd_user_role_relation where tu_id = ?"
);
Table
.
add
(
DELETE_USER_ROLE
,
"delete from pd_user_role_relation where 1=1"
)
.
add
(
"tu_id"
,
"and tu_id = ?"
);
}
}
...
@@ -68,14 +69,20 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
...
@@ -68,14 +69,20 @@ public class UserDaoImpl extends BaseDaoImpl implements UserDao {
@Override
@Override
public
int
deleteUserRole
(
UserRoleRelation
userRoleRelation
)
{
public
int
deleteUserRole
(
UserRoleRelation
userRoleRelation
)
{
return
this
.
updateSql
(
DELETE_USER_ROLE
,
userRoleRelation
);
userRoleRelation
.
setTru_id
(
1
l
);
if
(
userRoleRelation
.
getTu_id
()!=
null
)
{
return
this
.
updateSql
(
DELETE_USER_ROLE
,
userRoleRelation
);
}
else
{
return
0
;
}
}
}
@Override
@Override
public
int
saveUserRoles
(
List
<
UserRoleRelation
>
userRoleRelations
)
{
public
int
saveUserRoles
(
List
<
UserRoleRelation
>
userRoleRelations
)
{
//this.create(userRoleRelations);
for
(
UserRoleRelation
userRoleRelation
:
userRoleRelations
)
{
for
(
UserRoleRelation
userRoleRelation
:
userRoleRelations
)
{
this
.
creat
e
(
userRoleRelation
);
//this.sav
e(userRoleRelation);
}
}
return
userRoleRelations
.
size
()
;
return
0
;
}
}
}
}
src/main/java/com/pangding/web/tright/service/impl/UserServiceImpl.java
View file @
c3d8ff70
...
@@ -54,6 +54,8 @@ public class UserServiceImpl implements UserService {
...
@@ -54,6 +54,8 @@ public class UserServiceImpl implements UserService {
if
(
userDto
.
getRoleIds
()!=
null
&&
userDto
.
getRoleIds
().
size
()!=
0
)
{
if
(
userDto
.
getRoleIds
()!=
null
&&
userDto
.
getRoleIds
().
size
()!=
0
)
{
List
<
Long
>
longs
=
userDto
.
getRoleIds
();
//多个角色
List
<
Long
>
longs
=
userDto
.
getRoleIds
();
//多个角色
List
<
UserRoleRelation
>
userRoleRelations
=
new
ArrayList
<>();
List
<
UserRoleRelation
>
userRoleRelations
=
new
ArrayList
<>();
//查询当前用户的ID
//UserVo userVo = userDao.getUser(userDto);
for
(
Long
l
:
longs
)
{
for
(
Long
l
:
longs
)
{
UserRoleRelation
userRoleRelation
=
new
UserRoleRelation
();
UserRoleRelation
userRoleRelation
=
new
UserRoleRelation
();
userRoleRelation
.
setTr_id
(
l
);
userRoleRelation
.
setTr_id
(
l
);
...
...
src/main/java/com/pangding/web/tright/vo/UserRoleRelation.java
View file @
c3d8ff70
...
@@ -4,8 +4,11 @@ import com.yanzuoguang.dao.TableAnnotation;
...
@@ -4,8 +4,11 @@ import com.yanzuoguang.dao.TableAnnotation;
@TableAnnotation
(
"pd_user_role_relation"
)
@TableAnnotation
(
"pd_user_role_relation"
)
public
class
UserRoleRelation
{
public
class
UserRoleRelation
{
@TableAnnotation
(
"tru_id"
)
private
Long
tru_id
;
private
Long
tru_id
;
@TableAnnotation
(
"tr_id"
)
private
Long
tr_id
;
private
Long
tr_id
;
@TableAnnotation
(
"tu_id"
)
private
Long
tu_id
;
private
Long
tu_id
;
public
Long
getTru_id
()
{
public
Long
getTru_id
()
{
...
...
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