vue+springboot用戶注銷功能實(shí)現(xiàn)代碼
vue文件前端
<el-button type="warning" plain @click="handleDeletion">注 銷</el-button>
// 注銷 const handleDeletion = (userName) => { ElMessageBox.confirm('注銷該用戶所有信息后無法恢復(fù),您確認(rèn)注銷嗎?', '注銷確認(rèn)', { type: 'warning' }).then(() => { const userName = data.form.username; request.delete('http://localhost:9090/peoples/deletePeople/' + userName).then(res => { if (res.code === '200') { ElMessage.success("操作成功") router.push('/login') } else { ElMessage.error(res.msg) } }) }).catch(res => { console.error('Delete request failed'); }) }
springboot后臺(tái)
controller
/** * 注銷 * @param userName */ @DeleteMapping("/deletePeople/{userName}") public Result deletePeople(@PathVariable String userName){ peopleService.deletePeopleByUsername(userName); return Result.success(); }
其中Result是寫的一個(gè)公共方法
code是等于200(請(qǐng)求成功)還是500(請(qǐng)求失?。?/p>
mapper
//批量刪除 @Delete("delete from people where id in (#{id})") void deleteBatch(List<Integer> id);
service
/** * 根據(jù)用戶名刪除用戶 */ public void deletePeopleByUsername(String username) { peoplesMapper.deleteByUsername(username); }
到此這篇關(guān)于vue+springboot用戶注銷功能的文章就介紹到這了,更多相關(guān)vue springboot用戶注銷內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
- 詳解springboot?springsecuroty中的注銷和權(quán)限控制問題
- SpringBoot使用Spring Security實(shí)現(xiàn)登錄注銷功能
- SpringBoot--- SpringSecurity進(jìn)行注銷權(quán)限控制的配置方法
- Vue+springboot批量刪除功能實(shí)現(xiàn)代碼
- springboot和vue前后端交互的實(shí)現(xiàn)示例
- SpringBoot3結(jié)合Vue3實(shí)現(xiàn)用戶登錄功能
- 基于SpringBoot和Vue3的博客平臺(tái)的用戶注冊(cè)與登錄功能實(shí)現(xiàn)
- SpringBoot和Vue.js實(shí)現(xiàn)的前后端分離的用戶權(quán)限管理系統(tǒng)
- 詳解SpringBoot項(xiàng)目整合Vue做一個(gè)完整的用戶注冊(cè)功能
- Vue結(jié)合Springboot實(shí)現(xiàn)用戶列表單頁面(前后端分離)
相關(guān)文章
vue中數(shù)據(jù)請(qǐng)求axios的封裝和使用
這篇文章主要介紹了vue中數(shù)據(jù)請(qǐng)求axios的封裝和使用,Axios?是一個(gè)基于?promise?的?HTTP?庫,下面文章圍繞主題的相關(guān)資料展開詳細(xì)的內(nèi)容介紹,具有一定的參考價(jià)值,需要的小伙伴可以參考一下2022-04-04element-ui配合node實(shí)現(xiàn)自定義上傳文件方式
這篇文章主要介紹了element-ui配合node實(shí)現(xiàn)自定義上傳文件方式,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2022-09-09vue中通過使用$attrs實(shí)現(xiàn)組件之間的數(shù)據(jù)傳遞功能
組件之間傳遞數(shù)據(jù)的方式有很多種,之所以有這么多種方式,是為了滿足在不同場(chǎng)景不同條件下的使用。這篇文章主要介紹了vue中通過使用$attrs實(shí)現(xiàn)組件之間的數(shù)據(jù)傳遞,需要的朋友可以參考下2019-09-09vue中的v-model原理,與組件自定義v-model詳解
這篇文章主要介紹了vue中的v-model原理,與組件自定義v-model詳解,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來看看吧2020-08-08