<update id="updateEntity" parameterType="RyTangdian">
update ry_tangdian
<set>
<if test="tdName != null and tdName != ''">tdName = #{tdName},</if>
<if test="tel != null and tel != ''">tel = #{tel},</if>
<if test="principal != null and principal != ''">principal = #{principal},</if>
<if test="principalphone != null and principalphone != ''">principalphone = #{principalphone},</if>
<if test="address != null and address != ''">address = #{address},</if>
<if test="galleryful != null">galleryful = #{galleryful},</if>
<if test="classify != null and classify != ''">classify = #{classify},</if>
<if test="tdName == null or tdName == ''">tdName = null,</if>
<if test="tel == null or tel == ''">tel = null,</if>
<if test="principal == null or principal == ''">principal = null,</if>
<if test="principalphone == null or principalphone == ''">principalphone = null,</if>
<if test="address == null or address == ''">address = null,</if>
<if test="galleryful == null">galleryful = null,</if>
<if test="classify == null or classify == ''">classify = null,</if>
</set>
where tangdian_Id = #{tangdianID}
</update>
<insert id="insertEntity" parameterType="RyTangdian" useGeneratedKeys="true" keyProperty="tangdianID">
insert into ry_tangdian
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="tangdianID != null and tangdianID != 0">tangdian_Id,</if>
<if test="tdName != null and tdName != ''">tdName,</if>
<if test="tel != null and tel != ''">tel,</if>
<if test="principal != null and principal != ''">principal,</if>
<if test="principalphone != null and principalphone != ''">principalphone,</if>
<if test="address != null and address != ''">address,</if>
<if test="galleryful != null">galleryful,</if>
<if test="classify != null and classify != ''">classify,</if>
</trim>
<trim prefix="values(" suffix=")" suffixOverrides="," >
<if test="tangdianID != null and postId != 0">#{tangdianID},</if>
<if test="tdName != null and tdName != ''">#{tdName},</if>
<if test="tel != null and tel != ''">#{tel},</if>
<if test="principal != null and principal != ''">#{principal},</if>
<if test="principalphone != null and principalphone != ''">#{principalphone},</if>
<if test="address != null and address != ''">#{address},</if>
<if test="galleryful != null">#{galleryful},</if>
<if test="classify != null and classify != ''">#{classify},</if>
</trim>
</insert>
MyBatis增加和修改.XML示例
最新推荐文章于 2024-08-08 10:02:44 发布