最近项目赶得紧。自己还感冒了。不在状态,不过幸好做完了。留个纪念。
toolbar: [{
text: ' 文章名:<input type="text" id="title"/>'
}, {
iconCls: 'icon-search',
text: '查询',
handler: function () {
findMess();
}
}]
上文是jsp页面需要写的代码
var findMess = function(){
$("#MessPubList").datagrid('load', {
"title" : $("#title").val()
});
}
上面为点击查询时候所调用的方法。
@RequestMapping("findByTitle")
@ResponseBody
public String findByTilte(@RequestParam(value = "title",required = false)String title){
List<MessPublish> List = MessPubservice.findByTitle(title);
String json = "";
int total = MessPubservice.total();
Map map = new HashMap<String, Object>();
map.put("total", total);
map.put("rows", List);
json = JSONObject.fromObject(map).toString();
return json;
}
控制器里写入这个方法easyUI控件比较智能会根据你输出的值判断
List<MessPublish> findByTitle(String title); 业务层方法
@Override
public List<MessPublish> findByTitle(String title) {
List<MessPublish> find = mapper.findByTitle(title); 业务层实现方法比较简单
return find;
}
List<MessPublish> findByTitle(String title); mapper 里面写的方法
<select id="findByTitle" parameterType="String" resultType="MessPublish">
select ID,Title,MessContent,CreateTime,TypeID,CorpID,UserName,UserID,ModifyTime,CheckState,CheckTime,CheckID,CheckRemark,Mess_Fujian from Mes_publish
<where>
<if test=" _parameter!=null and _parameter!='' ">
and Title like '%'+#{_parameter}+'%'
</if>
</where>
</select>
上面为mapper里面的select 语句片段好了,记录到这。最后来前台展示

好了记录完活。最后希望大家不要感冒,最近头疼的厉害,写代码完全没有思路。
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/13155.html