package com.cku.subsystem.dog; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import com.cku.oa.dog.entity.DogBreedCertified; import com.cku.oa.dog.service.DogBreedCertifiedService; import com.cku.oa.sys.service.LoginServerService; import com.thinkgem.jeesite.common.persistence.Page; import com.thinkgem.jeesite.common.utils.StringUtils; import com.thinkgem.jeesite.common.web.BaseController; import com.thinkgem.jeesite.modules.sys.entity.User; import com.thinkgem.jeesite.modules.sys.utils.UserUtils; /** * 繁育证书Controller * @author zhuoHeng * @version 2016-08-22 */ @Controller @RequestMapping(value = "/subSystem/dogBreedCertified") public class SubDogBreedCertifiedController extends BaseController { @Autowired private DogBreedCertifiedService dogBreedCertifiedService; @Autowired private LoginServerService loginServerService; /** * 查询当前登录人登录类型得到跳转路径头 * @return * @author chaixueteng */ public String getUrlByUserType(){ User loginUser = UserUtils.getLoginUser(); return loginServerService.getShortNameByUserType(loginUser.getUserType()); } @ModelAttribute public DogBreedCertified get(@RequestParam(required=false) String id) { DogBreedCertified entity = null; if (StringUtils.isNotBlank(id)){ entity = dogBreedCertifiedService.get(id); } if (entity == null){ entity = new DogBreedCertified(); } return entity; } @RequestMapping(value = {"list", ""}) public String list(DogBreedCertified dogBreedCertified, HttpServletRequest request, HttpServletResponse response, Model model) { Page page = dogBreedCertifiedService.findPage(new Page(request, response), dogBreedCertified); model.addAttribute("page", page); return "subSystem/"+getUrlByUserType()+"/dog/dogbreed/dogBreedCertifiedList"; } @RequestMapping(value = "form") public String form(DogBreedCertified dogBreedCertified, Model model) { model.addAttribute("dogBreedCertified", dogBreedCertified); model.addAttribute("childShowsList",dogBreedCertified.getChildShowsList()); return "subSystem/"+getUrlByUserType()+"/dog/dogbreed/dogBreedCertifiedForm"; } }