根据传入的参数来决定:如果用户名不为空,则对用户名进行模糊查询,如果邮箱不为空,则以邮箱为查询条件
update
找到id为xxx这条数据,逐个属性判断,如果该属性不为空,则进行更新操作
update sys_user SET user_name = #{userName}, user_password = #{userPassword}, user_email = #{userEmail}, user_info = #{userInfo}, head_img = #{headImg}, create_time =#{createTime}, id = #{id} where id = #{id}
insert
insert into sys_user( user_name, user_password, user_email, user_info, head_img, create_time ) VALUES (#{userName}, #{userPassword},user_email = #{userEmail}, #{userInfo}, #{headImg, jdbcType=BLOB}, #{createTime,jdbcType=TIMESTAMP})
关于where1=1的应用,参见我的这个博客——>一起去大厂系列】深入理解MySQL中where 1 = 1的用处



