package com.lightinit.hsdataportal.controller.open;

import com.lightinit.hsdataportal.entity.BaseExample;
import com.lightinit.hsdataportal.model.LoginUser;
import com.lightinit.hsdataportal.model.OfflineConferenceListModel;
import com.lightinit.hsdataportal.model.OfflineConferenceSearchModel;
import com.lightinit.hsdataportal.service.IOfflineConferenceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;
import java.util.List;

@Controller
@RequestMapping(value = "/open/offlieConference")
public class OfflineConferenceOpenController {

    @Autowired
    private IOfflineConferenceService offlineConferenceService ;

    @RequestMapping(value = "list.htm")
    public ModelAndView openList(HttpSession session, OfflineConferenceSearchModel offlineConferenceSearchModel){
        LoginUser loginUser = (LoginUser) session.getAttribute(LoginUser.SESSION_KEY_LOGIN_USER);
        ModelAndView modelAndView = new ModelAndView("open/offlieConference/list");
        offlineConferenceSearchModel.setUserId(loginUser.getId());
        List<OfflineConferenceListModel> outputModel = offlineConferenceService.queryOpenList(offlineConferenceSearchModel);
        modelAndView.addObject("list", outputModel);
        return modelAndView;
    }

}
