Look at this SQL, what's the problem?
<UpdateId="Update"ParameterType="Creativegroupdo"> UpdateDsp_creative_groupSetGmt_modified=Now ()<ifTest=The title!= NULL">, title=#{title,jdbctype=VARCHAR} </if> <ifTest="Clickurl!= NULL">, Click_url=#{clickurl,jdbctype=VARCHAR} </if> <where> <ifTest="Creativegroupid!= NULL"> andcreative_group_id=#{creativegroupid,jdbctype=BIGINT} </if> </where> </Update>
The answer is already hidden in the gray-white font below. Please use your mouse to slide over the view.
I don't seem to have a problem, but what if creativegroupid = null? All Dsp_creative_group records will be updated with the title, Clickurl to the same value, resulting in data loss. You never know when the application will set the creative_group_id to NULL, which is almost uncontrollable. For online systems, once such a thing happens, it is definitely a disaster-level failure. The lesson is: Always, never add an if condition in the WHERE clause of the update!
A Dangerous SQL