Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bpm
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王厚康
bpm
Commits
abcb2e34
Commit
abcb2e34
authored
Mar 05, 2019
by
caowenda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
组织添加编辑部门 部门下添加人员 添加简单页面效果 添加样式
parent
fad630ee
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
409 additions
and
19 deletions
+409
-19
userController.java
src/main/java/com/bbd/bpm/controller/user/userController.java
+66
-3
MemberMapper.java
src/main/java/com/bbd/bpm/dao/MemberMapper.java
+18
-0
MemberMapper.xml
src/main/java/com/bbd/bpm/dao/MemberMapper.xml
+23
-0
UserInfoMapper.java
src/main/java/com/bbd/bpm/dao/UserInfoMapper.java
+6
-1
UserInfoMapper.xml
src/main/java/com/bbd/bpm/dao/UserInfoMapper.xml
+23
-0
BpmCompany.java
src/main/java/com/bbd/bpm/domain/BpmCompany.java
+4
-0
BpmEmployee.java
src/main/java/com/bbd/bpm/domain/BpmEmployee.java
+2
-2
UserInfoService.java
src/main/java/com/bbd/bpm/service/UserInfoService.java
+47
-4
UserInfoServiceImpl.java
src/main/java/com/bbd/bpm/serviceImpl/UserInfoServiceImpl.java
+163
-9
BpmEmployeeVo.java
src/main/java/com/bbd/bpm/vo/BpmEmployeeVo.java
+57
-0
organizationList.html
src/main/resources/templates/user/organizationList.html
+0
-0
No files found.
src/main/java/com/bbd/bpm/controller/user/userController.java
View file @
abcb2e34
...
...
@@ -3,14 +3,18 @@ package com.bbd.bpm.controller.user;
import
com.bbd.bpm.base.PageBean
;
import
com.bbd.bpm.result.Result
;
import
com.bbd.bpm.service.UserInfoService
;
import
io.swagger.models.auth.In
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
@Controller
@RequestMapping
(
value
=
"
/
bpm/user"
)
@RequestMapping
(
value
=
"bpm/user"
)
public
class
userController
{
...
...
@@ -38,20 +42,35 @@ public class userController {
* @Param:
* @return
**/
@RequestMapping
(
value
=
"getOrganizationInfo"
)
@ResponseBody
public
Result
getOrganizationInfo
(
Integer
id
){
Result
result
=
userInfoService
.
getOrganizationInfo
(
id
);
return
result
;
}
/**
* @Author:cwd
* @Description:获取组织列表
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@RequestMapping
(
value
=
"getOrganization"
)
@ResponseBody
public
Result
getOrganization
(
Model
model
,
PageBean
pageBean
){
public
Result
getOrganization
(
PageBean
pageBean
,
Integer
id
,
Integer
pId
){
if
(
pageBean
.
getPageNum
()==
0
){
pageBean
.
setPageNum
(
1
);
}
if
(
pageBean
.
getPageSize
()==
0
)
{
pageBean
.
setPageSize
(
10
);
}
Result
result
=
userInfoService
.
getOrganization
(
pageBean
);
Result
result
=
userInfoService
.
getOrganization
(
pageBean
,
id
,
pId
);
return
result
;
}
/**
* @Author:cwd
* @Description:加载ztree
...
...
@@ -66,6 +85,50 @@ public class userController {
return
result
;
}
/**
* @Author:cwd
* @Description:添加组织
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@RequestMapping
(
value
=
"addOrganization"
)
@ResponseBody
public
Result
addOrganization
(
String
name
,
String
abbreviationName
,
Long
pId
,
Integer
id
){
//获取session中的值
Result
result
=
userInfoService
.
addOrganization
(
name
,
abbreviationName
,
pId
,
id
);
return
result
;
}
/**
* @Author:cwd
* @Description:添加部门人员
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@RequestMapping
(
value
=
"addOrganizationMember"
)
@ResponseBody
public
Result
addOrganizationMember
(
String
name
,
String
position
,
Long
pId
,
Integer
id
){
//获取session中的值
Result
result
=
userInfoService
.
addOrganizationMember
(
name
,
position
,
pId
,
id
);
return
result
;
}
/**
* @Author:cwd
* @Description:修改组织
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@RequestMapping
(
value
=
"editOrganization"
)
@ResponseBody
public
Result
editOrganization
(
String
name
,
String
abbreviationName
,
Integer
id
){
Result
result
=
userInfoService
.
editOrganization
(
name
,
abbreviationName
,
id
);
return
result
;
}
}
src/main/java/com/bbd/bpm/dao/MemberMapper.java
0 → 100644
View file @
abcb2e34
package
com
.
bbd
.
bpm
.
dao
;
import
com.bbd.bpm.base.BaseMapper
;
import
com.bbd.bpm.domain.BpmCompany
;
import
com.bbd.bpm.domain.BpmEmployee
;
import
com.bbd.bpm.vo.BpmCompanyVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Map
;
@Repository
public
interface
MemberMapper
extends
BaseMapper
<
BpmEmployee
>{
List
<
BpmCompanyVo
>
getMemberList
(
@Param
(
"id"
)
Integer
id
);
}
src/main/java/com/bbd/bpm/dao/MemberMapper.xml
0 → 100644
View file @
abcb2e34
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.bbd.bpm.dao.MemberMapper"
>
<select
id=
"getMemberList"
resultType=
"com.bbd.bpm.vo.BpmEmployeeVo"
>
SELECT
a.id,
a.created_time createdTime,
a.update_time updateTime,
a.`name`,
a.position,
b.`name` department,
c.`code`
FROM
bpm_employee a
LEFT JOIN bpm_company b ON b.id = a.department
LEFT JOIN bpm_company c ON c.id = a.code_id
WHERE
a.`status` = 0 and department=#{id}
</select>
</mapper>
\ No newline at end of file
src/main/java/com/bbd/bpm/dao/UserInfoMapper.java
View file @
abcb2e34
...
...
@@ -4,6 +4,7 @@ package com.bbd.bpm.dao;
import
com.bbd.bpm.base.BaseMapper
;
import
com.bbd.bpm.domain.BpmCompany
;
import
com.bbd.bpm.vo.BpmCompanyVo
;
import
io.swagger.models.auth.In
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -13,9 +14,13 @@ import java.util.Map;
@Repository
public
interface
UserInfoMapper
extends
BaseMapper
<
BpmCompany
>{
List
<
BpmCompanyVo
>
getOrganization
();
List
<
BpmCompanyVo
>
getOrganization
(
@Param
(
"id"
)
Integer
id
);
List
<
Map
<
String
,
Object
>>
getOrganizationList
();
BpmCompanyVo
getParentName
(
@Param
(
"pId"
)
Integer
pId
);
String
getOrganizationRelation
(
@Param
(
"id"
)
Integer
id
);
Map
<
String
,
Object
>
getOrganizationInfo
(
@Param
(
"id"
)
Integer
id
);
}
src/main/java/com/bbd/bpm/dao/UserInfoMapper.xml
View file @
abcb2e34
...
...
@@ -17,6 +17,9 @@
bpm_company
WHERE
STATUS = 0 and parent_id!=0
<if
test=
"id!=null"
>
and parent_id=#{id}
</if>
</select>
<!--组织架构菜单-->
...
...
@@ -41,4 +44,23 @@
id=#{pId}
</select>
<select
id=
"getOrganizationRelation"
resultType=
"String"
>
SELECT
organization_relation
FROM
bpm_company
WHERE
id = #{id}
</select>
<select
id=
"getOrganizationInfo"
resultType=
"map"
>
SELECT
`name`,
abbreviation_name abbreviationName
FROM
bpm_company
WHERE
id = #{id}
</select>
</mapper>
\ No newline at end of file
src/main/java/com/bbd/bpm/domain/BpmCompany.java
View file @
abcb2e34
...
...
@@ -27,6 +27,10 @@ public class BpmCompany extends BaseEntity{
@Column
(
name
=
"status"
)
private
Integer
status
;
//上级id
@Column
(
name
=
"parent_id"
)
private
Integer
pId
;
}
src/main/java/com/bbd/bpm/domain/BpmEmployee.java
View file @
abcb2e34
...
...
@@ -15,10 +15,10 @@ public class BpmEmployee extends BaseEntity {
private
String
name
;
//编码id
@Column
(
name
=
"code_id"
)
private
String
codeId
;
private
Integer
codeId
;
//部门
@Column
(
name
=
"department"
)
private
String
department
;
private
Integer
department
;
//职位
@Column
(
name
=
"position"
)
private
String
position
;
...
...
src/main/java/com/bbd/bpm/service/UserInfoService.java
View file @
abcb2e34
package
com
.
bbd
.
bpm
.
service
;
import
com.bbd.bpm.BpmResponse
;
import
com.bbd.bpm.base.PageBean
;
import
com.bbd.bpm.result.Result
;
public
interface
UserInfoService
{
Result
getOrganization
(
PageBean
pageBean
);
/**
* @Author:cwd
* @Description:获取组织列表
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
Result
getOrganization
(
PageBean
pageBean
,
Integer
id
,
Integer
pId
);
/**
* @Author:cwd
* @Description:加载ztree
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
Result
getOrganizationList
();
/**
* @Author:cwd
* @Description:添加组织
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
Result
addOrganization
(
String
name
,
String
abbreviationName
,
Long
pId
,
Integer
id
);
/**
* @Author:cwd
* @Description:添加部门人员
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
Result
addOrganizationMember
(
String
name
,
String
position
,
Long
pId
,
Integer
id
);
/**
* @Author:cwd
* @Description:获取组织详情
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
Result
getOrganizationInfo
(
Integer
id
);
/**
* @Author:cwd
* @Description:修改组织
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
Result
editOrganization
(
String
name
,
String
abbreviationName
,
Integer
id
);
}
src/main/java/com/bbd/bpm/serviceImpl/UserInfoServiceImpl.java
View file @
abcb2e34
package
com
.
bbd
.
bpm
.
serviceImpl
;
import
com.bbd.bpm.base.PageBean
;
import
com.bbd.bpm.d
omain.BpmCompany
;
import
com.bbd.bpm.d
ao.MemberMapper
;
import
com.bbd.bpm.dao.UserInfoMapper
;
import
com.bbd.bpm.domain.BpmCompany
;
import
com.bbd.bpm.domain.BpmEmployee
;
import
com.bbd.bpm.result.RespCode
;
import
com.bbd.bpm.result.Result
;
import
com.bbd.bpm.result.ResultUtil
;
...
...
@@ -13,8 +15,7 @@ import com.github.pagehelper.PageInfo;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
@Service
public
class
UserInfoServiceImpl
implements
UserInfoService
{
...
...
@@ -22,27 +23,74 @@ public class UserInfoServiceImpl implements UserInfoService{
@Autowired
private
UserInfoMapper
userInfoMapper
;
@Autowired
private
MemberMapper
memberMapper
;
/**
* @Author:cwd
* @Description:获取组织列表
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@Override
public
Result
getOrganization
(
PageBean
pageBean
)
{
public
Result
getOrganization
(
PageBean
pageBean
,
Integer
id
,
Integer
pId
)
{
try
{
if
(
pId
==
null
){
PageHelper
.
startPage
(
pageBean
.
getPageNum
(),
pageBean
.
getPageSize
());
if
(
id
==
null
){
id
=
1
;
}
List
<
BpmCompanyVo
>
list
=
userInfoMapper
.
getOrganization
(
id
);
BpmCompanyVo
bpmCompanyVo
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
Integer
pIds
=
list
.
get
(
i
).
getPId
();
bpmCompanyVo
=
userInfoMapper
.
getParentName
(
pIds
);
//根据pid获取上级组织名称
list
.
get
(
i
).
setParentName
(
bpmCompanyVo
.
getName
());
}
PageInfo
<
BpmCompanyVo
>
pageInfo
=
new
PageInfo
<>(
list
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
16
);
map
.
put
(
"pageInfo"
,
pageInfo
);
map
.
put
(
"type"
,
1
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
,
map
);
}
else
if
(
pId
==
1
){
PageHelper
.
startPage
(
pageBean
.
getPageNum
(),
pageBean
.
getPageSize
());
List
<
BpmCompanyVo
>
list
=
userInfoMapper
.
getOrganization
(
);
List
<
BpmCompanyVo
>
list
=
userInfoMapper
.
getOrganization
(
id
);
BpmCompanyVo
bpmCompanyVo
;
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
Integer
pId
=
list
.
get
(
i
).
getPId
();
bpmCompanyVo
=
userInfoMapper
.
getParentName
(
pId
);
Integer
pIds
=
list
.
get
(
i
).
getPId
();
bpmCompanyVo
=
userInfoMapper
.
getParentName
(
pIds
);
//根据pid获取上级组织名称
list
.
get
(
i
).
setParentName
(
bpmCompanyVo
.
getName
());
}
PageInfo
<
BpmCompanyVo
>
pageInfo
=
new
PageInfo
<>(
list
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
,
pageInfo
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
16
);
map
.
put
(
"pageInfo"
,
pageInfo
);
map
.
put
(
"type"
,
1
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
,
map
);
}
else
{
PageHelper
.
startPage
(
pageBean
.
getPageNum
(),
pageBean
.
getPageSize
());
List
<
BpmCompanyVo
>
list
=
memberMapper
.
getMemberList
(
id
);
PageInfo
<
BpmCompanyVo
>
pageInfo
=
new
PageInfo
<>(
list
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>(
16
);
map
.
put
(
"pageInfo"
,
pageInfo
);
map
.
put
(
"type"
,
2
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
,
map
);
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
INTERNAL_SERVER_ERROR
);
}
}
/**
* @Author:cwd
* @Description:加载ztree
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@Override
public
Result
getOrganizationList
()
{
try
{
...
...
@@ -53,4 +101,110 @@ public class UserInfoServiceImpl implements UserInfoService{
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
INTERNAL_SERVER_ERROR
);
}
}
/**
* @Author:cwd
* @Description:添加组织
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@Override
public
Result
addOrganization
(
String
name
,
String
abbreviationName
,
Long
pId
,
Integer
id
)
{
try
{
BpmCompany
bpmCompany
=
new
BpmCompany
();
//组织编号
StringBuilder
str
=
new
StringBuilder
();
//定义变长字符串
Random
random
=
new
Random
();
//随机生成数字,并添加到字符串
for
(
int
i
=
0
;
i
<
8
;
i
++){
str
.
append
(
random
.
nextInt
(
6
));
}
String
number
=
"zz"
+
str
.
toString
();
//通过pid获取上一级的组织关系
String
relation
=
userInfoMapper
.
getOrganizationRelation
(
id
);
//拼接
String
a
=
relation
+
"/"
+
number
;
bpmCompany
.
setName
(
name
);
bpmCompany
.
setCreateTime
(
new
Date
());
bpmCompany
.
setUpdateTime
(
new
Date
());
bpmCompany
.
setAbbreviationName
(
abbreviationName
);
bpmCompany
.
setCode
(
number
);
bpmCompany
.
setOrganizationRelation
(
a
);
if
(
pId
==
null
){
pId
=
1L
;
}
bpmCompany
.
setPId
(
id
);
bpmCompany
.
setStatus
(
0
);
userInfoMapper
.
insertSelective
(
bpmCompany
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
INTERNAL_SERVER_ERROR
);
}
}
/**
* @Author:cwd
* @Description:部门下添加人员信息
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@Override
public
Result
addOrganizationMember
(
String
name
,
String
position
,
Long
pId
,
Integer
id
)
{
try
{
BpmEmployee
bpmEmployee
=
new
BpmEmployee
();
bpmEmployee
.
setCreateTime
(
new
Date
());
bpmEmployee
.
setUpdateTime
(
new
Date
());
bpmEmployee
.
setName
(
name
);
bpmEmployee
.
setCodeId
(
pId
.
intValue
());
bpmEmployee
.
setDepartment
(
id
);
bpmEmployee
.
setPosition
(
position
);
bpmEmployee
.
setStatus
(
0
);
memberMapper
.
insert
(
bpmEmployee
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
INTERNAL_SERVER_ERROR
);
}
}
/**
* @Author:cwd
* @Description:获取组织详情
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@Override
public
Result
getOrganizationInfo
(
Integer
id
)
{
try
{
Map
<
String
,
Object
>
map
=
userInfoMapper
.
getOrganizationInfo
(
id
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
,
map
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
INTERNAL_SERVER_ERROR
);
}
}
/**
* @Author:cwd
* @Description:修改组织信息
* @Date: 2019/03/04 22:53
* @Param:
* @return
**/
@Override
public
Result
editOrganization
(
String
name
,
String
abbreviationName
,
Integer
id
)
{
try
{
BpmCompany
bpmCompany
=
new
BpmCompany
();
bpmCompany
.
setName
(
name
);
bpmCompany
.
setAbbreviationName
(
abbreviationName
);
bpmCompany
.
setId
(
id
.
longValue
());
userInfoMapper
.
updateByPrimaryKeySelective
(
bpmCompany
);
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
SUCCESS
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ResultUtil
.
getResult
(
RespCode
.
Code
.
INTERNAL_SERVER_ERROR
);
}
}
}
src/main/java/com/bbd/bpm/vo/BpmEmployeeVo.java
0 → 100644
View file @
abcb2e34
package
com
.
bbd
.
bpm
.
vo
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
lombok.Data
;
import
java.util.Date
;
@Data
@JsonInclude
(
JsonInclude
.
Include
.
NON_NULL
)
public
class
BpmEmployeeVo
{
/**
* 人员id
*/
private
Integer
id
;
/**
* 人员名称
*/
private
String
name
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createdTime
;
/**
* 修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
/**
* 所属组织编码
*/
private
String
code
;
/**
* 部门名称
*/
private
String
department
;
/**
* 状态0.在职 1.离职 2删除
*/
private
Integer
status
;
/**
*职位
*/
private
String
position
;
}
src/main/resources/templates/user/organizationList.html
View file @
abcb2e34
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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