mybatis like ‘%%’问题

  • Post author:
  • Post category:其他


<select id="getMaxNotOnlineInfoByConditon" resultType="com.shishike.susie.entity.CustomConfirmInfo">

SELECT *
FROM t_customconfirminfo
WHERE (if(#{pduName,jdbcType=VARCHAR} IS NULL, 0 = 0, pduname = #{pduName,jdbcType=VARCHAR})
   AND if(#{moduleName,jdbcType=VARCHAR} IS NULL, 0 = 0, modulename = #{moduleName,jdbcType=VARCHAR})
   AND if(#{env,jdbcType=VARCHAR} IS NULL, 0 = 0, confirminfo = #{env,jdbcType=VARCHAR})
   AND if(#{ossAddress,jdbcType=VARCHAR} IS NULL, 0 = 0, ossaddress = #{ossAddress,jdbcType=VARCHAR})
   AND if(#{branch,jdbcType=VARCHAR} IS NULL, 0 = 0,  branch like concat(concat('%',#{branch,jdbcType=VARCHAR}),'%'))
   AND if(#{confirmId,jdbcType=BIGINT} IS NULL, 0 = 0, id > #{confirmId,jdbcType=BIGINT})
   AND onlineinfo is null)
ORDER BY CREATED DESC
LIMIT 1
</select>



版权声明:本文为intelrain原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。