日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

搭建基础架构-QueryRule

發布時間:2024/4/13 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 搭建基础架构-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的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。