refactor🎨: 缩减函数名称
This commit is contained in:
1 parent
bb77450f2c
commit
6e01c13e1c
23 files changed
+326
-377
No files matched your search
+10
-10
@@ -17,7 +17,7 @@ type SysApi struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// GetSysApiList 获取接口管理列表
|
||||
// GetPage 获取接口管理列表
|
||||
// @Summary 获取接口管理列表
|
||||
// @Description 获取接口管理列表
|
||||
// @Tags 接口管理
|
||||
@@ -30,7 +30,7 @@ type SysApi struct {
|
||||
// @Success 200 {object} response.Response{data=response.Page{list=[]models.SysApi}} "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-api [get]
|
||||
// @Security Bearer
|
||||
func (e SysApi) GetSysApiList(c *gin.Context) {
|
||||
func (e SysApi) GetPage(c *gin.Context) {
|
||||
s := service.SysApi{}
|
||||
req := dto.SysApiSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -47,7 +47,7 @@ func (e SysApi) GetSysApiList(c *gin.Context) {
|
||||
p := actions.GetPermissionFromContext(c)
|
||||
list := make([]models.SysApi, 0)
|
||||
var count int64
|
||||
err = s.GetSysApiPage(&req, p, &list, &count)
|
||||
err = s.GetPage(&req, p, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -55,7 +55,7 @@ func (e SysApi) GetSysApiList(c *gin.Context) {
|
||||
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
|
||||
}
|
||||
|
||||
// GetSysApi 获取接口管理
|
||||
// Get 获取接口管理
|
||||
// @Summary 获取接口管理
|
||||
// @Description 获取接口管理
|
||||
// @Tags 接口管理
|
||||
@@ -63,7 +63,7 @@ func (e SysApi) GetSysApiList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response{data=models.SysApi} "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-api/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysApi) GetSysApi(c *gin.Context) {
|
||||
func (e SysApi) Get(c *gin.Context) {
|
||||
req := dto.SysApiById{}
|
||||
s := service.SysApi{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -78,7 +78,7 @@ func (e SysApi) GetSysApi(c *gin.Context) {
|
||||
}
|
||||
p := actions.GetPermissionFromContext(c)
|
||||
var object models.SysApi
|
||||
err = s.GetSysApi(&req, p, &object).Error
|
||||
err = s.Get(&req, p, &object).Error
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -86,7 +86,7 @@ func (e SysApi) GetSysApi(c *gin.Context) {
|
||||
e.OK(object, "查看成功")
|
||||
}
|
||||
|
||||
// UpdateSysApi 修改接口管理
|
||||
// Update 修改接口管理
|
||||
// @Summary 修改接口管理
|
||||
// @Description 修改接口管理
|
||||
// @Tags 接口管理
|
||||
@@ -96,7 +96,7 @@ func (e SysApi) GetSysApi(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
|
||||
// @Router /api/v1/sys-api/{id} [put]
|
||||
// @Security Bearer
|
||||
func (e SysApi) UpdateSysApi(c *gin.Context) {
|
||||
func (e SysApi) Update(c *gin.Context) {
|
||||
req := dto.SysApiControl{}
|
||||
s := service.SysApi{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -110,7 +110,7 @@ func (e SysApi) UpdateSysApi(c *gin.Context) {
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
p := actions.GetPermissionFromContext(c)
|
||||
err = s.UpdateSysApi(&req, p)
|
||||
err = s.Update(&req, p)
|
||||
if err != nil {
|
||||
e.Error(500, err, "更新失败")
|
||||
return
|
||||
@@ -140,7 +140,7 @@ func (e SysApi) DeleteSysApi(c *gin.Context) {
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
p := actions.GetPermissionFromContext(c)
|
||||
err = s.RemoveSysApi(&req, p)
|
||||
err = s.Remove(&req, p)
|
||||
if err != nil {
|
||||
e.Error(500, err, "删除失败")
|
||||
return
|
||||
|
||||
+143
-143
@@ -15,7 +15,7 @@ type SysConfig struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// GetSysConfigList 获取配置管理列表
|
||||
// GetList 获取配置管理列表
|
||||
// @Summary 获取配置管理列表
|
||||
// @Description 获取配置管理列表
|
||||
// @Tags 配置管理
|
||||
@@ -28,7 +28,7 @@ type SysConfig struct {
|
||||
// @Success 200 {object} response.Response{data=response.Page{list=[]models.SysApi}} "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-config [get]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) GetSysConfigList(c *gin.Context) {
|
||||
func (e SysConfig) GetList(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -43,7 +43,7 @@ func (e SysConfig) GetSysConfigList(c *gin.Context) {
|
||||
|
||||
list := make([]models.SysConfig, 0)
|
||||
var count int64
|
||||
err = s.GetSysConfigPage(&req, &list, &count)
|
||||
err = s.GetPage(&req, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -51,6 +51,134 @@ func (e SysConfig) GetSysConfigList(c *gin.Context) {
|
||||
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
|
||||
}
|
||||
|
||||
// Get 获取配置管理
|
||||
// @Summary 获取配置管理
|
||||
// @Description 获取配置管理
|
||||
// @Tags 配置管理
|
||||
// @Param id path string false "id"
|
||||
// @Success 200 {object} response.Response{data=models.SysConfig} "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-config/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) Get(c *gin.Context) {
|
||||
req := dto.SysConfigById{}
|
||||
s := service.SysConfig{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
var object models.SysConfig
|
||||
|
||||
err = s.Get(&req, &object)
|
||||
if err != nil {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(object, "查看成功")
|
||||
}
|
||||
|
||||
// Insert 创建配置管理
|
||||
// @Summary 创建配置管理
|
||||
// @Description 创建配置管理
|
||||
// @Tags 配置管理
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.SysConfigControl true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "创建成功"}"
|
||||
// @Router /api/v1/sys-config [post]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) Insert(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
req.SetCreateBy(user.GetUserId(c))
|
||||
|
||||
err = s.Insert(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "创建失败")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "创建成功")
|
||||
}
|
||||
|
||||
// Update 修改配置管理
|
||||
// @Summary 修改配置管理
|
||||
// @Description 修改配置管理
|
||||
// @Tags 配置管理
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.SysConfigControl true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
|
||||
// @Router /api/v1/sys-config/{id} [put]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) Update(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
err = s.Update(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "更新失败")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "更新成功")
|
||||
}
|
||||
|
||||
// Delete 删除配置管理
|
||||
// @Summary 删除配置管理
|
||||
// @Description 删除配置管理
|
||||
// @Tags 配置管理
|
||||
// @Param ids body []int false "ids"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
|
||||
// @Router /api/v1/sys-config [delete]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) Delete(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
|
||||
err = s.Remove(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "删除失败")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
|
||||
// GetSysConfigBySysApp 获取系统配置信息
|
||||
// @Summary 获取系统前台配置信息,主要注意这里不在验证数据权限
|
||||
// @Description 获取系统配置信息,主要注意这里不在验证数据权限
|
||||
@@ -73,7 +201,7 @@ func (e SysConfig) GetSysConfigBySysApp(c *gin.Context) {
|
||||
// 控制只读前台的数据
|
||||
req.IsFrontend = 1
|
||||
list := make([]models.SysConfig, 0)
|
||||
err = s.GetSysConfigByKey(&req, &list)
|
||||
err = s.GetWithKeyList(&req, &list)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -88,104 +216,7 @@ func (e SysConfig) GetSysConfigBySysApp(c *gin.Context) {
|
||||
e.OK(mp, "查询成功")
|
||||
}
|
||||
|
||||
// GetSysConfig 获取配置管理
|
||||
// @Summary 获取配置管理
|
||||
// @Description 获取配置管理
|
||||
// @Tags 配置管理
|
||||
// @Param id path string false "id"
|
||||
// @Success 200 {object} response.Response{data=models.SysConfig} "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-config/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) GetSysConfig(c *gin.Context) {
|
||||
req := dto.SysConfigById{}
|
||||
s := service.SysConfig{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
var object models.SysConfig
|
||||
|
||||
err = s.GetSysConfig(&req, &object)
|
||||
if err != nil {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
e.OK(object, "查看成功")
|
||||
}
|
||||
|
||||
// InsertSysConfig 创建配置管理
|
||||
// @Summary 创建配置管理
|
||||
// @Description 创建配置管理
|
||||
// @Tags 配置管理
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.SysConfigControl true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "创建成功"}"
|
||||
// @Router /api/v1/sys-config [post]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) InsertSysConfig(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
req.SetCreateBy(user.GetUserId(c))
|
||||
|
||||
err = s.InsertSysConfig(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "创建失败")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "创建成功")
|
||||
}
|
||||
|
||||
// UpdateSysConfig 修改配置管理
|
||||
// @Summary 修改配置管理
|
||||
// @Description 修改配置管理
|
||||
// @Tags 配置管理
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.SysConfigControl true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
|
||||
// @Router /api/v1/sys-config/{id} [put]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) UpdateSysConfig(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
err = s.UpdateSysConfig(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "更新失败")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "更新成功")
|
||||
}
|
||||
|
||||
// GetSetSysConfig 获取配置
|
||||
// Get2Set 获取配置
|
||||
// @Summary 获取配置
|
||||
// @Description 界面操作设置配置值的获取
|
||||
// @Tags 配置管理
|
||||
@@ -194,9 +225,9 @@ func (e SysConfig) UpdateSysConfig(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response{data=map[string]interface{}} "{"code": 200, "message": "修改成功"}"
|
||||
// @Router /api/v1/set-config [get]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) GetSetSysConfig(c *gin.Context) {
|
||||
func (e SysConfig) Get2Set(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := make([]dto.GetSetSysConfigReq, 1)
|
||||
req := make([]dto.GetSetSysConfigReq, 0)
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
MakeService(&s.Service).
|
||||
@@ -206,7 +237,7 @@ func (e SysConfig) GetSetSysConfig(c *gin.Context) {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
err = s.GetSetSysConfig(&req)
|
||||
err = s.GetForSet(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -218,7 +249,7 @@ func (e SysConfig) GetSetSysConfig(c *gin.Context) {
|
||||
e.OK(m, "查询成功")
|
||||
}
|
||||
|
||||
// UpdateSetSysConfig 设置配置
|
||||
// Update2Set 设置配置
|
||||
// @Summary 设置配置
|
||||
// @Description 界面操作设置配置值
|
||||
// @Tags 配置管理
|
||||
@@ -228,12 +259,12 @@ func (e SysConfig) GetSetSysConfig(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "修改成功"}"
|
||||
// @Router /api/v1/set-config [put]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) UpdateSetSysConfig(c *gin.Context) {
|
||||
func (e SysConfig) Update2Set(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
d := make([]dto.GetSetSysConfigReq, 0)
|
||||
req := make([]dto.GetSetSysConfigReq, 0)
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&d).
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -242,7 +273,7 @@ func (e SysConfig) UpdateSetSysConfig(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.UpdateSetSysConfig(&d)
|
||||
err = s.UpdateForSet(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
@@ -251,37 +282,6 @@ func (e SysConfig) UpdateSetSysConfig(c *gin.Context) {
|
||||
e.OK("", "更新成功")
|
||||
}
|
||||
|
||||
// DeleteSysConfig 删除配置管理
|
||||
// @Summary 删除配置管理
|
||||
// @Description 删除配置管理
|
||||
// @Tags 配置管理
|
||||
// @Param ids body []int false "ids"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "message": "删除成功"}"
|
||||
// @Router /api/v1/sys-config [delete]
|
||||
// @Security Bearer
|
||||
func (e SysConfig) DeleteSysConfig(c *gin.Context) {
|
||||
s := service.SysConfig{}
|
||||
req := dto.SysConfigById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
|
||||
err = s.RemoveSysConfig(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "删除失败")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
|
||||
// GetSysConfigByKEYForService 根据Key获取SysConfig的Service
|
||||
// @Summary 根据Key获取SysConfig的Service
|
||||
// @Description 根据Key获取SysConfig的Service
|
||||
@@ -305,10 +305,10 @@ func (e SysConfig) GetSysConfigByKEYForService(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.GetSysConfigByKEY(req, resp)
|
||||
err = s.GetWithKey(req, resp)
|
||||
if err != nil {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
e.OK(resp, s.Msg)
|
||||
}
|
||||
}
|
||||
+24
-26
@@ -17,7 +17,7 @@ type SysDept struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// GetSysDeptList
|
||||
// GetList
|
||||
// @Summary 分页部门列表数据
|
||||
// @Description 分页列表
|
||||
// @Tags 部门
|
||||
@@ -27,7 +27,7 @@ type SysDept struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/dept [get]
|
||||
// @Security Bearer
|
||||
func (e SysDept) GetSysDeptList(c *gin.Context) {
|
||||
func (e SysDept) GetList(c *gin.Context) {
|
||||
s := service.SysDept{}
|
||||
req := dto.SysDeptSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -49,7 +49,7 @@ func (e SysDept) GetSysDeptList(c *gin.Context) {
|
||||
e.OK(list, "查询成功")
|
||||
}
|
||||
|
||||
// GetSysDept
|
||||
// Get
|
||||
// @Summary 部门列表数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 部门
|
||||
@@ -58,12 +58,12 @@ func (e SysDept) GetSysDeptList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/dept/{deptId} [get]
|
||||
// @Security Bearer
|
||||
func (e SysDept) GetSysDept(c *gin.Context) {
|
||||
s :=service.SysDept{}
|
||||
func (e SysDept) Get(c *gin.Context) {
|
||||
s := service.SysDept{}
|
||||
req := dto.SysDeptById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -73,7 +73,7 @@ func (e SysDept) GetSysDept(c *gin.Context) {
|
||||
}
|
||||
var object models.SysDept
|
||||
|
||||
err = s.GetSysDept(&req, &object)
|
||||
err = s.Get(&req, &object)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -82,7 +82,7 @@ func (e SysDept) GetSysDept(c *gin.Context) {
|
||||
e.OK(object, "查看成功")
|
||||
}
|
||||
|
||||
// InsertSysDept 添加部门
|
||||
// Insert 添加部门
|
||||
// @Summary 添加部门
|
||||
// @Description 获取JSON
|
||||
// @Tags 部门
|
||||
@@ -93,12 +93,12 @@ func (e SysDept) GetSysDept(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dept [post]
|
||||
// @Security Bearer
|
||||
func (e SysDept) InsertSysDept(c *gin.Context) {
|
||||
func (e SysDept) Insert(c *gin.Context) {
|
||||
s := service.SysDept{}
|
||||
req := dto.SysDeptControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -109,7 +109,7 @@ func (e SysDept) InsertSysDept(c *gin.Context) {
|
||||
|
||||
// 设置创建人
|
||||
req.SetCreateBy(user.GetUserId(c))
|
||||
err = s.InsertSysDept(&req)
|
||||
err = s.Insert(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "创建失败")
|
||||
return
|
||||
@@ -117,7 +117,7 @@ func (e SysDept) InsertSysDept(c *gin.Context) {
|
||||
e.OK(req.GetId(), "创建成功")
|
||||
}
|
||||
|
||||
// UpdateSysDept
|
||||
// Update
|
||||
// @Summary 修改部门
|
||||
// @Description 获取JSON
|
||||
// @Tags 部门
|
||||
@@ -129,12 +129,12 @@ func (e SysDept) InsertSysDept(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dept/{deptId} [put]
|
||||
// @Security Bearer
|
||||
func (e SysDept) UpdateSysDept(c *gin.Context) {
|
||||
func (e SysDept) Update(c *gin.Context) {
|
||||
s := service.SysDept{}
|
||||
req := dto.SysDeptControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -143,7 +143,7 @@ func (e SysDept) UpdateSysDept(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
err = s.UpdateSysDept(&req)
|
||||
err = s.Update(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
@@ -151,7 +151,7 @@ func (e SysDept) UpdateSysDept(c *gin.Context) {
|
||||
e.OK(req.GetId(), "更新成功")
|
||||
}
|
||||
|
||||
// DeleteSysDept
|
||||
// Delete
|
||||
// @Summary 删除部门
|
||||
// @Description 删除数据
|
||||
// @Tags 部门
|
||||
@@ -159,12 +159,12 @@ func (e SysDept) UpdateSysDept(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/dept [delete]
|
||||
func (e SysDept) DeleteSysDept(c *gin.Context) {
|
||||
func (e SysDept) Delete(c *gin.Context) {
|
||||
s := service.SysDept{}
|
||||
req := dto.SysDeptById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -173,7 +173,7 @@ func (e SysDept) DeleteSysDept(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.RemoveSysDept(&req)
|
||||
err = s.Remove(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "删除失败")
|
||||
return
|
||||
@@ -181,13 +181,13 @@ func (e SysDept) DeleteSysDept(c *gin.Context) {
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
|
||||
// GetDeptTree 用户管理 左侧部门树
|
||||
func (e SysDept) GetDeptTree(c *gin.Context) {
|
||||
// Get2Tree 用户管理 左侧部门树
|
||||
func (e SysDept) Get2Tree(c *gin.Context) {
|
||||
s := service.SysDept{}
|
||||
req := dto.SysDeptSearch{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req,binding.Form).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -195,9 +195,7 @@ func (e SysDept) GetDeptTree(c *gin.Context) {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
list := make([]dto.DeptLabel, 0)
|
||||
|
||||
list, err = s.SetDeptTree(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
@@ -227,7 +225,7 @@ func (e SysDept) GetDeptTreeRoleSelect(c *gin.Context) {
|
||||
}
|
||||
menuIds := make([]int, 0)
|
||||
if id != 0 {
|
||||
menuIds, err = s.GetRoleDeptId(id)
|
||||
menuIds, err = s.GetWithRoleId(id)
|
||||
if err != nil {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
@@ -237,4 +235,4 @@ func (e SysDept) GetDeptTreeRoleSelect(c *gin.Context) {
|
||||
"depts": result,
|
||||
"checkedKeys": menuIds,
|
||||
}, "")
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ type SysDictData struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// GetSysDictDataList
|
||||
// GetList
|
||||
// @Summary 字典数据列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 字典数据
|
||||
@@ -30,7 +30,7 @@ type SysDictData struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/dict/data [get]
|
||||
// @Security Bearer
|
||||
func (e SysDictData) GetSysDictDataList(c *gin.Context) {
|
||||
func (e SysDictData) GetList(c *gin.Context) {
|
||||
s := service.SysDictData{}
|
||||
req := dto.SysDictDataSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -63,7 +63,7 @@ func (e SysDictData) GetSysDictDataList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/dict/data/{dictCode} [get]
|
||||
// @Security Bearer
|
||||
func (e SysDictData) GetSysDictData(c *gin.Context) {
|
||||
func (e SysDictData) Get(c *gin.Context) {
|
||||
s := service.SysDictData{}
|
||||
req := dto.SysDictDataById{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -100,7 +100,7 @@ func (e SysDictData) GetSysDictData(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/data [post]
|
||||
// @Security Bearer
|
||||
func (e SysDictData) InsertSysDictData(c *gin.Context) {
|
||||
func (e SysDictData) Insert(c *gin.Context) {
|
||||
s := service.SysDictData{}
|
||||
req := dto.SysDictDataControl{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -134,7 +134,7 @@ func (e SysDictData) InsertSysDictData(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/data/{dictCode} [put]
|
||||
// @Security Bearer
|
||||
func (e SysDictData) UpdateSysDictData(c *gin.Context) {
|
||||
func (e SysDictData) Update(c *gin.Context) {
|
||||
s := service.SysDictData{}
|
||||
req := dto.SysDictDataControl{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -165,7 +165,7 @@ func (e SysDictData) UpdateSysDictData(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/dict/data/{dictCode} [delete]
|
||||
// @Security Bearer
|
||||
func (e SysDictData) DeleteSysDictData(c *gin.Context) {
|
||||
func (e SysDictData) Delete(c *gin.Context) {
|
||||
s := service.SysDictData{}
|
||||
req := dto.SysDictDataById{}
|
||||
err := e.MakeContext(c).
|
||||
|
||||
@@ -30,7 +30,7 @@ type SysDictType struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/dict/type [get]
|
||||
// @Security Bearer
|
||||
func (e SysDictType) GetSysDictTypeList(c *gin.Context) {
|
||||
func (e SysDictType) GetList(c *gin.Context) {
|
||||
s := service.SysDictType{}
|
||||
req := dto.SysDictTypeSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -61,7 +61,7 @@ func (e SysDictType) GetSysDictTypeList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/dict/type/{dictId} [get]
|
||||
// @Security Bearer
|
||||
func (e SysDictType) GetSysDictType(c *gin.Context) {
|
||||
func (e SysDictType) Get(c *gin.Context) {
|
||||
s := service.SysDictType{}
|
||||
req := dto.SysDictTypeById{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -94,7 +94,7 @@ func (e SysDictType) GetSysDictType(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/type [post]
|
||||
// @Security Bearer
|
||||
func (e SysDictType) InsertSysDictType(c *gin.Context) {
|
||||
func (e SysDictType) Insert(c *gin.Context) {
|
||||
s := service.SysDictType{}
|
||||
req := dto.SysDictTypeControl{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -128,7 +128,7 @@ func (e SysDictType) InsertSysDictType(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/dict/type/{dictId} [put]
|
||||
// @Security Bearer
|
||||
func (e SysDictType) UpdateSysDictType(c *gin.Context) {
|
||||
func (e SysDictType) Update(c *gin.Context) {
|
||||
s := service.SysDictType{}
|
||||
req := dto.SysDictTypeControl{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -158,7 +158,7 @@ func (e SysDictType) UpdateSysDictType(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/dict/type/{dictId} [delete]
|
||||
func (e SysDictType) DeleteSysDictType(c *gin.Context) {
|
||||
func (e SysDictType) Delete(c *gin.Context) {
|
||||
s := service.SysDictType{}
|
||||
req := dto.SysDictTypeById{}
|
||||
err := e.MakeContext(c).
|
||||
|
||||
@@ -28,7 +28,7 @@ type SysLoginLog struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-login-log [get]
|
||||
// @Security Bearer
|
||||
func (e SysLoginLog) GetSysLoginLogList(c *gin.Context) {
|
||||
func (e SysLoginLog) GetList(c *gin.Context) {
|
||||
s := service.SysLoginLog{}
|
||||
req := dto.SysLoginLogSearch {}
|
||||
err := e.MakeContext(c).
|
||||
@@ -43,7 +43,7 @@ func (e SysLoginLog) GetSysLoginLogList(c *gin.Context) {
|
||||
}
|
||||
list := make([]models.SysLoginLog, 0)
|
||||
var count int64
|
||||
err = s.GetSysLoginLogPage(&req, &list, &count)
|
||||
err = s.GetPage(&req, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -59,7 +59,7 @@ func (e SysLoginLog) GetSysLoginLogList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-login-log/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysLoginLog) GetSysLoginLog(c *gin.Context) {
|
||||
func (e SysLoginLog) Get(c *gin.Context) {
|
||||
s := service.SysLoginLog{}
|
||||
req := dto.SysLoginLogById{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -73,7 +73,7 @@ func (e SysLoginLog) GetSysLoginLog(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
var object models.SysLoginLog
|
||||
err = s.GetSysLoginLog(&req, &object)
|
||||
err = s.Get(&req, &object)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -88,7 +88,7 @@ func (e SysLoginLog) GetSysLoginLog(c *gin.Context) {
|
||||
// @Param data body dto.SysLoginLogById true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-login-log [delete]
|
||||
func (e SysLoginLog) DeleteSysLoginLog(c *gin.Context) {
|
||||
func (e SysLoginLog) Delete(c *gin.Context) {
|
||||
s := service.SysLoginLog{}
|
||||
req := dto.SysLoginLogById{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -102,7 +102,7 @@ func (e SysLoginLog) DeleteSysLoginLog(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
err = s.RemoveSysLoginLog(&req)
|
||||
err = s.Remove(&req)
|
||||
if err != nil {
|
||||
e.Error(500, err, "删除失败")
|
||||
return
|
||||
|
||||
+14
-14
@@ -26,7 +26,7 @@ type SysMenu struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/menu [get]
|
||||
// @Security Bearer
|
||||
func (e SysMenu) GetSysMenuList(c *gin.Context) {
|
||||
func (e SysMenu) GetList(c *gin.Context) {
|
||||
s := service.SysMenu{}
|
||||
req := dto.SysMenuSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -39,8 +39,8 @@ func (e SysMenu) GetSysMenuList(c *gin.Context) {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
var list = make([]models.SysMenu, 1)
|
||||
err = s.GetSysMenuPage(&req, &list).Error
|
||||
var list = make([]models.SysMenu, 0)
|
||||
err = s.GetPage(&req, &list).Error
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -56,7 +56,7 @@ func (e SysMenu) GetSysMenuList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/menu/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysMenu) GetSysMenu(c *gin.Context) {
|
||||
func (e SysMenu) Get(c *gin.Context) {
|
||||
req := dto.SysMenuById{}
|
||||
s := new(service.SysMenu)
|
||||
err := e.MakeContext(c).
|
||||
@@ -71,7 +71,7 @@ func (e SysMenu) GetSysMenu(c *gin.Context) {
|
||||
}
|
||||
var object = models.SysMenu{}
|
||||
|
||||
err = s.GetSysMenu(&req, &object).Error
|
||||
err = s.Get(&req, &object).Error
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -89,7 +89,7 @@ func (e SysMenu) GetSysMenu(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/menu [post]
|
||||
// @Security Bearer
|
||||
func (e SysMenu) InsertSysMenu(c *gin.Context) {
|
||||
func (e SysMenu) Insert(c *gin.Context) {
|
||||
req := dto.SysMenuControl{}
|
||||
s := new(service.SysMenu)
|
||||
err := e.MakeContext(c).
|
||||
@@ -104,7 +104,7 @@ func (e SysMenu) InsertSysMenu(c *gin.Context) {
|
||||
}
|
||||
// 设置创建人
|
||||
req.SetCreateBy(user.GetUserId(c))
|
||||
err = s.InsertSysMenu(&req).Error
|
||||
err = s.Insert(&req).Error
|
||||
if err != nil {
|
||||
e.Error(500, err, "创建失败")
|
||||
return
|
||||
@@ -123,7 +123,7 @@ func (e SysMenu) InsertSysMenu(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/menu/{id} [put]
|
||||
// @Security Bearer
|
||||
func (e SysMenu) UpdateSysMenu(c *gin.Context) {
|
||||
func (e SysMenu) Update(c *gin.Context) {
|
||||
req := dto.SysMenuControl{}
|
||||
s := new(service.SysMenu)
|
||||
err := e.MakeContext(c).
|
||||
@@ -138,7 +138,7 @@ func (e SysMenu) UpdateSysMenu(c *gin.Context) {
|
||||
}
|
||||
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
err = s.UpdateSysMenu(&req).Error
|
||||
err = s.Update(&req).Error
|
||||
if err != nil {
|
||||
e.Error(500, err, "更新失败")
|
||||
return
|
||||
@@ -153,7 +153,7 @@ func (e SysMenu) UpdateSysMenu(c *gin.Context) {
|
||||
// @Param data body dto.SysMenuById true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/menu [delete]
|
||||
func (e SysMenu) DeleteSysMenu(c *gin.Context) {
|
||||
func (e SysMenu) Delete(c *gin.Context) {
|
||||
control := new(dto.SysMenuById)
|
||||
s := new(service.SysMenu)
|
||||
err := e.MakeContext(c).
|
||||
@@ -166,7 +166,7 @@ func (e SysMenu) DeleteSysMenu(c *gin.Context) {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
err = s.RemoveSysMenu(control).Error
|
||||
err = s.Remove(control).Error
|
||||
if err != nil {
|
||||
e.Logger.Errorf("RemoveSysMenu error, %s", err)
|
||||
e.Error(http.StatusInternalServerError, err, "删除失败")
|
||||
@@ -205,7 +205,7 @@ func (e SysMenu) GetMenuRole(c *gin.Context) {
|
||||
}
|
||||
|
||||
// GetMenuIDS 获取角色对应的菜单id数组
|
||||
// @Summary 获取角色对应的菜单id数组
|
||||
// @Summary 获取角色对应的菜单id数组,设置角色权限使用
|
||||
// @Description 获取JSON
|
||||
// @Tags 菜单
|
||||
// @Param id path int true "id"
|
||||
@@ -261,7 +261,7 @@ func (e SysMenu) GetMenuTreeSelect(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
result, err := m.SetSysMenuLabel()
|
||||
result, err := m.SetLabel()
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -279,4 +279,4 @@ func (e SysMenu) GetMenuTreeSelect(c *gin.Context) {
|
||||
"menus": result,
|
||||
"checkedKeys": menuIds,
|
||||
}, "获取成功")
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ type SysOperaLog struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// GetSysOperaLogList 操作日志列表
|
||||
// GetPage 操作日志列表
|
||||
// @Summary 操作日志列表
|
||||
// @Description 获取JSON
|
||||
// @Tags 操作日志
|
||||
@@ -30,7 +30,7 @@ type SysOperaLog struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-opera-log [get]
|
||||
// @Security Bearer
|
||||
func (e SysOperaLog) GetSysOperaLogList(c *gin.Context) {
|
||||
func (e SysOperaLog) GetPage(c *gin.Context) {
|
||||
s := service.SysOperaLog{}
|
||||
req := new(dto.SysOperaLogSearch)
|
||||
err := e.MakeContext(c).
|
||||
@@ -47,7 +47,7 @@ func (e SysOperaLog) GetSysOperaLogList(c *gin.Context) {
|
||||
list := make([]models.SysOperaLog, 0)
|
||||
var count int64
|
||||
|
||||
err = s.GetSysOperaLogPage(req, &list, &count)
|
||||
err = s.GetPage(req, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(http.StatusUnprocessableEntity, err, "查询失败")
|
||||
return
|
||||
@@ -56,7 +56,7 @@ func (e SysOperaLog) GetSysOperaLogList(c *gin.Context) {
|
||||
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
|
||||
}
|
||||
|
||||
// GetSysOperaLog 操作日志通过id获取
|
||||
// Get 操作日志通过id获取
|
||||
// @Summary 操作日志通过id获取
|
||||
// @Description 获取JSON
|
||||
// @Tags 操作日志
|
||||
@@ -64,7 +64,7 @@ func (e SysOperaLog) GetSysOperaLogList(c *gin.Context) {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-opera-log/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysOperaLog) GetSysOperaLog(c *gin.Context) {
|
||||
func (e SysOperaLog) Get(c *gin.Context) {
|
||||
s := new(service.SysOperaLog)
|
||||
req := dto.SysOperaLogById{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -78,7 +78,7 @@ func (e SysOperaLog) GetSysOperaLog(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
var object models.SysOperaLog
|
||||
err = s.GetSysOperaLog(&req, &object)
|
||||
err = s.Get(&req, &object)
|
||||
if err != nil {
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
@@ -86,7 +86,7 @@ func (e SysOperaLog) GetSysOperaLog(c *gin.Context) {
|
||||
e.OK(object, "查看成功")
|
||||
}
|
||||
|
||||
// DeleteSysOperaLog 操作日志删除
|
||||
// Remove 操作日志删除
|
||||
// DeleteSysMenu 操作日志删除
|
||||
// @Summary 删除操作日志
|
||||
// @Description 删除数据
|
||||
@@ -94,7 +94,7 @@ func (e SysOperaLog) GetSysOperaLog(c *gin.Context) {
|
||||
// @Param data body dto.SysOperaLogById true "body"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-opera-log [delete]
|
||||
func (e SysOperaLog) DeleteSysOperaLog(c *gin.Context) {
|
||||
func (e SysOperaLog) Remove(c *gin.Context) {
|
||||
s := new(service.SysOperaLog)
|
||||
req := new(dto.SysOperaLogById)
|
||||
err := e.MakeContext(c).
|
||||
@@ -108,7 +108,7 @@ func (e SysOperaLog) DeleteSysOperaLog(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.RemoveSysOperaLog(req)
|
||||
err = s.Remove(req)
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
return
|
||||
|
||||
@@ -68,7 +68,7 @@ func (e SysPost) GetSysPost(c *gin.Context) {
|
||||
req := dto.SysPostById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -103,7 +103,7 @@ func (e SysPost) InsertSysPost(c *gin.Context) {
|
||||
req := dto.SysPostControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -141,7 +141,7 @@ func (e SysPost) UpdateSysPost(c *gin.Context) {
|
||||
req := dto.SysPostControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -173,7 +173,7 @@ func (e SysPost) DeleteSysPost(c *gin.Context) {
|
||||
req := dto.SysPostById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -189,4 +189,4 @@ func (e SysPost) DeleteSysPost(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
}
|
||||
+29
-30
@@ -20,7 +20,7 @@ type SysRole struct {
|
||||
api.Api
|
||||
}
|
||||
|
||||
// GetSysRoleList
|
||||
// GetList
|
||||
// @Summary 角色列表数据
|
||||
// @Description Get JSON
|
||||
// @Tags 角色/Role
|
||||
@@ -32,7 +32,7 @@ type SysRole struct {
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/role [get]
|
||||
// @Security Bearer
|
||||
func (e SysRole) GetSysRoleList(c *gin.Context) {
|
||||
func (e SysRole) GetList(c *gin.Context) {
|
||||
s := service.SysRole{}
|
||||
req := dto.SysRoleSearch{}
|
||||
err := e.MakeContext(c).
|
||||
@@ -49,16 +49,16 @@ func (e SysRole) GetSysRoleList(c *gin.Context) {
|
||||
list := make([]models.SysRole, 0)
|
||||
var count int64
|
||||
|
||||
err = s.GetSysRolePage(&req, &list, &count)
|
||||
err = s.GetPage(&req, &list, &count)
|
||||
if err != nil {
|
||||
e.Error(http.StatusUnprocessableEntity, err, "查询失败")
|
||||
e.Error(500, err, "查询失败")
|
||||
return
|
||||
}
|
||||
|
||||
e.PageOK(list, int(count), req.GetPageIndex(), req.GetPageSize(), "查询成功")
|
||||
}
|
||||
|
||||
// GetSysRole
|
||||
// Get
|
||||
// @Summary 获取Role数据
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
@@ -67,12 +67,12 @@ func (e SysRole) GetSysRoleList(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /api/v1/role/{id} [get]
|
||||
// @Security Bearer
|
||||
func (e SysRole) GetSysRole(c *gin.Context) {
|
||||
func (e SysRole) Get(c *gin.Context) {
|
||||
s := service.SysRole{}
|
||||
req := dto.SysRoleById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -83,7 +83,7 @@ func (e SysRole) GetSysRole(c *gin.Context) {
|
||||
|
||||
var object models.SysRole
|
||||
|
||||
err = s.GetSysRole(&req, &object)
|
||||
err = s.Get(&req, &object)
|
||||
if err != nil {
|
||||
e.Error(http.StatusUnprocessableEntity, err, "查询失败")
|
||||
return
|
||||
@@ -92,7 +92,7 @@ func (e SysRole) GetSysRole(c *gin.Context) {
|
||||
e.OK(object, "查看成功")
|
||||
}
|
||||
|
||||
// InsertSysRole
|
||||
// Insert
|
||||
// @Summary 创建角色
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
@@ -103,12 +103,12 @@ func (e SysRole) GetSysRole(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Router /api/v1/role [post]
|
||||
// @Security Bearer
|
||||
func (e SysRole) InsertSysRole(c *gin.Context) {
|
||||
func (e SysRole) Insert(c *gin.Context) {
|
||||
s := service.SysRole{}
|
||||
req := dto.SysRoleControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -123,21 +123,21 @@ func (e SysRole) InsertSysRole(c *gin.Context) {
|
||||
req.Status = "2"
|
||||
}
|
||||
|
||||
err = s.InsertSysRole(&req)
|
||||
err = s.Insert(&req)
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(http.StatusInternalServerError, err, "创建失败")
|
||||
e.Error(500, err, "创建失败")
|
||||
return
|
||||
}
|
||||
_, err = global.LoadPolicy(c)
|
||||
if err != nil {
|
||||
e.Error(http.StatusInternalServerError, err, "")
|
||||
e.Error(500, err, "")
|
||||
return
|
||||
}
|
||||
e.OK(req.GetId(), "创建成功")
|
||||
}
|
||||
|
||||
// UpdateSysRole 修改用户角色
|
||||
// Update 修改用户角色
|
||||
// @Summary 修改用户角色
|
||||
// @Description 获取JSON
|
||||
// @Tags 角色/Role
|
||||
@@ -148,12 +148,12 @@ func (e SysRole) InsertSysRole(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Router /api/v1/role/{id} [put]
|
||||
// @Security Bearer
|
||||
func (e SysRole) UpdateSysRole(c *gin.Context) {
|
||||
func (e SysRole) Update (c *gin.Context) {
|
||||
s := service.SysRole{}
|
||||
req := new(dto.SysRoleControl)
|
||||
req := dto.SysRoleControl{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(req).
|
||||
Bind(&req, nil, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -165,7 +165,7 @@ func (e SysRole) UpdateSysRole(c *gin.Context) {
|
||||
|
||||
req.SetUpdateBy(user.GetUserId(c))
|
||||
|
||||
err = s.UpdateSysRole(req, cb)
|
||||
err = s.Update(&req, cb)
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
return
|
||||
@@ -178,7 +178,7 @@ func (e SysRole) UpdateSysRole(c *gin.Context) {
|
||||
e.OK(req.GetId(), "更新成功")
|
||||
}
|
||||
|
||||
// DeleteSysRole
|
||||
// Delete
|
||||
// @Summary 删除用户角色
|
||||
// @Description 删除数据
|
||||
// @Tags 角色/Role
|
||||
@@ -187,12 +187,12 @@ func (e SysRole) UpdateSysRole(c *gin.Context) {
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Router /api/v1/role [delete]
|
||||
// @Security Bearer
|
||||
func (e SysRole) DeleteSysRole(c *gin.Context) {
|
||||
func (e SysRole) Delete(c *gin.Context) {
|
||||
s := new(service.SysRole)
|
||||
req := new(dto.SysRoleById)
|
||||
req := dto.SysRoleById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(req).
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -201,7 +201,7 @@ func (e SysRole) DeleteSysRole(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
err = s.RemoveSysRole(req)
|
||||
err = s.Remove(&req)
|
||||
if err != nil {
|
||||
e.Logger.Error(err)
|
||||
e.Error(http.StatusInternalServerError, err, "")
|
||||
@@ -215,13 +215,13 @@ func (e SysRole) DeleteSysRole(c *gin.Context) {
|
||||
e.OK(req.GetId(), "删除成功")
|
||||
}
|
||||
|
||||
// UpdateRoleDataScope 更新角色数据权限
|
||||
func (e SysRole) UpdateRoleDataScope(c *gin.Context) {
|
||||
// Update2DataScope 更新角色数据权限
|
||||
func (e SysRole) Update2DataScope(c *gin.Context) {
|
||||
s := &service.SysRole{}
|
||||
req := new(dto.RoleDataScopeReq)
|
||||
req := dto.RoleDataScopeReq{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -235,11 +235,10 @@ func (e SysRole) UpdateRoleDataScope(c *gin.Context) {
|
||||
DeptIds: req.DeptIds,
|
||||
}
|
||||
data.UpdateBy = user.GetUserId(c)
|
||||
|
||||
err = s.UpdateDataScope(data)
|
||||
if err != nil {
|
||||
e.Error(http.StatusInternalServerError, err, "")
|
||||
return
|
||||
}
|
||||
e.OK(nil, "操作成功")
|
||||
}
|
||||
}
|
||||
+24
-27
@@ -25,9 +25,8 @@ type SysUser struct {
|
||||
// @Description 获取JSON
|
||||
// @Tags 用户
|
||||
// @Param username query string false "username"
|
||||
// @Success 200 {string} string "{"code": 200, "data": [...]}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "抱歉未找到相关信息"}"
|
||||
// @Router /api/v1/sysUser [get]
|
||||
// @Success 200 {string} {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-user [get]
|
||||
// @Security Bearer
|
||||
func (e SysUser) GetSysUserList(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
@@ -97,8 +96,7 @@ func (e SysUser) GetSysUser(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.SysUserControl true "用户数据"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sysUser [post]
|
||||
func (e SysUser) InsertSysUser(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
@@ -132,9 +130,8 @@ func (e SysUser) InsertSysUser(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.SysUserControl true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Router /api/v1/sysuser/{userId} [put]
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sys-user/{userId} [put]
|
||||
func (e SysUser) UpdateSysUser(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
req := dto.SysUserControl{}
|
||||
@@ -167,15 +164,14 @@ func (e SysUser) UpdateSysUser(c *gin.Context) {
|
||||
// @Description 删除数据
|
||||
// @Tags 用户
|
||||
// @Param userId path int true "userId"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/sysuser/{userId} [delete]
|
||||
func (e SysUser) DeleteSysUser(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
req := dto.SysUserById{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req, binding.JSON, nil).
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -204,8 +200,7 @@ func (e SysUser) DeleteSysUser(c *gin.Context) {
|
||||
// @Tags 用户
|
||||
// @Accept multipart/form-data
|
||||
// @Param file formData file true "file"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "添加成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/user/avatar [post]
|
||||
func (e SysUser) InsetSysUserAvatar(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
@@ -253,15 +248,14 @@ func (e SysUser) InsetSysUserAvatar(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.UpdateSysUserStatusReq true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/user/status [put]
|
||||
func (e SysUser) UpdateSysUserStatus(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
req := dto.UpdateSysUserStatusReq{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON, nil).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -290,15 +284,14 @@ func (e SysUser) UpdateSysUserStatus(c *gin.Context) {
|
||||
// @Accept application/json
|
||||
// @Product application/json
|
||||
// @Param data body dto.ResetSysUserPwdReq true "body"
|
||||
// @Success 200 {string} string "{"code": 200, "message": "修改成功"}"
|
||||
// @Success 200 {string} string "{"code": -1, "message": "修改失败"}"
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/user/pwd/reset [put]
|
||||
func (e SysUser) ResetSysUserPwd(c *gin.Context) {
|
||||
s := service.SysUser{}
|
||||
req := dto.ResetSysUserPwdReq{}
|
||||
err := e.MakeContext(c).
|
||||
MakeOrm().
|
||||
Bind(&req).
|
||||
Bind(&req, binding.JSON).
|
||||
MakeService(&s.Service).
|
||||
Errors
|
||||
if err != nil {
|
||||
@@ -378,22 +371,29 @@ func (e SysUser) GetSysUserProfile(c *gin.Context) {
|
||||
|
||||
req.Id = user.GetUserId(c)
|
||||
|
||||
user := new(models.SysUser)
|
||||
sysUser := models.SysUser{}
|
||||
roles := make([]models.SysRole, 0)
|
||||
posts := make([]models.SysPost, 0)
|
||||
err = s.GetSysUserProfile(&req, user, &roles, &posts)
|
||||
err = s.GetSysUserProfile(&req, &sysUser, &roles, &posts)
|
||||
if err != nil {
|
||||
e.Logger.Errorf("get user profile error, %s", err.Error())
|
||||
e.Error(500, err, "获取用户信息失败")
|
||||
return
|
||||
}
|
||||
e.OK(gin.H{
|
||||
"user": user,
|
||||
"user": sysUser,
|
||||
"roles": roles,
|
||||
"posts": posts,
|
||||
}, "查询成功")
|
||||
}
|
||||
|
||||
// GetInfo
|
||||
// @Summary 获取个人信息
|
||||
// @Description 获取JSON
|
||||
// @Tags 个人中心
|
||||
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
|
||||
// @Router /api/v1/getinfo [get]
|
||||
// @Security Bearer
|
||||
func (e SysUser) GetInfo(c *gin.Context) {
|
||||
req := dto.SysUserById{}
|
||||
s := service.SysUser{}
|
||||
@@ -406,10 +406,7 @@ func (e SysUser) GetInfo(c *gin.Context) {
|
||||
e.Error(500, err, err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
//数据权限检查
|
||||
p := actions.GetPermissionFromContext(c)
|
||||
|
||||
var roles = make([]string, 1)
|
||||
roles[0] = user.GetRoleName(c)
|
||||
|
||||
@@ -433,7 +430,7 @@ func (e SysUser) GetInfo(c *gin.Context) {
|
||||
mp["buttons"] = list
|
||||
}
|
||||
|
||||
var sysUser models.SysUser
|
||||
sysUser := models.SysUser{}
|
||||
|
||||
req.Id = user.GetUserId(c)
|
||||
|
||||
@@ -454,4 +451,4 @@ func (e SysUser) GetInfo(c *gin.Context) {
|
||||
mp["deptId"] = sysUser.DeptId
|
||||
mp["name"] = sysUser.NickName
|
||||
e.OK(mp, "")
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package models
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"github.com/go-admin-team/go-admin-core/sdk"
|
||||
"github.com/go-admin-team/go-admin-core/sdk/runtime"
|
||||
@@ -52,7 +53,11 @@ func SaveSysApi(message storage.Messager) (err error) {
|
||||
dbList := sdk.Runtime.GetDb()
|
||||
for _, d := range dbList {
|
||||
for _, v := range l.List {
|
||||
if v.HttpMethod != "HEAD" {
|
||||
if v.HttpMethod != "HEAD" ||
|
||||
strings.Contains(v.RelativePath, "/swagger/") ||
|
||||
strings.Contains(v.RelativePath, "/static/") ||
|
||||
strings.Contains(v.RelativePath, "/form-generator/") ||
|
||||
strings.Contains(v.RelativePath, "/sys/tables") {
|
||||
err := d.Debug().Where(SysApi{Path: v.RelativePath, Action: v.HttpMethod}).
|
||||
Attrs(SysApi{Handle: v.Handler}).
|
||||
FirstOrCreate(&SysApi{}).Error
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"go-admin/common/models"
|
||||
)
|
||||
|
||||
type SysSetting struct {
|
||||
SettingsId int `json:"settings_id" gorm:"primary_key;AUTO_INCREMENT"`
|
||||
Name string `json:"name" gorm:"type:varchar(256);"`
|
||||
Logo string `json:"logo" gorm:"type:varchar(256);"`
|
||||
models.ModelTime
|
||||
}
|
||||
|
||||
func (SysSetting) TableName() string {
|
||||
return "sys_setting"
|
||||
}
|
||||
|
||||
func (s *SysSetting) GetId() interface{} {
|
||||
return s.SettingsId
|
||||
}
|
||||
|
||||
//查询
|
||||
//func (s *SysSetting) Get() (create SysSetting, err error) {
|
||||
// result := orm.Eloquent.Table("sys_setting").First(&create)
|
||||
// if result.Error != nil {
|
||||
// err = result.Error
|
||||
// return
|
||||
// }
|
||||
// return create, nil
|
||||
//}
|
||||
|
||||
//修改
|
||||
//func (s *SysSetting) Update() (update SysSetting, err error) {
|
||||
// if err = orm.Eloquent.Table("sys_setting").Model(&update).Where("settings_id = ?", s.SettingsId).Updates(&s).Error; err != nil {
|
||||
// return
|
||||
// }
|
||||
// return
|
||||
//}
|
||||
|
||||
type ResponseSystemConfig struct {
|
||||
Name string `json:"name" binding:"required"` // 名称
|
||||
Logo string `json:"logo" binding:"required"` // 头像
|
||||
SettingsId int `json:"settings_id" binding:"required"` // 头像
|
||||
}
|
||||
@@ -27,9 +27,6 @@ func InitExamplesRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gi
|
||||
func examplesNoCheckRoleRouter(r *gin.Engine) {
|
||||
// 可根据业务需求来设置接口版本
|
||||
v1 := r.Group("/api/v1")
|
||||
// 空接口防止v1定义无使用报错
|
||||
v1.GET("/nilcheckrole", nil)
|
||||
|
||||
for _, f := range routerNoCheckRole {
|
||||
f(v1)
|
||||
}
|
||||
@@ -39,9 +36,6 @@ func examplesNoCheckRoleRouter(r *gin.Engine) {
|
||||
func examplesCheckRoleRouter(r *gin.Engine, authMiddleware *jwtauth.GinJWTMiddleware) {
|
||||
// 可根据业务需求来设置接口版本
|
||||
v1 := r.Group("/api/v1")
|
||||
// 空接口防止v1定义无使用报错
|
||||
v1.GET("/checkrole", nil)
|
||||
|
||||
for _, f := range routerCheckRole {
|
||||
f(v1, authMiddleware)
|
||||
}
|
||||
|
||||
@@ -17,8 +17,8 @@ func registerSysApiRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlew
|
||||
api := apis.SysApi{}
|
||||
r := v1.Group("/sys-api").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysApiList)
|
||||
r.GET("/:id", api.GetSysApi)
|
||||
r.PUT("/:id", api.UpdateSysApi)
|
||||
r.GET("", api.GetPage)
|
||||
r.GET("/:id", api.Get)
|
||||
r.PUT("/:id", api.Update)
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,11 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd
|
||||
api := apis.SysConfig{}
|
||||
r := v1.Group("/config").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysConfigList)
|
||||
r.GET("/:id", api.GetSysConfig)
|
||||
r.POST("", api.InsertSysConfig)
|
||||
r.PUT("/:id", api.UpdateSysConfig)
|
||||
r.DELETE("", api.DeleteSysConfig)
|
||||
r.GET("", api.GetList)
|
||||
r.GET("/:id", api.Get)
|
||||
r.POST("", api.Insert)
|
||||
r.PUT("/:id", api.Update)
|
||||
r.DELETE("", api.Delete)
|
||||
}
|
||||
|
||||
r1 := v1.Group("/configKey").Use(authMiddleware.MiddlewareFunc())
|
||||
@@ -35,8 +35,8 @@ func registerSysConfigRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMidd
|
||||
|
||||
r3 := v1.Group("/set-config")
|
||||
{
|
||||
r3.PUT("", api.UpdateSetSysConfig)
|
||||
r3.GET("", api.GetSetSysConfig)
|
||||
r3.PUT("", api.Update2Set)
|
||||
r3.GET("", api.Get2Set)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,16 +17,16 @@ func registerSysDeptRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
||||
|
||||
r := v1.Group("/dept").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysDeptList)
|
||||
r.GET("/:id", api.GetSysDept)
|
||||
r.POST("", api.InsertSysDept)
|
||||
r.PUT("/:id", api.UpdateSysDept)
|
||||
r.DELETE("/:id", api.DeleteSysDept)
|
||||
r.GET("", api.GetList)
|
||||
r.GET("/:id", api.Get)
|
||||
r.POST("", api.Insert)
|
||||
r.PUT("/:id", api.Update)
|
||||
r.DELETE("/:id", api.Delete)
|
||||
}
|
||||
|
||||
r1 := v1.Group("").Use(authMiddleware.MiddlewareFunc())
|
||||
{
|
||||
r1.GET("/deptTree", api.GetDeptTree)
|
||||
r1.GET("/deptTree", api.Get2Tree)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,18 +17,18 @@ func registerDictRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar
|
||||
dicts := v1.Group("/dict").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
|
||||
dicts.GET("/data", dataApi.GetSysDictDataList)
|
||||
dicts.GET("/data/:dictCode", dataApi.GetSysDictData)
|
||||
dicts.POST("/data", dataApi.InsertSysDictData)
|
||||
dicts.PUT("/data/:dictCode", dataApi.UpdateSysDictData)
|
||||
dicts.DELETE("/data", dataApi.DeleteSysDictData)
|
||||
dicts.GET("/data", dataApi.GetList)
|
||||
dicts.GET("/data/:dictCode", dataApi.Get)
|
||||
dicts.POST("/data", dataApi.Insert)
|
||||
dicts.PUT("/data/:dictCode", dataApi.Update)
|
||||
dicts.DELETE("/data", dataApi.Delete)
|
||||
|
||||
dicts.GET("/type-option-select", dictApi.GetSysDictTypeAll)
|
||||
dicts.GET("/type", dictApi.GetSysDictTypeList)
|
||||
dicts.GET("/type/:id", dictApi.GetSysDictType)
|
||||
dicts.POST("/type", dictApi.InsertSysDictType)
|
||||
dicts.PUT("/type/:id", dictApi.UpdateSysDictType)
|
||||
dicts.DELETE("/type", dictApi.DeleteSysDictType)
|
||||
dicts.GET("/type", dictApi.GetList)
|
||||
dicts.GET("/type/:id", dictApi.Get)
|
||||
dicts.POST("/type", dictApi.Insert)
|
||||
dicts.PUT("/type/:id", dictApi.Update)
|
||||
dicts.DELETE("/type", dictApi.Delete)
|
||||
}
|
||||
v1.Group("/dict-data").Use(authMiddleware.MiddlewareFunc()).GET("/option-select", dataApi.GetSysDictDataAll)
|
||||
}
|
||||
@@ -17,8 +17,8 @@ func registerSysLoginLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi
|
||||
|
||||
r := v1.Group("/sys-login-log").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysLoginLogList)
|
||||
r.GET("/:id", api.GetSysLoginLog)
|
||||
r.DELETE("", api.DeleteSysLoginLog)
|
||||
r.GET("", api.GetList)
|
||||
r.GET("/:id", api.Get)
|
||||
r.DELETE("", api.Delete)
|
||||
}
|
||||
}
|
||||
@@ -17,17 +17,17 @@ func registerSysMenuRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
||||
|
||||
r := v1.Group("/menu").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysMenuList)
|
||||
r.GET("/:id", api.GetSysMenu)
|
||||
r.POST("", api.InsertSysMenu)
|
||||
r.PUT("/:id", api.UpdateSysMenu)
|
||||
r.DELETE("", api.DeleteSysMenu)
|
||||
r.GET("", api.GetList)
|
||||
r.GET("/:id", api.Get)
|
||||
r.POST("", api.Insert)
|
||||
r.PUT("/:id", api.Update)
|
||||
r.DELETE("", api.Delete)
|
||||
}
|
||||
|
||||
r1 := v1.Group("").Use(authMiddleware.MiddlewareFunc())
|
||||
{
|
||||
r1.GET("/menurole", api.GetMenuRole)
|
||||
r1.GET("/menuids", api.GetMenuIDS)
|
||||
//r1.GET("/menuids", api.GetMenuIDS)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,8 +16,8 @@ func registerSysOperaLogRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMi
|
||||
api := apis.SysOperaLog{}
|
||||
r := v1.Group("/sys-opera-log").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysOperaLogList)
|
||||
r.GET("/:id", api.GetSysOperaLog)
|
||||
r.DELETE("", api.DeleteSysOperaLog)
|
||||
r.GET("", api.GetPage)
|
||||
r.GET("/:id", api.Get)
|
||||
r.DELETE("", api.Remove)
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,11 @@ func registerSysRoleRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddle
|
||||
api := apis.SysRole{}
|
||||
r := v1.Group("/role").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetSysRoleList)
|
||||
r.GET("/:id", api.GetSysRole)
|
||||
r.POST("", api.InsertSysRole)
|
||||
r.PUT("/:id", api.UpdateSysRole)
|
||||
r.DELETE("", api.DeleteSysRole)
|
||||
r.GET("", api.GetList)
|
||||
r.GET("/:id", api.Get)
|
||||
r.POST("", api.Insert)
|
||||
r.PUT("/:id", api.Update)
|
||||
r.DELETE("", api.Delete)
|
||||
}
|
||||
v1.PUT("/roledatascope", api.UpdateRoleDataScope)
|
||||
v1.PUT("/roledatascope", api.Update2DataScope)
|
||||
}
|
||||
@@ -69,7 +69,7 @@ func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddlewar
|
||||
v1auth := v1.Group("").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
v1auth.GET("/roleMenuTreeselect/:roleId", api.GetMenuTreeSelect)
|
||||
v1.GET("/menuTreeselect", api.GetMenuTreeSelect)
|
||||
//v1.GET("/menuTreeselect", api.GetMenuTreeSelect)
|
||||
v1auth.GET("/roleDeptTreeselect/:roleId", api2.GetDeptTreeRoleSelect)
|
||||
v1auth.POST("/logout", handler.LogOut)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user