refactor🎨:格式化函数名称

This commit is contained in:
wenjianzhang committed 2021-06-24 20:18:20 +08:00
1 parent 2025809d91
commit 32d123eb89
1 file changed
+12 -8
+12 -8
View File
@@ -17,7 +17,7 @@ type SysTable struct {
api.Api
}
// GetSysTableList 分页列表数据
// GetPage 分页列表数据
// @Summary 分页列表数据
// @Description 生成表分页列表
// @Tags 工具 - 生成表
@@ -26,7 +26,7 @@ type SysTable struct {
// @Param pageIndex query int false "pageIndex / 页码"
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys/tables/page [get]
func (e SysTable) GetSysTableList(c *gin.Context) {
func (e SysTable) GetPage(c *gin.Context) {
e.Context = c
log := e.GetLogger()
var data tools.SysTables
@@ -60,6 +60,7 @@ func (e SysTable) GetSysTableList(c *gin.Context) {
e.PageOK(result, count, pageIndex, pageSize, "查询成功")
}
// Get
// @Summary 获取配置
// @Description 获取JSON
// @Tags 工具 - 生成表
@@ -67,7 +68,7 @@ func (e SysTable) GetSysTableList(c *gin.Context) {
// @Success 200 {object} response.Response "{"code": 200, "data": [...]}"
// @Router /api/v1/sys/tables/info/{tableId} [get]
// @Security Bearer
func (e SysTable) GetSysTables(c *gin.Context) {
func (e SysTable) Get(c *gin.Context) {
e.Context = c
log := e.GetLogger()
db, err := e.GetOrm()
@@ -142,6 +143,7 @@ func (e SysTable) GetSysTablesTree(c *gin.Context) {
e.OK(result, "")
}
// Insert
// @Summary 添加表结构
// @Description 添加表结构
// @Tags 工具 - 生成表
@@ -152,7 +154,7 @@ func (e SysTable) GetSysTablesTree(c *gin.Context) {
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/sys/tables/info [post]
// @Security Bearer
func (e SysTable) InsertSysTable(c *gin.Context) {
func (e SysTable) Insert(c *gin.Context) {
e.Context = c
log := e.GetLogger()
db, err := e.GetOrm()
@@ -222,7 +224,7 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
data.IsLogicalDelete = "1"
data.LogicalDelete = true
data.LogicalDeleteColumn = "is_del"
data.IsActions = 1
data.IsActions = 2
data.IsDataScope = 1
data.IsAuth = 1
@@ -287,6 +289,7 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
return data, err
}
// Update
// @Summary 修改表结构
// @Description 修改表结构
// @Tags 工具 - 生成表
@@ -297,7 +300,7 @@ func genTableInit(tx *gorm.DB, tablesList []string, i int, c *gin.Context) (tool
// @Success 200 {string} string "{"code": -1, "message": "添加失败"}"
// @Router /api/v1/sys/tables/info [put]
// @Security Bearer
func (e SysTable) UpdateSysTable(c *gin.Context) {
func (e SysTable) Update(c *gin.Context) {
var data tools.SysTables
err := c.Bind(&data)
pkg.HasError(err, "数据解析失败", 500)
@@ -321,6 +324,7 @@ func (e SysTable) UpdateSysTable(c *gin.Context) {
e.OK(result, "修改成功")
}
// Delete
// @Summary 删除表结构
// @Description 删除表结构
// @Tags 工具 - 生成表
@@ -328,7 +332,7 @@ func (e SysTable) UpdateSysTable(c *gin.Context) {
// @Success 200 {string} string "{"code": 200, "message": "删除成功"}"
// @Success 200 {string} string "{"code": -1, "message": "删除失败"}"
// @Router /api/v1/sys/tables/info/{tableId} [delete]
func (e SysTable) DeleteSysTables(c *gin.Context) {
func (e SysTable) Delete(c *gin.Context) {
e.Context = c
log := e.GetLogger()
db, err := e.GetOrm()
@@ -347,4 +351,4 @@ func (e SysTable) DeleteSysTables(c *gin.Context) {
return
}
e.OK(nil, "删除成功")
}
}