mirror of
https://gitee.com/xiangheng/x_admin.git
synced 2025-10-06 16:47:06 +08:00
批量删除清理缓存
This commit is contained in:
1
admin/.vscode/settings.json
vendored
1
admin/.vscode/settings.json
vendored
@@ -11,6 +11,7 @@
|
|||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"brotli",
|
"brotli",
|
||||||
"btns",
|
"btns",
|
||||||
|
"daterange",
|
||||||
"datetimerange",
|
"datetimerange",
|
||||||
"echarts",
|
"echarts",
|
||||||
"execa",
|
"execa",
|
||||||
|
@@ -68,7 +68,7 @@ export function user_protocol_edit(data: type_user_protocol_edit) {
|
|||||||
export function user_protocol_delete(Id: number | string) {
|
export function user_protocol_delete(Id: number | string) {
|
||||||
return request.post<null>({ url: '/user_protocol/del', data: { Id } })
|
return request.post<null>({ url: '/user_protocol/del', data: { Id } })
|
||||||
}
|
}
|
||||||
// 用户协议批量删除
|
// 用户协议删除-批量
|
||||||
export function user_protocol_delete_batch(data: { Ids: string }) {
|
export function user_protocol_delete_batch(data: { Ids: string }) {
|
||||||
return request.post<null>({ url: '/user_protocol/delBatch', data })
|
return request.post<null>({ url: '/user_protocol/delBatch', data })
|
||||||
}
|
}
|
||||||
|
@@ -75,14 +75,14 @@ const formRules = {
|
|||||||
message: '请输入协议内容',
|
message: '请输入协议内容',
|
||||||
trigger: ['blur']
|
trigger: ['blur']
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
Sort: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '请输入排序',
|
||||||
|
trigger: ['blur']
|
||||||
|
}
|
||||||
]
|
]
|
||||||
// Sort: [
|
|
||||||
// {
|
|
||||||
// required: true,
|
|
||||||
// message: '请输入排序',
|
|
||||||
// trigger: ['blur']
|
|
||||||
// }
|
|
||||||
// ],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none mt-4" shadow="never">
|
<el-card class="!border-none mt-4" shadow="never">
|
||||||
<div>
|
<div class="text-right">
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['admin:user_protocol:add']"
|
v-perms="['admin:user_protocol:add']"
|
||||||
type="primary"
|
type="primary"
|
||||||
@@ -43,6 +43,7 @@
|
|||||||
新增
|
新增
|
||||||
</el-button>
|
</el-button>
|
||||||
<upload
|
<upload
|
||||||
|
v-perms="['admin:user_protocol:ImportFile']"
|
||||||
class="ml-3 mr-3"
|
class="ml-3 mr-3"
|
||||||
:url="user_protocol_import_file"
|
:url="user_protocol_import_file"
|
||||||
:data="{ cid: 0 }"
|
:data="{ cid: 0 }"
|
||||||
@@ -57,13 +58,16 @@
|
|||||||
导入
|
导入
|
||||||
</el-button>
|
</el-button>
|
||||||
</upload>
|
</upload>
|
||||||
<el-button type="primary" @click="exportFile">
|
<el-button
|
||||||
|
v-perms="['admin:user_protocol:ExportFile']"
|
||||||
|
type="primary"
|
||||||
|
@click="exportFile"
|
||||||
|
>
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Download" />
|
<icon name="el-icon-Download" />
|
||||||
</template>
|
</template>
|
||||||
导出
|
导出
|
||||||
</el-button>
|
</el-button>
|
||||||
|
|
||||||
<el-button
|
<el-button
|
||||||
v-perms="['admin:user_protocol:delBatch']"
|
v-perms="['admin:user_protocol:delBatch']"
|
||||||
type="danger"
|
type="danger"
|
||||||
@@ -123,9 +127,6 @@ import {
|
|||||||
} from '@/api/user/protocol'
|
} from '@/api/user/protocol'
|
||||||
import type { type_user_protocol, type_user_protocol_query } from '@/api/user/protocol'
|
import type { type_user_protocol, type_user_protocol_query } from '@/api/user/protocol'
|
||||||
|
|
||||||
import { useDictData, useListAllData } from '@/hooks/useDictOptions'
|
|
||||||
import type { type_dict } from '@/hooks/useDictOptions'
|
|
||||||
|
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
import EditPopup from './edit.vue'
|
import EditPopup from './edit.vue'
|
||||||
@@ -166,6 +167,7 @@ const handleSelectionChange = (val: type_user_protocol[]) => {
|
|||||||
console.log(val)
|
console.log(val)
|
||||||
multipleSelection.value = val
|
multipleSelection.value = val
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDelete = async (Id: number) => {
|
const handleDelete = async (Id: number) => {
|
||||||
try {
|
try {
|
||||||
await feedback.confirm('确定要删除?')
|
await feedback.confirm('确定要删除?')
|
||||||
@@ -189,6 +191,7 @@ const deleteBatch = async () => {
|
|||||||
getLists()
|
getLists()
|
||||||
} catch (error) {}
|
} catch (error) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const exportFile = async () => {
|
const exportFile = async () => {
|
||||||
try {
|
try {
|
||||||
await feedback.confirm('确定要导出?')
|
await feedback.confirm('确定要导出?')
|
||||||
|
118
admin/typings/element-plus.d.ts
vendored
118
admin/typings/element-plus.d.ts
vendored
@@ -1,118 +0,0 @@
|
|||||||
// 复制node_modules\element-plus\global.d.ts
|
|
||||||
// 更改'@vue/runtime-core'为'vue'
|
|
||||||
|
|
||||||
// GlobalComponents for Volar
|
|
||||||
declare module 'vue' {
|
|
||||||
export interface GlobalComponents {
|
|
||||||
ElAffix: (typeof import('element-plus'))['ElAffix']
|
|
||||||
ElAlert: (typeof import('element-plus'))['ElAlert']
|
|
||||||
ElAside: (typeof import('element-plus'))['ElAside']
|
|
||||||
ElAutocomplete: (typeof import('element-plus'))['ElAutocomplete']
|
|
||||||
ElAvatar: (typeof import('element-plus'))['ElAvatar']
|
|
||||||
ElBacktop: (typeof import('element-plus'))['ElBacktop']
|
|
||||||
ElBadge: (typeof import('element-plus'))['ElBadge']
|
|
||||||
ElBreadcrumb: (typeof import('element-plus'))['ElBreadcrumb']
|
|
||||||
ElBreadcrumbItem: (typeof import('element-plus'))['ElBreadcrumbItem']
|
|
||||||
ElButton: (typeof import('element-plus'))['ElButton']
|
|
||||||
ElButtonGroup: (typeof import('element-plus'))['ElButtonGroup']
|
|
||||||
ElCalendar: (typeof import('element-plus'))['ElCalendar']
|
|
||||||
ElCard: (typeof import('element-plus'))['ElCard']
|
|
||||||
ElCarousel: (typeof import('element-plus'))['ElCarousel']
|
|
||||||
ElCarouselItem: (typeof import('element-plus'))['ElCarouselItem']
|
|
||||||
ElCascader: (typeof import('element-plus'))['ElCascader']
|
|
||||||
ElCascaderPanel: (typeof import('element-plus'))['ElCascaderPanel']
|
|
||||||
ElCheckbox: (typeof import('element-plus'))['ElCheckbox']
|
|
||||||
ElCheckboxButton: (typeof import('element-plus'))['ElCheckboxButton']
|
|
||||||
ElCheckboxGroup: (typeof import('element-plus'))['ElCheckboxGroup']
|
|
||||||
ElCol: (typeof import('element-plus'))['ElCol']
|
|
||||||
ElCollapse: (typeof import('element-plus'))['ElCollapse']
|
|
||||||
ElCollapseItem: (typeof import('element-plus'))['ElCollapseItem']
|
|
||||||
ElCollapseTransition: (typeof import('element-plus'))['ElCollapseTransition']
|
|
||||||
ElColorPicker: (typeof import('element-plus'))['ElColorPicker']
|
|
||||||
ElContainer: (typeof import('element-plus'))['ElContainer']
|
|
||||||
ElConfigProvider: (typeof import('element-plus'))['ElConfigProvider']
|
|
||||||
ElDatePicker: (typeof import('element-plus'))['ElDatePicker']
|
|
||||||
ElDialog: (typeof import('element-plus'))['ElDialog']
|
|
||||||
ElDivider: (typeof import('element-plus'))['ElDivider']
|
|
||||||
ElDrawer: (typeof import('element-plus'))['ElDrawer']
|
|
||||||
ElDropdown: (typeof import('element-plus'))['ElDropdown']
|
|
||||||
ElDropdownItem: (typeof import('element-plus'))['ElDropdownItem']
|
|
||||||
ElDropdownMenu: (typeof import('element-plus'))['ElDropdownMenu']
|
|
||||||
ElEmpty: (typeof import('element-plus'))['ElEmpty']
|
|
||||||
ElFooter: (typeof import('element-plus'))['ElFooter']
|
|
||||||
ElForm: (typeof import('element-plus'))['ElForm']
|
|
||||||
ElFormItem: (typeof import('element-plus'))['ElFormItem']
|
|
||||||
ElHeader: (typeof import('element-plus'))['ElHeader']
|
|
||||||
ElIcon: (typeof import('element-plus'))['ElIcon']
|
|
||||||
ElImage: (typeof import('element-plus'))['ElImage']
|
|
||||||
ElImageViewer: (typeof import('element-plus'))['ElImageViewer']
|
|
||||||
ElInput: (typeof import('element-plus'))['ElInput']
|
|
||||||
ElInputNumber: (typeof import('element-plus'))['ElInputNumber']
|
|
||||||
ElLink: (typeof import('element-plus'))['ElLink']
|
|
||||||
ElMain: (typeof import('element-plus'))['ElMain']
|
|
||||||
ElMenu: (typeof import('element-plus'))['ElMenu']
|
|
||||||
ElMenuItem: (typeof import('element-plus'))['ElMenuItem']
|
|
||||||
ElMenuItemGroup: (typeof import('element-plus'))['ElMenuItemGroup']
|
|
||||||
ElOption: (typeof import('element-plus'))['ElOption']
|
|
||||||
ElOptionGroup: (typeof import('element-plus'))['ElOptionGroup']
|
|
||||||
ElPageHeader: (typeof import('element-plus'))['ElPageHeader']
|
|
||||||
ElPagination: (typeof import('element-plus'))['ElPagination']
|
|
||||||
ElPopconfirm: (typeof import('element-plus'))['ElPopconfirm']
|
|
||||||
ElPopper: (typeof import('element-plus'))['ElPopper']
|
|
||||||
ElPopover: (typeof import('element-plus'))['ElPopover']
|
|
||||||
ElProgress: (typeof import('element-plus'))['ElProgress']
|
|
||||||
ElRadio: (typeof import('element-plus'))['ElRadio']
|
|
||||||
ElRadioButton: (typeof import('element-plus'))['ElRadioButton']
|
|
||||||
ElRadioGroup: (typeof import('element-plus'))['ElRadioGroup']
|
|
||||||
ElRate: (typeof import('element-plus'))['ElRate']
|
|
||||||
ElRow: (typeof import('element-plus'))['ElRow']
|
|
||||||
ElScrollbar: (typeof import('element-plus'))['ElScrollbar']
|
|
||||||
ElSelect: (typeof import('element-plus'))['ElSelect']
|
|
||||||
ElSlider: (typeof import('element-plus'))['ElSlider']
|
|
||||||
ElStep: (typeof import('element-plus'))['ElStep']
|
|
||||||
ElSteps: (typeof import('element-plus'))['ElSteps']
|
|
||||||
ElSubMenu: (typeof import('element-plus'))['ElSubMenu']
|
|
||||||
ElSwitch: (typeof import('element-plus'))['ElSwitch']
|
|
||||||
ElTabPane: (typeof import('element-plus'))['ElTabPane']
|
|
||||||
ElTable: (typeof import('element-plus'))['ElTable']
|
|
||||||
ElTableColumn: (typeof import('element-plus'))['ElTableColumn']
|
|
||||||
ElTabs: (typeof import('element-plus'))['ElTabs']
|
|
||||||
ElTag: (typeof import('element-plus'))['ElTag']
|
|
||||||
ElText: (typeof import('element-plus'))['ElText']
|
|
||||||
ElTimePicker: (typeof import('element-plus'))['ElTimePicker']
|
|
||||||
ElTimeSelect: (typeof import('element-plus'))['ElTimeSelect']
|
|
||||||
ElTimeline: (typeof import('element-plus'))['ElTimeline']
|
|
||||||
ElTimelineItem: (typeof import('element-plus'))['ElTimelineItem']
|
|
||||||
ElTooltip: (typeof import('element-plus'))['ElTooltip']
|
|
||||||
ElTransfer: (typeof import('element-plus'))['ElTransfer']
|
|
||||||
ElTree: (typeof import('element-plus'))['ElTree']
|
|
||||||
ElTreeV2: (typeof import('element-plus'))['ElTreeV2']
|
|
||||||
ElTreeSelect: (typeof import('element-plus'))['ElTreeSelect']
|
|
||||||
ElUpload: (typeof import('element-plus'))['ElUpload']
|
|
||||||
ElSpace: (typeof import('element-plus'))['ElSpace']
|
|
||||||
ElSkeleton: (typeof import('element-plus'))['ElSkeleton']
|
|
||||||
ElSkeletonItem: (typeof import('element-plus'))['ElSkeletonItem']
|
|
||||||
ElStatistic: (typeof import('element-plus'))['ElStatistic']
|
|
||||||
ElCheckTag: (typeof import('element-plus'))['ElCheckTag']
|
|
||||||
ElDescriptions: (typeof import('element-plus'))['ElDescriptions']
|
|
||||||
ElDescriptionsItem: (typeof import('element-plus'))['ElDescriptionsItem']
|
|
||||||
ElResult: (typeof import('element-plus'))['ElResult']
|
|
||||||
ElSelectV2: (typeof import('element-plus'))['ElSelectV2']
|
|
||||||
ElWatermark: (typeof import('element-plus'))['ElWatermark']
|
|
||||||
ElTour: (typeof import('element-plus'))['ElTour']
|
|
||||||
ElTourStep: (typeof import('element-plus'))['ElTourStep']
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentCustomProperties {
|
|
||||||
$message: (typeof import('element-plus'))['ElMessage']
|
|
||||||
$notify: (typeof import('element-plus'))['ElNotification']
|
|
||||||
$msgbox: (typeof import('element-plus'))['ElMessageBox']
|
|
||||||
$messageBox: (typeof import('element-plus'))['ElMessageBox']
|
|
||||||
$alert: (typeof import('element-plus'))['ElMessageBox']['alert']
|
|
||||||
$confirm: (typeof import('element-plus'))['ElMessageBox']['confirm']
|
|
||||||
$prompt: (typeof import('element-plus'))['ElMessageBox']['prompt']
|
|
||||||
$loading: (typeof import('element-plus'))['ElLoadingService']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export {}
|
|
@@ -3,6 +3,7 @@ package {{{ .ModuleName }}}
|
|||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"x_admin/core/request"
|
"x_admin/core/request"
|
||||||
|
@@ -196,7 +196,14 @@ func (service {{{ toCamelCase .EntityName }}}Service) Del({{{ toUpperCamelCase .
|
|||||||
func (service {{{ toCamelCase .EntityName }}}Service) DelBatch(Ids []string) (e error) {
|
func (service {{{ toCamelCase .EntityName }}}Service) DelBatch(Ids []string) (e error) {
|
||||||
var obj model.{{{ toUpperCamelCase .EntityName }}}
|
var obj model.{{{ toUpperCamelCase .EntityName }}}
|
||||||
err := service.db.Where("{{{ $.PrimaryKey }}} in (?)", Ids).Delete(&obj).Error
|
err := service.db.Where("{{{ $.PrimaryKey }}} in (?)", Ids).Delete(&obj).Error
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// 删除缓存
|
||||||
|
for _, v := range Ids {
|
||||||
|
cacheUtil.RemoveCache(v)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取Excel的列
|
// 获取Excel的列
|
||||||
|
@@ -54,7 +54,7 @@
|
|||||||
</el-form>
|
</el-form>
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-card class="!border-none mt-4" shadow="never">
|
<el-card class="!border-none mt-4" shadow="never">
|
||||||
<div>
|
<div class="text-right">
|
||||||
<el-button v-perms="['admin:{{{ .ModuleName }}}:add']" type="primary" @click="handleAdd()">
|
<el-button v-perms="['admin:{{{ .ModuleName }}}:add']" type="primary" @click="handleAdd()">
|
||||||
<template #icon>
|
<template #icon>
|
||||||
<icon name="el-icon-Plus" />
|
<icon name="el-icon-Plus" />
|
||||||
|
@@ -139,8 +139,9 @@ func (hd *UserProtocolHandler) Del(c *gin.Context) {
|
|||||||
response.CheckAndResp(c, UserProtocolService.Del(delReq.Id))
|
response.CheckAndResp(c, UserProtocolService.Del(delReq.Id))
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Summary 用户协议批量删除
|
// @Summary 用户协议删除-批量
|
||||||
// @Tags user_protocol-用户协议
|
// @Tags user_protocol-用户协议
|
||||||
|
//
|
||||||
// @Produce json
|
// @Produce json
|
||||||
// @Param Token header string true "token"
|
// @Param Token header string true "token"
|
||||||
// @Param Ids body string false "逗号分割的id"
|
// @Param Ids body string false "逗号分割的id"
|
||||||
@@ -156,9 +157,7 @@ func (hd *UserProtocolHandler) DelBatch(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
var Ids = strings.Split(delReq.Ids, ",")
|
var Ids = strings.Split(delReq.Ids, ",")
|
||||||
// if response.IsFailWithResp(c, util.VerifyUtil.VerifyJSON(c, &delReq)) {
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
response.CheckAndResp(c, UserProtocolService.DelBatch(Ids))
|
response.CheckAndResp(c, UserProtocolService.DelBatch(Ids))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,54 +1,58 @@
|
|||||||
package user_protocol
|
package user_protocol
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"x_admin/core"
|
"x_admin/core"
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// UserProtocolListReq 用户协议列表参数
|
//UserProtocolListReq 用户协议列表参数
|
||||||
type UserProtocolListReq struct {
|
type UserProtocolListReq struct {
|
||||||
Title *string `` // 标题
|
Title *string // 标题
|
||||||
Content *string `` // 协议内容
|
Content *string // 协议内容
|
||||||
Sort *float64 `` // 排序
|
Sort *float64 // 排序
|
||||||
CreateTimeStart *string `` // 开始创建时间
|
CreateTimeStart *string // 开始创建时间
|
||||||
CreateTimeEnd *string `` // 结束创建时间
|
CreateTimeEnd *string // 结束创建时间
|
||||||
UpdateTimeStart *string `` // 开始更新时间
|
UpdateTimeStart *string // 开始更新时间
|
||||||
UpdateTimeEnd *string `` // 结束更新时间
|
UpdateTimeEnd *string // 结束更新时间
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserProtocolAddReq 用户协议新增参数
|
|
||||||
|
|
||||||
|
//UserProtocolAddReq 用户协议新增参数
|
||||||
type UserProtocolAddReq struct {
|
type UserProtocolAddReq struct {
|
||||||
Title *string `` // 标题
|
Title *string // 标题
|
||||||
Content *string `` // 协议内容
|
Content *string // 协议内容
|
||||||
Sort core.NullFloat `` // 排序
|
Sort core.NullFloat // 排序
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserProtocolEditReq 用户协议编辑参数
|
//UserProtocolEditReq 用户协议编辑参数
|
||||||
type UserProtocolEditReq struct {
|
type UserProtocolEditReq struct {
|
||||||
Id int `` //
|
Id int //
|
||||||
Title *string `` // 标题
|
Title *string // 标题
|
||||||
Content *string `` // 协议内容
|
Content *string // 协议内容
|
||||||
Sort core.NullFloat `` // 排序
|
Sort core.NullFloat // 排序
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserProtocolDetailReq 用户协议详情参数
|
//UserProtocolDetailReq 用户协议详情参数
|
||||||
type UserProtocolDetailReq struct {
|
type UserProtocolDetailReq struct {
|
||||||
Id int `` //
|
Id int //
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserProtocolDelReq 用户协议删除参数
|
//UserProtocolDelReq 用户协议删除参数
|
||||||
type UserProtocolDelReq struct {
|
type UserProtocolDelReq struct {
|
||||||
Id int `` //
|
Id int //
|
||||||
}
|
|
||||||
type UserProtocolDelBatchReq struct {
|
|
||||||
Ids string `` //
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserProtocolResp 用户协议返回信息
|
//UserProtocolDelReq 用户协议批量删除参数
|
||||||
type UserProtocolResp struct {
|
type UserProtocolDelBatchReq struct {
|
||||||
Id int `` //
|
Ids string
|
||||||
Title string `` // 标题
|
}
|
||||||
Content string `` // 协议内容
|
|
||||||
Sort core.NullFloat `` // 排序
|
//UserProtocolResp 用户协议返回信息
|
||||||
CreateTime core.NullTime `` // 创建时间
|
type UserProtocolResp struct {
|
||||||
UpdateTime core.NullTime `` // 更新时间
|
Id int //
|
||||||
|
Title string // 标题
|
||||||
|
Content string // 协议内容
|
||||||
|
Sort core.NullFloat // 排序
|
||||||
|
CreateTime core.NullTime // 创建时间
|
||||||
|
UpdateTime core.NullTime // 更新时间
|
||||||
}
|
}
|
||||||
|
@@ -177,10 +177,17 @@ func (service userProtocolService) Del(Id int) (e error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DelBatch 用户协议-批量删除
|
// DelBatch 用户协议-批量删除
|
||||||
func (service userProtocolService) DelBatch(IdsArr []string) (e error) {
|
func (service userProtocolService) DelBatch(Ids []string) (e error) {
|
||||||
var obj model.UserProtocol
|
var obj model.UserProtocol
|
||||||
err := service.db.Where("id in (?)", IdsArr).Delete(&obj).Error
|
err := service.db.Where("id in (?)", Ids).Delete(&obj).Error
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
// 删除缓存
|
||||||
|
for _, v := range Ids {
|
||||||
|
cacheUtil.RemoveCache(v)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取Excel的列
|
// 获取Excel的列
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
package admin
|
package admin
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"x_admin/admin/user_protocol"
|
|
||||||
"x_admin/middleware"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"x_admin/middleware"
|
||||||
|
"x_admin/admin/user_protocol"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,12 +13,13 @@ import (
|
|||||||
- 下载并解压压缩包后,直接复制server、admin文件夹到项目根目录即可
|
- 下载并解压压缩包后,直接复制server、admin文件夹到项目根目录即可
|
||||||
|
|
||||||
2. 注册路由
|
2. 注册路由
|
||||||
请在 admin/entry.go 文件引入UserProtocolRoute注册路由
|
请在 router/admin/entry.go 文件引入 UserProtocolRoute 注册路由
|
||||||
|
|
||||||
3. 后台手动添加菜单和按钮
|
3. 后台手动添加菜单和按钮
|
||||||
admin:user_protocol:add
|
admin:user_protocol:add
|
||||||
admin:user_protocol:edit
|
admin:user_protocol:edit
|
||||||
admin:user_protocol:del
|
admin:user_protocol:del
|
||||||
|
admin:user_protocol:delBatch
|
||||||
admin:user_protocol:list
|
admin:user_protocol:list
|
||||||
admin:user_protocol:listAll
|
admin:user_protocol:listAll
|
||||||
admin:user_protocol:detail
|
admin:user_protocol:detail
|
||||||
@@ -33,7 +33,7 @@ INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, paths, component, is
|
|||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议添加','admin:user_protocol:add', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议添加','admin:user_protocol:add', 0, 1, 0, now(), now());
|
||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议编辑','admin:user_protocol:edit', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议编辑','admin:user_protocol:edit', 0, 1, 0, now(), now());
|
||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议删除','admin:user_protocol:del', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议删除','admin:user_protocol:del', 0, 1, 0, now(), now());
|
||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议批量删除','admin:user_protocol:delBatch', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议删除-批量','admin:user_protocol:delBatch', 0, 1, 0, now(), now());
|
||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议列表','admin:user_protocol:list', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议列表','admin:user_protocol:list', 0, 1, 0, now(), now());
|
||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议全部列表','admin:user_protocol:listAll', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议全部列表','admin:user_protocol:listAll', 0, 1, 0, now(), now());
|
||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议详情','admin:user_protocol:detail', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议详情','admin:user_protocol:detail', 0, 1, 0, now(), now());
|
||||||
@@ -41,6 +41,7 @@ INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_sh
|
|||||||
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议导入excel','admin:user_protocol:ImportFile', 0, 1, 0, now(), now());
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议导入excel','admin:user_protocol:ImportFile', 0, 1, 0, now(), now());
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// UserProtocolRoute(rg)
|
// UserProtocolRoute(rg)
|
||||||
func UserProtocolRoute(rg *gin.RouterGroup) {
|
func UserProtocolRoute(rg *gin.RouterGroup) {
|
||||||
handle := user_protocol.UserProtocolHandler{}
|
handle := user_protocol.UserProtocolHandler{}
|
||||||
@@ -49,12 +50,13 @@ func UserProtocolRoute(rg *gin.RouterGroup) {
|
|||||||
r.GET("/user_protocol/list", handle.List)
|
r.GET("/user_protocol/list", handle.List)
|
||||||
r.GET("/user_protocol/listAll", handle.ListAll)
|
r.GET("/user_protocol/listAll", handle.ListAll)
|
||||||
r.GET("/user_protocol/detail", handle.Detail)
|
r.GET("/user_protocol/detail", handle.Detail)
|
||||||
r.POST("/user_protocol/add", middleware.RecordLog("用户协议新增"), handle.Add)
|
|
||||||
r.POST("/user_protocol/edit", middleware.RecordLog("用户协议编辑"), handle.Edit)
|
|
||||||
r.POST("/user_protocol/del", middleware.RecordLog("用户协议删除"), handle.Del)
|
|
||||||
|
|
||||||
r.POST("/user_protocol/delBatch", middleware.RecordLog("用户协议批量删除"), handle.DelBatch)
|
r.POST("/user_protocol/add",middleware.RecordLog("用户协议新增"), handle.Add)
|
||||||
|
r.POST("/user_protocol/edit",middleware.RecordLog("用户协议编辑"), handle.Edit)
|
||||||
|
|
||||||
|
r.POST("/user_protocol/del", middleware.RecordLog("用户协议删除"), handle.Del)
|
||||||
|
r.POST("/user_protocol/delBatch", middleware.RecordLog("用户协议删除-批量"), handle.DelBatch)
|
||||||
|
|
||||||
r.GET("/user_protocol/ExportFile", middleware.RecordLog("用户协议导出"), handle.ExportFile)
|
r.GET("/user_protocol/ExportFile", middleware.RecordLog("用户协议导出"), handle.ExportFile)
|
||||||
r.POST("/user_protocol/ImportFile", handle.ImportFile)
|
r.POST("/user_protocol/ImportFile", handle.ImportFile)
|
||||||
}
|
}
|
56
server/routes/admin/user_protocol_route.go
Normal file
56
server/routes/admin/user_protocol_route.go
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
package admin
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"x_admin/middleware"
|
||||||
|
"x_admin/admin/user_protocol"
|
||||||
|
)
|
||||||
|
|
||||||
|
/**
|
||||||
|
集成
|
||||||
|
1. 导入
|
||||||
|
- 请先提交git避免文件覆盖!!!
|
||||||
|
- 下载并解压压缩包后,直接复制server、admin文件夹到项目根目录即可
|
||||||
|
|
||||||
|
2. 注册路由
|
||||||
|
请在 router/admin/entry.go 文件引入 UserProtocolRoute 注册路由
|
||||||
|
|
||||||
|
3. 后台手动添加菜单和按钮
|
||||||
|
admin:user_protocol:add
|
||||||
|
admin:user_protocol:edit
|
||||||
|
admin:user_protocol:del
|
||||||
|
admin:user_protocol:list
|
||||||
|
admin:user_protocol:listAll
|
||||||
|
admin:user_protocol:detail
|
||||||
|
admin:user_protocol:ExportFile
|
||||||
|
admin:user_protocol:ImportFile
|
||||||
|
|
||||||
|
// 列表-先添加菜单获取菜单id
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, paths, component, is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'C', '用户协议', 'user/protocol/index', 'user/protocol/index', 0, 1, 0, now(), now());
|
||||||
|
按钮-替换pid参数为菜单id
|
||||||
|
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议添加','admin:user_protocol:add', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议编辑','admin:user_protocol:edit', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议删除','admin:user_protocol:del', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议列表','admin:user_protocol:list', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议全部列表','admin:user_protocol:listAll', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议详情','admin:user_protocol:detail', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议导出excel','admin:user_protocol:ExportFile', 0, 1, 0, now(), now());
|
||||||
|
INSERT INTO x_system_auth_menu (pid, menu_type, menu_name, perms,is_cache, is_show, is_disable, create_time, update_time) VALUES (0, 'A', '用户协议导入excel','admin:user_protocol:ImportFile', 0, 1, 0, now(), now());
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
// UserProtocolRoute(rg)
|
||||||
|
func UserProtocolRoute(rg *gin.RouterGroup) {
|
||||||
|
handle := user_protocol.UserProtocolHandler{}
|
||||||
|
|
||||||
|
r := rg.Group("/", middleware.TokenAuth())
|
||||||
|
r.GET("/user_protocol/list", handle.List)
|
||||||
|
r.GET("/user_protocol/listAll", handle.ListAll)
|
||||||
|
r.GET("/user_protocol/detail", handle.Detail)
|
||||||
|
r.POST("/user_protocol/add",middleware.RecordLog("用户协议新增"), handle.Add)
|
||||||
|
r.POST("/user_protocol/edit",middleware.RecordLog("用户协议编辑"), handle.Edit)
|
||||||
|
r.POST("/user_protocol/del", middleware.RecordLog("用户协议删除"), handle.Del)
|
||||||
|
r.GET("/user_protocol/ExportFile", middleware.RecordLog("用户协议导出"), handle.ExportFile)
|
||||||
|
r.POST("/user_protocol/ImportFile", handle.ImportFile)
|
||||||
|
}
|
Reference in New Issue
Block a user