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) {
this.author = author == null ? null : author.trim();
}
public Integer getPages() {
return pages;
}
public void setPages(Integer pages) {
this.pages = pages;
}
public String getCreatetime() {
return createtime;
}
public void setCreatetime(String createtime) {
this.createtime = createtime;
}
}
com.service
PersonService.java
package com.service;
import java.util.List;
import com.entity.TbPerson;
public interface PersonService {
//查询所有
List selsctAll();
//删除
int delete(int id);
//根据id查询
TbPerson getByid(int id);
//修改
int update(TbPerson tbPerson);
//添加
int addPerson(TbPerson tbPerson);
}
com.service.impl
PersonServiceImpl.java
package com.service.impl;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.dao.TbPersonMapper;
import com.entity.TbPerson;
import com.service.PersonService;
@Service
public class PersonServiceImpl implements PersonService {
@Resource
private TbPersonMapper mapper;
@Override
public List selsctAll() {
// TODO Auto-generated method stub
List list=mapper.selectAll();
return list;
}
@Override
public int delete(int id) {
// TODO Auto-generated method stub
int rows=mapper.deleteByPrimaryKey(id);
return rows;
}
@Override
public TbPerson getByid(int id) {
// TODO Auto-generated method stub
TbPerson tbPerson=mapper.selectByPrimaryKey(id);
return tbPerson;
}
@Override
public int update(TbPerson tbPerson) {
// TODO Auto-generated method stub
int rows=mapper.updateByPrimaryKey(tbPerson);
return rows;
}
@Override</