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
8a831229
Commit
8a831229
authored
Apr 19, 2019
by
qiankunpingtai
Browse files
异常封装之关联关系信息后台修改
parent
bcc3ae4e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/controller/UserBusinessController.java
View file @
8a831229
...
...
@@ -36,7 +36,7 @@ public class UserBusinessController {
@GetMapping
(
value
=
"/getBasicData"
)
public
BaseResponseInfo
getBasicData
(
@RequestParam
(
value
=
"KeyId"
)
String
keyId
,
@RequestParam
(
value
=
"Type"
)
String
type
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
List
<
UserBusiness
>
list
=
userBusinessService
.
getBasicData
(
keyId
,
type
);
...
...
@@ -55,7 +55,7 @@ public class UserBusinessController {
@GetMapping
(
value
=
"/checkIsValueExist"
)
public
String
checkIsValueExist
(
@RequestParam
(
value
=
"type"
,
required
=
false
)
String
type
,
@RequestParam
(
value
=
"keyId"
,
required
=
false
)
String
keyId
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
Long
id
=
userBusinessService
.
checkIsValueExist
(
type
,
keyId
);
if
(
id
!=
null
)
{
...
...
@@ -76,7 +76,7 @@ public class UserBusinessController {
@PostMapping
(
value
=
"/updateBtnStr"
)
public
BaseResponseInfo
updateBtnStr
(
@RequestParam
(
value
=
"userBusinessId"
,
required
=
false
)
Long
userBusinessId
,
@RequestParam
(
value
=
"btnStr"
,
required
=
false
)
String
btnStr
,
HttpServletRequest
request
)
{
HttpServletRequest
request
)
throws
Exception
{
BaseResponseInfo
res
=
new
BaseResponseInfo
();
try
{
int
back
=
userBusinessService
.
updateBtnStr
(
userBusinessId
,
btnStr
);
...
...
src/main/java/com/jsh/erp/service/userBusiness/UserBusinessComponent.java
View file @
8a831229
...
...
@@ -22,21 +22,21 @@ public class UserBusinessComponent implements ICommonQuery {
private
UserBusinessService
userBusinessService
;
@Override
public
Object
selectOne
(
String
condition
)
{
public
Object
selectOne
(
String
condition
)
throws
Exception
{
return
null
;
}
@Override
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
{
public
List
<?>
select
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
getUserBusinessList
(
map
);
}
private
List
<?>
getUserBusinessList
(
Map
<
String
,
String
>
map
)
{
private
List
<?>
getUserBusinessList
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
null
;
}
@Override
public
Long
counts
(
Map
<
String
,
String
>
map
)
{
public
Long
counts
(
Map
<
String
,
String
>
map
)
throws
Exception
{
return
BusinessConstants
.
DEFAULT_LIST_NULL_NUMBER
;
}
...
...
@@ -51,17 +51,17 @@ public class UserBusinessComponent implements ICommonQuery {
}
@Override
public
int
delete
(
Long
id
)
{
public
int
delete
(
Long
id
)
throws
Exception
{
return
userBusinessService
.
deleteUserBusiness
(
id
);
}
@Override
public
int
batchDelete
(
String
ids
)
{
public
int
batchDelete
(
String
ids
)
throws
Exception
{
return
userBusinessService
.
batchDeleteUserBusiness
(
ids
);
}
@Override
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
userBusinessService
.
checkIsNameExist
(
id
,
name
);
}
...
...
src/main/java/com/jsh/erp/service/userBusiness/UserBusinessService.java
View file @
8a831229
...
...
@@ -2,16 +2,14 @@ package com.jsh.erp.service.userBusiness;
import
com.alibaba.fastjson.JSONObject
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.App
;
import
com.jsh.erp.datasource.entities.Functions
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.datasource.entities.UserBusiness
;
import
com.jsh.erp.datasource.entities.UserBusinessExample
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.mappers.UserBusinessMapper
;
import
com.jsh.erp.datasource.mappers.UserBusinessMapperEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.CommonQueryManager
;
import
com.jsh.erp.service.app.AppService
;
import
com.jsh.erp.service.functions.FunctionsService
;
import
com.jsh.erp.datasource.mappers.UserBusinessMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
...
...
@@ -25,11 +23,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.*
;
@Service
public
class
UserBusinessService
{
...
...
@@ -53,77 +47,145 @@ public class UserBusinessService {
@Resource
private
CommonQueryManager
configResourceManager
;
public
UserBusiness
getUserBusiness
(
long
id
)
{
return
userBusinessMapper
.
selectByPrimaryKey
(
id
);
public
UserBusiness
getUserBusiness
(
long
id
)
throws
Exception
{
UserBusiness
result
=
null
;
try
{
result
=
userBusinessMapper
.
selectByPrimaryKey
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
result
;
}
public
List
<
UserBusiness
>
getUserBusiness
()
{
public
List
<
UserBusiness
>
getUserBusiness
()
throws
Exception
{
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
return
userBusinessMapper
.
selectByExample
(
example
);
List
<
UserBusiness
>
list
=
null
;
try
{
list
=
userBusinessMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
insertUserBusiness
(
String
beanJson
,
HttpServletRequest
request
)
throws
Exception
{
UserBusiness
userBusiness
=
JSONObject
.
parseObject
(
beanJson
,
UserBusiness
.
class
);
int
inserts
=
userBusinessMapper
.
insertSelective
(
userBusiness
);
int
result
=
0
;
try
{
result
=
userBusinessMapper
.
insertSelective
(
userBusiness
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
// 更新应用权限
if
(
BusinessConstants
.
TYPE_NAME_ROLE_FUNCTIONS
.
equals
(
userBusiness
.
getType
())
&&
inserts
>
0
)
{
inserts
=
insertOrUpdateAppValue
(
BusinessConstants
.
TYPE_NAME_ROLE_APP
,
userBusiness
.
getKeyid
(),
userBusiness
.
getValue
());
if
(
BusinessConstants
.
TYPE_NAME_ROLE_FUNCTIONS
.
equals
(
userBusiness
.
getType
())
&&
result
>
0
)
{
result
=
insertOrUpdateAppValue
(
BusinessConstants
.
TYPE_NAME_ROLE_APP
,
userBusiness
.
getKeyid
(),
userBusiness
.
getValue
());
}
return
inserts
;
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
updateUserBusiness
(
String
beanJson
,
Long
id
)
throws
Exception
{
UserBusiness
userBusiness
=
JSONObject
.
parseObject
(
beanJson
,
UserBusiness
.
class
);
userBusiness
.
setId
(
id
);
int
updates
=
userBusinessMapper
.
updateByPrimaryKeySelective
(
userBusiness
);
int
result
=
0
;
try
{
result
=
userBusinessMapper
.
updateByPrimaryKeySelective
(
userBusiness
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
// 更新应用权限
if
(
BusinessConstants
.
TYPE_NAME_ROLE_FUNCTIONS
.
equals
(
userBusiness
.
getType
())
&&
updates
>
0
)
{
updates
=
insertOrUpdateAppValue
(
BusinessConstants
.
TYPE_NAME_ROLE_APP
,
userBusiness
.
getKeyid
(),
userBusiness
.
getValue
());
if
(
BusinessConstants
.
TYPE_NAME_ROLE_FUNCTIONS
.
equals
(
userBusiness
.
getType
())
&&
result
>
0
)
{
result
=
insertOrUpdateAppValue
(
BusinessConstants
.
TYPE_NAME_ROLE_APP
,
userBusiness
.
getKeyid
(),
userBusiness
.
getValue
());
}
return
updates
;
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
deleteUserBusiness
(
Long
id
)
{
return
userBusinessMapper
.
deleteByPrimaryKey
(
id
);
public
int
deleteUserBusiness
(
Long
id
)
throws
Exception
{
int
result
=
0
;
try
{
result
=
userBusinessMapper
.
deleteByPrimaryKey
(
id
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteUserBusiness
(
String
ids
)
{
public
int
batchDeleteUserBusiness
(
String
ids
)
throws
Exception
{
List
<
Long
>
idList
=
StringUtil
.
strToLongList
(
ids
);
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andIdIn
(
idList
);
return
userBusinessMapper
.
deleteByExample
(
example
);
int
result
=
0
;
try
{
result
=
userBusinessMapper
.
deleteByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
public
int
checkIsNameExist
(
Long
id
,
String
name
)
{
public
int
checkIsNameExist
(
Long
id
,
String
name
)
throws
Exception
{
return
1
;
}
public
List
<
UserBusiness
>
getBasicData
(
String
keyId
,
String
type
){
public
List
<
UserBusiness
>
getBasicData
(
String
keyId
,
String
type
)
throws
Exception
{
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andKeyidEqualTo
(
keyId
).
andTypeEqualTo
(
type
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
UserBusiness
>
list
=
userBusinessMapper
.
selectByExample
(
example
);
List
<
UserBusiness
>
list
=
null
;
try
{
list
=
userBusinessMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
Long
checkIsValueExist
(
String
type
,
String
keyId
)
{
public
Long
checkIsValueExist
(
String
type
,
String
keyId
)
throws
Exception
{
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andTypeEqualTo
(
type
).
andKeyidEqualTo
(
keyId
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
UserBusiness
>
list
=
userBusinessMapper
.
selectByExample
(
example
);
List
<
UserBusiness
>
list
=
null
;
try
{
list
=
userBusinessMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
Long
id
=
null
;
if
(
list
.
size
()
>
0
)
{
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
id
=
list
.
get
(
0
).
getId
();
}
return
id
;
}
public
Boolean
checkIsUserBusinessExist
(
String
TypeVale
,
String
KeyIdValue
,
String
UBValue
)
{
public
Boolean
checkIsUserBusinessExist
(
String
TypeVale
,
String
KeyIdValue
,
String
UBValue
)
throws
Exception
{
UserBusinessExample
example
=
new
UserBusinessExample
();
String
newVaule
=
"%"
+
UBValue
+
"%"
;
if
(
TypeVale
!=
null
&&
KeyIdValue
!=
null
)
{
...
...
@@ -133,8 +195,16 @@ public class UserBusinessService {
example
.
createCriteria
().
andValueLike
(
newVaule
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
}
List
<
UserBusiness
>
list
=
userBusinessMapper
.
selectByExample
(
example
);
if
(
list
.
size
()
>
0
)
{
List
<
UserBusiness
>
list
=
null
;
try
{
list
=
userBusinessMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
if
(
list
!=
null
&&
list
.
size
()
>
0
)
{
return
true
;
}
else
{
return
false
;
...
...
@@ -150,23 +220,48 @@ public class UserBusinessService {
userBusiness
.
setBtnstr
(
btnStr
);
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andIdEqualTo
(
userBusinessId
);
return
userBusinessMapper
.
updateByExampleSelective
(
userBusiness
,
example
);
int
result
=
0
;
try
{
result
=
userBusinessMapper
.
updateByExampleSelective
(
userBusiness
,
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
public
List
<
UserBusiness
>
findRoleByUserId
(
String
userId
){
public
List
<
UserBusiness
>
findRoleByUserId
(
String
userId
)
throws
Exception
{
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andKeyidEqualTo
(
userId
).
andTypeEqualTo
(
"UserRole"
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
UserBusiness
>
list
=
userBusinessMapper
.
selectByExample
(
example
);
List
<
UserBusiness
>
list
=
null
;
try
{
list
=
userBusinessMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
public
List
<
UserBusiness
>
findAppByRoles
(
String
roles
){
public
List
<
UserBusiness
>
findAppByRoles
(
String
roles
)
throws
Exception
{
List
<
String
>
rolesList
=
StringUtil
.
strToStringList
(
roles
);
UserBusinessExample
example
=
new
UserBusinessExample
();
example
.
createCriteria
().
andKeyidIn
(
rolesList
).
andTypeEqualTo
(
"RoleAPP"
)
.
andDeleteFlagNotEqualTo
(
BusinessConstants
.
DELETE_FLAG_DELETED
);
List
<
UserBusiness
>
list
=
userBusinessMapper
.
selectByExample
(
example
);
List
<
UserBusiness
>
list
=
null
;
try
{
list
=
userBusinessMapper
.
selectByExample
(
example
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_READ_FAIL_CODE
,
ExceptionConstants
.
DATA_READ_FAIL_MSG
);
}
return
list
;
}
...
...
@@ -177,7 +272,16 @@ public class UserBusinessService {
((
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
()).
getRequest
());
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
return
userBusinessMapperEx
.
batchDeleteUserBusinessByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
int
result
=
0
;
try
{
result
=
userBusinessMapperEx
.
batchDeleteUserBusinessByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
return
result
;
}
/**
...
...
@@ -188,48 +292,45 @@ public class UserBusinessService {
* @return
*/
public
int
insertOrUpdateAppValue
(
String
type
,
String
keyId
,
String
functionIds
)
throws
Exception
{
int
updates
=
0
;
int
result
=
0
;
functionIds
=
functionIds
.
replaceAll
(
"\\]\\["
,
","
).
replaceAll
(
"\\["
,
""
).
replaceAll
(
"\\]"
,
""
);
List
<
Functions
>
functionsList
=
functionsService
.
findByIds
(
functionIds
);
if
(!
CollectionUtils
.
isEmpty
(
functionsList
))
{
Set
<
String
>
appNumbers
=
new
HashSet
<>();
String
appNumber
;
for
(
Functions
functions
:
functionsList
)
{
appNumber
=
functions
.
getNumber
().
substring
(
0
,
2
);
appNumbers
.
add
(
appNumber
);
}
List
<
String
>
appNumberList
=
new
ArrayList
<>(
appNumbers
);
List
<
App
>
appList
=
appService
.
findAppByNumber
(
appNumberList
);
StringBuilder
appIdSb
=
new
StringBuilder
();
if
(!
CollectionUtils
.
isEmpty
(
appList
))
{
for
(
App
app
:
appList
)
{
appIdSb
.
append
(
"["
+
app
.
getId
()
+
"]"
);
}
List
<
UserBusiness
>
userBusinessList
=
getBasicData
(
keyId
,
type
);
if
(
userBusinessList
.
size
()
>
0
)
{
UserBusiness
userBusiness
=
userBusinessList
.
get
(
0
);
userBusiness
.
setValue
(
appIdSb
.
toString
());
updates
=
userBusinessMapper
.
updateByPrimaryKeySelective
(
userBusiness
);
}
else
{
UserBusiness
userBusiness
=
new
UserBusiness
();
userBusiness
.
setType
(
type
);
userBusiness
.
setKeyid
(
keyId
);
userBusiness
.
setValue
(
appIdSb
.
toString
());
updates
=
userBusinessMapper
.
insertSelective
(
userBusiness
);
try
{
if
(
userBusinessList
.
size
()
>
0
)
{
UserBusiness
userBusiness
=
userBusinessList
.
get
(
0
);
userBusiness
.
setValue
(
appIdSb
.
toString
());
result
=
userBusinessMapper
.
updateByPrimaryKeySelective
(
userBusiness
);
}
else
{
UserBusiness
userBusiness
=
new
UserBusiness
();
userBusiness
.
setType
(
type
);
userBusiness
.
setKeyid
(
keyId
);
userBusiness
.
setValue
(
appIdSb
.
toString
());
result
=
userBusinessMapper
.
insertSelective
(
userBusiness
);
}
}
catch
(
Exception
e
){
logger
.
error
(
"异常码[{}],异常提示[{}],异常[{}]"
,
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
,
e
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DATA_WRITE_FAIL_CODE
,
ExceptionConstants
.
DATA_WRITE_FAIL_MSG
);
}
}
}
return
updates
;
return
result
;
}
}
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