【springboot+mybatis搭建微信小程序】—— (二)表设计与实体类创建

1. 设计表

1
2
3
4
5
6
7
8
9
CREATE TABLE `tb_area`(
`area_id` int(2) NOT NULL AUTO_INCREMENT,
`area_name` VARCHAR(200) NOT NULL,
`priority` INT(2) NOT NULL DEFAULT '0',
`create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`last_edit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`area_id`),
UNIQUE KEY `UK_AREA`(`area_name`)
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='区域表';

2. 创建实体类

DAO层设计,新建一个package,用来存放所有的实体类

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package com.hq.demo.entity;

import java.util.Date;

public class {

private Integer areaId;
private String areaName;
private Integer priority;
private Date createTime;
private Date lastEditTime;

public Integer getAreaId() {
return areaId;
}

public void setAreaId(Integer areaId) {
this.areaId = areaId;
}

public String getAreaName() {
return areaName;
}

public void setAreaName(String areaName) {
this.areaName = areaName;
}

public Integer getPriority() {
return priority;
}

public void setPriority(Integer priority) {
this.priority = priority;
}

public Date getCreateTime() {
return createTime;
}

public void setCreateTime(Date createTime) {
this.createTime = createTime;
}

public Date getLastEditTime() {
return lastEditTime;
}

public void setLastEditTime(Date lastEditTime) {
this.lastEditTime = lastEditTime;
}
}