<select id="checkEmailByUserId" resultType="int" parameterMap="map">
select count(1) from user
where email=#{email} and id !=
#{userId}
</select>
修改后的方法
<select id="checkEmailByUserId" resultType="int" parameterType="map">
select count(1) from user
where email=#{email} and id !=
#{userId}
</select>
如果有多个参数,参数类型一定要是 parameterType="map"
奇怪的mybatis
这里用resultType="cn.li.pojo.User" 可以运行
<select id="login" parameterType="cn.li.pojo.User" resultType="cn.li.pojo.User" >
select * from t_user where loginname=#{loginName} and loginpass=#{loginPass}
</select>
这里用parameterType="cn.li.pojo.Order"不可以运行
<insert id="creatOrder" parameterType="cn.li.pojo.Order">
insert into t_order (oid,ordertime,total ,status,address,uid)
values(#{oid},#{ordertime},#{total},#{status},#{address},#{uid})
</insert>
必须改为<insert id="creatOrder" parameterType="map">map代表可以传多个参数
下面的这个却又不报错
<insert id="creatOrderitem" parameterType="cn.li.pojo.OrderItem">
insert into t_orderitem (orderItemId,quantity,subTotal,bid,bname ,currPrice,image_b,oid)
values(#{orderItemId},#{quantity},#{subTotal},#{bid},#{bname},#{currPrice},#{image_B},#{oid})
</insert>
搞得我脑壳疼