實現網頁的模糊查詢和批量刪除

2021-10-07 17:43:36 字數 3190 閱讀 9198

模糊查詢

"$/user/findall.do?type=1"

method=

"post"

>

="col-md-4 data1"

>

"text"

class

="form-control" name=

"username"

placeholder=

"username" value=

"">

<

/div>

"submit"

class

="btn bg-maroon"

>搜尋<

/button>

<

/form>

提交表單,獲得輸入框中的username

}如果是從表單接收的引數,currentpage預設為1,username進行儲存。跳轉頁面時,將username再次使用,此時currentpage改變值

@override

public pageinfo

findall

(int currentpage, string username)

else

if(currentpage>tp)

else

int start=

(pageinfo.

getcurrentpage()

-1)*

5;list

userlist = userdao.

findall

(start,username)

; pageinfo.

setlist

(userlist)

;return pageinfo;

}

findall方法多了乙個string的引數,進行修改

list

findall

(@param

("start"

)int start,

@param

("username"

) string username)

;

dao層也需要修改

"findall"  resulttype=

"user"

>

select * from tb_user

<

if test=

"username!=null and username!=''"

>

where username like concat

("%",#,

"%")

>

limit #,5

<

/select>

("%",#,"%")的含義是包含所輸入的字元的使用者資訊。這樣模糊查詢已經實現。

"button" name=

"delete"

class

="btn btn-default" title=

"刪除" onclick=

"deleteall()"

>

="fa fa-refresh"

>

<

/i> 刪除

<

/button>

function deleteall()

if(confirm

("確認要刪除這些使用者嗎?"))

);}alert

(userlist)

; $.

ajax

(/user/deleteall.do"

, data:

, success:function (),

error:function ()}

);}

(

"/deleteall.do"

)public string deleteall

(string userlist)

userservice.

deleteall

(ids)

;return

"redirect:findall.do";}

@override

public

void

deleteall

(list

ids)

void

deleteall

(@param

("ids"

)list

ids)

;

"deleteall" parametertype=

"list"

>

delete from tb_user where id in

"ids" item=

"id" open=

"(" close=

")" separator=

",">

#<

/foreach>

<

/delete>

新增訂單刪除 批量刪除 模糊查詢 過濾

class top ng click isshow isshow 新增訂單 ng click delmore 批量刪除 type text name id value title 按商品名查詢 ng model qname type text name id value title 按手機號查詢 n...

layui實現單個刪除和批量刪除

二 批量刪除 使用者列表 列表操作 ajaxres負責響應給頁面是否成功 public class ajaxres public void setsuccess boolean success public string getmsg public void setmsg string msg 刪除...

thinkphp批量刪除的實現

今天自己在寫後台的時候需要把以前上傳的測試文章全部刪除掉,但是利用 操作 裡面的乙個個刪除比較慢,因此想出乙個批量刪除的解決方案。首先在前端頁面裡面建立乙個表單,這個表單是把你選中的單選按鈕提交到控制器的操作函式 批量刪除前端用了乙個js 的簡單驗證 class delete class glyph...