在MySQL创建数据库,名为band315
创建一个表名为band的表,可以用代码如下
create table band
(
aid int(5) primary key,
name varchar(10) not null,
remark varchar(15),
status varchar(20)
)
创建Apartment类,定义成员变量并进行构造函数的声明与get、set方法的声明,代码如下:
`package cn.edu.mju.project13.entity;
public class band {
private Integer id;
private String name;
private String remark;
private Byte status;
public band() {
}
public band(Integer id, String name, Byte status,String remark) {
this.id = id;
this.name = name;
this.status = status;
this.remark=remark;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id= id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}
`定义接口,完成方法的定义,代码如下
import cn.edu.mju.project13.entity.band;
import java.util.List;
public interface IBandDao {
public Boolean insert(band band);
public Boolean delete(Integer id);
public Boolean updata(band band);
public band findById(Integer id);
public List<band> findAll();
public List<band> find(band band);
public Pager<band> pagenate(int page,int pageSize, band band);
}
persist路径下的impl包