Idea创建三层架构项目
首先创建一个Web项目model
创建Web完成后进行创建entity、dao、service
特别注意
根据上面的步骤进行创建即可得到
创建完成
我们首先创建数据库
create databasetherr_layergo
usetherr_layergo
create tabletest(
tidint identity(1,1),
tnamevarchar(20)
)go
insert into test values(‘dao‘),
(‘entity‘),
(‘service‘)go
select * from test
现在我们进行在实体层(entity)创建类
创建完成后,进行创建字段和方法
packagecom.wbg;public classtest {inttid;
String tname;publictest() {
}public intgetTid() {returntid;
}
@OverridepublicString toString() {return "test{" +
"tid=" + tid +
", tname=‘" + tname + ‘\‘‘ +
‘}‘;
}public void setTid(inttid) {this.tid =tid;
}publicString getTname() {returntname;
}public