增加批量删除功能 调节分页器样式
This commit is contained in:
@@ -147,3 +147,23 @@ func GetAllApis(c *gin.Context) {
|
||||
response.OkWithDetailed(response.SysAPIListResponse{Apis: apis}, "获取成功", c)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// @Tags SysApi
|
||||
// @Summary 删除选中Api
|
||||
// @Security ApiKeyAuth
|
||||
// @accept application/json
|
||||
// @Produce application/json
|
||||
// @Param data body request.IdsReq true "ID"
|
||||
// @Success 200 {string} string "{"success":true,"data":{},"msg":"删除成功"}"
|
||||
// @Router /api/deleteApisByIds [delete]
|
||||
func DeleteApisByIds(c *gin.Context) {
|
||||
var ids request.IdsReq
|
||||
_ = c.ShouldBindJSON(&ids)
|
||||
if err := service.DeleteApisByIds(ids); err != nil {
|
||||
global.GVA_LOG.Error("删除失败!", zap.Any("err", err))
|
||||
response.FailWithMessage("删除失败", c)
|
||||
} else {
|
||||
response.OkWithMessage("删除成功",c)
|
||||
}
|
||||
}
|
@@ -15,5 +15,6 @@ func InitApiRouter(Router *gin.RouterGroup) {
|
||||
ApiRouter.POST("getApiById", v1.GetApiById) // 获取单条Api消息
|
||||
ApiRouter.POST("updateApi", v1.UpdateApi) // 更新api
|
||||
ApiRouter.POST("getAllApis", v1.GetAllApis) // 获取所有api
|
||||
ApiRouter.DELETE("deleteApisByIds", v1.DeleteApisByIds) // 删除选中api
|
||||
}
|
||||
}
|
||||
|
@@ -129,3 +129,17 @@ func UpdateApi(api model.SysApi) (err error) {
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
|
||||
//@author: [piexlmax](https://github.com/piexlmax)
|
||||
//@function: DeleteApis
|
||||
//@description: 删除选中API
|
||||
//@param: apis []model.SysApi
|
||||
//@return: err error
|
||||
|
||||
func DeleteApisByIds(ids request.IdsReq) (err error) {
|
||||
err = global.GVA_DB.Delete(&[]model.SysApi{},"id in ?",ids.Ids).Error
|
||||
return err
|
||||
return
|
||||
}
|
@@ -85,8 +85,11 @@ var apis = []model.SysApi{
|
||||
{global.GVA_MODEL{ID: 82, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/loadExcel", "下载excel", "excel", "GET"},
|
||||
{global.GVA_MODEL{ID: 83, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/exportExcel", "导出excel", "excel", "POST"},
|
||||
{global.GVA_MODEL{ID: 84, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/excel/downloadTemplate", "下载excel模板", "excel", "GET"},
|
||||
{global.GVA_MODEL{ID: 85, CreatedAt: time.Now(), UpdatedAt: time.Now()}, "/api/deleteApisByIds", "批量删除api", "api", "DELETE"},
|
||||
}
|
||||
|
||||
|
||||
|
||||
//@author: [SliverHorn](https://github.com/SliverHorn)
|
||||
//@description: sys_apis 表数据初始化
|
||||
func (a *api) Init() error {
|
||||
|
@@ -84,6 +84,7 @@ var carbines = []gormadapter.CasbinRule{
|
||||
{PType: "p", V0: "888", V1: "/excel/loadExcel", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/excel/exportExcel", V2: "POST"},
|
||||
{PType: "p", V0: "888", V1: "/excel/downloadTemplate", V2: "GET"},
|
||||
{PType: "p", V0: "888", V1: "/api/deleteApisByIds", V2: "DELETE"},
|
||||
{PType: "p", V0: "8881", V1: "/base/login", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/user/register", V2: "POST"},
|
||||
{PType: "p", V0: "8881", V1: "/api/createApi", V2: "POST"},
|
||||
|
Reference in New Issue
Block a user