帮我根据以下sql 生成mapper文件 CREATE TABLE "subtittle" ( "id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, "size" integer, "color_text" TEXT, "width_bk" integer, "height_bk" integer, "color_bk" TEXT, "scroll_speed" integer, "scroll_dir" integer, "posX" integer, "posY" integer, "content" TEXT );
时间: 2023-06-04 14:08:12 浏览: 140
可以使用以下的mapper文件来操作该表:
```xml
<?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.mapper.SubtittleMapper">
<resultMap id="subtittleResultMap" type="com.example.entity.Subtittle">
<id column="id" property="id" />
<result column="size" property="size" />
<result column="color_text" property="colorText" />
<result column="width_bk" property="widthBk" />
<result column="height_bk" property="heightBk" />
<result column="color_bk" property="colorBk" />
<result column="scroll_speed" property="scrollSpeed" />
<result column="scroll_dir" property="scrollDir" />
<result column="posX" property="posX" />
<result column="posY" property="posY" />
<result column="content" property="content" />
</resultMap>
<select id="selectById" resultMap="subtittleResultMap">
SELECT * FROM subtittle WHERE id = #{id}
</select>
<insert id="insert" parameterType="com.example.entity.Subtittle">
INSERT INTO subtittle(size, color_text, width_bk, height_bk, color_bk, scroll_speed, scroll_dir, posX, posY, content)
VALUES (#{size}, #{colorText}, #{widthBk}, #{heightBk}, #{colorBk}, #{scrollSpeed}, #{scrollDir}, #{posX}, #{posY}, #{content})
</insert>
<update id="update" parameterType="com.example.entity.Subtittle">
UPDATE subtittle
SET size = #{size},
color_text = #{colorText},
width_bk = #{widthBk},
height_bk = #{heightBk},
color_bk = #{colorBk},
scroll_speed = #{scrollSpeed},
scroll_dir = #{scrollDir},
posX = #{posX},
posY = #{posY},
content = #{content}
WHERE id = #{id}
</update>
<delete id="deleteById" parameterType="int">
DELETE FROM subtittle WHERE id = #{id}
</delete>
</mapper>
```
阅读全文