XilongPei / Openparts

MIT License
3 stars 1 forks source link

当前端把likeOption处理为true,则后端形成SQL时,也应该认识这个LIKE #39

Closed XilongPei closed 6 years ago

XilongPei commented 6 years ago
            // alert(key+" "+type+" "+likeOption);
            if ((type && (type == "text" || type == "search") && likeOption == "true")) { // 如果是用户手动输入项,需要在前后各加一个百分号
                if (value && value != "") {
                    value = "%" + value + "%";
                }
            }
            if(!type&&likeOption=="true"&&value){
                value="%"+value+"%";
            }
            if (isExist) {
                map.value += "," + value;
            } else {
                map.key = key;
                map.value = value;
                map.isCondition = isCondition;
                map.operator = operator;
                conditions.push(map);
                // alert("key:"+key+" value:"+value);
            }
XilongPei commented 6 years ago

isCondition 表示当前的输入框里输入的是一个集合,条件为:字段值是这个集合中的某一个元素,则为真。

operator是操作符,EQ、LIKE之类 class ConditionOperator中定义的。

XilongPei commented 6 years ago

about likeOption, the front-end and the backend should be agreed commit: https://github.com/XilongPei/Openparts/commit/7a98638c27e570feb5b19f40b3abfedcfb02418d

XilongPei commented 6 years ago

fix typos: the default value of likeOption should be false commit: https://github.com/XilongPei/Openparts/commit/89df15125b2a9fd9311841ee208575349910c0d6