今天在MyBatis中看到了这样的代码
<insert id="insertTbbaseItemMaterial" parameterType="TbbaseItemMaterial" useGeneratedKeys="true" keyProperty="id">
insert into tbbase_item_material
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null and materialName != ''">material_name,</if>
<if test="materialType != null and materialType != ''"