Commit a1ed4324 authored by hanfeng's avatar hanfeng

修改获取用户信息接口

parent 2691347d
......@@ -129,4 +129,12 @@ public interface UserFeign {
@GetMapping("/app/user/finduserIdsByphones")
Map<String, Integer> findAppusersByUserNames(@RequestParam(value = "phones") List<String> phones);
/**
* 批量获取用户基本信息
* @param ids
* @return
*/
@GetMapping("/getUsersByUserIds")
ObjectRestResponse<List<AppUserVo>> getUsersByUserIds(@RequestParam("ids") List<Integer> ids);
}
......@@ -167,4 +167,8 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
criteria.andEqualTo("userid",userId);
mapper.updateByExampleSelective(appUserDetail,example);
}
public List<AppUserVo> getUserByUserIds(List<Integer> ids) {
return mapper.getUserVo(ids);
}
}
......@@ -22,5 +22,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
List<Integer> getUserIdByUsername(@Param("keywords") String keywords);
AppUserVo getUserVo();
List<AppUserVo> getUserVo(@Param("list") List<Integer> ids);
}
\ No newline at end of file
package com.github.wxiaoqi.security.admin.rest;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.entity.*;
......@@ -156,7 +157,20 @@ public class PublicController {
AppUserVo userVo = detailBiz.getUserInfoById(id);
appUserVos.add(userVo);
}
return ObjectRestResponse.succ(appUserVos);
}
@GetMapping("/getUsersByUserIds")
public ObjectRestResponse<List<AppUserVo>> getUsersByUserIds(@RequestParam("ids") List<Integer> ids) {
if(CollectionUtil.isEmpty(ids)) {
return ObjectRestResponse.createFailedResult(500, "参数id为空");
}
List<AppUserVo> appUserVos = detailBiz.getUserByUserIds(ids);
if(CollectionUtil.isEmpty(appUserVos)) {
return ObjectRestResponse.succ(new ArrayList<AppUserVo>());
}
return ObjectRestResponse.succ(appUserVos);
}
......
......@@ -40,6 +40,15 @@
<!-- 获取用户信息 -->
<select id="getUserInfo" resultMap="AppUserVoMap">
select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.* from app_user_login l
left join app_user_detail d
on d.userid = l.id
where d.userid = #{userId} limit 1
</select>
<!-- 获取用户信息 -->
<select id="getUserVo" resultMap="AppUserVoMap">
select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as jobTitle,buml.name as memberName from app_user_login l
left join app_user_detail d
on d.userid = l.id
......@@ -54,32 +63,13 @@
and
buml.isdel=0
and
bum.is_del=0
and
d.userid = #{userId} limit 1
</select>
d.userid in
<foreach collection="list" item="userId" index="index" open="(" separator="," close=")" >
#{userId}
</foreach>
<!-- &lt;!&ndash; 获取用户信息 &ndash;&gt;-->
<!-- <select id="getUserVo" resultMap="AppUserVoMap">-->
<!-- select l.im_userid,l.username,l.wx_openid,l.unionid,l.openid,l.status,l.id_number,l.certification_status,d.*,p.name as jobTitle,buml.name as memberName from app_user_login l-->
<!-- left join app_user_detail d-->
<!-- on d.userid = l.id-->
<!-- left join base_user_member bum-->
<!-- on bum.user_id=l.id-->
<!-- left join base_user_member_level buml-->
<!-- on bum.member_level = buml.level-->
<!-- left join app_user_position p-->
<!-- on d.position_id=p.id-->
<!-- where-->
<!-- p.is_del=0-->
<!-- and-->
<!-- buml.isdel=0-->
<!-- and-->
<!-- bum.is_del=0-->
<!-- and-->
<!-- d.userid = #{userId} limit 1-->
<!-- </select>-->
</select>
<select id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String">
......
......@@ -172,7 +172,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
List<OrderListVo> list = pageDataVO.getData();
List<Integer> userIds = list.stream().map(OrderListVo::getUserId).distinct().collect(Collectors.toList());
if (userIds != null && userIds.size() > 0) {
ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getByUserIds(userIds);
ObjectRestResponse<List<AppUserVo>> objectRestResponse = userFeign.getUsersByUserIds(userIds);
log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData());
Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>();
if (objectRestResponse.getData() != null) {
......@@ -215,7 +215,6 @@ public class BackStageOrderController extends CommonBaseController implements Us
String[] couponIds = orderPageVO.getCouponTickerNos().split(",");
List<Coupon> couponList = activityFeign.couponsByTickerNoList(Lists.newArrayList(couponIds));
orderPageVO.setCouponList(couponList);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment