|
@ -1,9 +1,13 @@ |
|
|
package system |
|
|
package system |
|
|
|
|
|
|
|
|
import "github.com/flipped-aurora/gin-vue-admin/server/global" |
|
|
|
|
|
|
|
|
|
|
|
// 自动迁移代码记录,用于回滚,重放使用
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/global" |
|
|
|
|
|
"github.com/flipped-aurora/gin-vue-admin/server/model/common/request" |
|
|
|
|
|
"strconv" |
|
|
|
|
|
"strings" |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// SysAutoCodeHistory 自动迁移代码记录,用于回滚,重放使用
|
|
|
type SysAutoCodeHistory struct { |
|
|
type SysAutoCodeHistory struct { |
|
|
global.GVA_MODEL |
|
|
global.GVA_MODEL |
|
|
TableName string `json:"tableName"` |
|
|
TableName string `json:"tableName"` |
|
@ -14,5 +18,20 @@ type SysAutoCodeHistory struct { |
|
|
StructCNName string `json:"structCNName"` |
|
|
StructCNName string `json:"structCNName"` |
|
|
ApiIDs string `json:"apiIDs,omitempty"` // api表注册内容
|
|
|
ApiIDs string `json:"apiIDs,omitempty"` // api表注册内容
|
|
|
Flag int `json:"flag"` // 表示对应状态 0 代表创建, 1 代表回滚 ...
|
|
|
Flag int `json:"flag"` // 表示对应状态 0 代表创建, 1 代表回滚 ...
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// ToRequestIds ApiIDs 转换 request.IdsReq
|
|
|
|
|
|
// Author [SliverHorn](https://github.com/SliverHorn)
|
|
|
|
|
|
func (m *SysAutoCodeHistory) ToRequestIds() request.IdsReq { |
|
|
|
|
|
if m.ApiIDs == "" { |
|
|
|
|
|
return request.IdsReq{} |
|
|
|
|
|
} |
|
|
|
|
|
slice := strings.Split(m.ApiIDs, ";") |
|
|
|
|
|
ids := make([]int, 0, len(slice)) |
|
|
|
|
|
length := len(slice) |
|
|
|
|
|
for i := 0; i < length; i++ { |
|
|
|
|
|
id, _ := strconv.ParseInt(slice[i], 10, 32) |
|
|
|
|
|
ids = append(ids, int(id)) |
|
|
|
|
|
} |
|
|
|
|
|
return request.IdsReq{Ids: ids} |
|
|
} |
|
|
} |