Skip to content

Commit

Permalink
add search param
Browse files Browse the repository at this point in the history
  • Loading branch information
sondertara committed Jan 10, 2022
1 parent 1e08527 commit 43bf5b3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/java/com/sondertara/joya/core/jdbc/JoyaJdbc.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public boolean inTransaction() {
*/
private PreparedStatement createPreparedStatement(Connection conn, String sql, Object... params) throws SQLException {
PreparedStatement stmt = conn.prepareStatement(sql);
if (null != params) {
if (null != params && params.length > 0) {
for (int i = 0; i < params.length; ++i) {
stmt.setObject(i + 1, params[i]);
}
Expand Down Expand Up @@ -304,4 +304,5 @@ public <T> T doInStatement(StatementCallback<T> action) {
connManager.close(conn, stmt);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


/**
* 分页参数
* pagination param
*
* @author huangxiaohu
* @version 1.0 2020年12月
Expand All @@ -18,23 +18,28 @@
@Data
public class PageQueryParam extends JoyaQuery implements Serializable {
/**
* page size
* 分页大小
*/
private Integer pageSize = 10;
/**
* page start default is zero
* 页数 默认从0开始
*/
private Integer page = 0;
/**
* the query type,default is AND
* 连接类型 默认and
*/
private LinkType linkType = LinkType.AND;
/**
* the order param
* 排序字段
*/
private List<OrderParam> orderList = Lists.newArrayList();

/**
* the param of where
* 搜索参数
*/
private List<SearchParam> params = Lists.newArrayList();
Expand All @@ -43,10 +48,19 @@ public enum LinkType {
/**
*
*/
AND,
OR
AND, OR

}

/**
* add search param
*
* @param filed fileName
* @param value value
* @param operator operator
*/
public void addSearchParam(String filed, Object value, FieldParam.Operator operator) {

this.params.add(new SearchParam(filed, value, operator));
}
}

0 comments on commit 43bf5b3

Please sign in to comment.