src/main/java/com/mty/cc/controller/AdminController.java

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

package com.mty.cc.controller;


import com.mty.cc.po.Admin;
import com.mty.cc.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/*
 * @description: 控制层
 * @author: mty
 */
@Controller
@RequestMapping(value = "/admin")
class AdminController {


    @Autowired(required=false)
    private AdminService adminService;

    /*
     * @description: 跳转到首页
     * @author: mty
     */
    @RequestMapping("/adminIndex")
    public String adminIndex(HttpServletRequest request,Model model) throws Exception{
        List<Admin> adminList = adminService.queryByAll();
        int total = adminList.size();
        model.addAttribute("adminList", adminList);
        model.addAttribute("total", total);
        return "admin/AdminIndex";
    }

    /*
     * @description:进入修改
     * @author: mty
     */
    @RequestMapping("/adminEdit/{id}")
    public ModelAndView  adminEdit(@PathVariable("id") String id,Model model) throws Exception{
        ModelAndView mv = new ModelAndView();
        Admin admin = adminService.queryById(id);
        model.addAttribute("admin", admin);
        mv.setViewName("admin/AdminEdit");
        return mv;
    }

    /*
     * @description:修改
     * @author: mty
     */
    @RequestMapping("/adminEditSubmit")
    public String  adminEditSubmit(Admin admin,Model model,HttpServletRequest request) throws Exception{
        try{
            adminService.update(admin);
后面还有 47 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。