mybatis-generator自动生成的xml文件里的每个id之间换行
具体遇到的问题
mybatis-generator自动生成的xml文件里面的每个id之间如何设置换行,自动生成时就自动换行,不然看起来就是一坨,非常难于阅读,请问这个可以设置么?
报错信息的截图
相关课程内容截图
尝试过的解决思路和结果
粘贴全部相关代码,切记添加代码注释(请勿截图)
<?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.pets.mybatis.dao.VideomanagementMapper">
<resultMap id="BaseResultMap" type="com.pets.mybatis.model.Videomanagement">
<result column="video_id" jdbcType="BIGINT" property="videoId" />
<result column="user_id" jdbcType="BIGINT" property="userId" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="relase_time" jdbcType="TIMESTAMP" property="relaseTime" />
<result column="brief_introduction" jdbcType="VARCHAR" property="briefIntroduction" />
<result column="Detaile_introduction" jdbcType="VARCHAR" property="detaileIntroduction" />
<result column="video_url" jdbcType="VARCHAR" property="videoUrl" />
<result column="del" jdbcType="INTEGER" property="del" />
<result column="status" jdbcType="INTEGER" property="status" />
<result column="refuse_description" jdbcType="VARCHAR" property="refuseDescription" />
<result column="user_release" jdbcType="INTEGER" property="userRelease" />
<result column="classification_id" jdbcType="BIGINT" property="classificationId" />
<result column="price" jdbcType="DECIMAL" property="price" />
<result column="free" jdbcType="INTEGER" property="free" />
<result column="user_read" jdbcType="INTEGER" property="userRead" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="front_cover" jdbcType="VARCHAR" property="frontCover" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.pets.mybatis.model.Videomanagement">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
video_id, user_id, title, relase_time, brief_introduction, Detaile_introduction,
video_url, del, status, refuse_description, user_release, classification_id, price,
free, user_read, create_time, sort, name, front_cover
</sql>
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.pets.mybatis.model.VideomanagementExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from videomanagement
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.pets.mybatis.model.VideomanagementExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from videomanagement
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="com.pets.mybatis.model.VideomanagementExample">
delete from videomanagement
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.pets.mybatis.model.Videomanagement">
<selectKey keyProperty="videoId" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into videomanagement (user_id, title, relase_time,
brief_introduction, Detaile_introduction,
video_url, del, status,
refuse_description, user_release, classification_id,
price, free, user_read,
create_time, sort, name,
front_cover, content)
values (#{userId,jdbcType=BIGINT}, #{title,jdbcType=VARCHAR}, #{relaseTime,jdbcType=TIMESTAMP},
#{briefIntroduction,jdbcType=VARCHAR}, #{detaileIntroduction,jdbcType=VARCHAR},
#{videoUrl,jdbcType=VARCHAR}, #{del,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
#{refuseDescription,jdbcType=VARCHAR}, #{userRelease,jdbcType=INTEGER}, #{classificationId,jdbcType=BIGINT},
#{price,jdbcType=DECIMAL}, #{free,jdbcType=INTEGER}, #{userRead,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{sort,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{frontCover,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.pets.mybatis.model.Videomanagement">
<selectKey keyProperty="videoId" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID()
</selectKey>
insert into videomanagement
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="title != null">
title,
</if>
<if test="relaseTime != null">
relase_time,
</if>
<if test="briefIntroduction != null">
brief_introduction,
</if>
<if test="detaileIntroduction != null">
Detaile_introduction,
</if>
<if test="videoUrl != null">
video_url,
</if>
<if test="del != null">
del,
</if>
<if test="status != null">
status,
</if>
<if test="refuseDescription != null">
refuse_description,
</if>
<if test="userRelease != null">
user_release,
</if>
<if test="classificationId != null">
classification_id,
</if>
<if test="price != null">
price,
</if>
<if test="free != null">
free,
</if>
<if test="userRead != null">
user_read,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="sort != null">
sort,
</if>
<if test="name != null">
name,
</if>
<if test="frontCover != null">
front_cover,
</if>
<if test="content != null">
content,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="relaseTime != null">
#{relaseTime,jdbcType=TIMESTAMP},
</if>
<if test="briefIntroduction != null">
#{briefIntroduction,jdbcType=VARCHAR},
</if>
<if test="detaileIntroduction != null">
#{detaileIntroduction,jdbcType=VARCHAR},
</if>
<if test="videoUrl != null">
#{videoUrl,jdbcType=VARCHAR},
</if>
<if test="del != null">
#{del,jdbcType=INTEGER},
</if>
<if test="status != null">
#{status,jdbcType=INTEGER},
</if>
<if test="refuseDescription != null">
#{refuseDescription,jdbcType=VARCHAR},
</if>
<if test="userRelease != null">
#{userRelease,jdbcType=INTEGER},
</if>
<if test="classificationId != null">
#{classificationId,jdbcType=BIGINT},
</if>
<if test="price != null">
#{price,jdbcType=DECIMAL},
</if>
<if test="free != null">
#{free,jdbcType=INTEGER},
</if>
<if test="userRead != null">
#{userRead,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="frontCover != null">
#{frontCover,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.pets.mybatis.model.VideomanagementExample" resultType="java.lang.Long">
select count(*) from videomanagement
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update videomanagement
<set>
<if test="record.videoId != null">
video_id = #{record.videoId,jdbcType=BIGINT},
</if>
<if test="record.userId != null">
user_id = #{record.userId,jdbcType=BIGINT},
</if>
<if test="record.title != null">
title = #{record.title,jdbcType=VARCHAR},
</if>
<if test="record.relaseTime != null">
relase_time = #{record.relaseTime,jdbcType=TIMESTAMP},
</if>
<if test="record.briefIntroduction != null">
brief_introduction = #{record.briefIntroduction,jdbcType=VARCHAR},
</if>
<if test="record.detaileIntroduction != null">
Detaile_introduction = #{record.detaileIntroduction,jdbcType=VARCHAR},
</if>
<if test="record.videoUrl != null">
video_url = #{record.videoUrl,jdbcType=VARCHAR},
</if>
<if test="record.del != null">
del = #{record.del,jdbcType=INTEGER},
</if>
<if test="record.status != null">
status = #{record.status,jdbcType=INTEGER},
</if>
<if test="record.refuseDescription != null">
refuse_description = #{record.refuseDescription,jdbcType=VARCHAR},
</if>
<if test="record.userRelease != null">
user_release = #{record.userRelease,jdbcType=INTEGER},
</if>
<if test="record.classificationId != null">
classification_id = #{record.classificationId,jdbcType=BIGINT},
</if>
<if test="record.price != null">
price = #{record.price,jdbcType=DECIMAL},
</if>
<if test="record.free != null">
free = #{record.free,jdbcType=INTEGER},
</if>
<if test="record.userRead != null">
user_read = #{record.userRead,jdbcType=INTEGER},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=TIMESTAMP},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.frontCover != null">
front_cover = #{record.frontCover,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update videomanagement
set video_id = #{record.videoId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
relase_time = #{record.relaseTime,jdbcType=TIMESTAMP},
brief_introduction = #{record.briefIntroduction,jdbcType=VARCHAR},
Detaile_introduction = #{record.detaileIntroduction,jdbcType=VARCHAR},
video_url = #{record.videoUrl,jdbcType=VARCHAR},
del = #{record.del,jdbcType=INTEGER},
status = #{record.status,jdbcType=INTEGER},
refuse_description = #{record.refuseDescription,jdbcType=VARCHAR},
user_release = #{record.userRelease,jdbcType=INTEGER},
classification_id = #{record.classificationId,jdbcType=BIGINT},
price = #{record.price,jdbcType=DECIMAL},
free = #{record.free,jdbcType=INTEGER},
user_read = #{record.userRead,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
sort = #{record.sort,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
front_cover = #{record.frontCover,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update videomanagement
set video_id = #{record.videoId,jdbcType=BIGINT},
user_id = #{record.userId,jdbcType=BIGINT},
title = #{record.title,jdbcType=VARCHAR},
relase_time = #{record.relaseTime,jdbcType=TIMESTAMP},
brief_introduction = #{record.briefIntroduction,jdbcType=VARCHAR},
Detaile_introduction = #{record.detaileIntroduction,jdbcType=VARCHAR},
video_url = #{record.videoUrl,jdbcType=VARCHAR},
del = #{record.del,jdbcType=INTEGER},
status = #{record.status,jdbcType=INTEGER},
refuse_description = #{record.refuseDescription,jdbcType=VARCHAR},
user_release = #{record.userRelease,jdbcType=INTEGER},
classification_id = #{record.classificationId,jdbcType=BIGINT},
price = #{record.price,jdbcType=DECIMAL},
free = #{record.free,jdbcType=INTEGER},
user_read = #{record.userRead,jdbcType=INTEGER},
create_time = #{record.createTime,jdbcType=TIMESTAMP},
sort = #{record.sort,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR},
front_cover = #{record.frontCover,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
</mapper>
8
收起
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星