添加数据权限处理方法

yun-zuoyi
贾文涛 5 years ago
parent 46a91a13bc
commit eadf0d67f8

@ -4,6 +4,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
/** /**
* @Description : hql * @Description : hql
@ -141,6 +142,24 @@ public class DdlPackBean {
} }
/** /**
* -
* @param hql
* @param hqlMap
*/
public void addColumnQuery(String hql,HashMap<String,Object> hqlMap){
if(hqlPreparedMap == null){
hqlPreparedMap = new HashMap<>();
}
if(hqlMap != null && !hqlMap.isEmpty()) {
hqlPreparedMap.putAll(hqlMap);
}
whereAppend.append(hql);
}
/**
* *
* @return * @return
*/ */

@ -14,26 +14,26 @@ public class MesEnumUtil {
@JsonFormat(shape = JsonFormat.Shape.OBJECT) @JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum HQL_EXPRESSION { public enum HQL_EXPRESSION {
GT(10,">","大于"), GT(">",">","大于"),
LT(20,"<","小于"), LT("<","<","小于"),
EQ(30,"=","等于"), EQ("=","=","等于"),
NEQ(40,"!=","不等于"), NEQ("!=","!=","不等于"),
GTE(50,">=","大于等于"), GTE(">=",">=","大于等于"),
LTE(60,"<=","小于等于"), LTE("<=","<=","小于等于"),
LIKE(70,"like","LIKE"), LIKE("like","like","LIKE"),
IN(80,"in","包含"); IN("in","in","包含");
private int value; private String value;
private String code; private String code;
private String description; private String description;
HQL_EXPRESSION(int value, String code, String description) { HQL_EXPRESSION(String value, String code, String description) {
this.value = value; this.value = value;
this.code = code; this.code = code;
this.description = description; this.description = description;
} }
public int getValue() { public String getValue() {
return value; return value;
} }
@ -45,38 +45,22 @@ public class MesEnumUtil {
return code; return code;
} }
public static String valueOf(int val) { public static String valueOfDesc(String val) {
String tmp = null;
for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) {
tmp = values()[i].description;
}
}
return tmp;
}
public static String codeOf(int val) {
String tmp = null;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
if (values()[i].value == val) { if (values()[i].value.equals(val)) {
tmp = values()[i].code; return values()[i].description;
} }
} }
return tmp; return null;
} }
public static int descOf(String desc) { public static HQL_EXPRESSION codeOf(String value) {
int tmp = 1;
for (int i = 0; i < values().length; i++) { for (int i = 0; i < values().length; i++) {
if (values()[i].description.equals(desc)) { if (values()[i].value.equals(value)) {
tmp = values()[i].value; return values()[i];
} }
} }
return tmp; return null;
}
public static String valueOfDescription(int val) {
return valueOf(val);
} }
} }

@ -7,5 +7,5 @@ import java.util.List;
@Data @Data
public class FilterGroup { public class FilterGroup {
private String andOr; private String andOr;
private List<FilterRuleAndOr> groups; private List<FilterRules> groups;
} }

@ -4,7 +4,7 @@ import lombok.Data;
@Data @Data
public class FilterRule { public class FilterRule {
private String filed; private String field;
private String op; private String op;
private String value; private String value;
} }

@ -5,7 +5,7 @@ import lombok.Data;
import java.util.List; import java.util.List;
@Data @Data
public class FilterRuleAndOr { public class FilterRules {
private String andOr; private String andOr;
private List<FilterRule> rules; private List<FilterRule> rules;
} }
Loading…
Cancel
Save