|
@@ -0,0 +1,49 @@
|
|
|
+package cn.rankin.userservice.controller;
|
|
|
+
|
|
|
+import cn.rankin.common.utils.api.model.APIResult;
|
|
|
+import cn.rankin.common.utils.api.page.Page;
|
|
|
+import cn.rankin.common.utils.enums.BaseOrderEnum;
|
|
|
+import cn.rankin.data.api.user.dto.WhiteUserSearchDTO;
|
|
|
+import cn.rankin.data.api.user.entity.WhiteUser;
|
|
|
+import cn.rankin.userservice.code.UserServiceAPICode;
|
|
|
+import cn.rankin.userservice.service.WhiteUserService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/white/user")
|
|
|
+public class WhiteUserController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private WhiteUserService whiteUserService;
|
|
|
+
|
|
|
+ @RequestMapping(value = "/{userId}", method = RequestMethod.GET)
|
|
|
+ public APIResult<WhiteUser> getWhiteUser(@PathVariable String userId) {
|
|
|
+ WhiteUser whiteUser = whiteUserService.findUserByUserId(userId);
|
|
|
+ if (whiteUser == null) {
|
|
|
+ return APIResult.error(UserServiceAPICode.NOT_EXISTS);
|
|
|
+ }
|
|
|
+ return APIResult.ok(whiteUser);
|
|
|
+ }
|
|
|
+
|
|
|
+ @RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
+ public APIResult<Page<WhiteUser>> search(WhiteUserSearchDTO searchDTO) {
|
|
|
+ WhiteUser sample = new WhiteUser();
|
|
|
+ String code = searchDTO.getCode();
|
|
|
+ if (!StringUtils.isEmpty(code)) {
|
|
|
+ sample.setCode("%" + code + "%");
|
|
|
+ }
|
|
|
+ Integer pageNo = searchDTO.getPageNo();
|
|
|
+ Integer pageSize = searchDTO.getPageSize();
|
|
|
+ LinkedHashMap<String, BaseOrderEnum> sort = new LinkedHashMap<>();
|
|
|
+ sort.put("gmtModified", BaseOrderEnum.DESC);
|
|
|
+// return whiteUserService.search(sample, pageNo, pageSize, sort);
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|