123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.lemon.lifecenter.controller;
- import java.util.ArrayList;
- import java.util.List;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import com.lemon.lifecenter.common.LifeCenterController;
- import com.lemon.lifecenter.common.LifeCenterSessionController;
- import com.lemon.lifecenter.dto.PopupDTO;
- import com.lemon.lifecenter.service.PopupService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.ModelAttribute;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.servlet.ModelAndView;
- @Controller
- @RequestMapping("/popup")
- public class PopupController extends LifeCenterController {
- @Autowired
- private PopupService popupService;
- @RequestMapping("/new")
- public ModelAndView newPopup() {
- ModelAndView mv = setMV("popup/new");
- return mv;
- }
- @RequestMapping("/list")
- public ModelAndView listPopup() {
- PopupDTO dto = new PopupDTO();
- int total = popupService.selectPopupCount(dto);
- List<PopupDTO> popupList = new ArrayList<PopupDTO>();
- if( total > 0 ) {
- popupList = popupService.selectPopupList(dto);
- }
- ModelAndView mv = setMV("popup/list");
- mv.addObject( "total", total );
- mv.addObject( "popupList", popupList );
-
- return mv;
- }
- @RequestMapping(value = "/new/insert", method = RequestMethod.POST)
- public String insertPopupData(@ModelAttribute("dto") final PopupDTO dto,
- HttpServletRequest request, HttpServletResponse response) {
- String sesId = LifeCenterSessionController.getSession(request, "sesId");
-
- dto.setCreatedBy( sesId );
- popupService.insertPopupData( dto );
- return "redirect:/popup/list";
- }
- }
|