<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<properties resource="druid.properties"></properties><!-- 引用加载数据库的配置文件-->
<settings>
<setting name="useGeneratedKeys" value="false"/>
<setting name="useColumnLabel" value="true"/>
<setting name="mapUnderscoreToCamelCase" value="true"/>
</settings>
<typeAliases>
<!-- <typeAlias alias="Category" type="Jopo.Category"/>-->
<package name="Jopo"/>
<!-- 将引用的类制定在那个包下面不用在引用类前加包名了-->
</typeAliases>
<plugins>
<plugin interceptor="com.github.pagehelper.PageInterceptor">
<property name="helperDialect" value="mysql"/>
<property name="reasonable" value="true"/>
</plugin>
</plugins>
<environments default="development">
<environment id="development">
<transactionManager type="JDBC">
<property name="" value=""/>
</transactionManager>
<dataSource type="UNPOOLED">
<property name="driver" value="${driveClassName}" /><!-- 引用的加载数据库的驱动-->
<property name="url" value="${url}"/><!-- 引用的加载数据库的驱动路径-->
<property name="username" value="${username}"/><!-- 数据库账户-->
<property name="password" value="${password}"/><!-- 数据库密码-->
</dataSource>
</environment>
</environments>
<!--mapper里面写的是引用的配置文件-->
<mappers>
<mapper resource="mybatis/CategoryMapper.xml"/>
<mapper resource="mybatis/IdColumnMapper.xml"/>
<mapper resource="mybatis/UuidColumnMapper.xml"/>
<mapper resource="mybatis/UserMapper.xml"/>
</mappers>
</configuration>
引用数据库文件文件类型"properties文件"
driveClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3306/java0412
username=root
password=123456
initialSize=5
maxWait=5000
maxActive=10
引用的子类配置文件
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="mapper.CategoryMapper">
<select id="select" resultType="Jopo.Category" >
select * from category order by cid asc
</select>
<select id="selectbyid" resultType="Jopo.Category" parameterType="String">
select * from category where cid=#{id}
</select>
<insert id="insert" parameterType="Jopo.Category">
insert into category(cid,cname)values (#{cId},#{cName})
</insert>
<update id="updata" parameterType="Jopo.Category">
update category set cname=#{cName} where cid=#{cId}
</update>
<delete id="delete" parameterType="String">
delete from category where cId=#{cId}
</delete>
</mapper>