package com.xjrsoft.module.form.entity; import lombok.Data; @Data public class QueryCondition { private String fieldName; private Object value; private String operator; // "=", ">=", "<=", "LIKE"等 private boolean isDate; private int index; // 添加索引字段 public String toSqlSnippet() { if (isDate && "BETWEEN".equals(operator)) { return String.format("%s BETWEEN #{conditions[%d].value[0]} AND #{conditions[%d].value[1]}", fieldName, index, index); } if ("LIKE".equals(operator)) { return String.format("%s LIKE #{conditions[%d].value}", fieldName, index); } return String.format("%s %s #{conditions[%d].value}", fieldName, operator, index); } }