Commit a1ed4324 authored by hanfeng's avatar hanfeng

修改获取用户信息接口

parent 2691347d
...@@ -129,4 +129,12 @@ public interface UserFeign { ...@@ -129,4 +129,12 @@ public interface UserFeign {
@GetMapping("/app/user/finduserIdsByphones") @GetMapping("/app/user/finduserIdsByphones")
Map<String, Integer> findAppusersByUserNames(@RequestParam(value = "phones") List<String> phones); 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 ...@@ -167,4 +167,8 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
criteria.andEqualTo("userid",userId); criteria.andEqualTo("userid",userId);
mapper.updateByExampleSelective(appUserDetail,example); 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> { ...@@ -22,5 +22,5 @@ public interface AppUserDetailMapper extends Mapper<AppUserDetail> {
List<Integer> getUserIdByUsername(@Param("keywords") String keywords); 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; package com.github.wxiaoqi.security.admin.rest;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.github.wxiaoqi.security.admin.biz.*; import com.github.wxiaoqi.security.admin.biz.*;
import com.github.wxiaoqi.security.admin.entity.*; import com.github.wxiaoqi.security.admin.entity.*;
...@@ -156,7 +157,20 @@ public class PublicController { ...@@ -156,7 +157,20 @@ public class PublicController {
AppUserVo userVo = detailBiz.getUserInfoById(id); AppUserVo userVo = detailBiz.getUserInfoById(id);
appUserVos.add(userVo); 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); return ObjectRestResponse.succ(appUserVos);
} }
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
<!-- 获取用户信息 --> <!-- 获取用户信息 -->
<select id="getUserInfo" resultMap="AppUserVoMap"> <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 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 left join app_user_detail d
on d.userid = l.id on d.userid = l.id
...@@ -54,32 +63,13 @@ ...@@ -54,32 +63,13 @@
and and
buml.isdel=0 buml.isdel=0
and and
bum.is_del=0 d.userid in
and
d.userid = #{userId} limit 1
</select>
<foreach collection="list" item="userId" index="index" open="(" separator="," close=")" >
#{userId}
</foreach>
<!-- &lt;!&ndash; 获取用户信息 &ndash;&gt;--> </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-->
<!-- 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 id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String"> <select id="getUserIdByUsername" resultType="java.lang.Integer" parameterType="java.lang.String">
......
...@@ -172,7 +172,7 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -172,7 +172,7 @@ public class BackStageOrderController extends CommonBaseController implements Us
List<OrderListVo> list = pageDataVO.getData(); List<OrderListVo> list = pageDataVO.getData();
List<Integer> userIds = list.stream().map(OrderListVo::getUserId).distinct().collect(Collectors.toList()); List<Integer> userIds = list.stream().map(OrderListVo::getUserId).distinct().collect(Collectors.toList());
if (userIds != null && userIds.size() > 0) { 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()); log.info("获取用户信息:objectRestResponse = {}", objectRestResponse.getData());
Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>(); Map<Integer, AppUserVo> appvoMap = new HashMap<Integer, AppUserVo>();
if (objectRestResponse.getData() != null) { if (objectRestResponse.getData() != null) {
...@@ -215,7 +215,6 @@ public class BackStageOrderController extends CommonBaseController implements Us ...@@ -215,7 +215,6 @@ public class BackStageOrderController extends CommonBaseController implements Us
String[] couponIds = orderPageVO.getCouponTickerNos().split(","); String[] couponIds = orderPageVO.getCouponTickerNos().split(",");
List<Coupon> couponList = activityFeign.couponsByTickerNoList(Lists.newArrayList(couponIds)); List<Coupon> couponList = activityFeign.couponsByTickerNoList(Lists.newArrayList(couponIds));
orderPageVO.setCouponList(couponList); 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