mybatis parametertype map里面可不可以是个J**aBean?

时间:2014.10.28 发布人:linda_peng

mybatis parametertype map里面可不可以是个J**aBean?

已解决问题

谷歌linda_peng用户在2014.10.28提交了关于“朱丹mybatis parametertype map里面可不可以是个J**aBean?”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-10-30T13:13:56。j**a代码
publicintupdateData(DemoVodemo)throwsException{
//TODOAuto-generatedmethodstub
Map<String,Object>map=newh**ashMap<String,Object>();
map.put("demo",demo);
map.put("Sql_temp","");
returndemoDao.update(map);
}
---------------------------
mapper.xml
<updateid="update"parameterType="Map"flushCache="true">
updatedemo_user
<set>
<iftest="name!=**llandname!=''">
name=#{***.name},
</if>
<iftest="pwd!=**llandpwd!=''">
pwd=#{demo.pwd},
</if>
</set>

<where>
<iftest="id!=**llandid!=''">
id=#{***.id}
</where>
<iftest="Sql_temp!=**llandSql_temp!=''">
and${Sql_temp}
</if>

</update>
请问xml里面,我这样写对不对。希望大家能够帮助她。

详细问题描述及疑问:j**a代码
publicintupdateData(DemoVodemo)throwsException{
//TODOAuto-generatedmethodstub
Map<String,Object>map=newh**ashMap<String,Object>();
map.put("demo",demo);
map.put("Sql_temp","");
returndemoDao.update(map);
}
---------------------------
mapper.xml
<updateid="update"parameterType="Map"flushCache="true">
updatedemo_user
<set>
<iftest="name!=**llandname!=''">
name=#{***.name},
</if>
<iftest="pwd!=**llandpwd!=''">
pwd=#{demo.pwd},
</if>
</set>

<where>
<iftest="id!=**llandid!=''">
id=#{***.id}
</where>
<iftest="Sql_temp!=**llandSql_temp!=''">
and${Sql_temp}
</if>

</update>
请问xml里面,我这样写对不对。期待您的答案,滴水之恩,来日我当涌泉相报 !

希望以下的回答,能够帮助你。

第1个回答

用户名:j40265219  

当然是可以的,没问题