This commit is contained in:
2025-08-18 13:08:02 +08:00
commit b382150514
18 changed files with 1207 additions and 0 deletions

View File

@ -0,0 +1,32 @@
<?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="com.example.practice.mapper.UserMapper">
<select id="selectList" resultType="com.example.practice.entity.User">
select * from user
</select>
<select id="selectOne" resultType="com.example.practice.entity.User">
select * from user where id = #{id}
</select>
<insert id="insert">
insert into user values (#{id}, #{nickName}, #{phoneNumber}, #{userAccount}, #{userPassword}, #{userRole}, #{money})
</insert>
<delete id="delete">
delete from user where id = #{id}
</delete>
<update id="update">
update user set nickName = #{nickName}, phoneNumber = #{phoneNumber}, userAccount = #{userAccount}, userPassword = #{userPassword}, userRole = #{userRole}, money = #{money} where id = #{id}
</update>
</mapper>
<!--SQL映射文件-->

View File

@ -0,0 +1,23 @@
<?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>
<environments default="dev">
<environment id="dev">
<transactionManager type="JDBC"/>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.cj.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/practice"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="mapper/UserMapper.xml"/>
</mappers>
</configuration>
<!--Mybatis核心配置文件-->