mybatis的select标签里从一个对象参数里取其中的map属性里的一个list里的某个特定元素
程序员文章站
2022-05-18 08:33:49
...
<select id="selectTest" parameterType="cn.com.n22.global.common.query.Query" resultType="java.util.LinkedHashMap"> <bind name="halo" value="searchMap['wordItem'][0]"/> select #{halo} name1 </select>
package cn.com.n22.global.common.query; import java.util.Map; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @JsonInclude(Include.NON_NULL) public class Query{ /** * 查询页码 */ private Integer pageNum = 1; /** * 查取记录数 * 默认 */ private Integer pageSize = 10; /** * 排序集合 * key = 排序字段 * value = 排序方式 */ private Map<String,Object> orderMap; /** * 模糊查詢 * 界面写法:searchMap['case_type'] */ private Map<String,Object> searchMap; /** * 精确查询 */ private Map<String,Object> accurateSearchMap; /** * 范围查询Map */ private Map<String,Object> rangeSearchMap; /** * 不等集合 */ private Map<String,Object> unEqualMap; public Map<String, Object> getUnEqualMap() { return unEqualMap; } public void setUnEqualMap(Map<String, Object> unEqualMap) { this.unEqualMap = unEqualMap; } public Map<String, Object> getRangeSearchMap() { return rangeSearchMap; } public void setRangeSearchMap(Map<String, Object> rangeSearchMap) { this.rangeSearchMap = rangeSearchMap; } public Map<String, Object> getOrderMap() { return orderMap; } public void setOrderMap(Map<String, Object> orderMap) { this.orderMap = orderMap; } public Map<String, Object> getSearchMap() { return searchMap; } public void setSearchMap(Map<String, Object> searchMap) { this.searchMap = searchMap; } public Integer getPageNum() { return pageNum; } public void setPageNum(Integer pageNum) { this.pageNum = pageNum; } public Integer getPageSize() { return pageSize; } public void setPageSize(Integer pageSize) { this.pageSize = pageSize; } public Map<String, Object> getAccurateSearchMap() { return accurateSearchMap; } public void setAccurateSearchMap(Map<String, Object> accurateSearchMap) { this.accurateSearchMap = accurateSearchMap; } public Query(){} public Query(Map<String,Object> rangeSearchMap){ this.rangeSearchMap = rangeSearchMap; } }
上一篇: jsonDB使用手册