1.serviceImpl层
public List<GroupVo> selectGroupInformationListByuserId(String userId,String groupIds) {
List<String> list = Arrays.asList(groupIds.split(","));
HashMap<String, Object> map = new HashMap<>(16);
map.put("userId", userId);
map.put("list", list);
List<GroupVo> groupchar= groupMemberMapper.selectGroupInformationListByuserId(map);
return groupchar;
}
2.Mapper层
List<GroupVo> selectGroupInformationListByuserId(HashMap<String, Object> map);
3.Mapper.xml层
<!-- 根据userId和群ids 查询当前群信息-->
<select id="selectGroupInformationListByuserId" parameterType="java.util.Map" resultType="com.mrd.pojo.VO.GroupVo">
select
id,
user_id userId,
name,
head_img_url headImgUrl
from
`group`
<where>
1 = 1
<if test="list != null and list.size() > 0 ">
and id in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>