欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Spring jdbctemplate 模糊查询Like

程序员文章站 2022-04-25 08:25:52
...
StringBuffer sbf = new StringBuffer();
sbf.append("SELECT  ");
sbf.append("acc_sign.AVATAR,");
sbf.append("acc_sign.USER_NAME,");
sbf.append("acc_sign.DISTANCE, ");
sbf.append("acc_sign.SIGN_TIME ");
sbf.append("FROM ");
sbf.append("acc_sign ");
sbf.append("WHERE ");
sbf.append("acc_sign.CORP_CODE = ? ");
sbf.append("AND STATUS = ? ");
sbf.append("AND STORE_CODE = ? ");
sbf.append("AND USER_NAME LIKE ? ");
sbf.append("AND ISACTIVE = 'Y' ");
sbf.append("LIMIT ?,? ");
return sbf.toString();

》》》》》参数
param[3]  = "%"+MapUtil.getParam(db.data,"user_name")+"%";