String sqlstring= "SELECT * from Tb_wf_main where trim (wf_name) = '" + wfname.trim () + "' ";
The string in Java can only double quotation marks (JS can be single quotation marks can also be double quotes), above, if the string needs to stitch the variable, the variable is enclosed in single quotation marks, and then add two double quotation marks plus two Plus, the middle is a variable
Just keep it that way: single quotes enclose two plus-sign intermediate variables (0q0 OMG)
JS is also a way to splice variables.
For example:
1 PublicJsonobject querydata (String startdate,string enddate,string stationid,string slenodeid,string bomOprId,String Lackflag,intPageNumber,2 intpageSize)3 {4StringBuffer HQL =NewStringBuffer ("from Operatordetail t where 1=1");5 if(!Stringutils.isblank (startdate))6 {7Hql.append ("and t.operatedate >= '" + startdate + "'");8 }9 if(!Stringutils.isblank (endDate))Ten { OneHql.append ("and t.operatedate <= '" + endDate + "'"); A } - if(!Stringutils.isblank (stationId)) - { theHql.append ("and T.stationid = '" + stationId + "'"); - } - if(!Stringutils.isblank (Slenodeid)) - { +Hql.append ("and T.slenodeid = '" + Slenodeid + "'"); - } + if(!Stringutils.isblank (Bomoprid)) A { atHql.append ("and T.bomoprid = '" + Oprid + "'"); - } - if(!Stringutils.isblank (lackflag)) - { -Hql.append ("and T.lackflag =" + Lackflag + ""); - } inHql.append ("ORDER by T.operatedate"); -map<string, object> recordmap = Queryobjectspage (Hql.tostring (), (pageNumber-1) *pageSize, pageSize); to returnJsonobject.fromobject (recordmap); +}
SQL Single-quote double-quote concatenation variable in Java