<insert id="insertServiceEquip" parameterType="Map">
<selectKey resultType="int" keyProperty="seq" order="BEFORE">
《获取新增id》
select
SEQ_EQUIPSERVICE.NEXTVAL as seq from dual
</selectKey>
INSERT INTO EQUIP_SERVICE
<trim prefix="(" suffix=")" suffixOverrides=",">
《这个choose下的when,otherwise就是if,else了》
<choose>
<when test="serviceAreaId !=null">
<if test="serviceAreaId != null">SEQ,</if>
</when>
<otherwise>
<if test="seq != null">SEQ, </if>
</otherwise>
</choose>
<if test="equipId != null">EQUIP_ID,</if>
<if test="buildId != null">BUILD_ID,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<choose>
<when test="serviceAreaId !=null">
<if test="serviceAreaId != null">#{serviceAreaId},</if>
</when>
<otherwise>
<if test="seq != null">#{seq}, </if>
</otherwise>
</choose>
<if test="equipId != null"> #{equipId}, </if>
<if test="buildId != null"> #{buildId}, </if>
</trim>
</insert>