完整教程:how2j
备忘
###学习目标
###项目理解
###1.表结构设计
1.1配置信息表config表1
2
3
4
5create table config{
id int,
key_ varchar(225),
value varchar(225)
}ENGINE=InnoDB DEFAULT CHARSET=UTF8;
1.2消费分类表category表1
2
3
4create table category{
id int,
name varchar(225)
}ENGINE=InnoDB DEFAULT CHARSET=UTF8'
1.3消费记录表record表1
2
3
4
5
6
7
8
9
10
11
12
13
14
15create table record{
id int,
spend int,
cid int,
comment varchar(225),
date Date
}ENGINE InnoDB DEFAULT CHARSET=UTF8;
```
###2.约束
2.1 主键约束add config
```sql
alter table category add constraint pk_category_id primary key (id);
alter table record add constraint pk_record_id primary key (id);
alter table config add constraint pk_config_id primary key (id);
2.2设置id自增长change id id int anto_increment1
2
3alter table category change id id int anto_increment;
alter table record change id id int anto_increment;
alter table config change id id int anto_increment;
2.3外键约束1
alter table record add constranit fk_record_category foreign key(cid) reference category(id);
3.放在一起
create table config{
id int anto_increment,
key_ varchar(225),
value int,
primary key(id)
}DEFAULT CHARSET=UTF8;
create table category{
id int anto_increment,
name varchar(225),
primary key(id)
}DEFAULT CHARSET=UTF8;
create table record{
id int anto_increment;
spend int,
cid int,
comment varchar(225),
date Date,
primary key(id),
constranit foreign key(cid) reference category(id)
}DEFAULT CHARSET=UTF8;
###2.原型设计
2.1粗陋的JFrame
2.2界面规划
2.3util类 居中面板类 centerPanel
3.界面上的工具类 GUIutil