Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
haoban3.0
haoban-manage3.0
Commits
8b49e6d2
Commit
8b49e6d2
authored
Mar 17, 2022
by
墨竹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:企微同步通讯录处理部门
parent
a94d9250
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
377 additions
and
350 deletions
+377
-350
MessageApiServiceImpl.java
...anage/service/service/out/impl/MessageApiServiceImpl.java
+36
-11
StaffDepartmentRelatedMapper.xml
...rc/main/resources/mapper/StaffDepartmentRelatedMapper.xml
+340
-338
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+1
-1
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
View file @
8b49e6d2
...
...
@@ -83,6 +83,8 @@ public class MessageApiServiceImpl implements MessageApiService {
private
SecretSettingService
secretSettingService
;
@Autowired
private
DepartmentApiService
departmentApiService
;
@Autowired
private
WxApplicationApiService
wxApplicationApiService
;
@Override
public
void
gicMessageReceive
(
GicMessageDTO
gicMessageDTO
)
{
...
...
@@ -277,15 +279,38 @@ public class MessageApiServiceImpl implements MessageApiService {
*/
private
void
dealDepartment
(
QywxCallBackDTO
qywxCallBackDTO
)
{
log
.
info
(
"处理部门:{}"
,
qywxCallBackDTO
);
Integer
wxDeptId
=
qywxCallBackDTO
.
getId
();
String
authCorpId
=
qywxCallBackDTO
.
getAuthCorpId
();
DepartmentDTO
departmentDTO
=
new
DepartmentDTO
();
departmentDTO
.
setDepartmentName
(
qywxCallBackDTO
.
getDepartmentName
());
departmentDTO
.
setIsStore
(
0
);
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
qywxCallBackDTO
.
getAuthCorpId
());
TabHaobanWxEnterprise
enterprise
=
this
.
enterpriseService
.
getEnterpriseBycorpId
(
authCorpId
);
if
(
enterprise
==
null
)
{
log
.
info
(
"为查询到企业:authCorpId:{}"
,
authCorpId
);
return
;
}
String
wxEnterpriseId
=
enterprise
.
getWxEnterpriseId
();
SecretSettingDTO
secretSetting
=
secretSettingService
.
getSecretSetting
(
wxEnterpriseId
,
SecretTypeEnum
.
HAOBAN_HELP
.
getVal
());
if
(
null
==
secretSetting
||
secretSetting
.
getCheckFlag
()
==
0
)
{
log
.
info
(
"没有配置secret:{}"
,
wxEnterpriseId
);
return
;
}
String
corpid
=
""
;
String
secret
=
secretSetting
.
getSecretVal
();
if
(
authCorpId
.
length
()
>
20
)
{
WxApplicationDTO
application
=
wxApplicationApiService
.
selectByWxEnterpriseIdAndApplicationType
(
wxEnterpriseId
,
3
);
if
(
application
!=
null
)
{
corpid
=
application
.
getCorpid
();
}
}
else
{
corpid
=
authCorpId
;
}
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
deptDetail
=
qywxDepartmentApiService
.
getSelfDepartmentById
(
corpid
,
secret
,
wxDeptId
);
departmentDTO
.
setDepartmentName
(
deptDetail
.
getName
());
TabHaobanDepartment
parentDepartment
=
new
TabHaobanDepartment
();
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
,
enterprise
.
getWxEnterpriseId
()
);
parentDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getParentId
()
+
""
,
wxEnterpriseId
);
}
else
{
TabHaobanDepartment
oldDepartment
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
()
);
TabHaobanDepartment
oldDepartment
=
this
.
departmentService
.
getByWxId
(
wxDeptId
+
""
,
wxEnterpriseId
);
if
(
oldDepartment
!=
null
)
{
parentDepartment
=
departmentService
.
selectById
(
oldDepartment
.
getParentDepartmentId
());
}
...
...
@@ -293,7 +318,7 @@ public class MessageApiServiceImpl implements MessageApiService {
String
changeType
=
qywxCallBackDTO
.
getChangeType
();
if
(!
changeType
.
equals
(
WxEditType
.
DELETE_DEPART
.
getCode
()))
{
if
(
parentDepartment
==
null
)
{
log
.
info
(
"
微信
同步父部门不存在"
);
log
.
info
(
"
企微
同步父部门不存在"
);
return
;
}
departmentDTO
.
setParentDepartmentId
(
parentDepartment
.
getDepartmentId
());
...
...
@@ -301,16 +326,16 @@ public class MessageApiServiceImpl implements MessageApiService {
departmentDTO
.
setChainName
(
parentDepartment
.
getChainName
()
+
Constant
.
NAME_SEPARATOR
+
parentDepartment
.
getChainName
());
departmentDTO
.
setLevel
(
parentDepartment
.
getLevel
()
+
1
);
}
departmentDTO
.
setWxEnterpriseId
(
enterprise
.
getWxEnterpriseId
()
);
departmentDTO
.
setWxDepartmentId
(
qywxCallBackDTO
.
getId
()
+
""
);
departmentDTO
.
setWxEnterpriseId
(
wxEnterpriseId
);
departmentDTO
.
setWxDepartmentId
(
wxDeptId
+
""
);
if
(
qywxCallBackDTO
.
getParentId
()
!=
null
)
{
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
list
Department
(
qywxCallBackDTO
.
getAuthCorpId
(),
qywxCallBackDTO
.
getSuiteId
()
,
qywxCallBackDTO
.
getParentId
());
List
<
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
>
list
=
this
.
qywxDepartmentApiService
.
list
SelfDepartment
(
corpid
,
secret
,
qywxCallBackDTO
.
getParentId
());
if
(
list
!=
null
)
{
for
(
com
.
gic
.
wechat
.
api
.
dto
.
qywx
.
DepartmentDTO
wxDepartmentDTO
:
list
)
{
if
(
Convert
.
toStr
(
wxDepartmentDTO
.
getId
()).
equals
(
departmentDTO
.
getDepartmentId
()))
{
departmentDTO
.
setSort
(
qywxCallBackDTO
.
getOrder
());
}
else
{
TabHaobanDepartment
tab
=
this
.
departmentService
.
getByWxId
(
wxDepartmentDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
()
);
TabHaobanDepartment
tab
=
this
.
departmentService
.
getByWxId
(
wxDepartmentDTO
.
getId
()
+
""
,
wxEnterpriseId
);
if
(
tab
!=
null
)
{
tab
.
setSort
(
wxDepartmentDTO
.
getOrder
());
this
.
departmentService
.
edit
(
EntityUtil
.
changeEntityByJSON
(
DepartmentDTO
.
class
,
tab
));
...
...
@@ -324,7 +349,7 @@ public class MessageApiServiceImpl implements MessageApiService {
this
.
departmentService
.
add
(
departmentDTO
);
}
else
if
(
changeType
.
equals
(
WxEditType
.
UPDATE_DEPART
.
getCode
()))
{
log
.
info
(
"企微修改部门同步"
);
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
()
);
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
wxDeptId
+
""
,
wxEnterpriseId
);
if
(
department
==
null
)
{
String
response
=
this
.
departmentService
.
add
(
departmentDTO
);
log
.
info
(
"企微同步新增部门:{}"
,
JSON
.
toJSONString
(
response
));
...
...
@@ -336,7 +361,7 @@ public class MessageApiServiceImpl implements MessageApiService {
}
}
else
if
(
changeType
.
equals
(
WxEditType
.
DELETE_DEPART
.
getCode
()))
{
log
.
info
(
"企微删除部门同步"
);
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
qywxCallBackDTO
.
getId
()
+
""
,
enterprise
.
getWxEnterpriseId
()
);
TabHaobanDepartment
department
=
this
.
departmentService
.
getByWxId
(
wxDeptId
+
""
,
wxEnterpriseId
);
if
(
department
==
null
)
{
log
.
info
(
"企微同步删除部门不存在"
);
}
else
{
...
...
haoban-manage3-service/src/main/resources/mapper/StaffDepartmentRelatedMapper.xml
View file @
8b49e6d2
<?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.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
<id
column=
"staff_department_related_id"
property=
"staffDepartmentRelatedId"
jdbcType=
"VARCHAR"
/>
<result
column=
"staff_id"
property=
"staffId"
jdbcType=
"VARCHAR"
/>
<result
column=
"phone_number"
property=
"phoneNumber"
jdbcType=
"VARCHAR"
/>
<result
column=
"nation_code"
property=
"nationCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_enterprise_id"
property=
"wxEnterpriseId"
jdbcType=
"VARCHAR"
/>
<result
column=
"department_id"
property=
"departmentId"
jdbcType=
"VARCHAR"
/>
<result
column=
"status_flag"
property=
"statusFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"clerk_code"
property=
"clerkCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"staff_name"
property=
"staffName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
staff_department_related_id, staff_id, phone_number, nation_code, wx_user_id, department_id,
<mapper
namespace=
"com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
<id
column=
"staff_department_related_id"
property=
"staffDepartmentRelatedId"
jdbcType=
"VARCHAR"
/>
<result
column=
"staff_id"
property=
"staffId"
jdbcType=
"VARCHAR"
/>
<result
column=
"phone_number"
property=
"phoneNumber"
jdbcType=
"VARCHAR"
/>
<result
column=
"nation_code"
property=
"nationCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_user_id"
property=
"wxUserId"
jdbcType=
"VARCHAR"
/>
<result
column=
"wx_enterprise_id"
property=
"wxEnterpriseId"
jdbcType=
"VARCHAR"
/>
<result
column=
"department_id"
property=
"departmentId"
jdbcType=
"VARCHAR"
/>
<result
column=
"status_flag"
property=
"statusFlag"
jdbcType=
"INTEGER"
/>
<result
column=
"clerk_code"
property=
"clerkCode"
jdbcType=
"VARCHAR"
/>
<result
column=
"staff_name"
property=
"staffName"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
staff_department_related_id, staff_id, phone_number, nation_code, wx_user_id, department_id,
status_flag, clerk_code, create_time, update_time,wx_enterprise_id,staff_name
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
insert into tab_haoban_staff_department_related (staff_department_related_id, staff_id,
phone_number, nation_code, wx_user_id,
department_id, status_flag, clerk_code,
create_time, update_time,wx_enterprise_id,staff_name)
values (#{staffDepartmentRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{phoneNumber,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR},
#{departmentId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{clerkCode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},#{wxEnterpriseId},#{staffName})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
insert into tab_haoban_staff_department_related
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"staffDepartmentRelatedId != null"
>
staff_department_related_id,
</if>
<if
test=
"staffId != null"
>
staff_id,
</if>
<if
test=
"phoneNumber != null"
>
phone_number,
</if>
<if
test=
"nationCode != null"
>
nation_code,
</if>
<if
test=
"wxUserId != null"
>
wx_user_id,
</if>
<if
test=
"wxEnterpriseId != null"
>
wx_enterprise_id,
</if>
<if
test=
"departmentId != null"
>
department_id,
</if>
<if
test=
"statusFlag != null"
>
status_flag,
</if>
<if
test=
"clerkCode != null"
>
clerk_code,
</if>
<if
test=
"staffName != null"
>
staff_name,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"staffDepartmentRelatedId != null"
>
#{staffDepartmentRelatedId,jdbcType=VARCHAR},
</if>
<if
test=
"staffId != null"
>
#{staffId,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNumber != null"
>
#{phoneNumber,jdbcType=VARCHAR},
</if>
<if
test=
"nationCode != null"
>
#{nationCode,jdbcType=VARCHAR},
</if>
<if
test=
"wxUserId != null"
>
#{wxUserId,jdbcType=VARCHAR},
</if>
<if
test=
"wxEnterpriseId != null"
>
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"departmentId != null"
>
#{departmentId,jdbcType=VARCHAR},
</if>
<if
test=
"statusFlag != null"
>
#{statusFlag,jdbcType=INTEGER},
</if>
<if
test=
"clerkCode != null"
>
#{clerkCode,jdbcType=VARCHAR},
</if>
<if
test=
"staffName != null"
>
#{staffName,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
update tab_haoban_staff_department_related
<set
>
<if
test=
"staffId != null"
>
staff_id = #{staffId,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNumber != null"
>
phone_number = #{phoneNumber,jdbcType=VARCHAR},
</if>
<if
test=
"nationCode != null"
>
nation_code = #{nationCode,jdbcType=VARCHAR},
</if>
<if
test=
"wxUserId != null"
>
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
</if>
<if
test=
"wxEnterpriseId != null"
>
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"departmentId != null"
>
department_id = #{departmentId,jdbcType=VARCHAR},
</if>
<if
test=
"statusFlag != null"
>
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if
test=
"clerkCode != null"
>
clerk_code = #{clerkCode,jdbcType=VARCHAR},
</if>
<if
test=
"staffName != null"
>
staff_name = #{staffName,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
update tab_haoban_staff_department_related
set staff_id = #{staffId,jdbcType=VARCHAR},
phone_number = #{phoneNumber,jdbcType=VARCHAR},
nation_code = #{nationCode,jdbcType=VARCHAR},
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
department_id = #{departmentId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
clerk_code = #{clerkCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<select
id=
"listByDepartmentId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"getOneByClerkCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and status_flag = 1
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete
from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
insert into tab_haoban_staff_department_related (staff_department_related_id, staff_id,
phone_number, nation_code, wx_user_id,
department_id, status_flag, clerk_code,
create_time, update_time, wx_enterprise_id, staff_name)
values (#{staffDepartmentRelatedId,jdbcType=VARCHAR}, #{staffId,jdbcType=VARCHAR},
#{phoneNumber,jdbcType=VARCHAR}, #{nationCode,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR},
#{departmentId,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{clerkCode,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{wxEnterpriseId}, #{staffName})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
insert into tab_haoban_staff_department_related
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"staffDepartmentRelatedId != null"
>
staff_department_related_id,
</if>
<if
test=
"staffId != null"
>
staff_id,
</if>
<if
test=
"phoneNumber != null"
>
phone_number,
</if>
<if
test=
"nationCode != null"
>
nation_code,
</if>
<if
test=
"wxUserId != null"
>
wx_user_id,
</if>
<if
test=
"wxEnterpriseId != null"
>
wx_enterprise_id,
</if>
<if
test=
"departmentId != null"
>
department_id,
</if>
<if
test=
"statusFlag != null"
>
status_flag,
</if>
<if
test=
"clerkCode != null"
>
clerk_code,
</if>
<if
test=
"staffName != null"
>
staff_name,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</select>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"staffDepartmentRelatedId != null"
>
#{staffDepartmentRelatedId,jdbcType=VARCHAR},
</if>
<if
test=
"staffId != null"
>
#{staffId,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNumber != null"
>
#{phoneNumber,jdbcType=VARCHAR},
</if>
<if
test=
"nationCode != null"
>
#{nationCode,jdbcType=VARCHAR},
</if>
<if
test=
"wxUserId != null"
>
#{wxUserId,jdbcType=VARCHAR},
</if>
<if
test=
"wxEnterpriseId != null"
>
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"departmentId != null"
>
#{departmentId,jdbcType=VARCHAR},
</if>
<if
test=
"statusFlag != null"
>
#{statusFlag,jdbcType=INTEGER},
</if>
<if
test=
"clerkCode != null"
>
#{clerkCode,jdbcType=VARCHAR},
</if>
<if
test=
"staffName != null"
>
#{staffName,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
update tab_haoban_staff_department_related
<set>
<if
test=
"staffId != null"
>
staff_id = #{staffId,jdbcType=VARCHAR},
</if>
<if
test=
"phoneNumber != null"
>
phone_number = #{phoneNumber,jdbcType=VARCHAR},
</if>
<if
test=
"nationCode != null"
>
nation_code = #{nationCode,jdbcType=VARCHAR},
</if>
<if
test=
"wxUserId != null"
>
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
</if>
<if
test=
"wxEnterpriseId != null"
>
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"departmentId != null"
>
department_id = #{departmentId,jdbcType=VARCHAR},
</if>
<if
test=
"statusFlag != null"
>
status_flag = #{statusFlag,jdbcType=INTEGER},
</if>
<if
test=
"clerkCode != null"
>
clerk_code = #{clerkCode,jdbcType=VARCHAR},
</if>
<if
test=
"staffName != null"
>
staff_name = #{staffName,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
update tab_haoban_staff_department_related
set staff_id = #{staffId,jdbcType=VARCHAR},
phone_number = #{phoneNumber,jdbcType=VARCHAR},
nation_code = #{nationCode,jdbcType=VARCHAR},
wx_user_id = #{wxUserId,jdbcType=VARCHAR},
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
department_id = #{departmentId,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
clerk_code = #{clerkCode,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"listByDepartmentId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"getOneByClerkCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and status_flag = 1
<update
id=
"deleteCode"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
update tab_haoban_staff_department_related
set
clerk_code = '',
update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<select
id=
"listStaffDepartmentByStaffId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
group by department_id
</select>
</select>
<update
id=
"delByUserid"
>
update tab_haoban_staff_department_related
set
status_flag = 0,update_time = now()
where wx_user_id = #{userid,jdbcType=VARCHAR}
</update>
<select
id=
"getDepartmentIdAndStaffId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and department_id = #{departmentId}
and status_flag = 1
limit 1
</select>
<select
id=
"listByWxUserId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where wx_user_id = #{wxUserId}
and status_flag = 1
</select>
<select
id=
"listByClerkCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode}
and status_flag = 1
</select>
<select
id=
"listByWxEnterpriseIdAndClerkCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select
id=
"countByDepartmentId"
resultType=
"java.lang.Integer"
parameterType=
"java.lang.String"
>
select
count(1)
from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"getDepartmentIdAndCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and department_id = #{departmentId}
and status_flag = 1
</select>
<select
id=
"listByDepartmentIdByKeyword"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where 1
and status_flag = 1
<if
test=
"keyword != null and keyword != ''"
>
and (clerk_code like CONCAT('%',#{keyword},'%') or phone_number like CONCAT('%',#{keyword},'%') or staff_name like CONCAT('%',#{keyword},'%'))
</if>
<if
test=
"departmentIds != null and departmentIds.size() > 0"
>
and department_id in
<foreach
collection=
"departmentIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select
id=
"countByDepartmentIds"
resultType=
"java.lang.Integer"
>
select
count(1)
from tab_haoban_staff_department_related
where department_id in
<foreach
collection=
"departmentIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
<select
id=
"listStaffDepartmentByStaffIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_id in
<foreach
collection=
"staffIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
<select
id=
"listByDepartmentIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where department_id in
<foreach
collection=
"departmentIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
and status_flag = 1
<update
id=
"cleanStaffDepartment"
>
update tab_haoban_staff_department_related
set
status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and staff_id in
<foreach
collection=
"staffIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</update>
</select>
<select
id=
"listByWxEnterpriseIdAndStaffId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId}
</select>
<update
id=
"deleteCode"
parameterType=
"com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated"
>
update tab_haoban_staff_department_related
set clerk_code = '',
update_time = #{updateTime,jdbcType=TIMESTAMP}
where staff_department_related_id = #{staffDepartmentRelatedId,jdbcType=VARCHAR}
</update>
<select
id=
"listStaffDepartmentByStaffId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and status_flag = 1
group by department_id
</select>
<update
id=
"delByUserid"
>
update tab_haoban_staff_department_related
set status_flag = 0,
update_time = now()
where wx_user_id = #{userid,jdbcType=VARCHAR}
</update>
<select
id=
"getDepartmentIdAndStaffId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_id = #{staffId,jdbcType=VARCHAR}
and department_id = #{departmentId}
and status_flag = 1
limit 1
</select>
<select
id=
"listByWxUserId"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where wx_user_id = #{wxUserId}
and status_flag = 1
</select>
<select
id=
"listByClerkCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode}
and status_flag = 1
</select>
<select
id=
"listByWxEnterpriseIdAndClerkCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode}
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<select
id=
"countByDepartmentId"
resultType=
"java.lang.Integer"
parameterType=
"java.lang.String"
>
select count(1)
from tab_haoban_staff_department_related
where department_id = #{departmentId,jdbcType=VARCHAR}
and status_flag = 1
</select>
<select
id=
"getDepartmentIdAndCode"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and department_id = #{departmentId}
and status_flag = 1
</select>
<select
id=
"listByDepartmentIdByKeyword"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where status_flag = 1
<if
test=
"keyword != null and keyword != ''"
>
and (clerk_code like CONCAT('%',#{keyword},'%') or phone_number like CONCAT('%',#{keyword},'%') or
staff_name like CONCAT('%',#{keyword},'%'))
</if>
<if
test=
"departmentIds != null and departmentIds.size() > 0"
>
and department_id in
<foreach
collection=
"departmentIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<select
id=
"countByDepartmentIds"
resultType=
"java.lang.Integer"
>
select
count(*)
from tab_haoban_staff_department_related
where department_id in
<foreach
collection=
"departmentIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
<select
id=
"listStaffDepartmentByStaffIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where staff_id in
<foreach
collection=
"staffIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
<select
id=
"listByDepartmentIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where department_id in
<foreach
collection=
"departmentIds"
item=
"id"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{id,jdbcType=VARCHAR}
</foreach>
and status_flag = 1
</select>
<update
id=
"cleanStaffDepartment"
>
update tab_haoban_staff_department_related
set
status_flag = 0,
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
and staff_id in
<foreach
collection=
"staffIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</update>
<select
id=
"listByWxEnterpriseIdAndStaffId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_department_related
where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId}
</select>
</mapper>
\ No newline at end of file
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
8b49e6d2
...
...
@@ -138,7 +138,7 @@ public class StaffController extends WebBaseController {
// 部门
List
<
DepartmentDTO
>
sonDepartmentList
=
departmentApiService
.
listSonByDepartmentIds
(
Lists
.
newArrayList
(
departmentId
),
login
.
getWxEnterpriseId
());
List
<
String
>
departmentIds
=
sonDepartmentList
.
stream
().
map
(
DepartmentDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toList
());
//
员工
//员工
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
activeFlag
,
keyWord
,
pageInfo
,
relationFlag
);
logger
.
info
(
"pages={},totalPage={}"
,
page
.
getCurrentPage
(),
page
.
getTotalPage
());
...
...
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