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
9fa082f2
"src/main/git@ustchcs.com:gujinli1118/JSH_ERP.git" did not exist on "693a7558ba71c403a36c1a2d2256ae09823794e9"
Commit
9fa082f2
authored
Apr 10, 2019
by
qiankunpingtai
Browse files
去除外键之仓库表jsh_depot相关修改
parent
bb1f9b7e
Changes
7
Hide whitespace changes
Inline
Side-by-side
erp_web/pages/manage/depot.html
View file @
9fa082f2
...
@@ -264,7 +264,17 @@
...
@@ -264,7 +264,17 @@
if
(
res
&&
res
.
code
==
200
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除仓库信息失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
depotID
;
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
single
'
;
batDeleteDepotForceConfirm
(
res
,
"
/depot/batchDeleteDepotByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除仓库信息异常,请稍后再试!
'
,
'
error
'
);
}
}
}
},
},
//此处添加错误处理
//此处添加错误处理
...
@@ -308,7 +318,17 @@
...
@@ -308,7 +318,17 @@
$
(
"
#searchBtn
"
).
click
();
$
(
"
#searchBtn
"
).
click
();
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
else
{
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除仓库信息失败,请稍后再试!
'
,
'
error
'
);
if
(
res
&&
res
.
code
==
601
){
var
jsondata
=
{};
jsondata
.
ids
=
ids
;
jsondata
.
deleteType
=
'
2
'
;
var
type
=
'
batch
'
;
batDeleteDepotForceConfirm
(
res
,
"
/depot/batchDeleteDepotByIds
"
,
jsondata
,
type
);
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除仓库信息异常,请稍后再试!
'
,
'
error
'
);
}
}
}
},
},
//此处添加错误处理
//此处添加错误处理
...
@@ -321,6 +341,38 @@
...
@@ -321,6 +341,38 @@
});
});
}
}
}
}
/**
* 确认强制删除
* */
function
batDeleteDepotForceConfirm
(
res
,
url
,
jsondata
,
type
)
{
$
.
messager
.
confirm
(
'
删除确认
'
,
res
.
msg
,
function
(
r
)
{
if
(
r
)
{
$
.
ajax
({
type
:
"
post
"
,
url
:
url
,
dataType
:
"
json
"
,
data
:
(
jsondata
),
success
:
function
(
res
)
{
if
(
res
&&
res
.
code
==
200
)
{
$
(
"
#searchBtn
"
).
click
();
if
(
type
==
'
batch
'
){
$
(
"
:checkbox
"
).
attr
(
"
checked
"
,
false
);
}
}
else
if
(
res
&&
res
.
code
==
600
){
$
.
messager
.
alert
(
'
删除提示
'
,
res
.
msg
,
'
error
'
);
}
else
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除仓库信息异常,请稍后再试!
'
,
'
error
'
);
}
},
//此处添加错误处理
error
:
function
()
{
$
.
messager
.
alert
(
'
删除提示
'
,
'
删除仓库信息异常,请稍后再试!
'
,
'
error
'
);
return
;
}
});
}
});
}
//增加
//增加
var
url
;
var
url
;
...
...
src/main/java/com/jsh/erp/controller/DepotController.java
View file @
9fa082f2
...
@@ -185,9 +185,20 @@ public class DepotController {
...
@@ -185,9 +185,20 @@ public class DepotController {
* @return java.lang.Object
* @return java.lang.Object
*/
*/
@RequestMapping
(
value
=
"/batchDeleteDepotByIds"
)
@RequestMapping
(
value
=
"/batchDeleteDepotByIds"
)
public
Object
batchDeleteDepotByIds
(
@RequestParam
(
"ids"
)
String
ids
)
throws
Exception
{
public
Object
batchDeleteDepotByIds
(
@RequestParam
(
"ids"
)
String
ids
,
@RequestParam
(
value
=
"deleteType"
,
required
=
false
,
defaultValue
=
BusinessConstants
.
DELETE_TYPE_NORMAL
)
String
deleteType
)
throws
Exception
{
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
JSONObject
result
=
ExceptionConstants
.
standardSuccess
();
int
i
=
depotService
.
batchDeleteDepotByIds
(
ids
);
int
i
=
0
;
if
(
BusinessConstants
.
DELETE_TYPE_NORMAL
.
equals
(
deleteType
)){
i
=
depotService
.
batchDeleteDepotByIdsNormal
(
ids
);
}
else
if
(
BusinessConstants
.
DELETE_TYPE_FORCE
.
equals
(
deleteType
)){
i
=
depotService
.
batchDeleteDepotByIds
(
ids
);
}
else
{
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}],deleteType[{}]"
,
ExceptionConstants
.
DELETE_REFUSED_CODE
,
ExceptionConstants
.
DELETE_REFUSED_MSG
,
ids
,
deleteType
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_REFUSED_CODE
,
ExceptionConstants
.
DELETE_REFUSED_MSG
);
}
if
(
i
<
1
){
if
(
i
<
1
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
logger
.
error
(
"异常码[{}],异常提示[{}],参数,ids[{}]"
,
ExceptionConstants
.
DEPOT_DELETE_FAILED_CODE
,
ExceptionConstants
.
DEPOT_DELETE_FAILED_MSG
,
ids
);
ExceptionConstants
.
DEPOT_DELETE_FAILED_CODE
,
ExceptionConstants
.
DEPOT_DELETE_FAILED_MSG
,
ids
);
...
...
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapperEx.java
View file @
9fa082f2
...
@@ -121,4 +121,6 @@ public interface DepotHeadMapperEx {
...
@@ -121,4 +121,6 @@ public interface DepotHeadMapperEx {
List
<
DepotHead
>
getDepotHeadListByOrganIds
(
@Param
(
"organIds"
)
String
[]
organIds
);
List
<
DepotHead
>
getDepotHeadListByOrganIds
(
@Param
(
"organIds"
)
String
[]
organIds
);
List
<
DepotHead
>
getDepotHeadListByHandsPersonIds
(
@Param
(
"handsPersonIds"
)
String
[]
handsPersonIds
);
List
<
DepotHead
>
getDepotHeadListByHandsPersonIds
(
@Param
(
"handsPersonIds"
)
String
[]
handsPersonIds
);
List
<
DepotHead
>
getDepotHeadListByDepotIds
(
@Param
(
"depotIds"
)
String
[]
depotIds
);
}
}
src/main/java/com/jsh/erp/datasource/mappers/DepotItemMapperEx.java
View file @
9fa082f2
...
@@ -168,4 +168,6 @@ public interface DepotItemMapperEx {
...
@@ -168,4 +168,6 @@ public interface DepotItemMapperEx {
int
batchDeleteDepotItemByDepotHeadIds
(
@Param
(
"depotheadIds"
)
Long
[]
depotHeadIds
);
int
batchDeleteDepotItemByDepotHeadIds
(
@Param
(
"depotheadIds"
)
Long
[]
depotHeadIds
);
int
batchDeleteDepotItemByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
int
batchDeleteDepotItemByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
List
<
DepotItem
>
getDepotItemListListByDepotIds
(
@Param
(
"depotIds"
)
String
[]
depotIds
);
}
}
src/main/java/com/jsh/erp/service/depot/DepotService.java
View file @
9fa082f2
package
com.jsh.erp.service.depot
;
package
com.jsh.erp.service.depot
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.constants.BusinessConstants
;
import
com.jsh.erp.datasource.entities.Depot
;
import
com.jsh.erp.constants.ExceptionConstants
;
import
com.jsh.erp.datasource.entities.DepotEx
;
import
com.jsh.erp.datasource.entities.*
;
import
com.jsh.erp.datasource.entities.DepotExample
;
import
com.jsh.erp.datasource.mappers.*
;
import
com.jsh.erp.datasource.entities.User
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.datasource.mappers.DepotMapper
;
import
com.jsh.erp.datasource.mappers.DepotMapperEx
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.log.LogService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.service.user.UserService
;
import
com.jsh.erp.utils.StringUtil
;
import
com.jsh.erp.utils.StringUtil
;
...
@@ -37,6 +36,10 @@ public class DepotService {
...
@@ -37,6 +36,10 @@ public class DepotService {
private
UserService
userService
;
private
UserService
userService
;
@Resource
@Resource
private
LogService
logService
;
private
LogService
logService
;
@Resource
private
DepotHeadMapperEx
depotHeadMapperEx
;
@Resource
private
DepotItemMapperEx
depotItemMapperEx
;
public
Depot
getDepot
(
long
id
)
{
public
Depot
getDepot
(
long
id
)
{
return
depotMapper
.
selectByPrimaryKey
(
id
);
return
depotMapper
.
selectByPrimaryKey
(
id
);
...
@@ -122,4 +125,54 @@ public class DepotService {
...
@@ -122,4 +125,54 @@ public class DepotService {
String
[]
idArray
=
ids
.
split
(
","
);
String
[]
idArray
=
ids
.
split
(
","
);
return
depotMapperEx
.
batchDeleteDepotByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
return
depotMapperEx
.
batchDeleteDepotByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
}
/**
* create by: qiankunpingtai
* website:https://qiankunpingtai.cn
* description:
* 正常删除,要考虑数据完整性,进行完整性校验
* create time: 2019/4/10 16:52
* @Param: ids
* @return int
*/
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
batchDeleteDepotByIdsNormal
(
String
ids
)
throws
Exception
{
/**
* 校验
* 1、单据主表 jsh_depothead
* 2、单据子表 jsh_depotitem
* 是否有相关数据
* */
int
deleteTotal
=
0
;
if
(
StringUtils
.
isEmpty
(
ids
)){
return
deleteTotal
;
}
String
[]
idArray
=
ids
.
split
(
","
);
/**
* 校验单据主表 jsh_depothead
* */
List
<
DepotHead
>
depotHeadList
=
depotHeadMapperEx
.
getDepotHeadListByDepotIds
(
idArray
);
if
(
depotHeadList
!=
null
&&
depotHeadList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,DepotIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
);
}
/**
* 校验单据子表 jsh_depotitem
* */
List
<
DepotItem
>
depotItemList
=
depotItemMapperEx
.
getDepotItemListListByDepotIds
(
idArray
);
if
(
depotItemList
!=
null
&&
depotItemList
.
size
()>
0
){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,DepotIds[{}]"
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
,
ids
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
DELETE_FORCE_CONFIRM_CODE
,
ExceptionConstants
.
DELETE_FORCE_CONFIRM_MSG
);
}
/**
* 校验通过执行删除操作
* */
deleteTotal
=
batchDeleteDepotByIds
(
ids
);
return
deleteTotal
;
}
}
}
src/main/resources/mapper_xml/DepotHeadMapperEx.xml
View file @
9fa082f2
...
@@ -474,5 +474,25 @@
...
@@ -474,5 +474,25 @@
)
)
and ifnull(delete_Flag,'0') !='1'
and ifnull(delete_Flag,'0') !='1'
</select>
</select>
<select
id=
"getDepotHeadListByDepotIds"
resultMap=
"com.jsh.erp.datasource.mappers.DepotHeadMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.DepotHeadMapper.Base_Column_List"
/>
from jsh_depothead
where 1=1
and
(ProjectId in (
<foreach
collection=
"depotIds"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
OR
AllocationProjectId in (
<foreach
collection=
"depotIds"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
)
and ifnull(delete_Flag,'0') !='1'
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapper_xml/DepotItemMapperEx.xml
View file @
9fa082f2
...
@@ -411,6 +411,18 @@
...
@@ -411,6 +411,18 @@
</foreach>
</foreach>
)
)
</update>
</update>
<select
id=
"getDepotItemListListByDepotIds"
resultMap=
"com.jsh.erp.datasource.mappers.DepotItemMapper.BaseResultMap"
>
select
<include
refid=
"com.jsh.erp.datasource.mappers.DepotItemMapper.Base_Column_List"
/>
from jsh_depotitem
where 1=1
and DepotId in (
<foreach
collection=
"depotIds"
item=
"depotId"
separator=
","
>
#{depotId}
</foreach>
)
and ifnull(delete_Flag,'0') !='1'
</select>
...
...
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