package com.vci.ubcs.starter.web.wrapper;
|
|
//
|
// Source code recreated from a .class file by IntelliJ IDEA
|
// (powered by FernFlower decompiler)
|
//
|
|
//package com.vci.starter.web.wrapper;
|
|
import java.lang.reflect.Field;
|
import java.util.ArrayList;
|
import java.util.Collection;
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.HashSet;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Locale;
|
import java.util.Map;
|
import java.util.Set;
|
import java.util.Map.Entry;
|
import java.util.stream.Collectors;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
import com.vci.ubcs.starter.exception.VciBaseException;
|
import com.vci.ubcs.starter.revision.model.TreeQueryObject;
|
import com.vci.ubcs.starter.web.annotation.VciFieldType;
|
import com.vci.ubcs.starter.web.annotation.VciUseEnum;
|
import com.vci.ubcs.starter.web.enumpck.VciFieldTypeEnum;
|
import com.vci.ubcs.starter.web.pagemodel.PageHelper;
|
import com.vci.ubcs.starter.web.service.VciSecretServiceI;
|
import com.vci.ubcs.starter.web.util.VciBaseUtil;
|
import org.springframework.util.CollectionUtils;
|
|
import javax.xml.bind.annotation.XmlType;
|
|
public class VciQueryWrapperForDO implements VciSecretServiceI {
|
public static boolean USER_TABLE_COMPATIBILITY = false;
|
public static String DATABASE_PLATFORM;
|
public static Map<String, String> USER_TABLE_COMPATIBILITY_BTM_MAP;
|
public static Map<String, String> USER_TABLE_COMPATIBILITY_FIELD_MAP;
|
public static final String USER_TABLE_COMPATIBILITY_FIELD_SEP = "${vcicomplibitysep}";
|
private Map<String, String> conditionMap;
|
private Map<String, String> customerSqlMap;
|
private String oidFieldName;
|
private static final String SPACE = " ";
|
public static final String QUERY_FIELD_SECRET = "${vciQuerySecret}";
|
public static final String QUERY_FIELD_DATARIGHT = "${vciQueryDataRight}";
|
private Class<?> doClass;
|
private PageHelper pageHelper;
|
private Map<String, String> allFieldNameMap;
|
private List<String> xmlTypeFieldList;
|
private boolean distinct;
|
public static final String OID_FIELD = "oid";
|
public static final String ID_FIELD = "id";
|
public static final String LC_STATUS_FIELD = "lcstatus";
|
public static final String LC_STATUS_FIELD_TEXT = "lcStatus_text";
|
private Map<String, VciFieldTypeEnum> allFieldTypeMap;
|
private Map<String, String> useReferMap;
|
private Map<String, String> enumFieldMap;
|
private String linkTableSql;
|
private String selectFieldSql;
|
private String selectPrefixForPage;
|
private String whereSql;
|
private String orderSql;
|
private String whereSubfixForPage;
|
private Map<String, String> valuesMap;
|
private String tableNick;
|
private Map<String, String> extendFieldMap;
|
private static final String DATETIME_FORMAT = "yyyy-mm-dd hh24:mi:ss";
|
private static final String DATE_FORMAT = "yyyy-mm-dd";
|
|
public void clearPage() {
|
this.pageHelper = null;
|
this.selectPrefixForPage = "";
|
this.whereSubfixForPage = "";
|
}
|
|
public VciQueryWrapperForDO in(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, "\\IN");
|
return this;
|
}
|
|
public VciQueryWrapperForDO notIn(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, "\\NOTIN");
|
return this;
|
}
|
|
public VciQueryWrapperForDO eq(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value);
|
return this;
|
}
|
|
public VciQueryWrapperForDO neq(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, "!=");
|
return this;
|
}
|
|
public VciQueryWrapperForDO less(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, "<");
|
return this;
|
}
|
|
public VciQueryWrapperForDO lessThan(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, "<=");
|
return this;
|
}
|
|
public VciQueryWrapperForDO more(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, ">");
|
return this;
|
}
|
|
public VciQueryWrapperForDO moreThan(String key, String value) throws VciBaseException {
|
this.addQueryMap(key, value, ">=");
|
return this;
|
}
|
|
public VciQueryWrapperForDO isNull(String key) throws VciBaseException {
|
this.addQueryMap(key, "_n", "=null");
|
return this;
|
}
|
|
public VciQueryWrapperForDO isNotNull(String key) throws VciBaseException {
|
this.addQueryMap(key, "_n", "!=null");
|
return this;
|
}
|
|
public VciQueryWrapperForDO secret() throws VciBaseException {
|
String secretSql = this.getLessThanUserSecretSql();
|
this.addQueryMap("secretGrade", secretSql, "<=");
|
return this;
|
}
|
|
public void addQueryMap(String key, String value) {
|
this.addQueryMap(key, value, (String)null);
|
}
|
|
public void addQueryMap(String key, String value, String operation) {
|
VciBaseUtil.alertNotNull(new Object[]{key, "查询条件的名称"});
|
if (StringUtils.isNotBlank(value)) {
|
if (this.conditionMap == null) {
|
this.conditionMap = new HashMap();
|
}
|
|
if (operation == null) {
|
operation = "";
|
}
|
|
this.conditionMap.put(key, operation + value);
|
}
|
|
}
|
|
public void addCustomSql(String key, String sql) {
|
VciBaseUtil.alertNotNull(new Object[]{key, "自定义SQL的KEY", sql, "自定义的SQL语句"});
|
if (StringUtils.isNotBlank(sql)) {
|
if (this.customerSqlMap == null) {
|
this.customerSqlMap = new HashMap();
|
}
|
|
this.customerSqlMap.put(key, sql);
|
}
|
|
}
|
|
public void addExtendField(String fieldName) {
|
this.addExtendField(fieldName, fieldName);
|
}
|
|
public void addExtendField(String fieldName, String nickName) {
|
this.extendFieldMap.put(fieldName, nickName);
|
}
|
|
public Map<String, String> getConditionMap() {
|
return this.conditionMap;
|
}
|
|
public void setConditionMap(Map<String, String> conditionMap) {
|
this.conditionMap = conditionMap;
|
}
|
|
public Map<String, String> switchConditionMap() {
|
Map<String, String> queryMap = new HashMap();
|
if (!CollectionUtils.isEmpty(this.conditionMap)) {
|
this.conditionMap.forEach((key, value) -> {
|
queryMap.put(key, value);
|
});
|
this.allFieldNameMap.forEach((dbField, field) -> {
|
if (this.conditionMap.containsKey(field)) {
|
queryMap.put(dbField, this.conditionMap.get(field));
|
}
|
|
});
|
}
|
|
return queryMap;
|
}
|
|
public String getLinkTableSql() {
|
return this.linkTableSql;
|
}
|
|
public void setLinkTableSql(String linkTableSql) {
|
this.linkTableSql = linkTableSql;
|
}
|
|
public void addLinkTableSql(String linkTableSql) {
|
this.linkTableSql = this.linkTableSql + " " + linkTableSql + " ";
|
}
|
|
public void setSelectFieldSql(String selectFieldSql) {
|
this.selectFieldSql = selectFieldSql;
|
}
|
|
public void appendSelectField(String sql) {
|
this.selectFieldSql = this.selectFieldSql + "," + sql;
|
}
|
|
public void appendSelectPagePrefix(String sql) {
|
this.selectPrefixForPage = this.selectPrefixForPage + "," + sql;
|
}
|
|
public String getWhereSql() {
|
if (StringUtils.isBlank(this.whereSql)) {
|
this.whereSql = " 1 = 1 ";
|
}
|
|
return this.pageHelper != null && this.pageHelper.getLimit() > 0 ? this.whereSql + (this.orderSql == null ? "" : this.orderSql) + (this.whereSubfixForPage == null ? "" : this.whereSubfixForPage) : (StringUtils.isNotBlank(this.whereSql) ? this.whereSql : " 1= 1 ") + (this.orderSql == null ? "" : this.orderSql);
|
}
|
|
public void setWhereSql(String whereSql) {
|
this.whereSql = whereSql;
|
}
|
|
public Map<String, String> getValuesMap() {
|
return this.valuesMap;
|
}
|
|
public void setValuesMap(Map<String, String> valuesMap) {
|
this.valuesMap = valuesMap;
|
}
|
|
public String getTableNick() {
|
return this.tableNick;
|
}
|
|
public void setTableNick(String tableNick) {
|
this.tableNick = tableNick;
|
}
|
|
public String getOrderSql() {
|
return this.orderSql;
|
}
|
|
public void setOrderSql(String orderSql) {
|
this.orderSql = orderSql;
|
}
|
|
public String getOidFieldName() {
|
return this.oidFieldName;
|
}
|
|
public void setOidFieldName(String oidFieldName) {
|
this.oidFieldName = oidFieldName;
|
}
|
|
public boolean isDistinct() {
|
return this.distinct;
|
}
|
|
public void setDistinct(boolean distinct) {
|
this.distinct = distinct;
|
}
|
|
public Map<String, String> getCustomerSqlMap() {
|
return this.customerSqlMap;
|
}
|
|
public void setCustomerSqlMap(Map<String, String> customerSqlMap) {
|
this.customerSqlMap = customerSqlMap;
|
}
|
|
}
|