mybatis OGNL应用
来源:互联网 发布:手机淘宝链接转换pc 编辑:程序博客网 时间:2024/06/08 04:17
<if test="@Ognl@isNotEmpty(name)">AND A.NAME like '%${name}%'</if><if test="@Ognl@isNotEmpty(mobile)">AND A.MOBILE = #{mobile}</if>
public class Ognl {/** * 可以用于判断 Map,Collection,String,Array是否为空 * * @param o * @return */@SuppressWarnings("unchecked")public static boolean isEmpty(Object o) throws IllegalArgumentException {if (o == null)return true;if (o instanceof String) {return StringUtils.isEmpty((String) o);} else if (o instanceof Collection) {return CollectionUtils.isEmpty((Collection) o);} else if (o.getClass().isArray()) {return ArrayUtils.isEmpty((Object[]) o);} else if (o instanceof Map) {MapUtils.isEmpty((Map) o);} else if (o instanceof Date) {return o == null;} else if (o instanceof Number) {return o == null;} else if (o instanceof Boolean) {return o == null;} else {throw new IllegalArgumentException("Illegal argument type,must be : Map,Collection,Array,String. but was:"+ o.getClass());}return false;}/** * 可以用于判断 Map,Collection,String,Array是否不为空 * * @param c * @return */public static boolean isNotEmpty(Object o) {return !isEmpty(o);}public static boolean isNotEmpty(Object... objects) {if (objects == null)return false;for (Object obj : objects) {if (isEmpty(obj)) {return false;};}return true;}public static boolean isNotBlank(Object o) {return !isBlank(o);}public static boolean isNumber(Object o) {if (o instanceof Number) {return true;} else if (o instanceof String) {return NumberUtils.isNumber((String) o);} else {return false;}}public static boolean isBlank(Object o) {return StringUtils.isBlank((String) o);}public static boolean isBlank(String str) {return StringUtils.isBlank(str);}}
Ognl.java 必须放在class目录,也就是没有包名。
- mybatis OGNL应用扩展
- mybatis OGNL应用
- mybatis OGNL应用
- MyBatis中的OGNL教程
- myBatis中OGNL
- MyBatis中的OGNL表达式
- MyBatis中的OGNL表达式
- MyBatis中OGNL
- mybatis中的OGNL表达式
- MyBatis中的OGNL教程
- Mybatis中的OGNL使用总结
- MyBatis(三) OGNL log4j
- mybatis的ognl表达式问题
- OGNL的应用
- OGNL在struts2中的应用
- OGNL在Struts2中的应用
- struts2中OGNL的应用
- OGNL在Struts2中的应用
- 人,是人,真的是人
- Python日期操作
- SQL SERVER数据库区分大小写设置
- OpenCV二位图像的DFT
- Rman 增量备份 level 1和2的区别
- mybatis OGNL应用
- Eclipse中如何搜索整个工程
- struts2和spring3零配置整合的思考
- android中使用的尺寸单位
- 学c之gcc编译过程及其常用编译选项
- Delphi获取进程的命令行参数
- 网页中代码的顺序是不可忽略的细节
- SetRegistryKey的作用
- Vim 设置相关 快捷操作