1.传入参数和传出参数的区别
ibatis传入参数用的是parameterClass 传出参数用的是resultClass
iBatis:<select id="serchDemo" parameterClass="Map" resultClass="BaseResultMap"> </select>
mybatis传入参数用的是parameterType 传出参数用的是resultType
MyBatis:<select id="serchDemo" parameterType="Map" resultMap="BaseResultMap"> </select>
2.接收参数的区别
ibatis用的是# # 和 $ $
UPDATE STUDENT set age= #age# where id = #id#
mybatis用的是#{} 和 ${}
update STUDENT set age= #{age} where id = #{id}
(因为$有SQL注入的问题所以很少用)
3.条件的区别
UPDATE STUDENT <dynamic prepend="set"> <isNotNull property="age " prepend=","> age = #age# </isNotNull> </dynamic> <dynamic prepend="WHERE"> <isNotEmpty property="ID" prepend="and"> ID = #ID# </isNotEmpty> </dynamic>
select age from DIGGING_PLAN_PROCESS <where> <if test="id != null and id != ''"> and id= #{id} </if> </where>
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/231740.html原文链接:https://javaforall.net
