@RequestMapping(value = "/updateTvContentTitle") public String updateTvContentTitle(TvContent tvContent) { Tv tv = tvService.selectTvByTvNo(tvContent.getTvNo()); tvContent.setTitle(tv.getTvTitle() + " " + tvContent.getTitle()); int result = tvService.updateTvContentTitle(tvContent); return "redirect:/tvContentList?tvNo=" + tvContent.getTvNo(); }
/** TV Contents */ @RequestMapping(value = "/tvContentList") public String tvContentList(Long tvNo, Model model) { Tv tv = tvService.selectTvByTvNo(tvNo); List<TvContent> tvContents = tvService.selectTvContents(tv); model.addAttribute("tv", tv); model.addAttribute("tvContents", tvContents); return "tv_content_list"; }
@RequestMapping(value = "/addTvContent") public String addTvContent(TvContent tvContent) { Tv tv = tvService.selectTvByTvNo(tvContent.getTvNo()); tvContent.setTitle(tv.getTvTitle() + " " + tvContent.getTitle()); int result = tvService.addTvContent(tvContent); log.info("title " + tvContent.getTitle() + ", result " + result); return "redirect:/tvContentList?tvNo=" + tvContent.getTvNo(); }
@RequestMapping(value = "/updateTvDayOfWeek") public String updateTvDayOfWeek(Tv tv) { int result = tvService.updateTvDayOfWeek(tv); return "redirect:/manage"; }
@RequestMapping(value = "/deleteTv") public String deleteTv(Long tvNo) { int result = tvService.deleteTv(tvNo); log.info("delete result " + result); return "redirect:/manage"; }
@RequestMapping(value = "/updateTv") public String updateTv(Tv tv) { int result = tvService.updateTv(tv); log.info("tvTitle " + tv.getTvTitle() + ", result " + result); return "redirect:/manage"; }
@RequestMapping(value = "/deleteTvContent") public String deleteTvContent(TvContent tvContent) { int result = tvService.deleteTvContent(tvContent.getContentNo()); log.info("title " + tvContent.getTitle() + ", result " + result); return "redirect:/tvContentList?tvNo=" + tvContent.getTvNo(); }
/** TV */ @RequestMapping(value = "/manage") public String index(Model model) { List<Tv> tvs = tvService.selectTvs(); DateTime dateTime = new DateTime(); int dayOfWeek = dateTime.getDayOfWeek(); dayOfWeek = dayOfWeek - 1; if (dayOfWeek == 0) { dayOfWeek = 7; } model.addAttribute("dayOfWeek", dayOfWeek); model.addAttribute("tvs", tvs); return "index"; }