目录


- driver=com.mysql.jdbc.Driver
- url=jdbc:mysql://localhost:3306/dp1?useUnicode=true&characterEncoding=utf-8
- username=root
- password=109923

- configuration
- PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-config.dtd">
- <configuration>
-
- <properties resource="jdbc.properties"/>
-
- <environments default="tj1">
-
- <environment id="tj1">
-
- <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>
-
- <mappers>
-
- <mapper resource="StudentMapper.xml"/>
- mappers>
- configuration>



- <typeAliases>
- <typeAlias type="demo1.bean.Student" alias="student"/>
- typeAliases>
- <select id="selectAll" resultType="student">
- SELECT * FROM student
- select>
- <select id="selectById" resultType="student" parameterType="int">
- SELECT * FROM student WHERE sid = #{sid}
- select>
- <insert id="insert" parameterType="student">
- INSERT INTO student VALUES (#{sid},#{name},#{age})
- insert>
- <update id="update" parameterType="student">
- UPDATE student SET name = #{name},age = #{age} WHERE sid = #{sid}
- update>
- <delete id="delete" parameterType="int">
- DELETE FROM student WHERE sid = ${sid}
- delete>