SpringBoot实现增加删除

该博客详细介绍了如何在SpringBoot应用中实现增删功能。从创建controller、dao、pojo、service各层,到配置mapper和HTML模板,作者逐步讲解了每个步骤。特别指出,删除操作已在接口文件通过注解方式完成,而添加操作的HTML路由需注意正确设置,如@example `/user/addUser`。
摘要由CSDN通过智能技术生成

之前一篇的文章已经将SpringBoot配置好了
这里继续实现功能
首先先创建java里的controller层,dao层,pojo层,service层
resources里的mapper 和存储html的templates(自取名)
controllerceng

package com.zr.gmspringboot.controller;

import com.zr.gmspringboot.pojo.UserInfo;
import com.zr.gmspringboot.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/user")
public class UserInfoController {

    @Autowired
    private IUserInfoService userInfoService;

    @RequestMapping("hello")
    @ResponseBody
    public String hello(){
        return "Hello World!";
    }

    @RequestMapping("page")
    public String page(){
        return "delUser"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值