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
e5dcaef9
Commit
e5dcaef9
authored
Dec 23, 2018
by
季圣华
Browse files
修复不能设置账户默认值的bug
parent
2ff7c900
Changes
3
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/manage/account.html
View file @
e5dcaef9
...
...
@@ -321,24 +321,21 @@
function
setDefault
(
accountID
,
isDefault
)
{
$
.
ajax
({
type
:
"
post
"
,
url
:
"
/account/updateAmountIsDefault
.action
"
,
url
:
"
/account/updateAmountIsDefault
"
,
dataType
:
"
json
"
,
async
:
false
,
data
:
({
A
ccountI
D
:
accountID
,
I
sDefault
:
isDefault
a
ccountI
d
:
accountID
,
i
sDefault
:
isDefault
}),
success
:
function
(
res
)
{
if
(
res
==
"
true
"
&&
isDefault
)
{
}
else
{
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
删除
提示
'
,
'
删除结算
账户异常,请稍后再试!
'
,
'
error
'
);
$
.
messager
.
alert
(
'
提示
'
,
'
设为默认
账户异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
...
...
src/main/java/com/jsh/erp/controller/AccountController.java
View file @
e5dcaef9
...
...
@@ -6,12 +6,10 @@ import com.jsh.erp.datasource.entities.Account;
import
com.jsh.erp.datasource.vo.AccountVo4InOutList
;
import
com.jsh.erp.service.account.AccountService
;
import
com.jsh.erp.utils.BaseResponseInfo
;
import
com.jsh.erp.utils.ErpInfo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -19,6 +17,8 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
static
com
.
jsh
.
erp
.
utils
.
ResponseJsonUtil
.
returnJson
;
@RestController
@RequestMapping
(
value
=
"/account"
)
public
class
AccountController
{
...
...
@@ -121,4 +121,18 @@ public class AccountController {
return
res
;
}
@PostMapping
(
value
=
"/updateAmountIsDefault"
)
public
String
updateAmountIsDefault
(
@RequestParam
(
"isDefault"
)
Boolean
isDefault
,
@RequestParam
(
"accountId"
)
Long
accountId
,
HttpServletRequest
request
)
{
Map
<
String
,
Object
>
objectMap
=
new
HashMap
<
String
,
Object
>();
int
res
=
accountService
.
updateAmountIsDefault
(
isDefault
,
accountId
);
if
(
res
>
0
)
{
return
returnJson
(
objectMap
,
ErpInfo
.
OK
.
name
,
ErpInfo
.
OK
.
code
);
}
else
{
return
returnJson
(
objectMap
,
ErpInfo
.
ERROR
.
name
,
ErpInfo
.
ERROR
.
code
);
}
}
}
src/main/java/com/jsh/erp/service/account/AccountService.java
View file @
e5dcaef9
...
...
@@ -75,6 +75,10 @@ public class AccountService {
public
int
insertAccount
(
String
beanJson
,
HttpServletRequest
request
)
{
Account
account
=
JSONObject
.
parseObject
(
beanJson
,
Account
.
class
);
if
(
account
.
getInitialamount
()
==
null
)
{
account
.
setInitialamount
(
0
d
);
}
account
.
setIsdefault
(
false
);
return
accountMapper
.
insertSelective
(
account
);
}
...
...
@@ -292,4 +296,12 @@ public class AccountService {
return
accountMapper
.
findAccountInOutListCount
(
accountId
);
}
public
int
updateAmountIsDefault
(
Boolean
isDefault
,
Long
accountId
)
{
Account
account
=
new
Account
();
account
.
setIsdefault
(
isDefault
);
AccountExample
example
=
new
AccountExample
();
example
.
createCriteria
().
andIdEqualTo
(
accountId
);
return
accountMapper
.
updateByExampleSelective
(
account
,
example
);
}
}
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