Commit da93085f by 孙喜旺

员工活码列表查询修改

1 parent 6dbafdef
......@@ -31,6 +31,14 @@ public interface WeEmpleCodeTagMapper extends BaseMapper<WeEmpleCodeTag>
public List<WeEmpleCodeTag> selectWeEmpleCodeTagListById(@Param("empleCodeId") Long empleCodeId);
/**
* 查询员工活码标签列表
*
* @param empleCodeIdList 员工活码Ids
* @return 员工活码标签集合
*/
List<WeEmpleCodeTag> selectWeEmpleCodeTagListByIds(@Param("empleCodeIdList") List<Long> empleCodeIdList);
/**
* 新增员工活码标签
*
* @param weEmpleCodeTag 员工活码标签
......@@ -77,4 +85,6 @@ public interface WeEmpleCodeTagMapper extends BaseMapper<WeEmpleCodeTag>
* @return
*/
public int batchRemoveWeEmpleCodeTagIds(@Param("ids") List<Long> ids);
}
......@@ -31,6 +31,13 @@ public interface WeEmpleCodeUseScopMapper extends BaseMapper<WeEmpleCodeUseScop>
public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListById(@Param("empleCodeId") Long empleCodeId);
/**
* 查询员工活码使用人列表(批量)
* @param empleCodeIdList
* @return
*/
List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListByIds(@Param("empleCodeIdList") List<Long> empleCodeIdList);
/**
* 新增员工活码使用人
*
* @param weEmpleCodeUseScop 员工活码使用人
......@@ -76,4 +83,6 @@ public interface WeEmpleCodeUseScopMapper extends BaseMapper<WeEmpleCodeUseScop>
* @return
*/
public int batchRemoveWeEmpleCodeUseScopIds(List<Long> ids);
}
......@@ -31,6 +31,14 @@ public interface IWeEmpleCodeTagService extends IService<WeEmpleCodeTag>
public List<WeEmpleCodeTag> selectWeEmpleCodeTagListById(Long empleCodeId);
/**
* 查询员工活码标签列表
*
* @param empleCodeIdList 员工活码ids
* @return 员工活码标签集合
*/
List<WeEmpleCodeTag> selectWeEmpleCodeTagListByIds(List<Long> empleCodeIdList);
/**
* 新增员工活码标签
*
* @param weEmpleCodeTag 员工活码标签
......@@ -76,4 +84,6 @@ public interface IWeEmpleCodeTagService extends IService<WeEmpleCodeTag>
* @return
*/
public int batchRemoveWeEmpleCodeTagIds(List<Long> ids);
}
......@@ -30,6 +30,14 @@ public interface IWeEmpleCodeUseScopService extends IService<WeEmpleCodeUseScop>
public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListById(Long empleCodeId);
/**
* 查询员工活码使用人列表(批量)
* @param empleCodeIdList
* @return
*/
public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListByIds(List<Long> empleCodeIdList);
/**
* 新增员工活码使用人
*
* @param weEmpleCodeUseScop 员工活码使用人
......
......@@ -10,6 +10,7 @@ import com.linkwechat.common.utils.SnowFlakeUtil;
import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.wecom.client.WeExternalContactClient;
import com.linkwechat.wecom.domain.WeEmpleCode;
import com.linkwechat.wecom.domain.WeEmpleCodeTag;
import com.linkwechat.wecom.domain.WeEmpleCodeUseScop;
import com.linkwechat.wecom.domain.WeMaterial;
import com.linkwechat.wecom.domain.dto.WeEmpleCodeDto;
......@@ -80,19 +81,23 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
if (weEmpleCodeList != null) {
weEmpleCodeList.forEach(empleCode -> {
List<WeEmpleCodeUseScop> weEmpleCodeUseScopList = empleCode.getWeEmpleCodeUseScops();
if (CollectionUtil.isNotEmpty(weEmpleCodeUseScopList)) {
String useUserName = weEmpleCodeUseScopList.stream().map(WeEmpleCodeUseScop::getBusinessName)
.filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
empleCode.setUseUserName(useUserName);
String mobile = weEmpleCodeUseScopList.stream().map(WeEmpleCodeUseScop::getMobile)
.filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
empleCode.setMobile(mobile);
}
setUserData(empleCode, weEmpleCodeUseScopList);
});
}
return weEmpleCodeList;
}
private void setUserData(WeEmpleCode empleCode, List<WeEmpleCodeUseScop> weEmpleCodeUseScopList) {
if (CollectionUtil.isNotEmpty(weEmpleCodeUseScopList)) {
String useUserName = weEmpleCodeUseScopList.stream().map(WeEmpleCodeUseScop::getBusinessName)
.filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
empleCode.setUseUserName(useUserName);
String mobile = weEmpleCodeUseScopList.stream().map(WeEmpleCodeUseScop::getMobile)
.filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
empleCode.setMobile(mobile);
}
}
/**
* 查询员工活码列表
*
......@@ -104,16 +109,18 @@ public class WeEmpleCodeServiceImpl extends ServiceImpl<WeEmpleCodeMapper, WeEmp
List<WeEmpleCode> weEmpleCodeList = this.baseMapper.selectWeEmpleCodeList(weEmpleCode);
if (CollectionUtil.isNotEmpty(weEmpleCodeList)) {
List<Long> empleCodeIdList = weEmpleCodeList.stream().map(WeEmpleCode::getId).collect(Collectors.toList());
List<WeEmpleCodeUseScop> useScopList = iWeEmpleCodeUseScopService.selectWeEmpleCodeUseScopListByIds(empleCodeIdList);
List<WeEmpleCodeTag> tagList = weEmpleCodeTagService.selectWeEmpleCodeTagListByIds(empleCodeIdList);
weEmpleCodeList.forEach(empleCode -> {
List<WeEmpleCodeUseScop> weEmpleCodeUseScopList = empleCode.getWeEmpleCodeUseScops();
if (CollectionUtil.isNotEmpty(weEmpleCodeUseScopList)) {
String useUserName = weEmpleCodeUseScopList.stream().map(WeEmpleCodeUseScop::getBusinessName)
.filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
empleCode.setUseUserName(useUserName);
String mobile = weEmpleCodeUseScopList.stream().map(WeEmpleCodeUseScop::getMobile)
.filter(StringUtils::isNotEmpty).collect(Collectors.joining(","));
empleCode.setMobile(mobile);
}
//活码使用人对象
List<WeEmpleCodeUseScop> weEmpleCodeUseScopList = useScopList.stream()
.filter(useScop -> useScop.getEmpleCodeId().equals(empleCode.getId())).collect(Collectors.toList());
setUserData(empleCode, weEmpleCodeUseScopList);
empleCode.setWeEmpleCodeUseScops(weEmpleCodeUseScopList);
//员工活码标签对象
empleCode.setWeEmpleCodeTags(tagList.stream()
.filter(tag -> tag.getEmpleCodeId().equals(empleCode.getId())).collect(Collectors.toList()));
});
}
return weEmpleCodeList;
......
......@@ -45,6 +45,11 @@ public class WeEmpleCodeTagServiceImpl extends ServiceImpl<WeEmpleCodeTagMapper,
return weEmpleCodeTagMapper.selectWeEmpleCodeTagListById(empleCodeId);
}
@Override
public List<WeEmpleCodeTag> selectWeEmpleCodeTagListByIds(List<Long> empleCodeIdList) {
return weEmpleCodeTagMapper.selectWeEmpleCodeTagListByIds(empleCodeIdList);
}
/**
* 新增员工活码标签
*
......
......@@ -46,6 +46,16 @@ public class WeEmpleCodeUseScopServiceImpl extends ServiceImpl<WeEmpleCodeUseSco
}
/**
* 查询员工活码使用人列表(批量)
* @param empleCodeIdList
* @return
*/
@Override
public List<WeEmpleCodeUseScop> selectWeEmpleCodeUseScopListByIds(List<Long> empleCodeIdList) {
return weEmpleCodeUseScopMapper.selectWeEmpleCodeUseScopListByIds(empleCodeIdList);
}
/**
* 新增员工活码使用人
*
* @param weEmpleCodeUseScop 员工活码使用人
......
......@@ -85,7 +85,7 @@
where 1=1 and wecode.del_flag = 0
</sql>
<select id="selectWeEmpleCodeList" parameterType="WeEmpleCode" resultMap="WeEmpleCodeResult">
<select id="selectWeEmpleCodeList" parameterType="WeEmpleCode" resultType="com.linkwechat.wecom.domain.WeEmpleCode">
<include refid="selectWeEmpleCodeLsit"/>
<if test="codeType != null ">and wecode.code_type = #{codeType}</if>
<if test="isJoinConfirmFriends != null ">and wecode.is_join_confirm_friends = #{isJoinConfirmFriends}</if>
......@@ -108,6 +108,7 @@
<if test="useUserName != null and useUserName !=''">
AND wecusn.business_name like concat('%', #{useUserName}, '%')
</if>
group by wecode.id
</select>
<select id="selectWeEmpleCodeById" parameterType="Long" resultMap="WeEmpleCodeResult">
......
......@@ -27,6 +27,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
we_emple_code_tag wect
WHERE wect.del_flag=0 and wect.emple_code_id=#{empleCodeId}
</select>
<select id="selectWeEmpleCodeTagListByIds" parameterType="Long" resultMap="WeEmpleCodeTagResult">
SELECT
wect.id,
wect.tag_id,
wect.emple_code_id,
wect.del_flag,
wect.tag_name
FROM
we_emple_code_tag wect
WHERE wect.del_flag=0
<if test="empleCodeIdList != null and empleCodeIdList.size > 0">
and wect.emple_code_id in
<foreach collection="empleCodeIdList" item="empleCodeId" open="(" close=")" separator=",">
#{empleCodeId}
</foreach>
</if>
</select>
<select id="selectWeEmpleCodeTagById" parameterType="Long" resultMap="WeEmpleCodeTagResult">
<include refid="selectWeEmpleCodeTagVo"/>
......
......@@ -27,6 +27,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
wecus.del_flag = 0
AND wecus.emple_code_id=#{empleCodeId}
</select>
<select id="selectWeEmpleCodeUseScopListByIds" parameterType="java.util.List" resultMap="WeEmpleCodeUseScopResult">
SELECT
wecus.id, wecus.emple_code_id,wecus.business_id,wecus.business_name,wu.mobile
FROM
we_emple_code_use_scop wecus
LEFT JOIN we_user wu ON wu.user_id = wecus.business_id
WHERE
wecus.del_flag = 0
<if test="empleCodeIdList != null and empleCodeIdList.size > 0">
and wecus.emple_code_id in
<foreach collection="empleCodeIdList" item="empleCodeId" open="(" close=")" separator=",">
#{empleCodeId}
</foreach>
</if>
</select>
<select id="selectWeEmpleCodeUseScopById" parameterType="Long" resultMap="WeEmpleCodeUseScopResult">
<include refid="selectWeEmpleCodeUseScopVo"/>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!