照着五月仓颉博客敲了一遍
测试一直跑不起来
出现了以下几个问题
1.config.xml
&的转义字符要写成
&
<properties>
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/45th?useSSL=false&characterEncoding=utf8"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</properties>
environments中datasouce优先级问题
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="${driver}"/>
<property name="url" value="${url}"/>
<property name="username" value="${username}"/>
<property name="password" value="${password}"/>
</dataSource>
</environment>
</environments>
别名的规范 type 后的路径用 . 隔开
<typeAliases>
<typeAlias alias="Mail" type="com.yepq.main.Mail"/>
</typeAliases>
mapper的resource 之前会碰到找不到.xml文件,因为路径问题 建议直接mail.xml
<mappers>
<mapper resource="mail.xml"/>
</mappers>
2.sql建表语句 comment 写成 commit 低级的拼写错误
drop table if exists mail;
create table mail
(
id int auto_increment not null comment '主键id',
create_time datetime not null comment '创建时间',
modify_time timestamp not null comment '修改时间',
web_id int not null comment '站点id,1表示新浪,2表示QQ,3表示搜狐,4表示火狐',
mail varchar(50) not null comment '邮箱名',
use_for varchar(30) comment '邮箱用途',
primary key(id),
index use_for(use_for),
unique index web_id_mail(web_id, mail)
)charset=utf8 engine=innodb comment='邮箱表';
标签:comment,xml,碰到,web,源码,Mybatis,mail,null,id
From: https://www.cnblogs.com/yepq2025/p/16794913.html