mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 18:20:50 +00:00
refactor🎨 : uint 调整为 int
This commit is contained in:
@@ -3,7 +3,6 @@ package sys_file
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go-admin/app/admin/service"
|
"go-admin/app/admin/service"
|
||||||
common "go-admin/common/models"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/admin/models"
|
||||||
@@ -20,27 +19,23 @@ type SysFileDir struct {
|
|||||||
|
|
||||||
func (e *SysFileDir) GetSysFileDirList(c *gin.Context) {
|
func (e *SysFileDir) GetSysFileDirList(c *gin.Context) {
|
||||||
msgID := tools.GenerateMsgIDFromContext(c)
|
msgID := tools.GenerateMsgIDFromContext(c)
|
||||||
d := new(dto.SysFileDirSearch)
|
search := new(dto.SysFileDirSearch)
|
||||||
db, err := tools.GetOrm(c)
|
db, err := tools.GetOrm(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req := d.Generate()
|
err = c.ShouldBind(search)
|
||||||
|
|
||||||
//查询列表
|
|
||||||
err = req.Bind(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var list *[]models.SysFileDirL
|
var list *[]models.SysFileDirL
|
||||||
serviceStudent := service.SysFileDir{}
|
serviceStudent := service.SysFileDir{}
|
||||||
serviceStudent.MsgID = msgID
|
serviceStudent.MsgID = msgID
|
||||||
serviceStudent.Orm = db
|
serviceStudent.Orm = db
|
||||||
list, err = serviceStudent.SetSysFileDir(req)
|
list, err = serviceStudent.SetSysFileDir(search)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
||||||
return
|
return
|
||||||
@@ -59,18 +54,17 @@ func (e *SysFileDir) GetSysFileDir(c *gin.Context) {
|
|||||||
|
|
||||||
msgID := tools.GenerateMsgIDFromContext(c)
|
msgID := tools.GenerateMsgIDFromContext(c)
|
||||||
//查看详情
|
//查看详情
|
||||||
req := control.Generate()
|
err = c.ShouldBindUri(control)
|
||||||
err = req.Bind(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var object models.SysFileDir
|
var object models.SysFileDir
|
||||||
|
|
||||||
serviceSysFileDir := service.SysFileDir{}
|
serviceSysFileDir := service.SysFileDir{}
|
||||||
serviceSysFileDir.MsgID = msgID
|
serviceSysFileDir.MsgID = msgID
|
||||||
serviceSysFileDir.Orm = db
|
serviceSysFileDir.Orm = db
|
||||||
err = serviceSysFileDir.GetSysFileDir(req, &object)
|
err = serviceSysFileDir.GetSysFileDir(control, &object)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
e.Error(c, http.StatusUnprocessableEntity, err, "查询失败")
|
||||||
return
|
return
|
||||||
@@ -89,32 +83,28 @@ func (e *SysFileDir) InsertSysFileDir(c *gin.Context) {
|
|||||||
|
|
||||||
msgID := tools.GenerateMsgIDFromContext(c)
|
msgID := tools.GenerateMsgIDFromContext(c)
|
||||||
//新增操作
|
//新增操作
|
||||||
req := control.Generate()
|
err = c.ShouldBindUri(control)
|
||||||
err = req.Bind(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
var object common.ActiveRecord
|
err = c.ShouldBind(control)
|
||||||
object, err = req.GenerateM()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
// 设置创建人
|
// 设置创建人
|
||||||
object.SetCreateBy(tools.GetUserIdUint(c))
|
control.CreateBy = tools.GetUserId(c)
|
||||||
|
|
||||||
serviceSysFileDir := service.SysFileDir{}
|
serviceSysFileDir := service.SysFileDir{}
|
||||||
serviceSysFileDir.Orm = db
|
serviceSysFileDir.Orm = db
|
||||||
serviceSysFileDir.MsgID = msgID
|
serviceSysFileDir.MsgID = msgID
|
||||||
err = serviceSysFileDir.InsertSysFileDir(object)
|
err = serviceSysFileDir.InsertSysFileDir(control)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
e.Error(c, http.StatusInternalServerError, err, "创建失败")
|
e.Error(c, http.StatusInternalServerError, err, "创建失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
e.OK(c, object.GetId(), "创建成功")
|
e.OK(c, control.ID, "创建成功")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) {
|
func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) {
|
||||||
@@ -126,20 +116,16 @@ func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
msgID := tools.GenerateMsgIDFromContext(c)
|
msgID := tools.GenerateMsgIDFromContext(c)
|
||||||
req := control.Generate()
|
err = c.ShouldBindUri(control)
|
||||||
//更新操作
|
|
||||||
err = req.Bind(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
var object common.ActiveRecord
|
err = c.ShouldBind(control)
|
||||||
object, err = req.GenerateM()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
// 设置创建人
|
||||||
|
control.UpdateBy = tools.GetUserId(c)
|
||||||
|
|
||||||
//数据权限检查
|
//数据权限检查
|
||||||
p := actions.GetPermissionFromContext(c)
|
p := actions.GetPermissionFromContext(c)
|
||||||
@@ -147,12 +133,12 @@ func (e *SysFileDir) UpdateSysFileDir(c *gin.Context) {
|
|||||||
serviceSysFileDir := service.SysFileDir{}
|
serviceSysFileDir := service.SysFileDir{}
|
||||||
serviceSysFileDir.Orm = db
|
serviceSysFileDir.Orm = db
|
||||||
serviceSysFileDir.MsgID = msgID
|
serviceSysFileDir.MsgID = msgID
|
||||||
err = serviceSysFileDir.UpdateSysFileDir(object, p)
|
err = serviceSysFileDir.UpdateSysFileDir(control, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e.OK(c, object.GetId(), "更新成功")
|
e.OK(c, control.ID, "更新成功")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) {
|
func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) {
|
||||||
@@ -165,22 +151,17 @@ func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) {
|
|||||||
|
|
||||||
msgID := tools.GenerateMsgIDFromContext(c)
|
msgID := tools.GenerateMsgIDFromContext(c)
|
||||||
//删除操作
|
//删除操作
|
||||||
req := control.Generate()
|
err = c.ShouldBindUri(control)
|
||||||
err = req.Bind(c)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("MsgID[%s] Bind error: %s", msgID, err)
|
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||||
e.Error(c, http.StatusUnprocessableEntity, err, "参数验证失败")
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
var object common.ActiveRecord
|
err = c.ShouldBind(control)
|
||||||
object, err = req.GenerateM()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置编辑人
|
// 设置编辑人
|
||||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
control.UpdateBy = tools.GetUserId(c)
|
||||||
|
|
||||||
// 数据权限检查
|
// 数据权限检查
|
||||||
p := actions.GetPermissionFromContext(c)
|
p := actions.GetPermissionFromContext(c)
|
||||||
@@ -188,10 +169,10 @@ func (e *SysFileDir) DeleteSysFileDir(c *gin.Context) {
|
|||||||
serviceSysFileDir := service.SysFileDir{}
|
serviceSysFileDir := service.SysFileDir{}
|
||||||
serviceSysFileDir.Orm = db
|
serviceSysFileDir.Orm = db
|
||||||
serviceSysFileDir.MsgID = msgID
|
serviceSysFileDir.MsgID = msgID
|
||||||
err = serviceSysFileDir.RemoveSysFileDir(req, object, p)
|
err = serviceSysFileDir.RemoveSysFileDir(control, p)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
e.OK(c, object.GetId(), "删除成功")
|
e.OK(c, control.Id, "删除成功")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ func (e *SysLoginLog) InsertSysLoginLog(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 设置创建人
|
// 设置创建人
|
||||||
object.SetCreateBy(tools.GetUserIdUint(c))
|
object.SetCreateBy(tools.GetUserId(c))
|
||||||
|
|
||||||
serviceSysLoginLog := service.SysLoginLog{}
|
serviceSysLoginLog := service.SysLoginLog{}
|
||||||
serviceSysLoginLog.Orm = db
|
serviceSysLoginLog.Orm = db
|
||||||
@@ -140,7 +140,7 @@ func (e *SysLoginLog) UpdateSysLoginLog(c *gin.Context) {
|
|||||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
object.SetUpdateBy(tools.GetUserId(c))
|
||||||
|
|
||||||
serviceSysLoginLog := service.SysLoginLog{}
|
serviceSysLoginLog := service.SysLoginLog{}
|
||||||
serviceSysLoginLog.Orm = db
|
serviceSysLoginLog.Orm = db
|
||||||
@@ -178,7 +178,7 @@ func (e *SysLoginLog) DeleteSysLoginLog(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置编辑人
|
// 设置编辑人
|
||||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
object.SetUpdateBy(tools.GetUserId(c))
|
||||||
|
|
||||||
serviceSysLoginLog := service.SysLoginLog{}
|
serviceSysLoginLog := service.SysLoginLog{}
|
||||||
serviceSysLoginLog.Orm = db
|
serviceSysLoginLog.Orm = db
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ func (e *SysOperaLog) InsertSysOperaLog(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 设置创建人
|
// 设置创建人
|
||||||
object.SetCreateBy(tools.GetUserIdUint(c))
|
object.SetCreateBy(tools.GetUserId(c))
|
||||||
|
|
||||||
serviceSysOperaLog := service.SysOperaLog{}
|
serviceSysOperaLog := service.SysOperaLog{}
|
||||||
serviceSysOperaLog.Orm = db
|
serviceSysOperaLog.Orm = db
|
||||||
@@ -140,7 +140,7 @@ func (e *SysOperaLog) UpdateSysOperaLog(c *gin.Context) {
|
|||||||
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
e.Error(c, http.StatusInternalServerError, err, "模型生成失败")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
object.SetUpdateBy(tools.GetUserId(c))
|
||||||
|
|
||||||
serviceSysOperaLog := service.SysOperaLog{}
|
serviceSysOperaLog := service.SysOperaLog{}
|
||||||
serviceSysOperaLog.Orm = db
|
serviceSysOperaLog.Orm = db
|
||||||
@@ -178,7 +178,7 @@ func (e *SysOperaLog) DeleteSysOperaLog(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 设置编辑人
|
// 设置编辑人
|
||||||
object.SetUpdateBy(tools.GetUserIdUint(c))
|
object.SetUpdateBy(tools.GetUserId(c))
|
||||||
|
|
||||||
serviceSysOperaLog := service.SysOperaLog{}
|
serviceSysOperaLog := service.SysOperaLog{}
|
||||||
serviceSysOperaLog.Orm = db
|
serviceSysOperaLog.Orm = db
|
||||||
|
|||||||
@@ -1,30 +1,28 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/common/models"
|
"go-admin/common/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SysFileDir struct {
|
type SysFileDir struct {
|
||||||
gorm.Model
|
models.Model
|
||||||
models.ControlBy
|
|
||||||
|
|
||||||
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
||||||
PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
||||||
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
||||||
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
||||||
|
models.ControlBy
|
||||||
|
models.ModelTime
|
||||||
}
|
}
|
||||||
|
|
||||||
type SysFileDirL struct {
|
type SysFileDirL struct {
|
||||||
gorm.Model
|
models.Model
|
||||||
|
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
||||||
|
PId int `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
||||||
|
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
||||||
|
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
||||||
models.ControlBy
|
models.ControlBy
|
||||||
|
models.ModelTime
|
||||||
Label string `json:"label" gorm:"type:varchar(255);comment:目录名称"` // 目录名称
|
Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息
|
||||||
PId uint `json:"pId" gorm:"type:int(11);comment:上级目录"` // 上级目录
|
|
||||||
Sort string `json:"sort" gorm:"type:bigint(20);comment:排序"` // 排序
|
|
||||||
Path string `json:"path" gorm:"type:varchar(255);comment:路径"` // 路径
|
|
||||||
Children []SysFileDirL `json:"children" gorm:"-"` // 下级信息
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SysFileDir) TableName() string { /**/
|
func (SysFileDir) TableName() string { /**/
|
||||||
|
|||||||
@@ -1,24 +1,22 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/common/models"
|
"go-admin/common/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SysCategory struct {
|
type SysCategory struct {
|
||||||
gorm.Model
|
models.Model
|
||||||
models.ControlBy
|
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
||||||
|
Img string `json:"img" gorm:"type:varchar(255);comment:图标"` //
|
||||||
Name string `json:"name" gorm:"type:varchar(255);comment:名称"` //
|
Sort string `json:"sort" gorm:"type:int(4);comment:排序"` //
|
||||||
Img string `json:"img" gorm:"type:varchar(255);comment:图标"` //
|
Status string `json:"status" gorm:"type:int(1);comment:状态"` //
|
||||||
Sort string `json:"sort" gorm:"type:int(4);comment:排序"` //
|
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||||
Status string `json:"status" gorm:"type:int(1);comment:状态"` //
|
models.ControlBy
|
||||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
models.ModelTime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SysCategory) TableName() string {
|
func (SysCategory) TableName() string {
|
||||||
return "sys_category"
|
return "sys_category"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *SysCategory) Generate() models.ActiveRecord {
|
func (e *SysCategory) Generate() models.ActiveRecord {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SysJob struct {
|
type SysJob struct {
|
||||||
JobId uint `json:"jobId" gorm:"primary_key;AUTO_INCREMENT"` // 编码
|
JobId int `json:"jobId" gorm:"primary_key;AUTO_INCREMENT"` // 编码
|
||||||
JobName string `json:"jobName" gorm:"size:255;"` // 名称
|
JobName string `json:"jobName" gorm:"size:255;"` // 名称
|
||||||
JobGroup string `json:"jobGroup" gorm:"size:255;"` // 任务分组
|
JobGroup string `json:"jobGroup" gorm:"size:255;"` // 任务分组
|
||||||
JobType int `json:"jobType" gorm:"size:1;"` // 任务类型
|
JobType int `json:"jobType" gorm:"size:1;"` // 任务类型
|
||||||
@@ -40,11 +40,11 @@ func (e *SysJob) GetId() interface{} {
|
|||||||
return e.JobId
|
return e.JobId
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *SysJob) SetCreateBy(createBy uint) {
|
func (e *SysJob) SetCreateBy(createBy int) {
|
||||||
e.CreateBy = strconv.Itoa(int(createBy))
|
e.CreateBy = strconv.Itoa(int(createBy))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *SysJob) SetUpdateBy(updateBy uint) {
|
func (e *SysJob) SetUpdateBy(updateBy int) {
|
||||||
e.UpdateBy = strconv.Itoa(int(updateBy))
|
e.UpdateBy = strconv.Itoa(int(updateBy))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/common/models"
|
"go-admin/common/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SysConfig struct {
|
type SysConfig struct {
|
||||||
gorm.Model
|
models.Model
|
||||||
models.ControlBy
|
|
||||||
ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` //
|
ConfigName string `json:"configName" gorm:"type:varchar(128);comment:ConfigName"` //
|
||||||
ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` //
|
ConfigKey string `json:"configKey" gorm:"type:varchar(128);comment:ConfigKey"` //
|
||||||
ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` //
|
ConfigValue string `json:"configValue" gorm:"type:varchar(255);comment:ConfigValue"` //
|
||||||
ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"` //
|
ConfigType string `json:"configType" gorm:"type:varchar(64);comment:ConfigType"` //
|
||||||
Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` //
|
Remark string `json:"remark" gorm:"type:varchar(128);comment:Remark"` //
|
||||||
|
models.ControlBy
|
||||||
|
models.ModelTime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SysConfig) TableName() string {
|
func (SysConfig) TableName() string {
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/common/models"
|
"go-admin/common/models"
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SysLoginLog struct {
|
type SysLoginLog struct {
|
||||||
gorm.Model
|
models.Model
|
||||||
models.ControlBy
|
|
||||||
|
|
||||||
Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` //
|
Username string `json:"username" gorm:"type:varchar(128);comment:用户名"` //
|
||||||
Status string `json:"status" gorm:"type:varchar(4);comment:状态"` //
|
Status string `json:"status" gorm:"type:varchar(4);comment:状态"` //
|
||||||
Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` //
|
Ipaddr string `json:"ipaddr" gorm:"type:varchar(255);comment:ip地址"` //
|
||||||
@@ -22,6 +18,8 @@ type SysLoginLog struct {
|
|||||||
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` //
|
LoginTime time.Time `json:"loginTime" gorm:"type:timestamp;comment:登录时间"` //
|
||||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||||
Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` //
|
Msg string `json:"msg" gorm:"type:varchar(255);comment:信息"` //
|
||||||
|
models.ControlBy
|
||||||
|
models.ModelTime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SysLoginLog) TableName() string {
|
func (SysLoginLog) TableName() string {
|
||||||
|
|||||||
@@ -1,17 +1,13 @@
|
|||||||
package system
|
package system
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/common/models"
|
"go-admin/common/models"
|
||||||
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SysOperaLog struct {
|
type SysOperaLog struct {
|
||||||
gorm.Model
|
models.Model
|
||||||
models.ControlBy
|
|
||||||
|
|
||||||
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` //
|
Title string `json:"title" gorm:"type:varchar(255);comment:操作模块"` //
|
||||||
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` //
|
BusinessType string `json:"businessType" gorm:"type:varchar(128);comment:操作类型"` //
|
||||||
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` //
|
BusinessTypes string `json:"businessTypes" gorm:"type:varchar(128);comment:BusinessTypes"` //
|
||||||
@@ -30,6 +26,8 @@ type SysOperaLog struct {
|
|||||||
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
Remark string `json:"remark" gorm:"type:varchar(255);comment:备注"` //
|
||||||
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` //
|
LatencyTime string `json:"latencyTime" gorm:"type:varchar(128);comment:耗时"` //
|
||||||
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` //
|
UserAgent string `json:"userAgent" gorm:"type:varchar(255);comment:ua"` //
|
||||||
|
models.ControlBy
|
||||||
|
models.ModelTime
|
||||||
}
|
}
|
||||||
|
|
||||||
func (SysOperaLog) TableName() string {
|
func (SysOperaLog) TableName() string {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/admin/models"
|
||||||
"go-admin/common/dto"
|
"go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
@@ -12,12 +10,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SysCategorySearch struct {
|
type SysCategorySearch struct {
|
||||||
dto.Pagination `search:"-"`
|
dto.Pagination `search:"-"`
|
||||||
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"`
|
Name string `form:"name" search:"type:exact;column:name;table:sys_category" comment:"名称"`
|
||||||
|
|
||||||
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"`
|
|
||||||
|
|
||||||
|
|
||||||
|
Status string `form:"status" search:"type:exact;column:status;table:sys_category" comment:"状态"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SysCategorySearch) GetNeedSearch() interface{} {
|
func (m *SysCategorySearch) GetNeedSearch() interface{} {
|
||||||
@@ -25,12 +21,12 @@ func (m *SysCategorySearch) GetNeedSearch() interface{} {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *SysCategorySearch) Bind(ctx *gin.Context) error {
|
func (m *SysCategorySearch) Bind(ctx *gin.Context) error {
|
||||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||||
err := ctx.ShouldBind(m)
|
err := ctx.ShouldBind(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
|
log.Debugf("MsgID[%s] ShouldBind error: %s", msgID, err.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *SysCategorySearch) Generate() dto.Index {
|
func (m *SysCategorySearch) Generate() dto.Index {
|
||||||
@@ -39,37 +35,31 @@ func (m *SysCategorySearch) Generate() dto.Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysCategoryControl struct {
|
type SysCategoryControl struct {
|
||||||
|
ID int `uri:"ID" comment:"标识"` // 标识
|
||||||
|
|
||||||
ID uint `uri:"ID" comment:"标识"` // 标识
|
Name string `json:"name" comment:"名称"`
|
||||||
|
|
||||||
Name string `json:"name" comment:"名称"`
|
Img string `json:"img" comment:"图标"`
|
||||||
|
|
||||||
|
Sort string `json:"sort" comment:"排序"`
|
||||||
|
|
||||||
Img string `json:"img" comment:"图标"`
|
Status string `json:"status" comment:"状态"`
|
||||||
|
|
||||||
|
|
||||||
Sort string `json:"sort" comment:"排序"`
|
|
||||||
|
|
||||||
|
|
||||||
Status string `json:"status" comment:"状态"`
|
|
||||||
|
|
||||||
|
|
||||||
Remark string `json:"remark" comment:"备注"`
|
|
||||||
|
|
||||||
|
Remark string `json:"remark" comment:"备注"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SysCategoryControl) Bind(ctx *gin.Context) error {
|
func (s *SysCategoryControl) Bind(ctx *gin.Context) error {
|
||||||
msgID := tools.GenerateMsgIDFromContext(ctx)
|
msgID := tools.GenerateMsgIDFromContext(ctx)
|
||||||
err := ctx.ShouldBindUri(s)
|
err := ctx.ShouldBindUri(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
log.Debugf("MsgID[%s] ShouldBindUri error: %s", msgID, err.Error())
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = ctx.ShouldBind(s)
|
err = ctx.ShouldBind(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
log.Debugf("MsgID[%s] ShouldBind error: %#v", msgID, err.Error())
|
||||||
}
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SysCategoryControl) Generate() dto.Control {
|
func (s *SysCategoryControl) Generate() dto.Control {
|
||||||
@@ -79,13 +69,12 @@ func (s *SysCategoryControl) Generate() dto.Control {
|
|||||||
|
|
||||||
func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) {
|
func (s *SysCategoryControl) GenerateM() (common.ActiveRecord, error) {
|
||||||
return &models.SysCategory{
|
return &models.SysCategory{
|
||||||
|
Model: common.Model{ID: s.ID},
|
||||||
Model: gorm.Model{ID: s.ID},
|
Name: s.Name,
|
||||||
Name: s.Name,
|
Img: s.Img,
|
||||||
Img: s.Img,
|
Sort: s.Sort,
|
||||||
Sort: s.Sort,
|
Status: s.Status,
|
||||||
Status: s.Status,
|
Remark: s.Remark,
|
||||||
Remark: s.Remark,
|
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package dto
|
|||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"go-admin/app/admin/models/system"
|
"go-admin/app/admin/models/system"
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/common/dto"
|
"go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
common "go-admin/common/models"
|
common "go-admin/common/models"
|
||||||
@@ -37,7 +35,7 @@ func (m *SysConfigSearch) Generate() dto.Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysConfigControl struct {
|
type SysConfigControl struct {
|
||||||
ID uint `uri:"ID" comment:"编码"` // 编码
|
ID int `uri:"ID" comment:"编码"` // 编码
|
||||||
ConfigName string `json:"configName" comment:""`
|
ConfigName string `json:"configName" comment:""`
|
||||||
ConfigKey string `json:"configKey" comment:""`
|
ConfigKey string `json:"configKey" comment:""`
|
||||||
ConfigValue string `json:"configValue" comment:""`
|
ConfigValue string `json:"configValue" comment:""`
|
||||||
@@ -66,7 +64,7 @@ func (s *SysConfigControl) Generate() dto.Control {
|
|||||||
|
|
||||||
func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) {
|
func (s *SysConfigControl) GenerateM() (common.ActiveRecord, error) {
|
||||||
return &system.SysConfig{
|
return &system.SysConfig{
|
||||||
Model: gorm.Model{ID: s.ID},
|
Model: common.Model{ID: s.ID},
|
||||||
ConfigName: s.ConfigName,
|
ConfigName: s.ConfigName,
|
||||||
ConfigKey: s.ConfigKey,
|
ConfigKey: s.ConfigKey,
|
||||||
ConfigValue: s.ConfigValue,
|
ConfigValue: s.ConfigValue,
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/admin/models"
|
||||||
"go-admin/common/dto"
|
"go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
@@ -14,7 +12,7 @@ import (
|
|||||||
type SysFileDirSearch struct {
|
type SysFileDirSearch struct {
|
||||||
dto.Pagination `search:"-"`
|
dto.Pagination `search:"-"`
|
||||||
|
|
||||||
ID uint `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"`
|
ID int `form:"ID" search:"type:exact;column:id;table:sys_file_dir" comment:"标识"`
|
||||||
Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"`
|
Label string `form:"label" search:"type:exact;column:label;table:sys_file_dir" comment:"目录名称"`
|
||||||
PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"`
|
PId string `form:"pId" search:"type:exact;column:p_id;table:sys_file_dir" comment:"上级目录"`
|
||||||
Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"`
|
Sort string `form:"sort" search:"type:exact;column:sort;table:sys_file_dir" comment:"排序"`
|
||||||
@@ -40,11 +38,13 @@ func (m *SysFileDirSearch) Generate() dto.Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysFileDirControl struct {
|
type SysFileDirControl struct {
|
||||||
ID uint `uri:"ID" comment:"标识"` // 标识
|
ID int `uri:"ID" comment:"标识"` // 标识
|
||||||
Label string `json:"label" comment:"目录名称"`
|
Label string `json:"label" comment:"目录名称"`
|
||||||
PId uint `json:"pId" comment:"上级目录"`
|
PId int `json:"pId" comment:"上级目录"`
|
||||||
Sort string `json:"sort" comment:"排序"`
|
Sort string `json:"sort" comment:"排序"`
|
||||||
Path string `json:"path" comment:"路径"`
|
Path string `json:"path" comment:"路径"`
|
||||||
|
CreateBy int `json:"-"`
|
||||||
|
UpdateBy int `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SysFileDirControl) Bind(ctx *gin.Context) error {
|
func (s *SysFileDirControl) Bind(ctx *gin.Context) error {
|
||||||
@@ -68,7 +68,7 @@ func (s *SysFileDirControl) Generate() dto.Control {
|
|||||||
|
|
||||||
func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) {
|
func (s *SysFileDirControl) GenerateM() (common.ActiveRecord, error) {
|
||||||
return &models.SysFileDir{
|
return &models.SysFileDir{
|
||||||
Model: gorm.Model{ID: s.ID},
|
Model: common.Model{ID: s.ID},
|
||||||
Label: s.Label,
|
Label: s.Label,
|
||||||
PId: s.PId,
|
PId: s.PId,
|
||||||
Sort: s.Sort,
|
Sort: s.Sort,
|
||||||
@@ -82,6 +82,7 @@ func (s *SysFileDirControl) GetId() interface{} {
|
|||||||
|
|
||||||
type SysFileDirById struct {
|
type SysFileDirById struct {
|
||||||
dto.ObjectById
|
dto.ObjectById
|
||||||
|
UpdateBy int `json:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SysFileDirById) Generate() dto.Control {
|
func (s *SysFileDirById) Generate() dto.Control {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/app/admin/models/system"
|
"go-admin/app/admin/models/system"
|
||||||
"go-admin/common/dto"
|
"go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
@@ -41,7 +39,7 @@ func (m *SysLoginLogSearch) Generate() dto.Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysLoginLogControl struct {
|
type SysLoginLogControl struct {
|
||||||
ID uint `uri:"ID" comment:"主键"` // 主键
|
ID int `uri:"ID" comment:"主键"` // 主键
|
||||||
Username string `json:"username" comment:"用户名"`
|
Username string `json:"username" comment:"用户名"`
|
||||||
Status string `json:"status" comment:"状态"`
|
Status string `json:"status" comment:"状态"`
|
||||||
Ipaddr string `json:"ipaddr" comment:"ip地址"`
|
Ipaddr string `json:"ipaddr" comment:"ip地址"`
|
||||||
@@ -75,8 +73,7 @@ func (s *SysLoginLogControl) Generate() dto.Control {
|
|||||||
|
|
||||||
func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) {
|
func (s *SysLoginLogControl) GenerateM() (common.ActiveRecord, error) {
|
||||||
return &system.SysLoginLog{
|
return &system.SysLoginLog{
|
||||||
|
Model: common.Model{ID: s.ID},
|
||||||
Model: gorm.Model{ID: s.ID},
|
|
||||||
Username: s.Username,
|
Username: s.Username,
|
||||||
Status: s.Status,
|
Status: s.Status,
|
||||||
Ipaddr: s.Ipaddr,
|
Ipaddr: s.Ipaddr,
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package dto
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"gorm.io/gorm"
|
|
||||||
|
|
||||||
"go-admin/app/admin/models/system"
|
"go-admin/app/admin/models/system"
|
||||||
"go-admin/common/dto"
|
"go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
@@ -42,7 +40,7 @@ func (m *SysOperaLogSearch) Generate() dto.Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysOperaLogControl struct {
|
type SysOperaLogControl struct {
|
||||||
ID uint `uri:"ID" comment:"编码"` // 编码
|
ID int `uri:"ID" comment:"编码"` // 编码
|
||||||
Title string `json:"title" comment:"操作模块"`
|
Title string `json:"title" comment:"操作模块"`
|
||||||
BusinessType string `json:"businessType" comment:"操作类型"`
|
BusinessType string `json:"businessType" comment:"操作类型"`
|
||||||
BusinessTypes string `json:"businessTypes" comment:""`
|
BusinessTypes string `json:"businessTypes" comment:""`
|
||||||
@@ -84,7 +82,7 @@ func (s *SysOperaLogControl) Generate() dto.Control {
|
|||||||
|
|
||||||
func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) {
|
func (s *SysOperaLogControl) GenerateM() (common.ActiveRecord, error) {
|
||||||
return &system.SysOperaLog{
|
return &system.SysOperaLog{
|
||||||
Model: gorm.Model{ID: s.ID},
|
Model: common.Model{ID: s.ID},
|
||||||
Title: s.Title,
|
Title: s.Title,
|
||||||
BusinessType: s.BusinessType,
|
BusinessType: s.BusinessType,
|
||||||
BusinessTypes: s.BusinessTypes,
|
BusinessTypes: s.BusinessTypes,
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ func (m *SysJobSearch) Generate() dto.Index {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysJobControl struct {
|
type SysJobControl struct {
|
||||||
JobId uint `json:"jobId"`
|
JobId int `json:"jobId"`
|
||||||
JobName string `json:"jobName" validate:"required"` // 名称
|
JobName string `json:"jobName" validate:"required"` // 名称
|
||||||
JobGroup string `json:"jobGroup"` // 任务分组
|
JobGroup string `json:"jobGroup"` // 任务分组
|
||||||
JobType int `json:"jobType"` // 任务类型
|
JobType int `json:"jobType"` // 任务类型
|
||||||
@@ -93,7 +93,7 @@ func (s *SysJobById) GenerateM() (common.ActiveRecord, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SysJobItem struct {
|
type SysJobItem struct {
|
||||||
JobId uint `json:"jobId"`
|
JobId int `json:"jobId"`
|
||||||
JobName string `json:"jobName" validate:"required"` // 名称
|
JobName string `json:"jobName" validate:"required"` // 名称
|
||||||
JobGroup string `json:"jobGroup"` // 任务分组
|
JobGroup string `json:"jobGroup"` // 任务分组
|
||||||
JobType int `json:"jobType"` // 任务类型
|
JobType int `json:"jobType"` // 任务类型
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ package service
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"go-admin/app/admin/models"
|
"go-admin/app/admin/models"
|
||||||
|
"go-admin/app/admin/service/dto"
|
||||||
"go-admin/common/actions"
|
"go-admin/common/actions"
|
||||||
cDto "go-admin/common/dto"
|
cDto "go-admin/common/dto"
|
||||||
"go-admin/common/log"
|
"go-admin/common/log"
|
||||||
common "go-admin/common/models"
|
|
||||||
"go-admin/common/service"
|
"go-admin/common/service"
|
||||||
"go-admin/tools"
|
"go-admin/tools"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@@ -17,7 +17,7 @@ type SysFileDir struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetSysFileDirPage 获取SysFileDir列表
|
// GetSysFileDirPage 获取SysFileDir列表
|
||||||
func (e *SysFileDir) GetSysFileDirPage(c cDto.Index, list *[]models.SysFileDirL) error {
|
func (e *SysFileDir) GetSysFileDirPage(c *dto.SysFileDirSearch, list *[]models.SysFileDirL) error {
|
||||||
var err error
|
var err error
|
||||||
var data models.SysFileDir
|
var data models.SysFileDir
|
||||||
msgID := e.MsgID
|
msgID := e.MsgID
|
||||||
@@ -25,7 +25,6 @@ func (e *SysFileDir) GetSysFileDirPage(c cDto.Index, list *[]models.SysFileDirL)
|
|||||||
err = e.Orm.Model(&data).
|
err = e.Orm.Model(&data).
|
||||||
Scopes(
|
Scopes(
|
||||||
cDto.MakeCondition(c.GetNeedSearch()),
|
cDto.MakeCondition(c.GetNeedSearch()),
|
||||||
//cDto.Paginate(c.GetPageSize(), c.GetPageIndex()),
|
|
||||||
).
|
).
|
||||||
Find(list). //Limit(-1).Offset(-1).
|
Find(list). //Limit(-1).Offset(-1).
|
||||||
Error
|
Error
|
||||||
@@ -58,7 +57,7 @@ func (e *SysFileDir) GetSysFileDir(d cDto.Control, model *models.SysFileDir) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
// InsertSysFileDir 创建SysFileDir对象
|
// InsertSysFileDir 创建SysFileDir对象
|
||||||
func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error {
|
func (e *SysFileDir) InsertSysFileDir(model *dto.SysFileDirControl) error {
|
||||||
var err error
|
var err error
|
||||||
var data models.SysFileDir
|
var data models.SysFileDir
|
||||||
msgID := e.MsgID
|
msgID := e.MsgID
|
||||||
@@ -70,7 +69,7 @@ func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
id := model.GetId()
|
id := model.GetId()
|
||||||
path := "/" + tools.UIntToString(id.(uint))
|
path := "/" + tools.IntToString(id.(int))
|
||||||
db = e.Orm.Model(&data).
|
db = e.Orm.Model(&data).
|
||||||
First(&data, model.GetId())
|
First(&data, model.GetId())
|
||||||
err = db.Error
|
err = db.Error
|
||||||
@@ -92,7 +91,7 @@ func (e *SysFileDir) InsertSysFileDir(model common.ActiveRecord) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// UpdateSysFileDir 修改SysFileDir对象
|
// UpdateSysFileDir 修改SysFileDir对象
|
||||||
func (e *SysFileDir) UpdateSysFileDir(c common.ActiveRecord, p *actions.DataPermission) error {
|
func (e *SysFileDir) UpdateSysFileDir(c *dto.SysFileDirControl, p *actions.DataPermission) error {
|
||||||
var err error
|
var err error
|
||||||
var data models.SysFileDir
|
var data models.SysFileDir
|
||||||
msgID := e.MsgID
|
msgID := e.MsgID
|
||||||
@@ -100,20 +99,19 @@ func (e *SysFileDir) UpdateSysFileDir(c common.ActiveRecord, p *actions.DataPerm
|
|||||||
db := e.Orm.Model(&data).
|
db := e.Orm.Model(&data).
|
||||||
Scopes(
|
Scopes(
|
||||||
actions.Permission(data.TableName(), p),
|
actions.Permission(data.TableName(), p),
|
||||||
).Where(c.GetId()).Updates(c)
|
).Where(c.ID).Updates(c)
|
||||||
if db.Error != nil {
|
if db.Error != nil {
|
||||||
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
log.Errorf("msgID[%s] db error:%s", msgID, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if db.RowsAffected == 0 {
|
if db.RowsAffected == 0 {
|
||||||
return errors.New("无权更新该数据")
|
return errors.New("无权更新该数据")
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveSysFileDir 删除SysFileDir
|
// RemoveSysFileDir 删除SysFileDir
|
||||||
func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p *actions.DataPermission) error {
|
func (e *SysFileDir) RemoveSysFileDir(d *dto.SysFileDirById, p *actions.DataPermission) error {
|
||||||
var err error
|
var err error
|
||||||
var data models.SysFileDir
|
var data models.SysFileDir
|
||||||
msgID := e.MsgID
|
msgID := e.MsgID
|
||||||
@@ -121,7 +119,7 @@ func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p *
|
|||||||
db := e.Orm.Model(&data).
|
db := e.Orm.Model(&data).
|
||||||
Scopes(
|
Scopes(
|
||||||
actions.Permission(data.TableName(), p),
|
actions.Permission(data.TableName(), p),
|
||||||
).Where(d.GetId()).Delete(c)
|
).Where(d.Id).Delete(&data)
|
||||||
if db.Error != nil {
|
if db.Error != nil {
|
||||||
err = db.Error
|
err = db.Error
|
||||||
log.Errorf("MsgID[%s] Delete error: %s", msgID, err)
|
log.Errorf("MsgID[%s] Delete error: %s", msgID, err)
|
||||||
@@ -134,7 +132,7 @@ func (e *SysFileDir) RemoveSysFileDir(d cDto.Control, c common.ActiveRecord, p *
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *SysFileDir) SetSysFileDir(c cDto.Index) (*[]models.SysFileDirL, error) {
|
func (e *SysFileDir) SetSysFileDir(c *dto.SysFileDirSearch) (*[]models.SysFileDirL, error) {
|
||||||
var list []models.SysFileDirL
|
var list []models.SysFileDirL
|
||||||
err := e.GetSysFileDirPage(c, &list)
|
err := e.GetSysFileDirPage(c, &list)
|
||||||
m := make([]models.SysFileDirL, 0)
|
m := make([]models.SysFileDirL, 0)
|
||||||
|
|||||||
+1
-1
@@ -22,7 +22,7 @@ var lock sync.Mutex
|
|||||||
type JobCore struct {
|
type JobCore struct {
|
||||||
InvokeTarget string
|
InvokeTarget string
|
||||||
Name string
|
Name string
|
||||||
JobId uint
|
JobId int
|
||||||
EntryId int
|
EntryId int
|
||||||
CronExpression string
|
CronExpression string
|
||||||
Args string
|
Args string
|
||||||
|
|||||||
Reference in New Issue
Block a user