在 .xml文件中写插入的sql语句; <insert id="addUpload" parameterType="int" keyProperty="id" keyColumn="id"> insert into 表名 ( <if test="name != null and name != '' ">name,</if> <if test="path != null and path != '' ">path,</if> &