桥后总结 二

The operator != is undefined for the argument type(s) int, null

参数类型 int null 的操作符!=未定义

数据库MySQL

select  count(*)
from tb_item
where name like '笔%'
and id =13 ;

 计数  :  count([distinct | All]   expression  | *)

table 的信息

对应的JavaWeb 的代码

   <!-- 获取符合条件的总记录数:int getTotalByQueryVO(QueryVo vo); -->
   <SELECT id="getTotalByQueryVO" parameterType="QueryVo" resultType="Integer">
      SELECT COUNT(1) FROM tb_item
      <WHERE>
           <IF test="id!=null">
             id=#{id}
         </IF>
         <IF test="name!=null">
             AND NAME  LIKE  "%"#{NAME}"%"
         </IF>
      </WHERE>
   </SELECT>
原文地址:https://www.cnblogs.com/WLCYSYS/p/12254282.html