package com.palmnest.webapp.controller.lingling;

import com.palmnest.model.property.TbOrganization;
import com.palmnest.webapp.controller.BaseFormController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

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

/**
 * @Author HXT
 * @Description 令令开门模块页面跳转控制器, 只负责页面跳转
 * @Date 2018/12/7 14:39
 **/
@Slf4j
@Controller
@RequestMapping(value = "/lingling/page")
public class LingLingPageController extends BaseFormController {


	/**
	 * 设备列表
	 *
	 * @return
	 */
	@RequestMapping(value = "/toDeviceListPage")
	public ModelAndView toDeviceListPage(HttpServletRequest request) {
		ModelAndView model = new ModelAndView();

		List<TbOrganization> organizationList = getUserRelationOrgList(request);
		model.addObject("organizationList", organizationList);
		model.setViewName("admin/lingling/deviceList");
		return model;
	}

	/**
	 * 通行历史
	 *
	 * @return
	 */
	@RequestMapping(value = "/toPassHistoryPage")
	public ModelAndView toPassHistoryPage(HttpServletRequest request) {

		ModelAndView model = new ModelAndView();

		List<TbOrganization> organizationList = getUserRelationOrgList(request);

		model.addObject("organizationList", organizationList);
		model.setViewName("admin/lingling/passHistory");

		return model;
	}

	/**
	 * 通行权限
	 *
	 * @return
	 */
	@RequestMapping(value = "/toPassPermPage")
	public ModelAndView toPassPermPage(HttpServletRequest request) {

		ModelAndView model = new ModelAndView();

		List<TbOrganization> organizationList = getUserRelationOrgList(request);

		model.addObject("organizationList", organizationList);
		model.setViewName("admin/lingling/passPerm");
		return model;
	}

	/**
	 * 员工通行
	 *
	 * @return
	 */
	@RequestMapping(value = "/toEmployeePass")
	public ModelAndView toEmployeePass(HttpServletRequest request) {

		ModelAndView model = new ModelAndView();
		model.setViewName("admin/lingling/employeePass");

		return model;
	}
}
