MyBatis配置返回boolean类型值
Mapper方法
boolean existsOrder(@Param("orderNumber") String orderNumber);
xml代码
<select id="existsOrder" parameterType="String" resultType="_boolean">
<![CDATA[
select count(`id`)
from `order`
where `order_number` = #{orderNumber}
]]>
</select>
当SQL执行的结果是0,那么返回false
;如果结果是非0,无论是正数还是负数(当然上述例子不会产生负数)都为true