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
2fb4195f
Commit
2fb4195f
authored
Mar 15, 2019
by
乾坤平台
Committed by
季圣华
Mar 15, 2019
Browse files
!35 添加选择人员的功能
Merge pull request !35 from 乾坤平台/master
parents
85d5098d
72e088c6
Changes
26
Hide whitespace changes
Inline
Side-by-side
src/main/java/com/jsh/erp/service/materialCategory/MaterialCategoryService.java
View file @
2fb4195f
...
...
@@ -100,8 +100,8 @@ public class MaterialCategoryService {
* @Param:
* @return java.util.List<com.jsh.erp.datasource.vo.TreeNode>
*/
public
List
<
TreeNode
>
getMaterialCategoryTree
()
throws
Exception
{
return
materialCategoryMapperEx
.
getNodeTree
();
public
List
<
TreeNode
>
getMaterialCategoryTree
(
Long
id
)
throws
Exception
{
return
materialCategoryMapperEx
.
getNodeTree
(
id
);
}
/**
* create by: cjl
...
...
@@ -117,8 +117,8 @@ public class MaterialCategoryService {
return
0
;
}
if
(
mc
.
getParentid
()==
null
){
//没有给定父级目录的id,默认设置父级目录为根目录
mc
.
setParentid
(
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_ID
);
//没有给定父级目录的id,默认设置父级目录为根目录
的父目录
mc
.
setParentid
(
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_
PARENT_
ID
);
}
//检查商品类型编号是否已存在
checkMaterialCategorySerialNo
(
mc
);
...
...
@@ -148,40 +148,16 @@ public class MaterialCategoryService {
if
(
strArray
.
length
<
1
){
return
0
;
}
/**
* create by: qiankunpingtai
* create time: 2019/3/13 14:49
* description:
* 添加一个限制,根目录不允许删除
*/
String
rootIdStr
=
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_ID
.
toString
();
for
(
String
s:
strArray
){
if
(
rootIdStr
.
equals
(
s
)){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,id:[{}]"
,
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE
,
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG
,
s
);
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_CODE
,
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_DELETE_MSG
);
}
}
return
materialCategoryMapperEx
.
batchDeleteMaterialCategoryByIds
(
updateDate
,
updater
,
strArray
);
}
@Transactional
(
value
=
"transactionManager"
,
rollbackFor
=
Exception
.
class
)
public
int
editMaterialCategory
(
MaterialCategory
mc
)
{
/**
* create by: qiankunpingtai
* create time: 2019/3/13 14:49
* description:
* 添加一个限制根目录不允许修改
*/
if
(
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_ID
.
equals
(
mc
.
getId
())){
logger
.
error
(
"异常码[{}],异常提示[{}],参数,id:[{}]"
,
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE
,
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG
,
mc
.
getId
());
throw
new
BusinessRunTimeException
(
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_CODE
,
ExceptionConstants
.
MATERIAL_CATEGORY_ROOT_NOT_SUPPORT_EDIT_MSG
);
if
(
mc
.
getParentid
()==
null
){
//没有给定父级目录的id,默认设置父级目录为根目录的父目录
mc
.
setParentid
(
BusinessConstants
.
MATERIAL_CATEGORY_ROOT_PARENT_ID
);
}
//检查商品类型编号是否已存在
checkMaterialCategorySerialNo
(
mc
);
//更新时间
...
...
src/main/java/com/jsh/erp/service/organization/OrganizationService.java
View file @
2fb4195f
...
...
@@ -82,7 +82,7 @@ public class OrganizationService {
* 未指定父级机构的时候默认为根机构
* */
if
(
StringUtil
.
isEmpty
(
org
.
getOrgParentNo
())){
org
.
setOrgParentNo
(
BusinessConstants
.
ORGANIZATION_ROOT_NO
);
org
.
setOrgParentNo
(
BusinessConstants
.
ORGANIZATION_ROOT_
PARENT_
NO
);
}
return
organizationMapperEx
.
addOrganization
(
org
);
}
...
...
@@ -103,13 +103,13 @@ public class OrganizationService {
* 未指定父级机构的时候默认为根机构
* */
if
(
StringUtil
.
isEmpty
(
org
.
getOrgParentNo
())){
org
.
setOrgParentNo
(
BusinessConstants
.
ORGANIZATION_ROOT_NO
);
org
.
setOrgParentNo
(
BusinessConstants
.
ORGANIZATION_ROOT_
PARENT_
NO
);
}
return
organizationMapperEx
.
editOrganization
(
org
);
}
public
List
<
TreeNode
>
getOrganizationTree
()
throws
Exception
{
return
organizationMapperEx
.
getNodeTree
();
public
List
<
TreeNode
>
getOrganizationTree
(
Long
id
)
throws
Exception
{
return
organizationMapperEx
.
getNodeTree
(
id
);
}
public
List
<
Organization
>
findById
(
Long
id
)
throws
Exception
{
...
...
src/main/java/com/jsh/erp/service/user/UserService.java
View file @
2fb4195f
...
...
@@ -10,6 +10,8 @@ import com.jsh.erp.datasource.entities.UserEx;
import
com.jsh.erp.datasource.entities.UserExample
;
import
com.jsh.erp.datasource.mappers.UserMapper
;
import
com.jsh.erp.datasource.mappers.UserMapperEx
;
import
com.jsh.erp.datasource.vo.TreeNode
;
import
com.jsh.erp.datasource.vo.TreeNodeEx
;
import
com.jsh.erp.exception.BusinessRunTimeException
;
import
com.jsh.erp.service.orgaUserRel.OrgaUserRelService
;
import
com.jsh.erp.utils.ExceptionCodeConstants
;
...
...
@@ -398,4 +400,7 @@ public class UserService {
}
}
public
List
<
TreeNodeEx
>
getOrganizationUserTree
()
{
return
userMapperEx
.
getNodeTree
();
}
}
src/main/resources/mapper_xml/MaterialCategoryMapperEx.xml
View file @
2fb4195f
...
...
@@ -33,14 +33,14 @@
<resultMap
id=
"BaseTreeResultMap"
type=
"com.jsh.erp.datasource.vo.TreeNode"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"name"
property=
"text"
/>
<collection
column=
"
id
"
property=
"children"
javaType=
"java.util.ArrayList"
<collection
column=
"
{currentId=currentId,id=id}
"
property=
"children"
javaType=
"java.util.ArrayList"
ofType=
"com.jsh.erp.datasource.vo.TreeNode"
select=
"getNextNodeTree"
/>
</resultMap>
<resultMap
id=
"NextTreeResultMap"
type=
"com.jsh.erp.datasource.vo.TreeNode"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"name"
property=
"text"
/>
<collection
column=
"
id
"
property=
"children"
javaType=
"java.util.ArrayList"
<collection
column=
"
{currentId=currentId,id=id}
"
property=
"children"
javaType=
"java.util.ArrayList"
ofType=
"com.jsh.erp.datasource.vo.TreeNode"
select=
"getNextNodeTree"
/>
</resultMap>
...
...
@@ -50,19 +50,25 @@
<select
id=
"getNextNodeTree"
resultMap=
"NextTreeResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
,#{currentId} as currentId
FROM jsh_materialcategory
WHERE ParentId = #{id}
<if
test=
"currentId != null"
>
and id !=#{currentId}
</if>
and status !='2'
order by sort asc
</select>
<select
id=
"getNodeTree"
resultMap=
"BaseTreeResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
,#{currentId} as currentId
FROM jsh_materialcategory
WHERE ParentId = -1
and status !='2'
<if
test=
"currentId != null"
>
and id !=#{currentId}
</if>
order by sort asc
</select>
<insert
id=
"addMaterialCategory"
parameterType=
"com.jsh.erp.datasource.entities.MaterialCategory"
...
...
src/main/resources/mapper_xml/OrganizationMapperEx.xml
View file @
2fb4195f
...
...
@@ -6,7 +6,7 @@
<result
column=
"id"
property=
"id"
/>
<result
column=
"org_abr"
property=
"text"
/>
<result
column=
"org_no"
property=
"attributes"
/>
<collection
column=
"
org_no
"
property=
"children"
javaType=
"java.util.ArrayList"
<collection
column=
"
{currentId=currentId,org_no=org_no}
"
property=
"children"
javaType=
"java.util.ArrayList"
ofType=
"com.jsh.erp.datasource.vo.TreeNode"
select=
"getNextNodeTree"
/>
</resultMap>
...
...
@@ -14,7 +14,7 @@
<result
column=
"id"
property=
"id"
/>
<result
column=
"org_abr"
property=
"text"
/>
<result
column=
"org_no"
property=
"attributes"
/>
<collection
column=
"
org_no
"
property=
"children"
javaType=
"java.util.ArrayList"
<collection
column=
"
{currentId=currentId,org_no=org_no}
"
property=
"children"
javaType=
"java.util.ArrayList"
ofType=
"com.jsh.erp.datasource.vo.TreeNode"
select=
"getNextNodeTree"
/>
</resultMap>
...
...
@@ -24,18 +24,24 @@
<select
id=
"getNextNodeTree"
resultMap=
"NextTreeResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
,#{currentId} as currentId
FROM jsh_organization
WHERE org_parent_no = #{org_no}
<if
test=
"currentId != null"
>
and id !=#{currentId}
</if>
and org_stcd !='5'
order by sort asc
</select>
<select
id=
"getNodeTree"
resultMap=
"BaseTreeResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
<include
refid=
"Base_Column_List"
/>
,#{currentId} as currentId
FROM jsh_organization
WHERE org_parent_no = -1
<if
test=
"currentId != null"
>
and id !=#{currentId}
</if>
and org_stcd !='5'
order by sort asc
</select>
...
...
src/main/resources/mapper_xml/UserMapperEx.xml
View file @
2fb4195f
...
...
@@ -132,4 +132,56 @@
</foreach>
)
</update>
<resultMap
id=
"BaseTreeResultMap"
type=
"com.jsh.erp.datasource.vo.TreeNodeEx"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"text"
property=
"text"
/>
<association
property=
"attributes"
javaType=
"com.jsh.erp.datasource.vo.NodeAttributes"
>
<id
column=
"orgNo"
property=
"no"
></id>
<result
column=
"type"
property=
"type"
></result>
</association>
<collection
column=
"{orgId=id,orgNo=orgNo}"
property=
"children"
javaType=
"java.util.ArrayList"
ofType=
"com.jsh.erp.datasource.vo.TreeNode"
select=
"getNextNodeTree"
/>
</resultMap>
<resultMap
id=
"NextTreeResultMap"
type=
"com.jsh.erp.datasource.vo.TreeNodeEx"
>
<result
column=
"id"
property=
"id"
/>
<result
column=
"text"
property=
"text"
/>
<result
column=
"iconCls"
property=
"iconCls"
/>
<association
property=
"attributes"
javaType=
"com.jsh.erp.datasource.vo.NodeAttributes"
>
<id
column=
"orgNo"
property=
"no"
></id>
<result
column=
"type"
property=
"type"
></result>
</association>
<collection
column=
"{orgId=id,orgNo=orgNo}"
property=
"children"
javaType=
"java.util.ArrayList"
ofType=
"com.jsh.erp.datasource.vo.TreeNode"
select=
"getNextNodeTree"
/>
</resultMap>
<select
id=
"getNextNodeTree"
resultMap=
"NextTreeResultMap"
>
select id , text,orgNo,sort ,iconCls,type from (
SELECT
org.id, org.org_abr as text,org.org_no as orgNo,org.sort as sort,null as iconCls,'0' as type
FROM jsh_organization org
WHERE org.org_parent_no = #{orgNo}
and org.org_stcd !='5'
union all
select
user.id,user.username as text, null as orgNo,rel.user_blng_orga_dspl_seq as sort,'icon-user' as iconCls,'1' as type
from jsh_user user,jsh_orga_user_rel rel
where
1=1
and user.id=rel.user_id
and rel.orga_id=#{orgId}
and rel.delete_flag !='1'
and user.status not in ('1','2')
) node
order by sort asc
</select>
<select
id=
"getNodeTree"
resultMap=
"BaseTreeResultMap"
>
SELECT
id, org_abr as text,org_no as orgNo,'0' as type
FROM jsh_organization
WHERE org_parent_no = -1
and org_stcd !='5'
order by sort asc
</select>
</mapper>
\ No newline at end of file
Prev
1
2
Next
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