主页 > 软件教程 > 搭建MyBatis基础环境(2)

搭建MyBatis基础环境(2)

private String address;//地址

private Integer userRole;//用户角色

private Integer createdBy;//创建者

private Date creationDate;//创建时间

private Integer modifyBy;//更新者

private Date modifyDate;//更新时间

依据mybatis-config.xml中此处的配置

我们创建对应的文件,编写对应的内容

PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

"http://mybatis.org/dtd/mybatis-3-mapper.dtd">

select count(1) as count from s_user

准备数据库和数据表及对应的数据

CREATE TABLE `s_user` (

`id` int(11) DEFAULT NULL,

`user_code` varchar(100) DEFAULT NULL,

`user_name` varchar(100) DEFAULT NULL,

`user_password` varchar(100) DEFAULT NULL,

`gender` int(11) DEFAULT NULL,

`birthday` datetime DEFAULT NULL,

`phone` varchar(100) DEFAULT NULL,

`address` varchar(100) DEFAULT NULL,

`user_role` int(11) DEFAULT NULL,

`create_by` int(11) DEFAULT NULL,

`creation_date` datetime DEFAULT NULL,

`modify_by` int(11) DEFAULT NULL,

`modify_date` datetime DEFAULT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into `s_user`(`id`,`user_code`,`user_name`,`user_password`,`gender`,`birthday`,`phone`,`address`,`user_role`,`create_by`,`creation_date`,`modify_by`,`modify_date`) values

(1,'001','张三','123456',0,'2019-04-15 15:55:00','12345674567','地址',0,1,'2019-04-15 15:55:58',1,'2019-04-15 15:56:06');

创建jdbc.properties

driverClassName=com.mysql.jdbc.Driver

url=jdbc:mysql://localhost:3306/mbtest

username=root

password=

创建jdbc.properties

说点什么吧
  • 全部评论(0
    还没有评论,快来抢沙发吧!