Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
JSH ERP
Commits
e692ae77
Commit
e692ae77
authored
Dec 29, 2019
by
季圣华
Browse files
解决用户无法注册的bug
parent
b1a48f81
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/service/user/UserService.java
View file @
e692ae77
...
...
@@ -307,6 +307,23 @@ public class UserService {
}
return
list
;
}
/**
* 根据用户名查询id
* @param loginName
* @return
*/
public
Long
getIdByLoginName
(
String
loginName
)
{
Long
userId
=
0L
;
UserExample
example
=
new
UserExample
();
example
.
createCriteria
().
andLoginameEqualTo
(
loginName
);
List
<
User
>
list
=
userMapper
.
selectByExample
(
example
);
if
(
list
!=
null
)
{
userId
=
list
.
get
(
0
).
getId
();
}
return
userId
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
void
addUserAndOrgUserRel
(
UserEx
ue
)
throws
Exception
{
if
(
BusinessConstants
.
DEFAULT_MANAGER
.
equals
(
ue
.
getLoginame
()))
{
...
...
@@ -335,13 +352,8 @@ public class UserService {
//机构id
oul
.
setOrgaId
(
ue
.
getOrgaId
());
//用户id,根据用户名查询id
UserExample
example
=
new
UserExample
();
example
.
createCriteria
().
andLoginameEqualTo
(
ue
.
getLoginame
());
List
<
User
>
list
=
userMapper
.
selectByExample
(
example
);
if
(
list
!=
null
)
{
Long
userId
=
list
.
get
(
0
).
getId
();
oul
.
setUserId
(
userId
);
}
Long
userId
=
getIdByLoginName
(
ue
.
getLoginame
());
oul
.
setUserId
(
userId
);
//用户在机构中的排序
oul
.
setUserBlngOrgaDsplSeq
(
ue
.
getUserBlngOrgaDsplSeq
());
...
...
@@ -403,6 +415,8 @@ public class UserService {
int
result
=
0
;
try
{
result
=
userMapper
.
insertSelective
(
ue
);
Long
userId
=
getIdByLoginName
(
ue
.
getLoginame
());
ue
.
setId
(
userId
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
...
...
Write
Preview
Supports
Markdown
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