Commit 0ff2f648 by 水库浪子

修改标签编辑bug

1 parent 38b6a864
Showing 24 changed files with 283 additions and 115 deletions
......@@ -21,16 +21,18 @@ public class LinkWeChatApplication
{
public static void main(String[] args)
{
SpringApplication.run(LinkWeChatApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
SpringApplication.run(LinkWeChatApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
}
}
......@@ -77,7 +77,7 @@ public class WeEmpleCodeController extends BaseController
@PreAuthorize("@ss.hasPermi('wecom:code:remove')")
@Log(title = "员工活码", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
public AjaxResult remove(@PathVariable String[] ids)
{
return toAjax(weEmpleCodeService.batchRemoveWeEmpleCodeIds(ListUtil.toList(ids)));
}
......
......@@ -36,7 +36,6 @@ public class WeUserController extends BaseController {
private IWeUserService weUserService;
/**
* 查询通讯录相关客户列表
*/
......@@ -71,7 +70,8 @@ public class WeUserController extends BaseController {
@ApiOperation("新增通讯录客户")
public AjaxResult add(@Validated @RequestBody WeUser weUser)
{
return toAjax(weUserService.insertWeUser(weUser));
weUserService.insertWeUser(weUser);
return AjaxResult.success();
}
/**
......@@ -83,24 +83,25 @@ public class WeUserController extends BaseController {
@ApiOperation("更新通讯录客户")
public AjaxResult edit(@RequestBody WeUser weUser)
{
return toAjax(weUserService.updateWeUser(weUser));
weUserService.updateWeUser(weUser);
return AjaxResult.success();
}
/**
* 启用或者禁止
* @param id
* @param enable
* @param weUser
* @return
*/
@PreAuthorize("@ss.hasPermi('wecom:user:startOrStop')")
@Log(title = "启用禁用用户", businessType = BusinessType.UPDATE)
@PutMapping("/startOrStop")
@ApiOperation("启用禁用用户 true:启用 false:禁用")
public AjaxResult startOrStop(Long id,Boolean enable){
@ApiOperation("是否启用(1表示启用成员,0表示禁用成员)")
public AjaxResult startOrStop(@RequestBody WeUser weUser){
weUserService.startOrStop(weUser);
return toAjax(weUserService.startOrStop(id,enable));
return AjaxResult.success();
}
......@@ -113,14 +114,15 @@ public class WeUserController extends BaseController {
@GetMapping({"/leaveUserAllocateList"})
public TableDataInfo leaveUserAllocateList(WeLeaveUserVo weLeaveUserVo) {
startPage();
weLeaveUserVo.setIsActivate(WeConstans.LEAVE_ALLOCATE_STATE);
List<WeLeaveUserVo> list = this.weUserService.leaveUserList(weLeaveUserVo);
weLeaveUserVo.setIsActivate(WeConstans.WE_USER_IS_LEAVE);
weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_ALLOCATE_STATE);
List<WeLeaveUserVo> list = this.weUserService.leaveNoAllocateUserList(weLeaveUserVo);
return getDataTable(list);
}
/**
* 离职等待分配
* 离职未分配
* @param weLeaveUserVo
* @return
*/
......@@ -130,7 +132,7 @@ public class WeUserController extends BaseController {
startPage();
weLeaveUserVo.setIsActivate(WeConstans.WE_USER_IS_LEAVE);
weLeaveUserVo.setIsAllocate(WeConstans.LEAVE_NO_ALLOCATE_STATE);
List<WeLeaveUserVo> list = this.weUserService.leaveUserList(weLeaveUserVo);
List<WeLeaveUserVo> list = weUserService.leaveNoAllocateUserList(weLeaveUserVo);
return getDataTable(list);
}
......@@ -165,6 +167,22 @@ public class WeUserController extends BaseController {
}
/**
* 删除用户
* @return
*/
@PreAuthorize("@ss.hasPermi('wecom:user:deleteUser')")
@DeleteMapping({"/{ids}"})
public AjaxResult deleteUser(@PathVariable String[] ids){
weUserService.deleteUser(ids);
return AjaxResult.success();
}
......
......@@ -147,4 +147,5 @@ wecome:
- /externalcontact/mark_tag
- /externalcontact/transfer
- /externalcontact/groupchat/transfer
- /externalcontact/get_unassigned_list
fileUplodUrl: /media/upload,/media/uploadimg
......@@ -78,7 +78,7 @@ public class WeConstans {
/**
* 已离职
*/
public static final Integer WE_USER_IS_LEAVE=5;
public static final Integer WE_USER_IS_LEAVE=6;
/**
......
......@@ -80,4 +80,15 @@ public interface WeUserClient {
type = "POST"
)
WeResultDto allocateGroup(@DataObject AllocateWeGroupDto allocateWeGroupDto);
/**
* 获取离职员工列表
* @return
*/
@Request(
url = "/externalcontact/get_unassigned_list",
type = "POST"
)
LeaveWeUserListsDto leaveWeUsers();
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import lombok.AllArgsConstructor;
......@@ -66,6 +67,7 @@ public class WeFlowerCustomerRel
private String status;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date createTime;
......
......@@ -25,9 +25,6 @@ import java.util.Date;
@TableName("we_tag")
public class WeTag
{
private static final long serialVersionUID = 1L;
/** 标签组id */
private String groupId;
......
package com.linkwechat.wecom.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
......@@ -12,7 +13,10 @@ import com.linkwechat.common.utils.bean.BeanUtils;
import com.linkwechat.wecom.domain.dto.WeUserDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.util.Date;
......@@ -26,18 +30,21 @@ import java.util.Date;
*/
@Data
@TableName("we_user")
public class WeUser extends BaseEntity
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class WeUser
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id= SnowFlakeUtil.nextId();
/** 用户头像 */
@TableField(value = "head_image_url")
private String avatarMediaid;
/** 用户名称 */
@NotBlank(message = "姓名不可为空")
@TableField(value = "user_name")
private String name;
/** 用户昵称 */
......@@ -45,6 +52,7 @@ public class WeUser extends BaseEntity
/** 账号 */
@NotBlank(message = "账号不可为空")
@TableId
private String userId;
/** 性别。1表示男性,2表示女性 */
......@@ -74,7 +82,7 @@ public class WeUser extends BaseEntity
private Date joinTime;
/** 是否启用(1表示启用成员,0表示禁用成员) */
private Integer enable=new Integer(1);
private Integer enable;
/** 身份证号 */
private String idCard;
......@@ -98,6 +106,11 @@ public class WeUser extends BaseEntity
/** 离职是否分配(1:已分配;0:未分配;) */
private Integer isAllocate;
/** 离职时间 */
private Date dimissionTime;
/** 转化成企业微信需要的dto对象 */
......
package com.linkwechat.wecom.domain.dto;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* @description: 离职成员客户列表
* @author: HaoN
* @create: 2020-10-25 16:07
**/
@Data
public class LeaveWeUserListsDto extends WeResultDto{
private List<LeaveWeUser> info;
@Data
public class LeaveWeUser{
/**离职成员的userid*/
private String handover_userid;
/**外部联系人userid*/
private String external_userid;
/**离职时间*/
private Date dimission_time;
}
}
......@@ -50,6 +50,9 @@ public class WeUserDto extends WeResultDto{
//全局唯一。对于同一个服务商,不同应用获取到企业内同一个成员的open_userid是相同的,最多64个字节。仅第三方应用可获取
private String open_userid;
//激活状态: 1=已激活,2=已禁用,4=未激活,5=退出企业。
private Integer status;
}
......@@ -25,6 +25,7 @@ public class WeUserListDto extends WeResultDto{
userlist.stream().forEach(k->{
WeUser weUser=new WeUser();
BeanUtils.copyPropertiesASM(k,weUser);
weUser.setIsActivate(k.getStatus());
weUsers.add(weUser);
});
}
......
......@@ -37,6 +37,7 @@ public class WeCropGroupTagDto {
*/
public static WeCropGroupTagDto transformAddTag(WeTagGroup weTagGroup){
WeCropGroupTagDto weCropGroupTagDto=WeCropGroupTagDto.builder()
.group_id(weTagGroup.getGroupId())
.group_name(weTagGroup.getGourpName())
.build();
List<WeTag> weTags = weTagGroup.getWeTags();
......@@ -45,9 +46,23 @@ public class WeCropGroupTagDto {
List<WeTag> newAddWeTag
= weTags.stream().filter(v -> StringUtils.isEmpty(v.getTagId())).collect(Collectors.toList());
List<WeCropTagDto> weTagDtos=new ArrayList<>();
BeanUtils.copyPropertiesignoreOther(newAddWeTag,weTagDtos);
weCropGroupTagDto.setTag(weTagDtos);
if(CollectionUtil.isNotEmpty(newAddWeTag)){
List<WeCropTagDto> weTagDtos=new ArrayList<>();
newAddWeTag.stream().forEach(weTag -> {
weTagDtos.add(WeCropTagDto.builder()
.id(weTag.getTagId())
.name(weTag.getName())
.build());
});
weCropGroupTagDto.setTag(weTagDtos);
}
}
......
package com.linkwechat.wecom.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.core.domain.BaseEntity;
import lombok.Data;
......@@ -16,6 +17,7 @@ public class WeLeaveUserVo extends BaseEntity {
private String department;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dimissionTime;
private Integer allocateCustomerNum;
......
......@@ -67,5 +67,5 @@ public interface WeEmpleCodeMapper
* @param ids 需要删除的数据ID
* @return 结果
*/
public int batchRemoveWeEmpleCodeIds(@Param("ids") List<Long> ids);
public int batchRemoveWeEmpleCodeIds(@Param("ids") List<String> ids);
}
......@@ -49,11 +49,20 @@ public interface WeUserMapper extends BaseMapper<WeUser>
/**
* 离职员工
* 离职未分配员工
* @param weLeaveUserVo
* @return
*/
public List<WeLeaveUserVo> leaveUserList(WeLeaveUserVo weLeaveUserVo);
public List<WeLeaveUserVo> leaveNoAllocateUserList(WeLeaveUserVo weLeaveUserVo);
/**
* 离职已分配员工
* @param weLeaveUserVo
* @return
*/
public List<WeLeaveUserVo> leaveAllocateUserList(WeLeaveUserVo weLeaveUserVo);
/**
......
......@@ -68,7 +68,7 @@ public interface IWeEmpleCodeService
* @param ids 需要删除的数据ID
* @return 结果
*/
public int batchRemoveWeEmpleCodeIds(List<Long> ids);
public int batchRemoveWeEmpleCodeIds(List<String> ids);
......
......@@ -37,7 +37,7 @@ public interface IWeUserService extends IService<WeUser>
* @param weUser 通讯录相关客户
* @return 结果
*/
public int insertWeUser(WeUser weUser);
public void insertWeUser(WeUser weUser);
/**
* 修改通讯录相关客户
......@@ -45,24 +45,30 @@ public interface IWeUserService extends IService<WeUser>
* @param weUser 通讯录相关客户
* @return 结果
*/
public int updateWeUser(WeUser weUser);
public void updateWeUser(WeUser weUser);
/**
* 启用或禁用用户
* @param id
* @param enable
* @return
*/
public int startOrStop(Long id, Boolean enable);
public void startOrStop(WeUser weUser);
/**
* 离职员工
* 离职未分配员工
* @param weLeaveUserVo
* @return
*/
List<WeLeaveUserVo> leaveUserList(WeLeaveUserVo weLeaveUserVo);
List<WeLeaveUserVo> leaveNoAllocateUserList(WeLeaveUserVo weLeaveUserVo);
/**
* 离职已分配员工
* @param weLeaveUserVo
* @return
*/
List<WeLeaveUserVo> leaveAllocateUserList(WeLeaveUserVo weLeaveUserVo);
/**
......@@ -77,4 +83,11 @@ public interface IWeUserService extends IService<WeUser>
*/
void synchWeUser();
/**
* 删除用户
* @param ids
*/
void deleteUser(String[] ids);
}
......@@ -223,7 +223,7 @@ public class WeEmpleCodeServiceImpl implements IWeEmpleCodeService
* @return 结果
*/
@Override
public int batchRemoveWeEmpleCodeIds(List<Long> ids) {
public int batchRemoveWeEmpleCodeIds(List<String> ids) {
return weEmpleCodeMapper.batchRemoveWeEmpleCodeIds(ids);
}
......
......@@ -28,7 +28,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import java.util.stream.Stream;
......@@ -109,29 +111,25 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
public void updateWeTagGroup(WeTagGroup weTagGroup)
{
if(this.updateById(weTagGroup)){
List<WeTag> weTags = weTagGroup.getWeTags();
//获取新增的集合
if(CollectionUtil.isNotEmpty(weTags)) {
List<WeTag> filterWeTags = weTags.stream().filter(v -> StringUtils.isEmpty(v.getTagId())).collect(Collectors.toList());
//同步新增标签到微信端
if(CollectionUtil.isNotEmpty(WeCropGroupTagDto.transformAddTag(weTagGroup).getTag())){
WeCropGropTagDtlDto
weCropGropTagDtlDto = weCropTagClient.addCorpTag( WeCropGroupTagDto.transformAddTag(weTagGroup));
if(weCropGropTagDtlDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)){
//微信端返回的标签主键,设置到weTags中
//微信端返回的标签主键,设置到weTags中
Map<String, String> weCropTagMap = weCropGropTagDtlDto.getTag_group().getTag().stream()
.collect(Collectors.toMap(weCropTagDto -> weCropTagDto.getName(), weCropTagDto -> weCropTagDto.getId()));
filterWeTags.stream().forEach(tag->{
tag.setTagId(weCropTagMap.get(tag.getName()));
tag.setCreateTime(new Date());
});
}
}
//同步更新微信端标签名称
WeCropTagDto.transFormto(weTags).stream().forEach(k->{
weCropTagClient.editCorpTag(k);
});
//获取需要删除的数据
......@@ -150,23 +148,12 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
//移除本地
removeWeTags.stream().forEach(v -> v.setStatus(Constants.DELETE_CODE));
iWeTagService.updateBatchById(removeWeTags);
}
//保存或更新wetag
weTags.stream().forEach(v->v.setGroupId(weTagGroup.getGroupId()));
iWeTagService.saveOrUpdateBatch(weTags);
}
filterWeTags.stream().forEach(v->v.setGroupId(weTagGroup.getGroupId()));
iWeTagService.saveOrUpdateBatch(filterWeTags);
}
......@@ -213,7 +200,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
* 同步标签
*/
@Override
@Transactional(rollbackFor = Exception.class)
@Transactional
public void synchWeTags() {
......@@ -231,6 +218,7 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
* @param tagGroup
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void batchSaveOrUpdateTagGroupAndTag(List<WeCropGroupTagDto> tagGroup) {
List<WeTagGroup> weTagGroups=new ArrayList<>();
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.framework.web.domain.server.Sys;
......@@ -9,6 +10,7 @@ import com.linkwechat.wecom.client.WeDepartMentClient;
import com.linkwechat.wecom.client.WeUserClient;
import com.linkwechat.wecom.domain.WeDepartment;
import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.dto.LeaveWeUserListsDto;
import com.linkwechat.wecom.domain.dto.WeDepartMentDto;
import com.linkwechat.wecom.domain.dto.WeUserDto;
import com.linkwechat.wecom.domain.dto.WeUserListDto;
......@@ -25,6 +27,8 @@ import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
......@@ -44,8 +48,6 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
private WeUserClient weUserClient;
@Autowired
private IWeCustomerService iWeCustomerService;
......@@ -89,18 +91,16 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/
@Override
@Transactional
public int insertWeUser(WeUser weUser)
public void insertWeUser(WeUser weUser)
{
int returnCode = weUserMapper.insertWeUser(weUser);
if(returnCode>0){
if(this.save(weUser)){
weUserClient.createUser(
weUser.transformWeUserDto()
);
}
return returnCode;
}
/**
......@@ -111,18 +111,14 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
*/
@Override
@Transactional
public int updateWeUser(WeUser weUser)
public void updateWeUser(WeUser weUser)
{
int returnCode = weUserMapper.updateWeUser(weUser);
if(returnCode >0){
if(this.updateById(weUser)){
weUserClient.updateUser(
weUser.transformWeUserDto()
);
}
return returnCode;
}
......@@ -130,38 +126,34 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
/**
* 启用或禁用用户
* @param id
* @param enable
* @param weUser
* @return
*/
@Override
@Transactional
public int startOrStop(Long id, Boolean enable) {
int returnCode = -1;
WeUser weUser = this.selectWeUserById(id);
if(null != weUser){
weUser.setEnable(enable?WeConstans.WE_USER_START:WeConstans.WE_USER_STOP);
returnCode=updateWeUser(weUser);
}
public void startOrStop(WeUser weUser) {
this.updateWeUser(weUser);
}
return returnCode;
/**
* 离职未分配员工
* @param weLeaveUserVo
* @return
*/
@Override
public List<WeLeaveUserVo> leaveNoAllocateUserList(WeLeaveUserVo weLeaveUserVo) {
return this.weUserMapper.leaveNoAllocateUserList(weLeaveUserVo);
}
/**
* 离职分配员工
* 离职已分配员工
* @param weLeaveUserVo
* @return
*/
@Override
public List<WeLeaveUserVo> leaveUserList(WeLeaveUserVo weLeaveUserVo) {
return this.weUserMapper.leaveUserList(weLeaveUserVo);
public List<WeLeaveUserVo> leaveAllocateUserList(WeLeaveUserVo weLeaveUserVo) {
return null;
}
......@@ -200,10 +192,35 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper,WeUser> implemen
= weUserClient.list(WeConstans.WE_ROOT_DEPARMENT_ID, WeConstans.DEPARTMENT_SUB_WEUSER).getWeUsers();
if(CollectionUtil.isNotEmpty(weUsers)){
//删除当前员工表员工
weUserMapper.deleteWeUser();
//重新插入员工
weUserMapper.batchInsertWeUser(weUsers);
this.saveOrUpdateBatch(weUsers);
}
}
/**
* 删除用户
* @param ids
*/
@Override
@Transactional
public void deleteUser(String[] ids) {
List<WeUser> weUsers=new ArrayList<>();
CollectionUtil.newArrayList(ids).stream().forEach(k->{
weUsers.add(
WeUser.builder()
.userId(k)
.enable(WeConstans.WE_USER_IS_LEAVE)
.dimissionTime(new Date())
.build()
);
});
if(this.updateBatchById(weUsers)){
weUsers.stream().forEach(k->{
weUserClient.deleteUserByUserId(k.getUserId());
});
}
}
......
......@@ -3,6 +3,24 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.linkwechat.wecom.mapper.WeAllocateCustomerMapper">
<!-- <select id="getAllocateCustomers" resultType="com.linkwechat.wecom.domain.vo.WeAllocateCustomer">-->
<!-- -->
<!-- SELECT-->
<!-- wc.`name` as customerName,-->
<!-- wu.user_name as userName,-->
<!-- (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,-->
<!-- wac.allocate_time-->
<!-- FROM-->
<!-- we_allocate_customer wac-->
<!-- INNER JOIN we_customer wc ON wc.external_userid=wac.external_userid-->
<!-- INNER JOIN we_user wu ON wu.user_id=wac.takeover_userid-->
<!-- WHERE wac.handover_userid=1232-->
<!-- AND -->
<!-- -->
<!-- </select>-->
......
......@@ -25,7 +25,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="operUserid" column="oper_userid" />
<result property="addWay" column="add_way" />
<result property="state" column="state" />
<!-- <result property="customerId" column="customer_id" />-->
<result property="userName" column="user_name"/>
<collection property="weFlowerCustomerTagRels" ofType="com.linkwechat.wecom.domain.WeFlowerCustomerTagRel">
<result property="flowerCustomerRelId" column="flower_customer_rel_id" />
......
......@@ -18,18 +18,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="position" column="position" />
<result property="isLeaderInDept" column="is_leader_in_dept" typeHandler="com.linkwechat.framework.handler.StringArrayJoinTypeHandler" />
<result property="joinTime" column="join_time" />
<result property="enable" column="enable" />
<result property="idCard" column="id_card" />
<result property="qqAccount" column="qq_account" />
<result property="telephone" column="telephone" />
<result property="address" column="address" />
<result property="birthday" column="birthday" />
<result property="remark" column="remark" />
<result property="isActivate" column="is_activate" />
<result property="isActivate" column="is_activate"/>
</resultMap>
<sql id="selectWeUserVo">
select id, head_image_url as avatarMediaid, user_name, alias, user_id, gender, mobile, email, wx_account, department, position, is_leader_in_dept, join_time, enable, id_card, qq_account, telephone, address, birthday, remark, is_activate from we_user
select head_image_url as avatarMediaid, user_name, alias, user_id, gender, mobile, email, wx_account, department, position, is_leader_in_dept, join_time, enable, id_card, qq_account, telephone, address, birthday, remark from we_user
</sql>
<select id="selectWeUserList" parameterType="WeUser" resultMap="WeUserResult">
......@@ -47,13 +46,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="position != null and position != ''"> and position = #{position}</if>
<if test="isLeaderInDept != null "> and is_leader_in_dept = #{isLeaderInDept}</if>
<if test="joinTime != null "> and join_time = #{joinTime}</if>
<if test="enable != null "> and enable = #{enable}</if>
<if test="idCard != null and idCard != ''"> and id_card = #{idCard}</if>
<if test="qqAccount != null and qqAccount != ''"> and qq_account = #{qqAccount}</if>
<if test="telephone != null and telephone != ''"> and telephone = #{telephone}</if>
<if test="address != null and address != ''"> and address = #{address}</if>
<if test="birthday != null "> and birthday = #{birthday}</if>
<if test="isActivate != null "> and is_activate = #{isActivate}</if>
</where>
</select>
......@@ -142,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="leaveUserList" parameterType="WeLeaveUserVo" resultType="com.linkwechat.wecom.domain.vo.WeLeaveUserVo">
<select id="leaveNoAllocateUserList" parameterType="WeLeaveUserVo" resultType="com.linkwechat.wecom.domain.vo.WeLeaveUserVo">
SELECT
wu.user_id,
wu.user_name,
......@@ -163,6 +160,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="leaveAllocateUserList" parameterType="WeLeaveUserVo" resultType="com.linkwechat.wecom.domain.vo.WeLeaveUserVo">
SELECT
wu.user_id,
wu.user_name,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,
(SELECT COUNT(*) FROM we_allocate_customer wac WHERE wac.handover_userid=wu.user_id) as allocateCustomerNum,
(SELECT COUNT(*) FROM we_allocate_group wag WHERE wag.old_owner=wu.user_id) as allocateGroupNum,
wu.dimission_time
FROM
we_user wu
<where>
<if test="userName != null and userName !=''">and wu.user_name=#{userName}</if>
<if test="beginTime != null and beginTime !='' and endTime != null and endTime !=''">
DATE_FORMAT(wu.dimission_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime}
</if>
<if test="isActivate != null ">and wu.is_activate = #{isActivate}</if>
<if test="isAllocate != null ">and wu.is_allocate = #{isAllocate}</if>
</where>
</select>
<delete id="deleteWeUser">
delete from we_user
</delete>
......@@ -204,4 +222,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!