Combinatorial fuzzy query is so simple
<select id= "Findalljiemu" parametertype= "Java.util.Map" resultmap= "Imnoticejiemu" >
Select A.*, (select F.names from Pt_userinfo f where f.ids = (select R.userinfoids from Pt_user r where R.ids = A.createus ER)) as Createname, (select F.names from Pt_userinfo f where f.ids = (select R.userinfoids from Pt_user r where R.ids = A.updateuser)) as UpdateName from Im_notice_jiemu A WHERE A.companycode=#{companycode,jdbctype=varchar}
<if test= "status!=" and Status!=null "><! [Cdata[and a.status = #{status}]]></if>
<if test= "Content!=null and content!=" ><! [Cdata[and a.content like #{content}]]></if>
ORDER BY a.createtime Desc
</select>
Combining Fuzzy DAO
Public page<imnoticejiemu> Findalljiemu (Param param,map<string,object> Map) {
try {
Return super.getpage (param, "Com.kinglo.pojo.ImNoticeJiemu.findAllJiemu", map);
} catch (Exception e) {
E.printstacktrace ();
}
return null;
}
Action class
@RequestMapping ("/findalljiemu.do")
public void Findalljiemu () {
String userid=this.getparamnotnnll (" UserId2 ");
Map<string, object> CeMAP = new hashmap<string, object> ();
Cemap.put ("id", userId);
User u = los.findeuser (CeMAP);
String Qz=u.getcompanycode ();
Map<string, object> Map = new hashmap<string, object> ();
Map.put ("Companycode", QZ);
Map.put ("status", GetParam ("Fstatus2"));
Map.put ("content", "%" + (GetParam ("Fcontent2") ==null? ": GetParam (" Fcontent2 ")) +"% ");
Param param=new Param (Getpagenumber (), Getmaxresult ());
//page<imnoticejiemu> page=imnoticeservice.findallnotice (param, map);
page<imnoticejiemu> Page=jiemuservice.findalljiemu (param, map);
Jsonobject json=jsonobject.fromobject (page, Jsonconfigdate.getcountsql ());
This.outjsondatastring (json.tostring ());
}
Page out
var initPage2 = function (PageIndex2, MAXRESULT2, QUERYSTR2) {
var page2 = new Page (".. /.. /noticejiemu/findalljiemu.do ", ' tab_2 ', showHTML2);
Page2.init (PageIndex2, MAXRESULT2, QUERYSTR2);
};
var showHTML2 = function (data) {
if (data.totalpages = = 0) {
$ (". Jmgg"). HTML ("");
$ (". Jmgg"). HTML ("<tr style= ' color:red;text-align:center ' ><td colspan= ' 9 ' > did not find the data you want to query!</td>< /tr> ");
} else {
var type = {"0": "Enabled", "1": "Disabled"};
var html = "";
$ (data.list). each (function (ID, item) {
HTML + = "<tr>";
HTML + = "<td>" + (id+1) + "</td>";
HTML + = "<td>" + type[item.status] + "</td>";
HTML + = "<td>" + item.content + "</td>";
HTML + = "<td>" + item.createname + "</td>";
HTML + = "<td>" + item.createtime+ "</td>";
HTML + = "<td>" + item.updatename + "</td>";
HTML + = "<td>" + item.updatetime+ "</td>";
HTML + = "<td><a style= ' cursor:pointer ' fid2=" +item.id+ "class= ' updatekeyword2 ' > Modify </a><a style= ' Cursor:pointer ' did2= "+item.id+" class= ' deletekeyword2 ' > Delete </a></td> ";
HTML + = "</tr>";
});
$ (". Jmgg"). HTML (HTML);
}
};
<div class= "box" id= "Box_jiemu" style= "Display:none;" >
<div class= "HR"
Style= "HEIGHT:3PX; margin-top:3px; Background: #0393D6 "></div>
<div class= "Con" >
<div class= "Scroll" >
<div class= "Search" >
<form id= "BlackListForm2" >
<input type= "hidden" name= "UserId2" id= "UserId2"/>
<table border= "0" cellpadding= "0" cellspacing= "0"
Style= "width:100%;" >
<colgroup>
<col width= "34%"/>
<col width= "30%"/>
<col width= "18%"/>
<col width= "18%"/>
</colgroup>
<tbody style= "padding:0px 10px" >
<tr style= "background: #F0EEEE; height:60px ">
<td>
State
<select name= "Fstatus2" >
<option value= "" > Please select </option>
<option value= "0" > Enable </option>
<option value= "1" > Disable </option>
</select>
</td>
<td>
Content
<input type= "text" name= "Fcontent2" width= "90px"/>
</td>
<td>
<a href= "javascript:;" class= "btn" id= "Query2" > Queries </a>
<a href= "javascript:;" class= "BTN" id= "reset" > Reset </a>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<div class= "Edit-list" >
<a href= "javascript:;" onclick= "ShowBlackList2 ()" class= "btn" > Add </a>
</div>
<div class= "Tables"
Style= "MIN-HEIGHT:285PX; Height:auto!important; height:285px; " >
<table width= "100%" >
<col width= "16%" >
<col width= "16%" >
<col width= "16%" >
<col width= "16%" >
<col width= "16%" >
<col width= "16%" >
<col width= "16%" >
<col width= "16%" >
<thead>
<tr>
<th>
Serial number
</th>
<th>
State
</th>
<th>
Content
</th>
<th>
Create person
</th>
<th>
Creation time
</th>
<th>
Modify People
</th>
<th>
Modification time
</th>
<th>
Operation
</th>
</tr>
</thead>
<tbody class= "Tbody jmgg" ></tbody>
</table>
</div>
</div>
<div style= "Clear:both;" ></div>
<div class= "page tab_2" style= "height:40px" >
</div>
</div>
</div>
MyBatis combination blur + paged query