added next
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package de.jottyfan.bico.modules.next;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import de.jottyfan.bico.modules.CommonController;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author jotty
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
public class NextController extends CommonController {
|
||||
|
||||
@Autowired
|
||||
private NextService service;
|
||||
|
||||
@GetMapping("/next")
|
||||
public String getNext(Model model) {
|
||||
model.addAttribute("list", service.getNext(LocalDate.now()));
|
||||
return "/next";
|
||||
}
|
||||
|
||||
@GetMapping("/next/{date}")
|
||||
public String getNextForDate(@PathVariable("date") String dateStr, Model model) {
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
LocalDate date = LocalDate.parse(dateStr, formatter);
|
||||
model.addAttribute("list", service.getNext(date));
|
||||
return "/next";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user