Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c62f08f9
authored
Sep 09, 2020
by
HaoN
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
通讯录员工新增,修改,启用禁用,列表功能接口完成,并测试。
1 parent
c2529e7e
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
84 additions
and
257 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/tool/TestController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeUserController.java
linkwe-admin/src/main/resources/mybatis/mybatis-config.xml
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
linkwe-framework/src/main/java/com/linkwechat/framework/handler/IntArrayJoinTypeHandler.java → linkwe-framework/src/main/java/com/linkwechat/framework/handler/LongArrayJoinTypeHandler.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeUser.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeUserMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeUserService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/system/SysUserController.java
View file @
c62f08f
package
com
.
linkwechat
.
web
.
controller
.
system
;
package
com
.
linkwechat
.
web
.
controller
.
system
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.constant.UserConstants
;
import
com.linkwechat.common.constant.UserConstants
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
...
@@ -34,6 +17,15 @@ import com.linkwechat.framework.web.service.TokenService;
...
@@ -34,6 +17,15 @@ import com.linkwechat.framework.web.service.TokenService;
import
com.linkwechat.system.service.ISysPostService
;
import
com.linkwechat.system.service.ISysPostService
;
import
com.linkwechat.system.service.ISysRoleService
;
import
com.linkwechat.system.service.ISysRoleService
;
import
com.linkwechat.system.service.ISysUserService
;
import
com.linkwechat.system.service.ISysUserService
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* 用户信息
* 用户信息
...
@@ -42,7 +34,6 @@ import com.linkwechat.system.service.ISysUserService;
...
@@ -42,7 +34,6 @@ import com.linkwechat.system.service.ISysUserService;
*/
*/
@RestController
@RestController
@RequestMapping
(
"/system/user"
)
@RequestMapping
(
"/system/user"
)
@Api
(
"系统用户管理"
)
public
class
SysUserController
extends
BaseController
public
class
SysUserController
extends
BaseController
{
{
@Autowired
@Autowired
...
@@ -62,7 +53,6 @@ public class SysUserController extends BaseController
...
@@ -62,7 +53,6 @@ public class SysUserController extends BaseController
*/
*/
@PreAuthorize
(
"@ss.hasPermi('system:user:list')"
)
@PreAuthorize
(
"@ss.hasPermi('system:user:list')"
)
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
@ApiOperation
(
"获取用户列表"
)
public
TableDataInfo
list
(
SysUser
user
)
public
TableDataInfo
list
(
SysUser
user
)
{
{
startPage
();
startPage
();
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/tool/TestController.java
deleted
100644 → 0
View file @
c2529e7
package
com
.
linkwechat
.
web
.
controller
.
tool
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.utils.StringUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiOperation
;
/**
* swagger 用户测试方法
*
* @author ruoyi
*/
@Api
(
"用户信息管理"
)
@RestController
@RequestMapping
(
"/test/user"
)
public
class
TestController
extends
BaseController
{
private
final
static
Map
<
Integer
,
UserEntity
>
users
=
new
LinkedHashMap
<
Integer
,
UserEntity
>();
{
users
.
put
(
1
,
new
UserEntity
(
1
,
"admin"
,
"admin123"
,
"15888888888"
));
users
.
put
(
2
,
new
UserEntity
(
2
,
"ry"
,
"admin123"
,
"15666666666"
));
}
@ApiOperation
(
"获取用户列表"
)
@GetMapping
(
"/list"
)
public
AjaxResult
userList
()
{
List
<
UserEntity
>
userList
=
new
ArrayList
<
UserEntity
>(
users
.
values
());
return
AjaxResult
.
success
(
userList
);
}
@ApiOperation
(
"获取用户详细"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户ID"
,
required
=
true
,
dataType
=
"int"
,
paramType
=
"path"
)
@GetMapping
(
"/{userId}"
)
public
AjaxResult
getUser
(
@PathVariable
Integer
userId
)
{
if
(!
users
.
isEmpty
()
&&
users
.
containsKey
(
userId
))
{
return
AjaxResult
.
success
(
users
.
get
(
userId
));
}
else
{
return
AjaxResult
.
error
(
"用户不存在"
);
}
}
@ApiOperation
(
"新增用户"
)
@ApiImplicitParam
(
name
=
"userEntity"
,
value
=
"新增用户信息"
,
dataType
=
"UserEntity"
)
@PostMapping
(
"/save"
)
public
AjaxResult
save
(
UserEntity
user
)
{
if
(
StringUtils
.
isNull
(
user
)
||
StringUtils
.
isNull
(
user
.
getUserId
()))
{
return
AjaxResult
.
error
(
"用户ID不能为空"
);
}
return
AjaxResult
.
success
(
users
.
put
(
user
.
getUserId
(),
user
));
}
@ApiOperation
(
"更新用户"
)
@ApiImplicitParam
(
name
=
"userEntity"
,
value
=
"新增用户信息"
,
dataType
=
"UserEntity"
)
@PutMapping
(
"/update"
)
public
AjaxResult
update
(
UserEntity
user
)
{
if
(
StringUtils
.
isNull
(
user
)
||
StringUtils
.
isNull
(
user
.
getUserId
()))
{
return
AjaxResult
.
error
(
"用户ID不能为空"
);
}
if
(
users
.
isEmpty
()
||
!
users
.
containsKey
(
user
.
getUserId
()))
{
return
AjaxResult
.
error
(
"用户不存在"
);
}
users
.
remove
(
user
.
getUserId
());
return
AjaxResult
.
success
(
users
.
put
(
user
.
getUserId
(),
user
));
}
@ApiOperation
(
"删除用户信息"
)
@ApiImplicitParam
(
name
=
"userId"
,
value
=
"用户ID"
,
required
=
true
,
dataType
=
"int"
,
paramType
=
"path"
)
@DeleteMapping
(
"/{userId}"
)
public
AjaxResult
delete
(
@PathVariable
Integer
userId
)
{
if
(!
users
.
isEmpty
()
&&
users
.
containsKey
(
userId
))
{
users
.
remove
(
userId
);
return
AjaxResult
.
success
();
}
else
{
return
AjaxResult
.
error
(
"用户不存在"
);
}
}
}
@ApiModel
(
"用户实体"
)
class
UserEntity
{
@ApiModelProperty
(
"用户ID"
)
private
Integer
userId
;
@ApiModelProperty
(
"用户名称"
)
private
String
username
;
@ApiModelProperty
(
"用户密码"
)
private
String
password
;
@ApiModelProperty
(
"用户手机"
)
private
String
mobile
;
public
UserEntity
()
{
}
public
UserEntity
(
Integer
userId
,
String
username
,
String
password
,
String
mobile
)
{
this
.
userId
=
userId
;
this
.
username
=
username
;
this
.
password
=
password
;
this
.
mobile
=
mobile
;
}
public
Integer
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
Integer
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUsername
()
{
return
username
;
}
public
void
setUsername
(
String
username
)
{
this
.
username
=
username
;
}
public
String
getPassword
()
{
return
password
;
}
public
void
setPassword
(
String
password
)
{
this
.
password
=
password
;
}
public
String
getMobile
()
{
return
mobile
;
}
public
void
setMobile
(
String
mobile
)
{
this
.
mobile
=
mobile
;
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeUserController.java
View file @
c62f08f
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
java.util.List
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
java.util.List
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.service.IWeUserService
;
/**
/**
...
@@ -78,30 +70,32 @@ public class WeUserController extends BaseController {
...
@@ -78,30 +70,32 @@ public class WeUserController extends BaseController {
* 修改通讯录相关客户
* 修改通讯录相关客户
*/
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:user:edit')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:user:edit')"
)
@Log
(
title
=
"
通讯录相关
客户"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"
更新通讯录
客户"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
@PutMapping
@ApiOperation
(
"更新通讯录客户"
)
public
AjaxResult
edit
(
@RequestBody
WeUser
weUser
)
public
AjaxResult
edit
(
@RequestBody
WeUser
weUser
)
{
{
return
toAjax
(
weUserService
.
updateWeUser
(
weUser
));
return
toAjax
(
weUserService
.
updateWeUser
(
weUser
));
}
}
/**
* 启用或者禁止
* @param id
* @param enable
* @return
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:user:startOrStop')"
)
@PreAuthorize
(
"@ss.hasPermi('wecom:user:startOrStop')"
)
@Log
(
title
=
"启用禁用用户"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"启用禁用用户"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
(
"/startOrStop"
)
@PutMapping
(
"/startOrStop"
)
public
AjaxResult
startOrStop
(
Long
id
,
Integer
enable
){
@ApiOperation
(
"启用禁用用户 true:启用 false:禁用"
)
public
AjaxResult
startOrStop
(
Long
id
,
Boolean
enable
){
return
toAjax
(
weUserService
.
startOrStop
(
id
,
enable
));
return
toAjax
(
weUserService
.
startOrStop
(
id
,
enable
));
}
}
// /**
// * 删除通讯录相关客户
// */
// @PreAuthorize("@ss.hasPermi('wecom:user:remove')")
// @Log(title = "通讯录相关客户", businessType = BusinessType.DELETE)
// @DeleteMapping("/{ids}")
// public AjaxResult remove(@PathVariable Long[] ids)
// {
// return toAjax(weUserService.deleteWeUserByIds(ids));
// }
}
}
linkwe-admin/src/main/resources/mybatis/mybatis-config.xml
View file @
c62f08f
...
@@ -11,5 +11,10 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
...
@@ -11,5 +11,10 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
<setting
name=
"logImpl"
value=
"SLF4J"
/>
<!-- 指定 MyBatis 所用日志的具体实现 -->
<setting
name=
"logImpl"
value=
"SLF4J"
/>
<!-- 指定 MyBatis 所用日志的具体实现 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> 驼峰式命名 -->
</settings>
</settings>
<typeHandlers>
<typeHandler
handler=
"com.linkwechat.framework.handler.LongArrayJoinTypeHandler"
/>
</typeHandlers>
</configuration>
</configuration>
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
View file @
c62f08f
...
@@ -23,4 +23,16 @@ public class WeConstans {
...
@@ -23,4 +23,16 @@ public class WeConstans {
* 企业微信端根部门id
* 企业微信端根部门id
*/
*/
public
static
final
Long
WE_ROOT_DEPARMENT_ID
=
1L
;
public
static
final
Long
WE_ROOT_DEPARMENT_ID
=
1L
;
/**
* 企业微信通讯录用户启用
*/
public
static
final
Integer
WE_USER_START
=
1
;
/**
* 企业微信通讯录用户停用
*/
public
static
final
Integer
WE_USER_STOP
=
0
;
}
}
linkwe-framework/src/main/java/com/linkwechat/framework/handler/
Int
ArrayJoinTypeHandler.java
→
linkwe-framework/src/main/java/com/linkwechat/framework/handler/
Long
ArrayJoinTypeHandler.java
View file @
c62f08f
...
@@ -19,36 +19,36 @@ import java.util.List;
...
@@ -19,36 +19,36 @@ import java.util.List;
**/
**/
@MappedTypes
(
value
=
{
Integer
[].
class
,
Short
[].
class
,
Long
[].
class
})
@MappedTypes
(
value
=
{
Integer
[].
class
,
Short
[].
class
,
Long
[].
class
})
@MappedJdbcTypes
(
value
=
JdbcType
.
VARCHAR
)
@MappedJdbcTypes
(
value
=
JdbcType
.
VARCHAR
)
public
class
IntArrayJoinTypeHandler
extends
BaseTypeHandler
<
Integer
[]>
{
public
class
LongArrayJoinTypeHandler
extends
BaseTypeHandler
<
Long
[]>
{
String
split
=
","
;
String
split
=
","
;
@Override
@Override
public
void
setNonNullParameter
(
PreparedStatement
ps
,
int
i
,
Integer
[]
parameter
,
JdbcType
jdbcType
)
public
void
setNonNullParameter
(
PreparedStatement
ps
,
int
i
,
Long
[]
parameter
,
JdbcType
jdbcType
)
throws
SQLException
{
throws
SQLException
{
ps
.
setString
(
i
,
StringUtils
.
join
(
parameter
,
split
));
ps
.
setString
(
i
,
StringUtils
.
join
(
parameter
,
split
));
}
}
@Override
@Override
public
Integer
[]
getNullableResult
(
ResultSet
rs
,
String
columnName
)
throws
SQLException
{
public
Long
[]
getNullableResult
(
ResultSet
rs
,
String
columnName
)
throws
SQLException
{
String
reString
=
rs
.
getString
(
columnName
);
String
reString
=
rs
.
getString
(
columnName
);
if
(
reString
!=
null
&&
reString
.
length
()
>
0
)
{
if
(
reString
!=
null
&&
reString
.
length
()
>
0
)
{
String
[]
arrs
=
reString
.
split
(
split
);
String
[]
arrs
=
reString
.
split
(
split
);
List
<
Integer
>
idList
=
new
ArrayList
<>(
arrs
.
length
);
List
<
Long
>
idList
=
new
ArrayList
<>(
arrs
.
length
);
for
(
String
id
:
arrs
)
{
for
(
String
id
:
arrs
)
{
if
(
id
!=
null
&&
id
.
length
()
>
0
)
{
if
(
id
!=
null
&&
id
.
length
()
>
0
)
{
idList
.
add
(
Integer
.
valueOf
(
id
));
idList
.
add
(
Long
.
valueOf
(
id
));
}
}
}
}
return
idList
.
toArray
(
new
Integer
[
idList
.
size
()]);
return
idList
.
toArray
(
new
Long
[
idList
.
size
()]);
}
}
return
null
;
return
null
;
}
}
@Override
@Override
public
Integer
[]
getNullableResult
(
ResultSet
rs
,
int
columnIndex
)
throws
SQLException
{
public
Long
[]
getNullableResult
(
ResultSet
rs
,
int
columnIndex
)
throws
SQLException
{
String
reString
=
rs
.
getString
(
columnIndex
);
String
reString
=
rs
.
getString
(
columnIndex
);
if
(
reString
!=
null
&&
reString
.
length
()
>
0
)
{
if
(
reString
!=
null
&&
reString
.
length
()
>
0
)
{
String
[]
arrs
=
reString
.
split
(
split
);
String
[]
arrs
=
reString
.
split
(
split
);
...
@@ -59,13 +59,13 @@ public class IntArrayJoinTypeHandler extends BaseTypeHandler<Integer[]> {
...
@@ -59,13 +59,13 @@ public class IntArrayJoinTypeHandler extends BaseTypeHandler<Integer[]> {
idList
.
add
(
Integer
.
valueOf
(
id
));
idList
.
add
(
Integer
.
valueOf
(
id
));
}
}
}
}
return
idList
.
toArray
(
new
Integer
[
idList
.
size
()]);
return
idList
.
toArray
(
new
Long
[
idList
.
size
()]);
}
}
return
null
;
return
null
;
}
}
@Override
@Override
public
Integer
[]
getNullableResult
(
CallableStatement
cs
,
int
columnIndex
)
throws
SQLException
{
public
Long
[]
getNullableResult
(
CallableStatement
cs
,
int
columnIndex
)
throws
SQLException
{
String
reString
=
cs
.
getString
(
columnIndex
);
String
reString
=
cs
.
getString
(
columnIndex
);
if
(
reString
!=
null
&&
reString
.
length
()
>
0
)
{
if
(
reString
!=
null
&&
reString
.
length
()
>
0
)
{
String
[]
arrs
=
reString
.
split
(
split
);
String
[]
arrs
=
reString
.
split
(
split
);
...
@@ -76,7 +76,7 @@ public class IntArrayJoinTypeHandler extends BaseTypeHandler<Integer[]> {
...
@@ -76,7 +76,7 @@ public class IntArrayJoinTypeHandler extends BaseTypeHandler<Integer[]> {
idList
.
add
(
Integer
.
valueOf
(
id
));
idList
.
add
(
Integer
.
valueOf
(
id
));
}
}
}
}
return
idList
.
toArray
(
new
Integer
[
idList
.
size
()]);
return
idList
.
toArray
(
new
Long
[
idList
.
size
()]);
}
}
return
null
;
return
null
;
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeUser.java
View file @
c62f08f
...
@@ -103,7 +103,7 @@ public class WeUser extends BaseEntity
...
@@ -103,7 +103,7 @@ public class WeUser extends BaseEntity
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
/** 是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 */
@ApiModelProperty
(
"是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 "
)
@ApiModelProperty
(
"是否激活(1:是;2:否)该字段主要表示当前信息是否同步微信 "
)
private
Integer
isActivate
=
new
Integer
(
1
);
private
Integer
isActivate
=
new
Integer
(
2
);
/** 转化成企业微信需要的dto对象 */
/** 转化成企业微信需要的dto对象 */
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeUserMapper.java
View file @
c62f08f
package
com
.
linkwechat
.
wecom
.
mapper
;
package
com
.
linkwechat
.
wecom
.
mapper
;
import
java.util.List
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
java.util.List
;
/**
/**
* 通讯录相关客户Mapper接口
* 通讯录相关客户Mapper接口
*
*
...
@@ -60,10 +61,4 @@ public interface WeUserMapper
...
@@ -60,10 +61,4 @@ public interface WeUserMapper
public
int
deleteWeUserByIds
(
Long
[]
ids
);
public
int
deleteWeUserByIds
(
Long
[]
ids
);
/**
* 根据部门id获取员工
* @param departmentId
* @return
*/
public
List
<
WeUser
>
findWeUsersByDepartmentId
(
Long
departmentId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeUserService.java
View file @
c62f08f
package
com
.
linkwechat
.
wecom
.
service
;
package
com
.
linkwechat
.
wecom
.
service
;
import
java.util.List
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
java.util.List
;
/**
/**
* 通讯录相关客户Service接口
* 通讯录相关客户Service接口
*
*
...
@@ -66,5 +67,8 @@ public interface IWeUserService
...
@@ -66,5 +67,8 @@ public interface IWeUserService
* @param enable
* @param enable
* @return
* @return
*/
*/
public
int
startOrStop
(
Long
id
,
Integer
enable
);
public
int
startOrStop
(
Long
id
,
Boolean
enable
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
View file @
c62f08f
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
java.util.List
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.domain.dto.WeUserDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.linkwechat.wecom.mapper.WeUserMapper
;
import
com.linkwechat.wecom.mapper.WeUserMapper
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
/**
/**
* 通讯录相关客户Service业务层处理
* 通讯录相关客户Service业务层处理
...
@@ -60,6 +60,7 @@ public class WeUserServiceImpl implements IWeUserService
...
@@ -60,6 +60,7 @@ public class WeUserServiceImpl implements IWeUserService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
public
int
insertWeUser
(
WeUser
weUser
)
public
int
insertWeUser
(
WeUser
weUser
)
{
{
...
@@ -86,6 +87,7 @@ public class WeUserServiceImpl implements IWeUserService
...
@@ -86,6 +87,7 @@ public class WeUserServiceImpl implements IWeUserService
* @return 结果
* @return 结果
*/
*/
@Override
@Override
@Transactional
public
int
updateWeUser
(
WeUser
weUser
)
public
int
updateWeUser
(
WeUser
weUser
)
{
{
int
returnCode
=
weUserMapper
.
updateWeUser
(
weUser
);
int
returnCode
=
weUserMapper
.
updateWeUser
(
weUser
);
...
@@ -137,7 +139,8 @@ public class WeUserServiceImpl implements IWeUserService
...
@@ -137,7 +139,8 @@ public class WeUserServiceImpl implements IWeUserService
* @return
* @return
*/
*/
@Override
@Override
public
int
startOrStop
(
Long
id
,
Integer
enable
)
{
@Transactional
public
int
startOrStop
(
Long
id
,
Boolean
enable
)
{
int
returnCode
=
-
1
;
int
returnCode
=
-
1
;
...
@@ -145,7 +148,7 @@ public class WeUserServiceImpl implements IWeUserService
...
@@ -145,7 +148,7 @@ public class WeUserServiceImpl implements IWeUserService
if
(
null
!=
weUser
){
if
(
null
!=
weUser
){
weUser
.
setEnable
(
enable
);
weUser
.
setEnable
(
enable
?
WeConstans
.
WE_USER_START
:
WeConstans
.
WE_USER_STOP
);
returnCode
=
updateWeUser
(
weUser
);
returnCode
=
updateWeUser
(
weUser
);
}
}
...
@@ -154,4 +157,7 @@ public class WeUserServiceImpl implements IWeUserService
...
@@ -154,4 +157,7 @@ public class WeUserServiceImpl implements IWeUserService
return
returnCode
;
return
returnCode
;
}
}
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
View file @
c62f08f
...
@@ -14,9 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -14,9 +14,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"mobile"
column=
"mobile"
/>
<result
property=
"mobile"
column=
"mobile"
/>
<result
property=
"email"
column=
"email"
/>
<result
property=
"email"
column=
"email"
/>
<result
property=
"wxAccount"
column=
"wx_account"
/>
<result
property=
"wxAccount"
column=
"wx_account"
/>
<result
property=
"department"
column=
"department"
typeHandler=
"com.linkwechat.framework.handler.Int
ArrayJoinTypeHandler"
/>
<result
property=
"department"
column=
"department"
typeHandler=
"com.linkwechat.framework.handler.Long
ArrayJoinTypeHandler"
/>
<result
property=
"position"
column=
"position"
/>
<result
property=
"position"
column=
"position"
/>
<result
property=
"isLeaderInDept"
column=
"is_leader_in_dept"
typeHandler=
"com.linkwechat.framework.handler.
Int
ArrayJoinTypeHandler"
/>
<result
property=
"isLeaderInDept"
column=
"is_leader_in_dept"
typeHandler=
"com.linkwechat.framework.handler.
Long
ArrayJoinTypeHandler"
/>
<result
property=
"joinTime"
column=
"join_time"
/>
<result
property=
"joinTime"
column=
"join_time"
/>
<result
property=
"enable"
column=
"enable"
/>
<result
property=
"enable"
column=
"enable"
/>
<result
property=
"idCard"
column=
"id_card"
/>
<result
property=
"idCard"
column=
"id_card"
/>
...
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -43,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"mobile != null and mobile != ''"
>
and mobile = #{mobile}
</if>
<if
test=
"mobile != null and mobile != ''"
>
and mobile = #{mobile}
</if>
<if
test=
"email != null and email != ''"
>
and email = #{email}
</if>
<if
test=
"email != null and email != ''"
>
and email = #{email}
</if>
<if
test=
"wxAccount != null and wxAccount != ''"
>
and wx_account = #{wxAccount}
</if>
<if
test=
"wxAccount != null and wxAccount != ''"
>
and wx_account = #{wxAccount}
</if>
<if
test=
"department != null and department != ''"
>
and
department = #{department}
</if>
<if
test=
"department != null and department != ''"
>
and
FIND_IN_SET(#{department},department)
</if>
<if
test=
"position != null and position != ''"
>
and position = #{position}
</if>
<if
test=
"position != null and position != ''"
>
and position = #{position}
</if>
<if
test=
"isLeaderInDept != null "
>
and is_leader_in_dept = #{isLeaderInDept}
</if>
<if
test=
"isLeaderInDept != null "
>
and is_leader_in_dept = #{isLeaderInDept}
</if>
<if
test=
"joinTime != null "
>
and join_time = #{joinTime}
</if>
<if
test=
"joinTime != null "
>
and join_time = #{joinTime}
</if>
...
@@ -97,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -97,9 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"mobile != null and mobile != ''"
>
#{mobile},
</if>
<if
test=
"mobile != null and mobile != ''"
>
#{mobile},
</if>
<if
test=
"email != null"
>
#{email},
</if>
<if
test=
"email != null"
>
#{email},
</if>
<if
test=
"wxAccount != null"
>
#{wxAccount},
</if>
<if
test=
"wxAccount != null"
>
#{wxAccount},
</if>
<if
test=
"department != null"
>
#{department
},
</if>
<if
test=
"department != null"
>
#{department,jdbcType=OTHER,typeHandler=com.linkwechat.framework.handler.LongArrayJoinTypeHandler
},
</if>
<if
test=
"position != null"
>
#{position},
</if>
<if
test=
"position != null"
>
#{position},
</if>
<if
test=
"isLeaderInDept != null"
>
#{isLeaderInDept},
</if>
<if
test=
"isLeaderInDept != null"
>
#{isLeaderInDept
,jdbcType=OTHER,typeHandler=com.linkwechat.framework.handler.LongArrayJoinTypeHandler
},
</if>
<if
test=
"joinTime != null"
>
#{joinTime},
</if>
<if
test=
"joinTime != null"
>
#{joinTime},
</if>
<if
test=
"enable != null"
>
#{enable},
</if>
<if
test=
"enable != null"
>
#{enable},
</if>
<if
test=
"idCard != null"
>
#{idCard},
</if>
<if
test=
"idCard != null"
>
#{idCard},
</if>
...
@@ -150,10 +150,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -150,10 +150,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</foreach>
</delete>
</delete>
<select
id=
"findWeUsersByDepartmentId"
parameterType=
"Long"
resultMap=
"WeUserResult"
>
<include
refid=
"selectWeUserVo"
/>
where FIND_IN_SET(#{departmentId},department)
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment