springboot+mybatis+Mysql实现的增删改查实例系统(功能包含员工增删改查等)

springboot+mybatis+Mysql实现的增删改查实例系统

本系统是一个简单的springboot实例,实现了员工的增删改查,适合出初学springboot的同学学习哦
(文末查看完整源码)

实现功能截图

请添加图片描述
首页
请添加图片描述
新增
请添加图片描述
新增成功
请添加图片描述
编辑
请添加图片描述

系统功能

本系统实现了以下功能:
1、员工增删改查

使用技术

数据库:mysql
开发工具:Idea(Myeclispe、Eclipse也可以)
知识点:Spring+mybatis+maven+layUI

项目结构

在这里插入图片描述

代码

java端
实体类
person.java

package cn.lj.yy.model;

public class Person {

    private int id;
    private String name;
    private int age;
    private String sex;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    @Override
    public String toString() {
        return "Person{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age + '\'' +
                ", sex='" + sex + '\'' +
                '}';
    }
}

service.java

package cn.lj.yy.service;

import cn.lj.yy.mapper.PersonMapper;
import cn.lj.yy.model.Person;
import com.github.pagehelper.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class PersonService {

    @Autowired
    PersonMapper personMapper;

    public Person getPersonById(int id) {
        return personMapper.getPersonById(id);
    }

    public Page<Person> getAllPersonByPage(Map params) {
        return personMapper.getAllPersonByPage(params);
    }

    public boolean addPerson(Person person) {
        return personMapper.addPerson(person) > 0;
    }

    public boolean updatePerson(Person person) {
        return personMapper.updatePerson(person) > 0;
    }

    public boolean deletePerson(int id) {
        return personMapper.deletePerson(id) > 0;
    }
}

PersonMapper.java

package cn.lj.yy.mapper;

import cn.lj.yy.model.Person;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;

import java.util.Map;

@Mapper
public interface PersonMapper {

    /**
     * 根据id查询人员
     * @param id 人员编号
     * @return
     */
    Person getPersonById(int id);

    /**
     * 分页查询人员
     *@param params 查询条件
     * @return
     */
    Page<Person> getAllPersonByPage(Map params);

    /**
     * 添加人员信息
     * @param person 人员实例
     * @return 成功操作的记录数目
     */
    int addPerson(Person person);

    /**
     * 修改人员信息
     * @param person 人员实例
     * @return 成功操作的记录数目
     */
    int updatePerson(Person person);

    /**
     * 删除人员信息
     * @param id 人员编号
     * @return 成功操作的记录数目
     */
    int deletePerson(int id);
}

完整源码

觉得有用,记得一键三连哦!

  • 2
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

anmu4200

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值