语句基础语法
INSERT INTO table_name (column1,column2,column3,...) VALUES (value1,value2,value3,...);
使用动态标签:
<insert id="insertTable" parameterType = "tableDao"> INSERT INTO tableDaoa <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id!=null"> id, </if> <if test="time!=null"> time, </if> </trim> VALUES <trim prefix="(" suffix=")" suffixOverrides=","> <if test="id!=null"> #{id}, </if> <if test="time!=null"> #{time}, </if> </trim> </insert>