|
@@ -1,6 +1,7 @@
|
|
|
package com.boman.system.mapper;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.boman.common.core.utils.obj.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.ibatis.annotations.*;
|
|
|
import org.apache.ibatis.annotations.Param;
|
|
@@ -85,6 +86,25 @@ public interface StandardlyMapper {
|
|
|
@Select("select max(${pkName}) from ${tableName}")
|
|
|
Long selectMaxId(@Param("tableName") String tableName, @Param("pkName") String pkName);
|
|
|
|
|
|
+ /**
|
|
|
+ * 功能描述: 自定义查询,需要查询的字段和value都在condition中
|
|
|
+ *
|
|
|
+ * @param tableName tableName
|
|
|
+ * @param condition condition
|
|
|
+ * @param limit 分页
|
|
|
+ * @param offset 分页
|
|
|
+ * @return java.util.List<com.alibaba.fastjson.JSONObject>
|
|
|
+ */
|
|
|
+ @SelectProvider(type = StandardlyMapper.SqlProvider.class, method = "selectByCondition")
|
|
|
+ List<JSONObject> selectByCondition(@Param("tableName") String tableName
|
|
|
+ , @Param("condition") JSONObject condition
|
|
|
+ , @Param("showData") JSONObject showData
|
|
|
+ , @Param("limit") int limit
|
|
|
+ , @Param("offset") int offset);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public static class SqlProvider {
|
|
|
static final String[] READONLY_COLUMNS = new String[]{"OWNERID", "OWNERNAME", "OWNERENAME", "CREATIONDATE", "ID"};
|
|
|
|
|
@@ -383,5 +403,25 @@ public interface StandardlyMapper {
|
|
|
throw new IllegalArgumentException("model 无效");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+// @Param("tableName") String tableName, @Param("condition") JSONObject condition, @Param("limit") int limit, @Param("offset") int offset
|
|
|
+ public String selectByCondition(Map<String, Object> para) {
|
|
|
+ JSONObject condition = (JSONObject) para.get("condition");
|
|
|
+ ObjectUtils.requireNonNull(condition);
|
|
|
+ String tableName = (String) para.get("tableName");
|
|
|
+ ObjectUtils.requireNonNull(tableName);
|
|
|
+ int limit = (int) para.get("limit");
|
|
|
+ ObjectUtils.requireNonNull(limit);
|
|
|
+ int offset = (int) para.get("offset");
|
|
|
+ ObjectUtils.requireNonNull(offset);
|
|
|
+
|
|
|
+ StringBuilder sql = new StringBuilder();
|
|
|
+ sql.append("select ");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return "";
|
|
|
+ }
|
|
|
}
|
|
|
}
|