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
9dc97851
Commit
9dc97851
authored
Nov 09, 2021
by
季圣华
Browse files
优化商品类别和机构的删除操作
parent
15ee7455
Changes
5
Hide whitespace changes
Inline
Side-by-side
jshERP-boot/src/main/java/com/jsh/erp/constants/ExceptionConstants.java
View file @
9dc97851
...
@@ -253,12 +253,15 @@ public class ExceptionConstants {
...
@@ -253,12 +253,15 @@ public class ExceptionConstants {
//商品类别编号已存在
//商品类别编号已存在
public
static
final
int
MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE
=
7500003
;
public
static
final
int
MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_CODE
=
7500003
;
public
static
final
String
MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG
=
"商品类别编号已存在"
;
public
static
final
String
MATERIAL_CATEGORY_SERIAL_ALREADY_EXISTS_MSG
=
"商品类别编号已存在"
;
//根
目录
不支持修改
//根
类别
不支持修改
public
static
final
int
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE
=
7500004
;
public
static
final
int
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE
=
7500004
;
public
static
final
String
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG
=
"根
目录
不支持修改"
;
public
static
final
String
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG
=
"根
类别
不支持修改"
;
//根
目录
不支持删除
//根
类别
不支持删除
public
static
final
int
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE
=
7500005
;
public
static
final
int
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE
=
7500005
;
public
static
final
String
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG
=
"根目录不支持删除"
;
public
static
final
String
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG
=
"根类别不支持删除"
;
//该类别存在下级不允许删除
public
static
final
int
MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_CODE
=
7500006
;
public
static
final
String
MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_MSG
=
"该类别存在下级不允许删除"
;
/**
/**
* 商品信息
* 商品信息
* type = 80
* type = 80
...
@@ -422,6 +425,9 @@ public class ExceptionConstants {
...
@@ -422,6 +425,9 @@ public class ExceptionConstants {
//根机构不允许修改
//根机构不允许修改
public
static
final
int
ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_CODE
=
11000005
;
public
static
final
int
ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_CODE
=
11000005
;
public
static
final
String
ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_MSG
=
"根机构不允许修改"
;
public
static
final
String
ORGANIZATION_ROOT_NOT_ALLOWED_EDIT_MSG
=
"根机构不允许修改"
;
//该机构存在下级不允许删除
public
static
final
int
ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_CODE
=
11000006
;
public
static
final
String
ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_MSG
=
"该机构存在下级不允许删除"
;
/**
/**
* 机构用户关联关系
* 机构用户关联关系
* type = 115
* type = 115
...
...
jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/OrganizationMapperEx.java
View file @
9dc97851
...
@@ -23,6 +23,8 @@ public interface OrganizationMapperEx {
...
@@ -23,6 +23,8 @@ public interface OrganizationMapperEx {
int
addOrganization
(
Organization
org
);
int
addOrganization
(
Organization
org
);
List
<
Organization
>
getOrganizationByParentIds
(
@Param
(
"ids"
)
String
ids
[]);
int
batchDeleteOrganizationByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
int
batchDeleteOrganizationByIds
(
@Param
(
"updateTime"
)
Date
updateTime
,
@Param
(
"updater"
)
Long
updater
,
@Param
(
"ids"
)
String
ids
[]);
int
editOrganization
(
Organization
org
);
int
editOrganization
(
Organization
org
);
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
View file @
9dc97851
...
@@ -200,10 +200,14 @@ public class MaterialCategoryService {
...
@@ -200,10 +200,14 @@ public class MaterialCategoryService {
if
(
strArray
.
length
<
1
){
if
(
strArray
.
length
<
1
){
return
0
;
return
0
;
}
}
try
{
List
<
MaterialCategory
>
mcList
=
materialCategoryMapperEx
.
getMaterialCategoryListByCategoryIds
(
idArray
);
if
(
mcList
!=
null
&&
mcList
.
size
()>
0
)
{
logger
.
error
(
"异常码[{}],异常提示[{}]"
,
ExceptionConstants
.
MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_CODE
,
ExceptionConstants
.
MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_MSG
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_CODE
,
ExceptionConstants
.
MATERIAL_CATEGORY_CHILD_NOT_SUPPORT_DELETE_MSG
);
}
else
{
result
=
materialCategoryMapperEx
.
batchDeleteMaterialCategoryByIds
(
updateDate
,
updater
,
strArray
);
result
=
materialCategoryMapperEx
.
batchDeleteMaterialCategoryByIds
(
updateDate
,
updater
,
strArray
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
}
return
result
;
return
result
;
}
}
...
...
jshERP-boot/src/main/java/com/jsh/erp/service/organization/OrganizationService.java
View file @
9dc97851
...
@@ -117,11 +117,16 @@ public class OrganizationService {
...
@@ -117,11 +117,16 @@ public class OrganizationService {
User
userInfo
=
userService
.
getCurrentUser
();
User
userInfo
=
userService
.
getCurrentUser
();
String
[]
idArray
=
ids
.
split
(
","
);
String
[]
idArray
=
ids
.
split
(
","
);
int
result
=
0
;
int
result
=
0
;
try
{
List
<
Organization
>
organList
=
organizationMapperEx
.
getOrganizationByParentIds
(
idArray
);
if
(
organList
!=
null
&&
organList
.
size
()>
0
)
{
//如果存在子机构则不能删除
logger
.
error
(
"异常码[{}],异常提示[{}]"
,
ExceptionConstants
.
ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_CODE
,
ExceptionConstants
.
ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_MSG
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_CODE
,
ExceptionConstants
.
ORGANIZATION_CHILD_NOT_ALLOWED_DELETE_MSG
);
}
else
{
result
=
organizationMapperEx
.
batchDeleteOrganizationByIds
(
result
=
organizationMapperEx
.
batchDeleteOrganizationByIds
(
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
new
Date
(),
userInfo
==
null
?
null
:
userInfo
.
getId
(),
idArray
);
}
catch
(
Exception
e
){
JshException
.
writeFail
(
logger
,
e
);
}
}
return
result
;
return
result
;
}
}
...
...
jshERP-boot/src/main/resources/mapper_xml/OrganizationMapperEx.xml
View file @
9dc97851
...
@@ -60,6 +60,17 @@
...
@@ -60,6 +60,17 @@
#{parentId,jdbcType=BIGINT}, #{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{parentId,jdbcType=BIGINT}, #{sort,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
</insert>
<select
id=
"getOrganizationByParentIds"
resultMap=
"com.jsh.erp.datasource.mappers.OrganizationMapper.BaseResultMap"
>
select * from jsh_organization
where
1=1
and ifnull(delete_flag,'0') !='1'
and parent_id in (
<foreach
collection=
"ids"
item=
"id"
separator=
","
>
#{id}
</foreach>
)
</select>
<update
id=
"batchDeleteOrganizationByIds"
>
<update
id=
"batchDeleteOrganizationByIds"
>
update jsh_organization
update jsh_organization
set update_Time=#{updateTime},delete_flag='1'
set update_Time=#{updateTime},delete_flag='1'
...
...
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