MyBatis Insert Empty property with trim suffix= "suffixoverrides=", "Go redundant".
<sql id= "Userareacolume" > <trim suffix= "suffixoverrides=", ">
<if test= "id!= null" >
Id
</if>
<if test= "name!= null" >
NAME,
</if>
<if test= "type!= null" >
Area_type,
</if>
<if test= "routepoint!= null" >
Route_point,
</if>
<if test= "Routestart!= null" >
Route_start,
</if>
<if test= "routeend!= null" >
Route_end,
</if>
<if test= "HeightMax!= null" >
Height_max,
</if>
<if test= "heightmin!= null" >
Height_min,
</if>
<if test= "desc!= null" >
DESCRIPTION,
</if>
</trim>
</sql>
<sql id= "Userareavalue" >
<trim suffix= "" suffixoverrides= "," >
<if test= "id!= null" >
#{id},
</if>
<if test= "name!= null" >
#{name},
</if>
<if test= "type!= null" >
#{type},
</if>
<if test= "routepoint!= null" >
#{routepoint},
</if>
<if test= "Routestart!= null" >
#{routestart},
</if>
<if test= "routeend!= null" >
#{routeend},
</if>
<if test= "HeightMax!= null" >
#{heightmax},
</if>
<if test= "heightmin!= null" >
#{heightmin},
</if>
<if test= "desc!= null" >
#{desc},
</if>
</trim>
</sql>
<insert id= "Saveuserarea" parametertype= "Userarea" >
<selectkey keyproperty= "id" resulttype= "int" order= "before" >
Select S_user_area_id_seq.nextval as value from dual
</selectKey>
INSERT INTO S_user_area (
<include refid= "Userareacolume"/>
) VALUES (
<include refid= "Userareavalue"/>
)
</insert>
Ext: http://blog.csdn.net/grhlove123/article/details/6436539/