Mybatis 引用静态常量或静态方法


优点:
  1、美化代码
  2、灵活性
  3、鲁棒性

 

一、

变更前

<if test =' name != null and name != \"\"'>
    AND name =#{name}
</if>

变更后

<if test =' @cn.hutool.core.util@isNotBlank(name)'>
    AND name =#{name}
</if>

 

二、

变更前

    AND status IN (0,1)

变更后

    AND status IN (${@com.X.X.X.XEnum@getNormalStatus()})

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM