package com.lovenav.controller;

import com.lovenav.entity.Nav;
import com.lovenav.service.NavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class NavController {
    @Autowired
    NavService navService;
    @RequestMapping("/updateNav")
    public String updateNav(Nav nav){
        if (nav==null){
            return "选择更新的导航标签！";
        }
        return navService.updateNav(nav);
    }

    @RequestMapping("/addNav")
    public String addNav(Nav nav){
        if (nav==null){
            return "添加的导航不能为空";
        }
        return navService.addNav(nav);
    }
    @RequestMapping("/deleteNav")
    public String deleteNav(Nav nav){
        if (nav==null){
            return "删除的导航不能为空";
        }
        return navService.deleteNav(nav);
    }

    @RequestMapping("/selectAllNav")
    public String selectAllNav(){
        return navService.selectAllNav();
    }

}
