package com.cab.controller;

import com.cab.service.ShareServiceImpl;
import com.cku.core.RESTResponse;
import com.cku.core.ZAException;
import com.cku.util.PageBean;
import com.cku.util.ServletUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created by user on 2016/5/5.
 */
@Controller
@RequestMapping("share")
public class ShareController {
    @Autowired
    private ShareServiceImpl shareService;

    @RequestMapping("/getShare")
    public ModelAndView getShare(HttpServletRequest request, HttpServletResponse response) throws IOException {
        ModelAndView result = new ModelAndView("jsp/share");
        String id = request.getParameter("id");
        PageBean pb = ServletUtils.getParameterBean(request);
        Object obj = shareService.getShare(Long.parseLong(id), pb);
        result.addObject("items", obj);
        return result;
    }
}
