搭建基础架构-QueryRule
/*** 查询规则构造器,实现多条件复杂查询的条件拼接* Role 角色,Rule 尺子,规则*/
public final class QueryRule implements Serializable {private static final long serialVersionUID = 1L;public static final int ASC_ORDER = 101;public static final int DESC_ORDER = 102;public static final int LIKE = 1;public static final int IN = 2;public static final int NOTIN = 3;public static final int BETWEEN = 4;public static final int EQ = 5;public static final int NOTEQ = 6;public static final int GT = 7;public static final int GE = 8;public static final int LT = 9;public static final int LE = 10;public static final int ISNULL = 11;public static final int ISNOTNULL = 12;public static final int ISEMPTY = 13;public static final int ISNOTEMPTY = 14;public static final int AND = 201;public static final int OR = 202;private List<Rule> ruleList = new ArrayList<Rule>();private List<QueryRule> queryRuleList = new ArrayList<QueryRule>();private String propertyName;private QueryRule() {}private QueryRule(String propertyName) {this.propertyName = propertyName;}public static QueryRule getInstance() {return new QueryRule();}/*** 添加升序规则* @param propertyName* @return*/public QueryRule addAscOrder(String propertyName) {this.ruleList.add(new Rule(ASC_ORDER, propertyName));return this;}/*** 添加降序规则* @param propertyName* @return*/public QueryRule addDescOrder(String propertyName) {this.ruleList.add(new Rule(DESC_ORDER, propertyName));return this;}public QueryRule andIsNull(String propertyName) {this.ruleList.add(new Rule(ISNULL, propertyName).setAndOr(AND));return this;}public QueryRule andIsNotNull(String propertyName) {this.ruleList.add(new Rule(ISNOTNULL, propertyName).setAndOr(AND));return this;}public QueryRule andIsEmpty(String propertyName) {this.ruleList.add(new Rule(ISEMPTY, propertyName).setAndOr(AND));return this;}public QueryRule andIsNotEmpty(String propertyName) {this.ruleList.add(new Rule(ISNOTEMPTY, propertyName).setAndOr(AND));return this;}public QueryRule andLike(String propertyName, Object value) {this.ruleList.add(new Rule(LIKE, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule andEqual(String propertyName, Object value) {this.ruleList.add(new Rule(EQ, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule andBetween(String propertyName, Object... values) {this.ruleList.add(new Rule(BETWEEN, propertyName, values).setAndOr(AND));return this;}public QueryRule andIn(String propertyName, List<Object> values) {this.ruleList.add(new Rule(IN, propertyName, new Object[] { values }).setAndOr(AND));return this;}public QueryRule andIn(String propertyName, Object... values) {this.ruleList.add(new Rule(IN, propertyName, values).setAndOr(AND));return this;}public QueryRule andNotIn(String propertyName, List<Object> values) {this.ruleList.add(new Rule(NOTIN, propertyName, new Object[] { values }).setAndOr(AND));return this;}public QueryRule orNotIn(String propertyName, Object... values) {this.ruleList.add(new Rule(NOTIN, propertyName, values).setAndOr(OR));return this;}public QueryRule andNotEqual(String propertyName, Object value) {this.ruleList.add(new Rule(NOTEQ, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule andGreaterThan(String propertyName, Object value) {this.ruleList.add(new Rule(GT, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule andGreaterEqual(String propertyName, Object value) {this.ruleList.add(new Rule(GE, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule andLessThan(String propertyName, Object value) {this.ruleList.add(new Rule(LT, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule andLessEqual(String propertyName, Object value) {this.ruleList.add(new Rule(LE, propertyName, new Object[] { value }).setAndOr(AND));return this;}public QueryRule orIsNull(String propertyName) {this.ruleList.add(new Rule(ISNULL, propertyName).setAndOr(OR));return this;}public QueryRule orIsNotNull(String propertyName) {this.ruleList.add(new Rule(ISNOTNULL, propertyName).setAndOr(OR));return this;}public QueryRule orIsEmpty(String propertyName) {this.ruleList.add(new Rule(ISEMPTY, propertyName).setAndOr(OR));return this;}public QueryRule orIsNotEmpty(String propertyName) {this.ruleList.add(new Rule(ISNOTEMPTY, propertyName).setAndOr(OR));return this;}public QueryRule orLike(String propertyName, Object value) {this.ruleList.add(new Rule(LIKE, propertyName, new Object[] { value }).setAndOr(OR));return this;}public QueryRule orEqual(String propertyName, Object value) {this.ruleList.add(new Rule(EQ, propertyName, new Object[] { value }).setAndOr(OR));return this;}public QueryRule orBetween(String propertyName, Object... values) {this.ruleList.add(new Rule(BETWEEN, propertyName, values).setAndOr(OR));return this;}public QueryRule orIn(String propertyName, List<Object> values) {this.ruleList.add(new Rule(IN, propertyName, new Object[] { values }).setAndOr(OR));return this;}public QueryRule orIn(String propertyName, Object... values) {this.ruleList.add(new Rule(IN, propertyName, values).setAndOr(OR));return this;}public QueryRule orNotEqual(String propertyName, Object value) {this.ruleList.add(new Rule(NOTEQ, propertyName, new Object[] { value }).setAndOr(OR));return this;}public QueryRule orGreaterThan(String propertyName, Object value) {this.ruleList.add(new Rule(GT, propertyName, new Object[] { value }).setAndOr(OR));return this;}public QueryRule orGreaterEqual(String propertyName, Object value) {this.ruleList.add(new Rule(GE, propertyName, new Object[] { value }).setAndOr(OR));return this;}public QueryRule orLessThan(String propertyName, Object value) {this.ruleList.add(new Rule(LT, propertyName, new Object[] { value }).setAndOr(OR));return this;}public QueryRule orLessEqual(String propertyName, Object value) {this.ruleList.add(new Rule(LE, propertyName, new Object[] { value }).setAndOr(OR));return this;}public List<Rule> getRuleList() {return this.ruleList;}public List<QueryRule> getQueryRuleList() {return this.queryRuleList;}public String getPropertyName() {return this.propertyName;}protected class Rule implements Serializable {private static final long serialVersionUID = 1L;private int type; //规则的类型private String property_name;private Object[] values;private int andOr = AND;public Rule(int paramInt, String paramString) {this.property_name = paramString;this.type = paramInt;}public Rule(int paramInt, String paramString,Object[] paramArrayOfObject) {this.property_name = paramString;this.values = paramArrayOfObject;this.type = paramInt;}public Rule setAndOr(int andOr){this.andOr = andOr;return this;}public int getAndOr(){return this.andOr;}public Object[] getValues() {return this.values;}public int getType() {return this.type;}public String getPropertyName() {return this.property_name;}}
}
搭建基础架构-QueryRule相关推荐
- 从零到一搭建基础架构(2)-如何构建基础架构模块划分
Hello,这里是爱 Coding,爱 Hiphop,爱喝点小酒的 AKA 柏炎. 本篇是手把手搭建基础架构专栏的第二篇. 在第一篇<从零到一搭建基础架构(1)-玩转maven依赖版本管理> ...
- 搭建基础架构-Order
/*** sql排序组件*/ public class Order {private boolean ascending; //升序还是降序private String propertyName; / ...
- 搭建基础架构-ResultMsg
//最底层设计 public class ResultMsg<T> implements Serializable {private static final long serialVer ...
- 搭建基础架构-Page
/*** 分页对象. 包含当前页数据及分页信息如总记录数.* 能够支持JQuery EasyUI直接对接,能够支持和BootStrap Table直接对接*/ public class Page< ...
- SpringCloud系列二:Restful 基础架构(搭建项目环境、创建 Dept 微服务、客户端调用微服务)...
声明:本文来源于MLDN培训视频的课堂笔记,写在这里只是为了方便查阅. 1.概念:Restful 基础架构 2.具体内容 对于 Rest 基础架构实现处理是 SpringCloud 核心所在,其基本操 ...
- [翻译]用 Puppet 搭建易管理的服务器基础架构(3)
我通过伯乐在线翻译了一个Puppet简明教程,一共分为四部分,这是第三部分. 本文由 伯乐在线 - Wing 翻译,黄利民 校稿.未经许可,禁止转载! 英文出处:Manuel Kiessling.欢迎 ...
- SpringCloud 基础架构搭建
SpringCloud 基础架构搭建 一.基础环境 (一)安装Redis (二)安装Nacos 访问地址:http://localhost:8848/nacos/#/login 出现以下界面,则安装成 ...
- vue.js项目实战运用篇之抖音视频APP-第二节:项目基础架构搭建
[温馨提示]:若想了解更多关于本次项目实战内容,可转至vue.js项目实战运用篇之抖音视频APP-项目规划中进一步了解项目规划. [项目地址] 项目采用Git进行管理,最终项目将会发布到GitHub中 ...
- 背后的力量 | 搭建新型IT基础架构 华云数据助力妇幼保健院提升数字化医院建设水平
某市妇幼保健院创建于1953 年,是黔北地区唯一一所集临床医疗.科研 教学.预防保健.康复.基层卫生指导等功能为一体的三级妇幼保健院. 华云数据(微信号:chinac_com)是中国领先的综合云计算服 ...
最新文章
- python正方形螺旋绘制_利用Python绘制一个正方形螺旋线
- 遍历列表python_python列表的遍历与循环
- Java中程序初始化的顺序
- 在Windows平台架设DNS服务器
- Java中的ThreadLocal详解
- 利用Comet4J 及时推送消息
- 按需路由选择(ODR)原理及实验
- 超全!Python获取某一日期是“星期几”的6种方法!
- 2016年10月计算机网络技术,2016年10月自考《计算机网络技术》练习题及答案1
- 人工智障学习笔记——强化学习(3)蒙特卡洛方法
- 突然不能访问服务器未响应,windows 访问不服务器未响应
- Atitit 提升开发效率的方法 提升语言级别 目录 1. 提升语言级别到4gl	1 1.1. 语言的代际关系 sql 》script 》java	1 1.2. 使用4gl dsl语言与api	1
- win10远程桌面Android软件,Android端Win10远程桌面更新:支持Windows虚拟桌面
- 数据可视化平台-智慧安防可视化管理系统-解决楼宇监控管理难题
- 微软浏览器edge对日期Date对象format(yyyy-mm-dd)/getDiff()方法不识别
- 拒绝低销量:2022最新YouTube引流亚马逊方法
- 蓝桥杯比赛准备总结(大学编程学习历程)
- 时序图神经网络总结(1)
- 迪杰斯特拉(Dijkstra)算法之两点之间的最短距离问题
- GeoTool常见问题