use of org.springframework.web.bind.annotation.GetMapping in project judge by zjnu-acm.
the class ModifyUserController method updatePage.
@GetMapping({ "/modifyuserpage", "/modifyuser" })
public String updatePage(Model model, Authentication authentication) {
String userId = authentication != null ? authentication.getName() : null;
User user = accountService.findOne(userId);
model.addAttribute("user", user);
return "users/edit";
}
use of org.springframework.web.bind.annotation.GetMapping in project judge by zjnu-acm.
the class SearchUserController method searchuser.
@GetMapping("/searchuser")
public String searchuser(Model model, @RequestParam(value = "user_id", defaultValue = "") String keyword, @RequestParam(value = "position", required = false) String position, @PageableDefault(1000) Pageable pageable) {
if (keyword.replace("%", "").length() < 2) {
throw new BusinessException(BusinessCode.USER_SEARCH_KEYWORD_SHORT);
}
String like = keyword;
if (position == null) {
like = "%" + like + "%";
} else if (position.equalsIgnoreCase("begin")) {
like += "%";
} else {
like = "%" + like;
}
Pageable t = pageable;
if (t.getSort() == null) {
t = new PageRequest(pageable.getPageNumber(), pageable.getPageSize(), new Sort(new Sort.Order("solved").with(Sort.Direction.DESC), new Sort.Order("submit")));
}
Page<User> users = accountService.findAll(AccountForm.builder().disabled(Boolean.FALSE).query(like).build(), t);
model.addAttribute("query", keyword);
model.addAttribute("users", users);
return "users/search";
}
use of org.springframework.web.bind.annotation.GetMapping in project incubator-servicecomb-java-chassis by apache.
the class GetMappingMethodAnnotationProcessor method process.
@Override
public void process(Object annotation, OperationGenerator operationGenerator) {
GetMapping mappingAnnotation = (GetMapping) annotation;
Operation operation = operationGenerator.getOperation();
// path/value是等同的
this.processPath(mappingAnnotation.path(), operationGenerator);
this.processPath(mappingAnnotation.value(), operationGenerator);
this.processMethod(RequestMethod.GET, operationGenerator);
this.processConsumes(mappingAnnotation.consumes(), operation);
this.processProduces(mappingAnnotation.produces(), operation);
if (StringUtils.isEmpty(operationGenerator.getHttpMethod()) && StringUtils.isEmpty(operationGenerator.getSwaggerGenerator().getHttpMethod())) {
throw new Error("HttpMethod must not both be empty in class and method");
}
}
use of org.springframework.web.bind.annotation.GetMapping in project jhipster-registry by jhipster.
the class EurekaResource method lastn.
/**
* GET /eureka/lastn : get Eureka registrations
*/
@GetMapping("/eureka/lastn")
@Timed
public ResponseEntity<Map<String, Map<Long, String>>> lastn() {
Map<String, Map<Long, String>> lastn = new HashMap<>();
PeerAwareInstanceRegistryImpl registry = (PeerAwareInstanceRegistryImpl) getRegistry();
Map<Long, String> canceledMap = new HashMap<>();
registry.getLastNCanceledInstances().forEach(canceledInstance -> {
canceledMap.put(canceledInstance.first(), canceledInstance.second());
});
lastn.put("canceled", canceledMap);
Map<Long, String> registeredMap = new HashMap<>();
registry.getLastNRegisteredInstances().forEach(registeredInstance -> {
registeredMap.put(registeredInstance.first(), registeredInstance.second());
});
lastn.put("registered", registeredMap);
return new ResponseEntity<>(lastn, HttpStatus.OK);
}
use of org.springframework.web.bind.annotation.GetMapping in project jhipster-registry by jhipster.
the class EurekaResource method eureka.
/**
* GET /eureka/applications : get Eureka applications information
*/
@GetMapping("/eureka/applications")
@Timed
public ResponseEntity<EurekaVM> eureka() {
EurekaVM eurekaVM = new EurekaVM();
eurekaVM.setApplications(getApplications());
return new ResponseEntity<>(eurekaVM, HttpStatus.OK);
}
Aggregations