基于Spring MVC + Spring + MyBatis的【图书信息管理系统(二)】(1)

@RequestMapping(“deleteByid”)

public String deleteByid(int id) {

int rows=service.delete(id);

return “redirect:/selectAll.do”;

}

//添加页面跳转

@RequestMapping(“getpage”)

public String getpage() {

return “/addPage”;

}

//添加

@RequestMapping(“addPerson”)

public String addPerson(TbPerson tbPerson) {

SimpleDateFormat simple=new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);

tbPerson.setCreatetime(simple.format(new Date()));

int rows=service.addPerson(tbPerson);

return “redirect:/selectAll.do”;

}

//根据id查询

@RequestMapping(“getbyid”)

public String getbyid(Model model,int id) {

TbPerson tbPerson=service.getByid(id);

model.addAttribute(“tbPerson”, tbPerson);

return “/addPage”;

}

//修改

@RequestMapping(“update”)

public String update(TbPerson tbPerson) {

SimpleDateFormat simple=new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);

tbPerson.setCreatetime(simple.format(new Date()));

int rows=service.update(tbPerson);

return “redirect:/selectAll.do”;

}

}

com.dao

TbPersonMapper.java

package com.dao;

import com.entity.TbPerson;

import java.util.List;

public interface TbPersonMapper {

int deleteByPrimaryKey(Integer id);

int insert(TbPerson record);

TbPerson selectByPrimaryKey(Integer id);

List selectAll();

int updateByPrimaryKey(TbPerson record);

}

TbPersonMapper.xml

<?xml version="1.0" encoding="UTF-8" ?>

delete from tb_person

where id = #{id,jdbcType=INTEGER}

insert into tb_person (id, BookName, author,

pages, createTime)

values (#{id,jdbcType=INTEGER}, #{bookname,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR},

#{pages,jdbcType=INTEGER}, #{createtime,jdbcType=TIMESTAMP})

update tb_person

set BookName = #{bookname,jdbcType=VARCHAR},

author = #{author,jdbcType=VARCHAR},

pages = #{pages,jdbcType=INTEGER},

createTime = #{createtime,jdbcType=TIMESTAMP}

where id = #{id,jdbcType=INTEGER}

select id, BookName, author, pages, createTime

from tb_person

where id = #{id,jdbcType=INTEGER}

select id, BookName, author, pages, createTime

from tb_person ORDER BY createTime DESC

com.entity

TbPerson.java

package com.entity;

import java.util.Date;

public class TbPerson {

private Integer id;

private String bookname;

private String author;

private Integer pages;

private String createtime;

public Integer getId() {

return id;

}

public void setId(Integer id) {

this.id = id;

}

public String getBookname() {

return bookname;

}

public void setBookname(String bookname) {

this.bookname = bookname == null ? null : bookname.trim();

}

public String getAuthor() {

return author;

}

public void setAuthor(String author) { <

  • 18
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
地铁线路信息管理系统是一个基于Web的应用程序,主要用于管理地铁线路信息和提供查询服务。系统采用了SpringSpring MVCMyBatis等技术,具有可扩展性、可维护性、可靠性和安全性等优点。 系统主要功能包括以下几个方面: 1. 地铁线路信息维护:管理员可以对地铁线路信息进行增、删、改、查等操作,包括线路名称、起始站、终点站、途经站点、票价等信息。 2. 站点信息维护:管理员可以对站点信息进行增、删、改、查等操作,包括站点名称、所属线路、经纬度等信息。 3. 车站信息维护:管理员可以对车站信息进行增、删、改、查等操作,包括车站名称、所属站点、到达时间、发车时间等信息。 4. 乘客查询服务:乘客可以通过系统查询地铁线路、站点和车站信息,以及票价和车次信息等。 5. 管理员权限管理系统管理员可以对用户权限进行管理,包括添加、删除、修改角色和分配权限等。 6. 系统日志管理系统可以记录用户的操作日志和异常日志,方便管理员进行系统的监控和管理。 在技术实现方面,系统采用了Spring作为IoC容器和AOP框架,Spring MVC作为Web框架,MyBatis作为持久化框架,同时还使用了其他技术如JSP、jQuery等。系统采用了Maven作为项目管理工具,可以方便地管理项目依赖和构建。在数据存储方面,系统采用了MySQL数据库进行数据存储和管理。 总之,基于Spring+Spring MVC+MyBatis技术的地铁线路信息管理系统具有实用性和可扩展性,可以满足不同场景下的需求。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值