ibatis+mysql Map类型参数
发布网友
发布时间:2022-04-07 17:48
我来回答
共1个回答
热心网友
时间:2022-04-07 19:17
<select id="checksame" resultClass="java.lang.Integer" parameterClass="java.util.Map" >
select count(schoolid)
from school
<dynamic prepend="WHERE">
<isNotEmpty prepend="AND" property="other1">
(other1 = #other1#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="schoolcode">
(schoolcode = #schoolcode#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="isuse">
(isuse = #isuse#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="schooladdress">
(schooladdress = #schooladdress#)
</isNotEmpty>
<isNotEmpty prepend="AND" property="schoolid">
(schoolid <![CDATA[ <> ]]> #schoolid#)
</isNotEmpty>
</dynamic>
</select>
大概是这样的结构,
不用dynamic也行,
直接把返回的集合改下,
要先在sqlmap-config中定义
然后where中大概这样:
where user like #user
and #bigage
and...#smallage