Commit 378fbae4 authored by shiyu's avatar shiyu

会员列表下拉框查询

parent 2b59d57f
...@@ -11,6 +11,7 @@ import com.wwdz.ch.core.validator.Sort; ...@@ -11,6 +11,7 @@ import com.wwdz.ch.core.validator.Sort;
import com.wwdz.ch.db.domain.Admin; import com.wwdz.ch.db.domain.Admin;
import com.wwdz.ch.db.domain.User; import com.wwdz.ch.db.domain.User;
import com.wwdz.ch.db.dto.request.UserSearchRequestDto; import com.wwdz.ch.db.dto.request.UserSearchRequestDto;
import org.apache.commons.collections.map.AbstractMapDecorator;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -18,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,6 +19,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -56,9 +59,15 @@ public class AdminUserController { ...@@ -56,9 +59,15 @@ public class AdminUserController {
@PostMapping("/findList") @PostMapping("/findList")
public Result findList(@RequestBody UserSearchRequestDto dto) { public Result findList(@RequestBody UserSearchRequestDto dto) {
try { try {
List<Map<String, Object>> mapList = new ArrayList<>();
List<User> list = adminUserService.findList(dto); List<User> list = adminUserService.findList(dto);
Map<Long, String> map = list.stream().collect(Collectors.toMap(User::getId, User::getNickname, (k1, k2) -> k2)); list.forEach(user -> {
return Result.success(map); Map<String, Object> map = new HashMap<>();
map.put("id", user.getId());
map.put("name", user.getNickname());
mapList.add(map);
});
return Result.success(mapList);
} catch (Exception e) { } catch (Exception e) {
logger.error("邀请码管理->下拉框会员列表->查询 error:{]",e); logger.error("邀请码管理->下拉框会员列表->查询 error:{]",e);
} }
......
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