layui自定義查詢條件html頁面,Layui的數據表格+springmvc實現搜索功能的例子_飛雲_前端開發者...

如下所示:

4495823138c88f71f4f885bcbe8014e5.png

主要在前端頁面加:

搜索ID:

userid

content

搜索

reload:function () {

var keyWord=$("#keyWord").val();

var keyType=$("#key_type option:selected").val();

table.reload('contenttable',{

method:'post',

where:{keyWord:keyWord,keyType:keyType}

});

}

layui.use('table', function(){

var table = layui.table;

//渲染

table.render({

elem: '#test' //綁定table表格

,height: 450

,url: '/admin/backContent' //后臺springmvc接收路徑

,page:true //true表示分頁

,limit: 10

,id:'contenttable'

,toolbar: '#toolbarDemo'

,cols: [[

{type: 'checkbox', fixed: 'left'}

,{field:'id', title:'id', width:80, fixed: 'left', unresize: true, sort: true}

,{field:'content', title:'內容', width:120}

,{field:'userid', title:'用戶id', width:80, sort: true}

,{field:'nice', title:'點贊數', width:100}

,{field:'createtime', title:'分享時間', width:80, sort: true}

,{field:'pic1', title:'圖片1', width:120,templet:'

p><p>@RequestMapping(value%20=%20

@ResponseBody

public ResultMap> backContent(Page page, @RequestParam("limit") int limit){

page.setRows(limit);

ListcontentList=contentService.selectPageList(page);

int totals=contentService.selectPageCount(page);

page.setTotalRecord(totals);

return new ResultMap>(0,"",totals,contentList);

}

因為layui返回的參數不單單是json數組,要符號其的數據格式才能在jsp頁面顯示數據,所以用ResultMap類來處理返回數據的格式。

package net.stxy.one.model;

/**

*

* layui數據表格返回數據處理類

* Created by ASUS on 2018/5/19

*

* @Authod Grey Wolf

*/

public class ResultMap {

private String msg;

private T data;

private int code;

private int count;

public String getMsg() {

return msg;

}

public void setMsg(String msg) {

this.msg = msg;

}

public T getData() {

return data;

}

public void setData(T data) {

this.data = data;

}

public int getCode() {

return code;

}

public void setCode(int code) {

this.code = code;

}

public int getCount() {

return count;

}

public void setCount(int count) {

this.count = count;

}

public ResultMap(int code,String msg, int count,T data) {

this.code = code;

this.msg = msg;

this.count = count;

this.data = data;

}

public ResultMap() {

}

}

其中mapper的語句:

select

from content

AND userid like '%' #{keyWord} '%'

AND content like '%' #{keyWord} '%'

order by id DESC

limit #{start},#{rows}

select count(1) from content

AND userid like '%' #{keyWord} '%'

AND content like '%' #{keyWord} '%'

以上這篇layui的數據表格+springmvc實現搜索功能的例子就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持前端開發者。

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/395372.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/395372.shtml
英文地址,請注明出處:http://en.pswp.cn/news/395372.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

mysql+keepalived 雙主熱備高可用

理論介紹&#xff1a;我們通常說的雙機熱備是指兩臺機器都在運行&#xff0c;但并不是兩臺機器都同時在提供服務。當提供服務的一臺出現故障的時候&#xff0c;另外一臺會馬上自動接管并且提供服務&#xff0c;而且切換的時間非常短。MySQL雙主復制&#xff0c;即互為Master-Sl…

java ldap userpassword 解密_Spring Boot中使用LDAP來統一管理用戶信息

LDAP簡介LDAP(輕量級目錄訪問協議&#xff0c;Lightweight Directory Access Protocol)是實現提供被稱為目錄服務的信息服務。目錄服務是一種特殊的數據庫系統&#xff0c;其專門針對讀取&#xff0c;瀏覽和搜索操作進行了特定的優化。目錄一般用來包含描述性的&#xff0c;基于…

第三章之枚舉、注解

2019-01-22內容&#xff1a;枚舉、注解一、自定義一個枚舉類1 public class TestSeason {2 3 public static void main(String[] args) {4 Season spring Season.Spring;5 System.out.println(spring);6 }7 }8 public class Season {9 //將屬性定…

html打開后默認瀏覽器頁面,使用VBA打開默認瀏覽器中的html頁面?

您可以使用Windows API函數ShellExecute來執行此操作&#xff1a;Option ExplicitPrivate Declare Function ShellExecute _Lib "shell32.dll" Alias "ShellExecuteA" ( _ByVal hWnd As Long, _ByVal Operation As String, _ByVal Filename As String, _Op…

數據科學r語言_您應該為數據科學學習哪些語言?

數據科學r語言Data science is an exciting field to work in, combining advanced statistical and quantitative skills with real-world programming ability. There are many potential programming languages that the aspiring data scientist might consider specializi…

Linux平臺不同解壓縮命令的使用方法

作者&#xff1a;郭孝星 微博&#xff1a;郭孝星的新浪微博 郵箱&#xff1a;allenwells163.com 博客&#xff1a;http://blog.csdn.net/allenwells github&#xff1a;https://github.com/AllenWell 一 .tar 解包 tar xvf FileName.tar 打包 tar cvf FileName.tar DirName 注意…

unity中怎么做河流_【干貨】工作中怎么做工業設計的?(一)

最近在找工作&#xff0c;一直在看招聘信息。看到工業設計工資還是蠻高的。應屆畢業生一般是4-6K&#xff0c;1-3年工作經驗是6-8K&#xff0c;3年以后的差不多是8K以上了。我沒有嫉妒羨慕恨&#xff0c;發誓&#xff0c;真的沒有。工業設計已經被重視&#xff0c;未來的道路會…

[易學易懂系列|golang語言|零基礎|快速入門|(一)]

golang編程語言&#xff0c;是google推出的一門語言。 主要應用在系統編程和高性能服務器編程&#xff0c;有廣大的市場前景&#xff0c;目前整個生態也越來越強大&#xff0c;未來可能在企業應用和人工智能等領域占有越來越重要的地位。 本文章是【易學易懂系列|編程語言入門】…

APUE學習之三個特殊位 設置用戶ID(set-user-ID),設置組ID(set-group-ID),sticky...

設置用戶ID&#xff08;set-user-ID&#xff09;&#xff0c;設置組ID&#xff08;set-group-ID&#xff09;&#xff0c;stickyset-user-ID: SUID當文件的該位有設置時&#xff0c;表示當該文件被執行時&#xff0c;程序具有文件所有者的權限而不是執行者的權限。這樣說有點繞…

微信調用html退后方法,微信瀏覽器后退關閉頁面

不需要引用 微信jssdk 關閉瀏覽器WeixinJSBridge.invoke(closeWindow, {}, function (res) { });參考&#xff1a;https://mp.weixin.qq.com/wiki/12/7dd29a53f4b55a8ddc6177ab60e5ee2c.html監聽微信、支付寶等移動app及瀏覽器的返回、后退、上一頁按鈕的事件方法參考&#xff…

在gitlab 中使用webhook 實現php 自動部署git 代碼

在技術團隊討論中&#xff0c;我們決定從svn 遷移到 git ,于是使用了gitlab&#xff0c;代碼自動部署使用了webhook在服務器上 1.開啟PHP需要的環境支持 服務器環境必須先安裝git 環境&#xff0c;webhook 依賴php運行環境&#xff0c;同時需要使用shell_exec 和 exec 等函數。…

spi收發時的寄存器sr不變_「正點原子Linux連載」第二十七章SPI實驗(二)

1)實驗平臺&#xff1a;正點原子Linux開發板2)摘自《正點原子I.MX6U嵌入式Linux驅動開發指南》關注官方微信號公眾號&#xff0c;獲取更多資料&#xff1a;正點原子文件bsp_spi.c中有兩個函數&#xff1a;spi_init和spich0_readwrite_byte&#xff0c;函數spi_init是SPI初始化函…

vue腳手架vue數據交互_學習Vue:3分鐘的交互式Vue JS教程

vue腳手架vue數據交互Vue.js is a JavaScript library for building user interfaces. Last year, it started to become quite popular among web developers. It’s lightweight, relatively easy to learn, and powerful.Vue.js是用于構建用戶界面JavaScript庫。 去年&#…

[JSOI2018]潛入行動

題解 一道思路不難但是寫起來很麻煩的樹形背包 我們發現每個節點有很多信息需要保留 所以就暴力的設\(f[u][j][0/1][0/1]\)表示點u的子樹分配了j個監察器,點u有沒有被控制,點u放沒放監察器 然后就分四種情況暴力討論就好了 注意背包的時候要卡常數 代碼 #include<cstdio>…

css。元素樣式、邊框樣式

1.外邊距  margin 縮寫形式&#xff1a; margin&#xff1a;上邊距  右邊距  下邊距  左邊距 margin&#xff1a;上下邊距  左右邊距 margin&#xff1a;上邊距  左右邊距  下邊距 2.內邊距  padding 縮寫形式&#xff1a; padding&#xff1a;上邊距  右邊距…

html文本對齊6,HTML對齊文本

我要像以下列方式顯示頁面上的文本&#xff1a;HTML對齊文本My Text: Text HereMy Text: More Text Here.........................................................Text from line above continued here.我有以下的標記只是為了測試&#xff1a;body {font-family: arial;}fo…

vue底部跳轉_詳解Vue底部導航欄組件

不多說直接上代碼 BottomNav.vue&#xff1a;{{item.name}}export default{props:[idx],data(){return {items:[{cls:"home",name:"首頁",push:"/home",icon:"../static/home.png",iconSelect:"../static/home_select.png"}…

Android Studio環境搭建

Android Studio環境搭建 個人博客 歡迎大家多多關注該獨立博客。 ###[csdn博客]&#xff08;http://blog.csdn.net/peace1213&#xff09; 一直想把自己的經驗分享出來&#xff0c;記得上次寫博客還是ok6410的筆記。感覺時代久遠啊。記得那個時候我還一心想搞硬件了。如今又一次…

hacktoberfest_Hacktoberfest和其他有趣的事情將在本周末在freeCodeCamp

hacktoberfestby Quincy Larson昆西拉爾森(Quincy Larson) Hacktoberfest和其他有趣的事情將在本周末在freeCodeCamp (Hacktoberfest and other fun things going on this weekend at freeCodeCamp) Earlier this month, the freeCodeCamp community turned 3 years old. And …

C# 動態創建數據庫三(MySQL)

前面有說明使用EF動態新建數據庫與表&#xff0c;數據庫使用的是SQL SERVER2008的&#xff0c;在使用MYSQL的時候還是有所不同 一、添加 EntityFramework.dll &#xff0c;System.Data.Entity.dll &#xff0c;MySql.Data, MySql.Data.Entity.EF6 注意&#xff1a;Entity Frame…