You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
package web.controller;
|
|
|
|
import db.form.DBAction;
|
|
import db.model.bilibili.MenuModel;
|
|
import org.hibernate.criterion.DetachedCriteria;
|
|
import org.hibernate.criterion.Order;
|
|
import org.hibernate.criterion.Property;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.Model;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
@Controller
|
|
@RequestMapping("/menu")
|
|
public class MenuController extends BiliController<MenuModel> {
|
|
|
|
|
|
@RequestMapping
|
|
public String find(Model model, MenuModel queryCommand, @RequestParam Integer firstResult, @RequestParam Integer maxResults){
|
|
model.addAttribute("menus", service.find(getDetachedCriteria(queryCommand), firstResult, maxResults).toString());
|
|
return "menu";
|
|
}
|
|
|
|
@Override
|
|
public boolean checkAction(DBAction action) {
|
|
return DBAction.R.equals(action);
|
|
}
|
|
|
|
@Override
|
|
protected DetachedCriteria getDetachedCriteria(MenuModel queryCommand) {
|
|
return super.getDetachedCriteria(queryCommand).add(Property.forName("menuLevel").eq(0)).addOrder(Order.asc("sort"));
|
|
}
|
|
}
|
|
|