package com.weavi.controller;

import com.weavi.entity.Interface;
import com.weavi.service.InterfaceService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.util.Date;


@Controller
@RequestMapping("/interface")
public class InterfaceController {
    @Resource
    InterfaceService interfaceService;

    @RequestMapping("/save")
    public String save(){
        Interface in1 = new Interface();

        in1.setId(1);
        in1.setInterfaceName("coupon interface");
        in1.setCreateTime(new Date());
        in1.setDescription("优惠券接口.....");
        interfaceService.save(in1);

        Interface in2 = new Interface();
        in2.setId(2);
        in2.setInterfaceName("map route interface");
        in2.setCreateTime(new Date());
        in2.setDescription("地图路径类接口.....");
        interfaceService.save(in2);

        return "save success.";
    }
    @RequestMapping(value = "/show",method = RequestMethod.GET)
    public String show(Model model){
        model.addAttribute("uid","123456");
        model.addAttribute("name","admin");
        return "show";
    }


}
