派生自 projectDept/qhighschool

胡仁荣
2023-08-04 2174b22bbbb45284765a23b8189df59583c65d29
src/main/java/com/qxueyou/scc/base/util/ParamsUtils.java
@@ -14,11 +14,11 @@
public class ParamsUtils {
   
   /**
     * 获取查询条件的公用方法
     * 获取查询条件的公用方法
     * 
     * @param request HttpServletRequest
     * @param strSupportQueryArray 定义自己功能模块支持查询的条件数组集合
     * @param lstQueryCondition 查询条件
     * @param strSupportQueryArray 定义自己功能模块支持查询的条件数组集合
     * @param lstQueryCondition 查询条件
     */
    public static void getAllQueryCondition(HttpServletRequest request, String[] strSupportQueryArray,
        List<Param> lstParams) {
@@ -28,28 +28,28 @@
        String strValue = "";
        List<String> lstSupportQuery = Arrays.asList(strSupportQueryArray);
        /**
         * 条件分为以下几种情况: 1、关键字查询  2、单选按钮的数据字典值  3、复选数组,比如类型
         * 4、时间范围,比如开始时间和结束时间 5、数字范围, 6、其它类型
         * 条件分为以下几种情况: 1、关键字查询  2、单选按钮的数据字典值  3、复选数组,比如类型
         * 4、时间范围,比如开始时间和结束时间 5、数字范围, 6、其它类型
         */
        for (Map.Entry<String, String[]> entry : entryseSet) {
            /** 获取参数中的键值对 */
            /** 获取参数中的键值对 */
            strKey = entry.getKey().toString();
            strValue = entry.getValue()[0];
            /** 不支持的条件将会被过滤 */
            /** 不支持的条件将会被过滤 */
            if (lstSupportQuery.contains(strKey) && StringUtils.isNotBlank(strValue)) {
                // 去空格
                // 去空格
                strValue = strValue.trim();
                if (strValue.matches("^[0-9]*[0-9][0-9]*$")) {// 单选 数字
                if (strValue.matches("^[0-9]*[0-9][0-9]*$")) {// 单选 数字
                   lstParams.add(new Param(strKey, " = ", strValue));
                } else if (strValue.contains(",")) {// 复选 数字
                } else if (strValue.contains(",")) {// 复选 数字
                    if (strValue.replace(",", "").matches("^-?[0-9]*$")){
                       lstParams.add(new Param(strKey, " in ",  strValue ));
                    }
                } else if (strValue.contains("~")) {// 时间范围
                } else if (strValue.contains("~")) {// 时间范围
                    
                }else if (strValue.contains("-")) {// 数字范围
                }else if (strValue.contains("-")) {// 数字范围
                   
                }  else {// 其它
                }  else {// 其它
                   lstParams.add(new Param(strKey, " LIKE ", "%"+strValue+"%"));
                }
            }