用concat连接通配符解决:MySQL报错解决--Parameter index out of range (1 > number of parameters, which is 0)
JAVA
Kv conds = new Kv();
if(StrKit.notBlank(para)) {
conds.set(Json.getJson().parse(para, HashMap.class));
}
SqlPara sqlPara = Db.getSqlPara("paginateUser", Kv.by("conds", conds));
Page<Record> userPage = Db.paginate(pageNum, colNum, sqlPara);出错SQL
### 用户动态分页查询
#sql("paginateUser")
select * from user where 1=1
#for(x:conds)
#if(x.value)
and #(x.key) like '%#para(x.value)%'
#end
#end
order by id desc
#end修改后SQL
### 用户动态分页查询
#sql("paginateUser")
select * from user where 1=1
#for(x:conds)
#if(x.value)
and #(x.key) like concat('%',#para(x.value),'%')
#end
#end
order by id desc
#end