资源简介

使用Idea工具开发,Maven+SpringMVC+Mybatis的增删改查Demo,也是根据网上找的demo,自己亲自动手写的,在编写过程也是遇到了各种小问题,不过都一一处理,里面附带了一个简单文档和建表语句,希望对你有所帮助。遇到BUG需要有一个好的心态,Good Luck.

资源截图

代码片段和文件信息

package com.controller;

import com.pojo.Paper;
import com.service.PaperService;

import java.util.ArrayList;
import java.util.List;

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.bind.annotation.RequestParam;

@Controller
@RequestMapping(“/paper“)
public class PaperController {
    @Autowired
    private PaperService paperService;

    @RequestMapping(“/allPaper“)
    public String list(Model model) {
        List list = paperService.queryAllPaper();
        model.addAttribute(“list“ list);
        return “allPaper“;
    }

    @RequestMapping(“toAddPaper“)
    public String toAddPaper() {
        return “addPaper“;
    }

    @RequestMapping(“/addPaper“)
    public String addPaper(Paper paper) {
        paperService.addPaper(paper);
        return “redirect:/paper/allPaper“;
    }

    @RequestMapping(“/del/{id}“)
    public String deletePaper(@PathVariable(“id“) int id) {
        paperService.deletePaperById(id);
        return “redirect:/paper/allPaper“;
    }

    @RequestMapping(“toUpdatePaper“)
    public String toUpdatePaper(Model model int id) {
        Paper pager=paperService.queryById(id);
        //List list =paperService.queryListById(id);
        model.addAttribute(“paper“ pager);
        return “updatePaper“;
    }

    @RequestMapping(“/updatePaper“)
    public String updatePaper(Model model Paper paper) {
        paperService.updatePaper(paper);
        paper = paperService.queryById(paper.getId());
        model.addAttribute(“paper“ paper);
        return “redirect:/paper/allPaper“;
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件        281  2019-05-15 14:11  Suiyi\.idea\artifacts\Suiyi_war.xml

     文件       3369  2019-05-14 16:54  Suiyi\.idea\artifacts\Suiyi_war_exploded.xml

     文件        622  2019-05-11 09:37  Suiyi\.idea\compiler.xml

     文件        172  2019-05-11 09:37  Suiyi\.idea\encodings.xml

     文件       1444  2019-05-11 08:06  Suiyi\.idea\inspectionProfiles\Project_Default.xml

     文件        599  2019-05-15 14:11  Suiyi\.idea\libraries\Maven__ch_qos_logback_logback_classic_1_1_11.xml

     文件        578  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__ch_qos_logback_logback_core_1_1_11.xml

     文件        668  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_annotations_2_9_0.xml

     文件        619  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_core_2_9_8.xml

     文件        647  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__com_fasterxml_jackson_core_jackson_databind_2_9_8.xml

     文件        517  2019-05-11 09:48  Suiyi\.idea\libraries\Maven__com_mchange_c3p0_0_9_5_2.xml

     文件        622  2019-05-11 09:48  Suiyi\.idea\libraries\Maven__com_mchange_mchange_commons_java_0_2_11.xml

     文件        602  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__javax_servlet_javax_servlet_api_3_1_0.xml

     文件        518  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__javax_servlet_jsp_api_2_0.xml

     文件        497  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__javax_servlet_jstl_1_2.xml

     文件        546  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__javax_servlet_servlet_api_2_4.xml

     文件        479  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__junit_junit_4_11.xml

     文件        591  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__mysql_mysql_connector_java_5_1_6.xml

     文件        556  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_hamcrest_hamcrest_core_1_3.xml

     文件        524  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_mybatis_mybatis_3_5_0.xml

     文件        573  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_mybatis_mybatis_spring_1_3_1.xml

     文件        537  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_slf4j_slf4j_api_1_7_22.xml

     文件        633  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_aop_5_1_5_RELEASE.xml

     文件        647  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_beans_5_1_5_RELEASE.xml

     文件        661  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_context_5_1_5_RELEASE.xml

     文件        717  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_context_support_4_3_3_RELEASE.xml

     文件        640  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_core_5_1_5_RELEASE.xml

     文件        682  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_expression_5_1_5_RELEASE.xml

     文件        633  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_jcl_5_1_5_RELEASE.xml

     文件        640  2019-05-11 09:37  Suiyi\.idea\libraries\Maven__org_springframework_spring_jdbc_5_1_5_RELEASE.xml

............此处省略152个文件信息

评论

共有 条评论