Browse Source

查询首页工作台数据

terry 2 years ago
parent
commit
93cb6516a5
88 changed files with 485 additions and 354 deletions
  1. 14 1
      app/device/controller/workbenchController.go
  2. 2 2
      app/device/dao/LightStrategyDao.go
  3. 2 2
      app/device/dao/alarmDao.go
  4. 2 2
      app/device/dao/alarmTerminalDao.go
  5. 2 2
      app/device/dao/bridgeDao.go
  6. 2 2
      app/device/dao/bridgeSensorDao.go
  7. 2 2
      app/device/dao/cameraDao.go
  8. 2 2
      app/device/dao/captureUnitDao.go
  9. 3 3
      app/device/dao/checkPointDao.go
  10. 2 2
      app/device/dao/garbageDao.go
  11. 2 2
      app/device/dao/garbageWayGroupDao.go
  12. 2 2
      app/device/dao/gatewayDao.go
  13. 2 2
      app/device/dao/infoBoardDao.go
  14. 3 2
      app/device/dao/intelligentLightingDao.go
  15. 2 2
      app/device/dao/ipBroadcastDao.go
  16. 2 2
      app/device/dao/lampPoleDao.go
  17. 3 3
      app/device/dao/lampPoleGroupDao.go
  18. 2 2
      app/device/dao/lightConditionDao.go
  19. 2 2
      app/device/dao/lightControlDao.go
  20. 2 2
      app/device/dao/manholeCoverDao.go
  21. 3 3
      app/device/dao/onDemandGroupDao.go
  22. 2 2
      app/device/dao/onDemandSensorDao.go
  23. 2 2
      app/device/dao/optoSensoDao.go
  24. 2 2
      app/device/dao/switchBoxDao.go
  25. 2 2
      app/device/dao/timeConditionDao.go
  26. 2 2
      app/device/dao/transformerDao.go
  27. 2 2
      app/device/dao/venderDao.go
  28. 100 25
      app/device/dao/workbenchDao.go
  29. 2 2
      app/device/dao/zigbeeDao.go
  30. 2 2
      app/device/service/LightStrategyService.go
  31. 51 44
      app/device/service/alarmService.go
  32. 10 2
      app/device/service/alarmTerminalService.go
  33. 20 2
      app/device/service/bigService.go
  34. 3 3
      app/device/service/bridgeSensorService.go
  35. 2 2
      app/device/service/bridgeService.go
  36. 3 2
      app/device/service/cameraService.go
  37. 5 4
      app/device/service/captureUintService.go
  38. 4 4
      app/device/service/garbageService.go
  39. 3 3
      app/device/service/garbageWayGroupService.go
  40. 2 2
      app/device/service/gatewayService.go
  41. 35 35
      app/device/service/infoBoardServiceTime.go
  42. 7 3
      app/device/service/intelligentLightingService.go
  43. 3 2
      app/device/service/ipBroadcastService.go
  44. 2 2
      app/device/service/lampPoleGroupService.go
  45. 2 2
      app/device/service/lampPoleService.go
  46. 1 1
      app/device/service/lightConditionService.go
  47. 2 2
      app/device/service/lightControlService.go
  48. 2 2
      app/device/service/manholeCoverService.go
  49. 4 4
      app/device/service/onDemandGroupService.go
  50. 2 2
      app/device/service/onDemandSensorService.go
  51. 2 2
      app/device/service/optoSensoService.go
  52. 2 2
      app/device/service/switchBoxService.go
  53. 4 4
      app/device/service/transformerService.go
  54. 2 1
      app/device/service/workbenchService.go
  55. 2 2
      app/device/service/zigbeeService.go
  56. 3 3
      app/middleware/token.go
  57. 2 2
      app/multimedia/dao/libraryDao.go
  58. 2 2
      app/multimedia/dao/programDao.go
  59. 18 16
      app/multimedia/dao/publishLibrariesDao.go
  60. 2 2
      app/multimedia/service/libraryService.go
  61. 2 2
      app/multimedia/service/programService.go
  62. 2 3
      app/multimedia/service/publishLibrariesService.go
  63. 0 3
      app/record/dao/aKeyAlarmDao.go
  64. 1 1
      app/security/service/multiscreenService.go
  65. 5 7
      app/system/controller/menu.go
  66. 1 1
      app/system/controller/role.go
  67. 1 1
      app/system/controller/tenant.go
  68. 1 1
      app/system/controller/token.go
  69. 1 1
      app/system/controller/user.go
  70. 17 17
      app/system/dao/menu.go
  71. 1 1
      app/system/dao/operationHisDao.go
  72. 2 2
      app/system/dao/role.go
  73. 4 4
      app/system/dao/roleMenu.go
  74. 3 3
      app/system/dao/tenant.go
  75. 7 7
      app/system/dao/user.go
  76. 5 5
      app/system/model/menu.go
  77. 10 10
      app/system/model/role.go
  78. 1 1
      app/system/model/tenant.go
  79. 2 2
      app/system/model/token.go
  80. 3 3
      app/system/model/user.go
  81. 21 16
      app/system/service/menuService.go
  82. 1 1
      app/system/service/operationHisService.go
  83. 4 4
      app/system/service/roleMenuService.go
  84. 4 4
      app/system/service/roleService.go
  85. 2 2
      app/system/service/tenantService.go
  86. 6 6
      app/system/service/userService.go
  87. 1 1
      app/warn/service/noticeSetService.go
  88. 1 1
      util/common/common.go

+ 14 - 1
app/device/controller/workbenchController.go

@@ -62,16 +62,29 @@ func (c *workbenchCtl) CountJobTodo(ctx *gin.Context) {
 	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, alarms))
 	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, alarms))
 }
 }
 
 
+//	func (c *workbenchCtl) Notification(ctx *gin.Context) {
+//		value, _ := ctx.Get(middleware.Authorization)
+//		claims := value.(*middleware.Claims)
+//
+//		alarms, err := service.WorkbenchService.Notification(claims.TenantId)
+//		if err != nil {
+//			ctx.JSON(http.StatusOK, err)
+//			return
+//		}
+//		ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, alarms))
+//
+// }
+// 显示设备离线的状态
 func (c *workbenchCtl) Notification(ctx *gin.Context) {
 func (c *workbenchCtl) Notification(ctx *gin.Context) {
 	value, _ := ctx.Get(middleware.Authorization)
 	value, _ := ctx.Get(middleware.Authorization)
 	claims := value.(*middleware.Claims)
 	claims := value.(*middleware.Claims)
-
 	alarms, err := service.WorkbenchService.Notification(claims.TenantId)
 	alarms, err := service.WorkbenchService.Notification(claims.TenantId)
 	if err != nil {
 	if err != nil {
 		ctx.JSON(http.StatusOK, err)
 		ctx.JSON(http.StatusOK, err)
 		return
 		return
 	}
 	}
 	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, alarms))
 	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Succeeded, alarms))
+
 }
 }
 
 
 func (c *workbenchCtl) LightRate(ctx *gin.Context) {
 func (c *workbenchCtl) LightRate(ctx *gin.Context) {

+ 2 - 2
app/device/dao/LightStrategyDao.go

@@ -16,9 +16,9 @@ type LightStrategy struct {
 	IsAutomaticRenewal int       `gorm:"type:int;default 1" json:"isAutomaticRenewal"` //自动续期设置 2=是,1=否
 	IsAutomaticRenewal int       `gorm:"type:int;default 1" json:"isAutomaticRenewal"` //自动续期设置 2=是,1=否
 	TenantId           string    `gorm:"type:varchar(12)" json:"tenantId"`             //租户ID
 	TenantId           string    `gorm:"type:varchar(12)" json:"tenantId"`             //租户ID
 	CreateTime         time.Time `gorm:"type:datetime" json:"createTime"`              //新增时间
 	CreateTime         time.Time `gorm:"type:datetime" json:"createTime"`              //新增时间
-	CreateUser         int64     `gorm:"type:bigint" json:"createUser"`                //新增记录操作用户ID
+	CreateUser         int       `gorm:"type:int" json:"createUser"`                   //新增记录操作用户ID
 	UpdateTime         time.Time `gorm:"type:datetime" json:"updateTime"`              //修改时间
 	UpdateTime         time.Time `gorm:"type:datetime" json:"updateTime"`              //修改时间
-	UpdateUser         int64     `gorm:"type:bigint" json:"updateUser"`                //修改用户
+	UpdateUser         int       `gorm:"type:int" json:"updateUser"`                   //修改用户
 	IsDeleted          int       `gorm:"type:int;default 0" json:"isDeleted"`          //是否删除 0=未删除,1=删除
 	IsDeleted          int       `gorm:"type:int;default 0" json:"isDeleted"`          //是否删除 0=未删除,1=删除
 	Status             int       `gorm:"type:int;default 1" json:"status"`             //状态 0=正常,1=异常
 	Status             int       `gorm:"type:int;default 1" json:"status"`             //状态 0=正常,1=异常
 	LightSn            string    `gorm:"type:varchar(64)" json:"lightSn"`              //策略编码
 	LightSn            string    `gorm:"type:varchar(64)" json:"lightSn"`              //策略编码

+ 2 - 2
app/device/dao/alarmDao.go

@@ -23,9 +23,9 @@ type Alarm struct {
 	InstallTime *time.Time `gorm:"type:date" json:"installTime"`      //安装时间
 	InstallTime *time.Time `gorm:"type:date" json:"installTime"`      //安装时间
 	TenantId    string     `gorm:"type:varchar(12)" json:"tenantId"`  //租户id
 	TenantId    string     `gorm:"type:varchar(12)" json:"tenantId"`  //租户id
 	CreateTime  time.Time  `gorm:"type:datetime" json:"createTime"`   //新增时间
 	CreateTime  time.Time  `gorm:"type:datetime" json:"createTime"`   //新增时间
-	CreateUser  int64      `gorm:"type:bigint" json:"createUser"`     //新增记录操作用户ID
+	CreateUser  int        `gorm:"type:int" json:"createUser"`        //新增记录操作用户ID
 	UpdateTime  time.Time  `gorm:"type:datetime" json:"updateTime"`   //修改时间
 	UpdateTime  time.Time  `gorm:"type:datetime" json:"updateTime"`   //修改时间
-	UpdateUser  int64      `gorm:"type:bigint" json:"updateUser"`     //修改用户
+	UpdateUser  int        `gorm:"type:int" json:"updateUser"`        //修改用户
 	IsDeleted   int        `gorm:"type:int" json:"isDeleted"`         //是否删除 0=未删除,1=删除
 	IsDeleted   int        `gorm:"type:int" json:"isDeleted"`         //是否删除 0=未删除,1=删除
 	Status      int        `gorm:"type:int" json:"status"`            //告警状态 1处理完成2待处理3无需处理
 	Status      int        `gorm:"type:int" json:"status"`            //告警状态 1处理完成2待处理3无需处理
 	Tag         string     `gorm:"type:varchar(255)" json:"tag"`      //标签,(备用,逗号区分)
 	Tag         string     `gorm:"type:varchar(255)" json:"tag"`      //标签,(备用,逗号区分)

+ 2 - 2
app/device/dao/alarmTerminalDao.go

@@ -25,9 +25,9 @@ type AlarmTerminal struct {
 	InstallTime      time.Time `gorm:"type:date" json:"installTime"`              //安装时间
 	InstallTime      time.Time `gorm:"type:date" json:"installTime"`              //安装时间
 	TenantId         string    `gorm:"type:varchar(12)" json:"tenantId"`          //租户id
 	TenantId         string    `gorm:"type:varchar(12)" json:"tenantId"`          //租户id
 	CreateTime       time.Time `gorm:"type:datetime" json:"createTime"`           //新增时间
 	CreateTime       time.Time `gorm:"type:datetime" json:"createTime"`           //新增时间
-	CreateUser       int64     `gorm:"type:bigint" json:"createUser"`             //新增记录操作用户ID
+	CreateUser       int       `gorm:"type:int" json:"createUser"`                //新增记录操作用户ID
 	UpdateTime       time.Time `gorm:"type:datetime" json:"updateTime"`           //修改时间
 	UpdateTime       time.Time `gorm:"type:datetime" json:"updateTime"`           //修改时间
-	UpdateUser       int64     `gorm:"type:bigint" json:"updateUser"`             //修改用户
+	UpdateUser       int       `gorm:"type:int" json:"updateUser"`                //修改用户
 	IsDeleted        int       `gorm:"type:int" json:"isDeleted"`                 //是否删除 0=未删除,1=删除
 	IsDeleted        int       `gorm:"type:int" json:"isDeleted"`                 //是否删除 0=未删除,1=删除
 	Status           int       `gorm:"type:int  " json:"status"`                  //告警状态 1处理完成2待处理3无需处理
 	Status           int       `gorm:"type:int  " json:"status"`                  //告警状态 1处理完成2待处理3无需处理
 	Tag              string    `gorm:"type:varchar(255)" json:"tag"`              //标签,(备用,逗号区分)
 	Tag              string    `gorm:"type:varchar(255)" json:"tag"`              //标签,(备用,逗号区分)

+ 2 - 2
app/device/dao/bridgeDao.go

@@ -31,9 +31,9 @@ type Bridge struct {
 	Photo             string    `gorm:"type:varchar(255)" json:"photo"`             //照片
 	Photo             string    `gorm:"type:varchar(255)" json:"photo"`             //照片
 	TenantId          string    `gorm:"type:varchar(12)" json:"tenantId"`           //租户id
 	TenantId          string    `gorm:"type:varchar(12)" json:"tenantId"`           //租户id
 	CreateTime        time.Time `gorm:"type:datetime" json:"createTime"`            //新增时间
 	CreateTime        time.Time `gorm:"type:datetime" json:"createTime"`            //新增时间
-	CreateUser        int64     `gorm:"type:bigint" json:"createUser"`              //新增记录操作用户ID
+	CreateUser        int       `gorm:"type:int" json:"createUser"`                 //新增记录操作用户ID
 	UpdateTime        time.Time `gorm:"type:datetime" json:"updateTime"`            //修改时间
 	UpdateTime        time.Time `gorm:"type:datetime" json:"updateTime"`            //修改时间
-	UpdateUser        int64     `gorm:"type:bigint" json:"updateUser"`              //修改用户
+	UpdateUser        int       `gorm:"type:int" json:"updateUser"`                 //修改用户
 	IsDeleted         int       `gorm:"type:int;default 0" json:"isDeleted"`        //是否删除 0=未删除,1=删除
 	IsDeleted         int       `gorm:"type:int;default 0" json:"isDeleted"`        //是否删除 0=未删除,1=删除
 	Status            int       `gorm:"type:int" json:"status"`                     //状态 0=正常,1=异常
 	Status            int       `gorm:"type:int" json:"status"`                     //状态 0=正常,1=异常
 }
 }

+ 2 - 2
app/device/dao/bridgeSensorDao.go

@@ -21,9 +21,9 @@ type BridgeSensor struct {
 	IPAddress        string     `gorm:"type:varchar(64)" json:"ipAddress"`        //IP地址-备用
 	IPAddress        string     `gorm:"type:varchar(64)" json:"ipAddress"`        //IP地址-备用
 	TenantID         string     `gorm:"type:varchar(12)" json:"tenantID"`         //租户id
 	TenantID         string     `gorm:"type:varchar(12)" json:"tenantID"`         //租户id
 	CreateTime       time.Time  `gorm:"type:datetime" json:"createTime"`          //新增时间
 	CreateTime       time.Time  `gorm:"type:datetime" json:"createTime"`          //新增时间
-	CreateUser       int64      `gorm:"type:bigint" json:"createUser"`            //新增记录操作用户ID
+	CreateUser       int        `gorm:"type:int" json:"createUser"`               //新增记录操作用户ID
 	UpdateTime       time.Time  `gorm:"type:datetime" json:"updateTime"`          //修改时间
 	UpdateTime       time.Time  `gorm:"type:datetime" json:"updateTime"`          //修改时间
-	UpdateUser       int64      `gorm:"type:bigint" json:"updateUser"`            //修改用户
+	UpdateUser       int        `gorm:"type:int" json:"updateUser"`               //修改用户
 	IsDeleted        int        `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	IsDeleted        int        `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	Status           int        `gorm:"type:int" json:"status"`                   //状态 0=正常,1=异常
 	Status           int        `gorm:"type:int" json:"status"`                   //状态 0=正常,1=异常
 	IsEnable         int        `gorm:"type:tinyint; default 1" json:"isEnable"`  //启用禁用:1启用,2禁用
 	IsEnable         int        `gorm:"type:tinyint; default 1" json:"isEnable"`  //启用禁用:1启用,2禁用

+ 2 - 2
app/device/dao/cameraDao.go

@@ -27,9 +27,9 @@ type CameraDevice struct {
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`                   //安装时间
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`                   //安装时间
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`               //租户ID
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`               //租户ID
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`                //新增时间
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`                //新增时间
-	CreateUser       int64       `gorm:"type:bigint" json:"createUser"`                  //新增记录操作用户ID
+	CreateUser       int         `gorm:"type:int" json:"createUser"`                     //新增记录操作用户ID
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`                //修改时间
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`                //修改时间
-	UpdateUser       int64       `gorm:"type:bigint" json:"updateUser"`                  //修改用户
+	UpdateUser       int         `gorm:"type:int" json:"updateUser"`                     //修改用户
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`            //是否删除 0=未删除,1=删除
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`            //是否删除 0=未删除,1=删除
 	Status           int         `gorm:"type:int" json:"status"`                         //状态 0=正常,1=异常
 	Status           int         `gorm:"type:int" json:"status"`                         //状态 0=正常,1=异常
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`                   //标签,(备用,逗号区分)
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`                   //标签,(备用,逗号区分)

+ 2 - 2
app/device/dao/captureUnitDao.go

@@ -31,9 +31,9 @@ type CaptureUnit struct {
 	GatewaySn              string    `gorm:"type:varchar(30)" json:"gatewaySn"`                    //网关编码
 	GatewaySn              string    `gorm:"type:varchar(30)" json:"gatewaySn"`                    //网关编码
 	TenantId               string    `gorm:"type:varchar(12)" json:"tenantId"`                     //租户ID
 	TenantId               string    `gorm:"type:varchar(12)" json:"tenantId"`                     //租户ID
 	CreateTime             time.Time `gorm:"type:datetime" json:"createTime"`                      //新增时间
 	CreateTime             time.Time `gorm:"type:datetime" json:"createTime"`                      //新增时间
-	CreateUser             int64     `gorm:"type:bigint" json:"createUser"`                        //新增记录操作用户ID
+	CreateUser             int       `gorm:"type:int" json:"createUser"`                           //新增记录操作用户ID
 	UpdateTime             time.Time `gorm:"type:datetime" json:"updateTime"`                      //修改时间
 	UpdateTime             time.Time `gorm:"type:datetime" json:"updateTime"`                      //修改时间
-	UpdateUser             int64     `gorm:"type:bigint" json:"updateUser"`                        //修改用户
+	UpdateUser             int       `gorm:"type:int" json:"updateUser"`                           //修改用户
 	IsDeleted              int       `gorm:"type:int;default 0" json:"isDeleted"`                  //是否删除 0=未删除,1=删除
 	IsDeleted              int       `gorm:"type:int;default 0" json:"isDeleted"`                  //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 3 - 3
app/device/dao/checkPointDao.go

@@ -4,7 +4,7 @@ import (
 	"time"
 	"time"
 )
 )
 
 
-//CheckPoint 卡口
+// CheckPoint 卡口
 type CheckPoint struct {
 type CheckPoint struct {
 	ID            int       `gorm:"primary_key" json:"id"`                  //编号
 	ID            int       `gorm:"primary_key" json:"id"`                  //编号
 	PointName     string    `gorm:"type:varchar(64)" json:"pointName"`      //卡口名称
 	PointName     string    `gorm:"type:varchar(64)" json:"pointName"`      //卡口名称
@@ -12,9 +12,9 @@ type CheckPoint struct {
 	PointLocation string    `gorm:"type:varchar(150)" json:"pointLocation"` //卡口位置
 	PointLocation string    `gorm:"type:varchar(150)" json:"pointLocation"` //卡口位置
 	TenantId      string    `gorm:"type:varchar(12)" json:"tenantId"`       //租户ID
 	TenantId      string    `gorm:"type:varchar(12)" json:"tenantId"`       //租户ID
 	CreateTime    time.Time `gorm:"type:datetime" json:"createTime"`        //新增时间
 	CreateTime    time.Time `gorm:"type:datetime" json:"createTime"`        //新增时间
-	CreateUser    int64     `gorm:"type:bigint" json:"createUser"`          //新增记录操作用户ID
+	CreateUser    int       `gorm:"type:int" json:"createUser"`             //新增记录操作用户ID
 	UpdateTime    time.Time `gorm:"type:datetime" json:"updateTime"`        //修改时间
 	UpdateTime    time.Time `gorm:"type:datetime" json:"updateTime"`        //修改时间
-	UpdateUser    int64     `gorm:"type:bigint" json:"updateUser"`          //修改用户
+	UpdateUser    int       `gorm:"type:int" json:"updateUser"`             //修改用户
 	IsDeleted     int       `gorm:"type:int;default 0" json:"isDeleted"`    //是否删除 0=未删除,1=删除
 	IsDeleted     int       `gorm:"type:int;default 0" json:"isDeleted"`    //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 2 - 2
app/device/dao/garbageDao.go

@@ -33,9 +33,9 @@ type Garbage struct {
 	Remark          string    `gorm:"type:varchar(1000)" json:"remark"`         //备注
 	Remark          string    `gorm:"type:varchar(1000)" json:"remark"`         //备注
 	TenantId        string    `gorm:"type:varchar(12)" json:"tenantId"`         //租户id
 	TenantId        string    `gorm:"type:varchar(12)" json:"tenantId"`         //租户id
 	CreateTime      time.Time `gorm:"type:datetime" json:"createTime"`          //新增时间
 	CreateTime      time.Time `gorm:"type:datetime" json:"createTime"`          //新增时间
-	CreateUser      int64     `gorm:"type:bigint" json:"createUser"`            //新增记录操作用户ID
+	CreateUser      int       `gorm:"type:int" json:"createUser"`               //新增记录操作用户ID
 	UpdateTime      time.Time `gorm:"type:datetime" json:"updateTime"`          //修改时间
 	UpdateTime      time.Time `gorm:"type:datetime" json:"updateTime"`          //修改时间
-	UpdateUser      int64     `gorm:"type:bigint" json:"updateUser"`            //修改用户
+	UpdateUser      int       `gorm:"type:int" json:"updateUser"`               //修改用户
 	IsDeleted       int       `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	IsDeleted       int       `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	Threshold       int       `gorm:"type:int" json:"threshold"`                //阈值设定:告警百分比%
 	Threshold       int       `gorm:"type:int" json:"threshold"`                //阈值设定:告警百分比%
 }
 }

+ 2 - 2
app/device/dao/garbageWayGroupDao.go

@@ -11,9 +11,9 @@ type GarbageWayGroup struct {
 	GroupName  string    `gorm:"type:varchar(64)" json:"groupName"`   //分组名称
 	GroupName  string    `gorm:"type:varchar(64)" json:"groupName"`   //分组名称
 	TenantId   string    `gorm:"type:varchar(12)" json:"tenantId"`    //租户id
 	TenantId   string    `gorm:"type:varchar(12)" json:"tenantId"`    //租户id
 	CreateTime time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
 	CreateTime time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
-	CreateUser int64     `gorm:"type:bigint" json:"createUser"`       //新增记录操作用户ID
+	CreateUser int       `gorm:"type:int" json:"createUser"`          //新增记录操作用户ID
 	UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
 	UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
-	UpdateUser int64     `gorm:"type:bigint" json:"updateUser"`       //修改用户
+	UpdateUser int       `gorm:"type:int" json:"updateUser"`          //修改用户
 	IsDeleted  int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 	IsDeleted  int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 	Remark     string    `gorm:"type:varchar(255)" json:"remark"`     //备注
 	Remark     string    `gorm:"type:varchar(255)" json:"remark"`     //备注
 }
 }

+ 2 - 2
app/device/dao/gatewayDao.go

@@ -28,9 +28,9 @@ type Gateway struct {
 	NetworkNum         int         `gorm:"type:int;default 0" json:"networkNum"`            //网口数量
 	NetworkNum         int         `gorm:"type:int;default 0" json:"networkNum"`            //网口数量
 	TenantId           string      `gorm:"type:varchar(12)" json:"tenantId"`                //租户ID
 	TenantId           string      `gorm:"type:varchar(12)" json:"tenantId"`                //租户ID
 	CreateTime         time.Time   `gorm:"type:datetime" json:"createTime"`                 //新增时间
 	CreateTime         time.Time   `gorm:"type:datetime" json:"createTime"`                 //新增时间
-	CreateUser         int64       `gorm:"type:bigint" json:"createUser"`                   //新增记录操作用户ID
+	CreateUser         int         `gorm:"type:int" json:"createUser"`                      //新增记录操作用户ID
 	UpdateTime         time.Time   `gorm:"type:datetime" json:"updateTime"`                 //修改时间
 	UpdateTime         time.Time   `gorm:"type:datetime" json:"updateTime"`                 //修改时间
-	UpdateUser         int64       `gorm:"type:bigint" json:"updateUser"`                   //修改用户
+	UpdateUser         int         `gorm:"type:int" json:"updateUser"`                      //修改用户
 	IsDeleted          int         `gorm:"type:int;default 0" json:"isDeleted"`             //是否删除 0=未删除,1=删除
 	IsDeleted          int         `gorm:"type:int;default 0" json:"isDeleted"`             //是否删除 0=未删除,1=删除
 	Status             int         `gorm:"type:int" json:"status"`                          //状态 0=正常,1=异常
 	Status             int         `gorm:"type:int" json:"status"`                          //状态 0=正常,1=异常
 	Tag                string      `gorm:"type:varchar(255)" json:"tag"`                    //标签,(备用,逗号区分)
 	Tag                string      `gorm:"type:varchar(255)" json:"tag"`                    //标签,(备用,逗号区分)

+ 2 - 2
app/device/dao/infoBoardDao.go

@@ -31,9 +31,9 @@ type InfoBoard struct {
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`                     //安装时间
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`                     //安装时间
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`                 //租户ID
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`                 //租户ID
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`                  //新增时间
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`                  //新增时间
-	CreateUser       int64       `gorm:"type:bigint" json:"createUser"`                    //新增记录操作用户ID
+	CreateUser       int         `gorm:"type:int" json:"createUser"`                       //新增记录操作用户ID
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`                  //修改时间
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`                  //修改时间
-	UpdateUser       int64       `gorm:"type:bigint" json:"updateUser"`                    //修改用户
+	UpdateUser       int         `gorm:"type:int" json:"updateUser"`                       //修改用户
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`              //是否删除 0=未删除,1=删除
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`              //是否删除 0=未删除,1=删除
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`                     //标签,保留字段(逗号区分)
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`                     //标签,保留字段(逗号区分)
 	ExteriorUid      int         `gorm:"type:bigint" json:"exteriorUid"`                   //外设ID
 	ExteriorUid      int         `gorm:"type:bigint" json:"exteriorUid"`                   //外设ID

+ 3 - 2
app/device/dao/intelligentLightingDao.go

@@ -59,9 +59,9 @@ type IntelligentLight struct {
 	Rid          int       `gorm:"type:int" json:"rid"`                 //关联外键ID 根据type类型关联至其表
 	Rid          int       `gorm:"type:int" json:"rid"`                 //关联外键ID 根据type类型关联至其表
 	TenantId     string    `gorm:"type:varchar(12)" json:"tenantId"`    //租户ID
 	TenantId     string    `gorm:"type:varchar(12)" json:"tenantId"`    //租户ID
 	CreateTime   time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
 	CreateTime   time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
-	CreateUser   int64     `gorm:"type:bigint" json:"createUser"`       //新增记录操作用户ID
+	CreateUser   int       `gorm:"type:int" json:"createUser"`          //新增记录操作用户ID
 	UpdateTime   time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
 	UpdateTime   time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
-	UpdateUser   int64     `gorm:"type:bigint" json:"updateUser"`       //修改用户
+	UpdateUser   int       `gorm:"type:int" json:"updateUser"`          //修改用户
 	IsDeleted    int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 	IsDeleted    int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 }
 }
 
 
@@ -82,6 +82,7 @@ func (c *IntelligentLight) CreateDefaultStrategyByLight(rid int, relationType in
 	return err
 	return err
 }
 }
 
 
+// 批量获取
 func (c *IntelligentLight) BatchGet(ids []int) ([]IntelligentLight, error) {
 func (c *IntelligentLight) BatchGet(ids []int) ([]IntelligentLight, error) {
 	var intelligentLights []IntelligentLight
 	var intelligentLights []IntelligentLight
 	err := Db.Model(&c).Where("light_id in ? and is_deleted = 0", ids).Find(&intelligentLights).Error
 	err := Db.Model(&c).Where("light_id in ? and is_deleted = 0", ids).Find(&intelligentLights).Error

+ 2 - 2
app/device/dao/ipBroadcastDao.go

@@ -26,9 +26,9 @@ type IpBroadcast struct {
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`                     //安装时间
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`                     //安装时间
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`                 //租户ID
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`                 //租户ID
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`                  //新增时间
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`                  //新增时间
-	CreateUser       int64       `gorm:"type:bigint" json:"createUser"`                    //新增记录操作用户ID
+	CreateUser       int         `gorm:"type:int" json:"createUser"`                       //新增记录操作用户ID
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`                  //修改时间
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`                  //修改时间
-	UpdateUser       int64       `gorm:"type:bigint" json:"updateUser"`                    //修改用户
+	UpdateUser       int         `gorm:"type:int" json:"updateUser"`                       //修改用户
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`              //是否删除 0=未删除,1=删除
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`              //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 2 - 2
app/device/dao/lampPoleDao.go

@@ -29,9 +29,9 @@ type LampPole struct {
 	LampPolePhoto   string      `gorm:"type:varchar(255)" json:"lampPolePhoto"`   //灯杆照片
 	LampPolePhoto   string      `gorm:"type:varchar(255)" json:"lampPolePhoto"`   //灯杆照片
 	TenantId        string      `gorm:"type:varchar(12)" json:"tenantId"`         //租户ID
 	TenantId        string      `gorm:"type:varchar(12)" json:"tenantId"`         //租户ID
 	CreateTime      time.Time   `gorm:"type:datetime" json:"createTime"`          //新增时间
 	CreateTime      time.Time   `gorm:"type:datetime" json:"createTime"`          //新增时间
-	CreateUser      int64       `gorm:"type:bigint" json:"createUser"`            //新增记录操作用户ID
+	CreateUser      int         `gorm:"type:int" json:"createUser"`               //新增记录操作用户ID
 	UpdateTime      time.Time   `gorm:"type:datetime" json:"updateTime"`          //修改时间
 	UpdateTime      time.Time   `gorm:"type:datetime" json:"updateTime"`          //修改时间
-	UpdateUser      int64       `gorm:"type:bigint" json:"updateUser"`            //修改用户
+	UpdateUser      int         `gorm:"type:int" json:"updateUser"`               //修改用户
 	IsDeleted       int         `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	IsDeleted       int         `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	Status          int         `gorm:"type:int" json:"status"`                   //状态 0=正常,1=异常
 	Status          int         `gorm:"type:int" json:"status"`                   //状态 0=正常,1=异常
 	Tag             string      `gorm:"type:varchar(255)" json:"tag"`             //标签,(备用,逗号区分)
 	Tag             string      `gorm:"type:varchar(255)" json:"tag"`             //标签,(备用,逗号区分)

+ 3 - 3
app/device/dao/lampPoleGroupDao.go

@@ -6,15 +6,15 @@ import (
 	"time"
 	"time"
 )
 )
 
 
-//LampPoleGroup 灯杆分组
+// LampPoleGroup 灯杆分组
 type LampPoleGroup struct {
 type LampPoleGroup struct {
 	ID            int         `gorm:"primary_key" json:"id"`                             //编号
 	ID            int         `gorm:"primary_key" json:"id"`                             //编号
 	PoleGroupName string      `gorm:"type:varchar(64)" json:"poleGroupName"`             //分组名称
 	PoleGroupName string      `gorm:"type:varchar(64)" json:"poleGroupName"`             //分组名称
 	TenantId      string      `gorm:"type:varchar(12)" json:"tenantId"`                  //租户ID
 	TenantId      string      `gorm:"type:varchar(12)" json:"tenantId"`                  //租户ID
 	CreateTime    common.Time `gorm:"type:datetime;not null'" json:"createTime"`         //新增时间
 	CreateTime    common.Time `gorm:"type:datetime;not null'" json:"createTime"`         //新增时间
-	CreateUser    int64       `gorm:"type:bigint" json:"createUser"`                     //新增记录操作用户ID
+	CreateUser    int         `gorm:"type:int" json:"createUser"`                        //新增记录操作用户ID
 	UpdateTime    common.Time `gorm:"type:datetime" json:"updateTime"`                   //修改时间
 	UpdateTime    common.Time `gorm:"type:datetime" json:"updateTime"`                   //修改时间
-	UpdateUser    int64       `gorm:"type:bigint" json:"updateUser"`                     //修改用户
+	UpdateUser    int         `gorm:"type:int" json:"updateUser"`                        //修改用户
 	IsDeleted     int         `gorm:"type:int;default 0" json:"isDeleted"`               //是否删除 0=未删除,1=删除
 	IsDeleted     int         `gorm:"type:int;default 0" json:"isDeleted"`               //是否删除 0=未删除,1=删除
 	Tag           string      `gorm:"type:varchar(255)" json:"tag"`                      //标签,(备用,逗号区分)
 	Tag           string      `gorm:"type:varchar(255)" json:"tag"`                      //标签,(备用,逗号区分)
 	Remark        string      `gorm:"type:varchar(255)" json:"remark"`                   //备注
 	Remark        string      `gorm:"type:varchar(255)" json:"remark"`                   //备注

+ 2 - 2
app/device/dao/lightConditionDao.go

@@ -10,9 +10,9 @@ type LightCondition struct {
 	Luminance  int       `gorm:"type:int " json:"luminance"`          //开灯亮度
 	Luminance  int       `gorm:"type:int " json:"luminance"`          //开灯亮度
 	Remark     string    `gorm:"type:varchar(255)" json:"remark"`     //备注
 	Remark     string    `gorm:"type:varchar(255)" json:"remark"`     //备注
 	CreateTime time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
 	CreateTime time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
-	CreateUser int64     `gorm:"type:bigint" json:"createUser"`       //新增记录操作用户ID
+	CreateUser int       `gorm:"type:int" json:"createUser"`          //新增记录操作用户ID
 	UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
 	UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
-	UpdateUser int64     `gorm:"type:bigint" json:"updateUser"`       //修改用户
+	UpdateUser int       `gorm:"type:int" json:"updateUser"`          //修改用户
 	IsDeleted  int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 	IsDeleted  int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 2 - 2
app/device/dao/lightControlDao.go

@@ -27,9 +27,9 @@ type LightControl struct {
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`              //安装时间
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`              //安装时间
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`          //租户ID
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`          //租户ID
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`           //新增时间
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`           //新增时间
-	CreateUser       int64       `gorm:"type:bigint" json:"createUser"`             //新增记录操作用户ID
+	CreateUser       int         `gorm:"type:int" json:"createUser"`                //新增记录操作用户ID
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`           //修改时间
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`           //修改时间
-	UpdateUser       int64       `gorm:"type:bigint" json:"updateUser"`             //修改用户
+	UpdateUser       int         `gorm:"type:int" json:"updateUser"`                //修改用户
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`       //是否删除 0=未删除,1=删除
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`       //是否删除 0=未删除,1=删除
 	Status           int         `gorm:"type:int" json:"status"`                    //状态 0=正常,1=异常
 	Status           int         `gorm:"type:int" json:"status"`                    //状态 0=正常,1=异常
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`              //标签,(备用,逗号区分)
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`              //标签,(备用,逗号区分)

+ 2 - 2
app/device/dao/manholeCoverDao.go

@@ -30,9 +30,9 @@ type ManholeCover struct {
 	Remark              string     `gorm:"type:varchar(1000)  " json:"remark"`       //备注
 	Remark              string     `gorm:"type:varchar(1000)  " json:"remark"`       //备注
 	TenantId            string     `gorm:"type:varchar(12)" json:"tenantId"`         //租户ID
 	TenantId            string     `gorm:"type:varchar(12)" json:"tenantId"`         //租户ID
 	CreateTime          time.Time  `gorm:"type:datetime" json:"createTime"`          //新增时间
 	CreateTime          time.Time  `gorm:"type:datetime" json:"createTime"`          //新增时间
-	CreateUser          int64      `gorm:"type:bigint" json:"createUser"`            //新增记录操作用户ID
+	CreateUser          int        `gorm:"type:int" json:"createUser"`               //新增记录操作用户ID
 	UpdateTime          time.Time  `gorm:"type:datetime" json:"updateTime"`          //修改时间
 	UpdateTime          time.Time  `gorm:"type:datetime" json:"updateTime"`          //修改时间
-	UpdateUser          int64      `gorm:"type:bigint" json:"updateUser"`            //修改用户
+	UpdateUser          int        `gorm:"type:int" json:"updateUser"`               //修改用户
 	IsDeleted           int        `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	IsDeleted           int        `gorm:"type:int;default 0" json:"isDeleted"`      //是否删除 0=未删除,1=删除
 	Status              int        `gorm:"type:int" json:"status"`                   //状态 0=正常,1=异常
 	Status              int        `gorm:"type:int" json:"status"`                   //状态 0=正常,1=异常
 	Tag                 string     `gorm:"type:varchar(255)" json:"tag"`             //标签,保留字段(逗号区分)
 	Tag                 string     `gorm:"type:varchar(255)" json:"tag"`             //标签,保留字段(逗号区分)

+ 3 - 3
app/device/dao/onDemandGroupDao.go

@@ -5,7 +5,7 @@ import (
 	"time"
 	"time"
 )
 )
 
 
-//OnDemandGroup 灯随车走分组
+// OnDemandGroup 灯随车走分组
 type OnDemandGroup struct {
 type OnDemandGroup struct {
 	ID                int       `gorm:"primary_key" json:"id"`                 //编号
 	ID                int       `gorm:"primary_key" json:"id"`                 //编号
 	PoleGroupName     string    `gorm:"type:varchar(64)" json:"poleGroupName"` //分组名称
 	PoleGroupName     string    `gorm:"type:varchar(64)" json:"poleGroupName"` //分组名称
@@ -16,9 +16,9 @@ type OnDemandGroup struct {
 	OutTimes          int       `gorm:"type:int" json:"outTimes"`              //延迟时间
 	OutTimes          int       `gorm:"type:int" json:"outTimes"`              //延迟时间
 	TenantId          string    `gorm:"type:varchar(12)" json:"tenantId"`      //租户ID
 	TenantId          string    `gorm:"type:varchar(12)" json:"tenantId"`      //租户ID
 	CreateTime        time.Time `gorm:"type:datetime" json:"createTime"`       //新增时间
 	CreateTime        time.Time `gorm:"type:datetime" json:"createTime"`       //新增时间
-	CreateUser        int64     `gorm:"type:bigint" json:"createUser"`         //新增记录操作用户ID
+	CreateUser        int       `gorm:"type:int" json:"createUser"`            //新增记录操作用户ID
 	UpdateTime        time.Time `gorm:"type:datetime" json:"updateTime"`       //修改时间
 	UpdateTime        time.Time `gorm:"type:datetime" json:"updateTime"`       //修改时间
-	UpdateUser        int64     `gorm:"type:bigint" json:"updateUser"`         //修改用户
+	UpdateUser        int       `gorm:"type:int" json:"updateUser"`            //修改用户
 	IsDeleted         int       `gorm:"type:int;default 0" json:"isDeleted"`   //是否删除 0=未删除,1=删除
 	IsDeleted         int       `gorm:"type:int;default 0" json:"isDeleted"`   //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 2 - 2
app/device/dao/onDemandSensorDao.go

@@ -17,9 +17,9 @@ type OnDemandSensor struct {
 	InstallTime time.Time `gorm:"type:date" json:"installTime"`         //安装时间
 	InstallTime time.Time `gorm:"type:date" json:"installTime"`         //安装时间
 	TenantId    string    `gorm:"type:varchar(12)" json:"tenantId"`     //租户ID
 	TenantId    string    `gorm:"type:varchar(12)" json:"tenantId"`     //租户ID
 	CreateTime  time.Time `gorm:"type:datetime" json:"createTime"`      //新增时间
 	CreateTime  time.Time `gorm:"type:datetime" json:"createTime"`      //新增时间
-	CreateUser  int64     `gorm:"type:bigint" json:"createUser"`        //新增记录操作用户ID
+	CreateUser  int       `gorm:"type:int" json:"createUser"`           //新增记录操作用户ID
 	UpdateTime  time.Time `gorm:"type:datetime" json:"updateTime"`      //修改时间
 	UpdateTime  time.Time `gorm:"type:datetime" json:"updateTime"`      //修改时间
-	UpdateUser  int64     `gorm:"type:bigint" json:"updateUser"`        //修改用户
+	UpdateUser  int       `gorm:"type:int" json:"updateUser"`           //修改用户
 	IsDeleted   int       `gorm:"type:int; default 0" json:"isDeleted"` //是否删除:0=未删除,1=删除
 	IsDeleted   int       `gorm:"type:int; default 0" json:"isDeleted"` //是否删除:0=未删除,1=删除
 	Status      int       `gorm:"type:int; default 0" json:"status"`    //状态0=正常,1=异常
 	Status      int       `gorm:"type:int; default 0" json:"status"`    //状态0=正常,1=异常
 }
 }

+ 2 - 2
app/device/dao/optoSensoDao.go

@@ -25,9 +25,9 @@ type OptoSensor struct {
 	IsDefault        int         `gorm:"type:int;default 0" json:"isDefault"`       //是否设为首页默认展示 0=不展示,1=设置展示
 	IsDefault        int         `gorm:"type:int;default 0" json:"isDefault"`       //是否设为首页默认展示 0=不展示,1=设置展示
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`          //租户ID
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`          //租户ID
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`           //新增时间
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`           //新增时间
-	CreateUser       int64       `gorm:"type:bigint" json:"createUser"`             //新增记录操作用户ID
+	CreateUser       int         `gorm:"type:int" json:"createUser"`                //新增记录操作用户ID
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`           //修改时间
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`           //修改时间
-	UpdateUser       int64       `gorm:"type:bigint" json:"updateUser"`             //修改用户
+	UpdateUser       int         `gorm:"type:int" json:"updateUser"`                //修改用户
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`       //是否删除 0=未删除,1=删除
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`       //是否删除 0=未删除,1=删除
 	Status           int         `gorm:"type:int" json:"status"`                    //状态 0=正常,1=异常
 	Status           int         `gorm:"type:int" json:"status"`                    //状态 0=正常,1=异常
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`              //标签,保留字段(逗号区分)
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`              //标签,保留字段(逗号区分)

+ 2 - 2
app/device/dao/switchBoxDao.go

@@ -26,9 +26,9 @@ type SwitchBox struct {
 	InstallTime    common.Time `gorm:"type:date" json:"installTime"`                      //安装时间
 	InstallTime    common.Time `gorm:"type:date" json:"installTime"`                      //安装时间
 	TenantId       string      `gorm:"type:varchar(12)" json:"tenantId"`                  //租户id
 	TenantId       string      `gorm:"type:varchar(12)" json:"tenantId"`                  //租户id
 	CreateTime     time.Time   `gorm:"type:datetime" json:"createTime"`                   //新增时间
 	CreateTime     time.Time   `gorm:"type:datetime" json:"createTime"`                   //新增时间
-	CreateUser     int64       `gorm:"type:bigint" json:"createUser"`                     //新增记录操作用户ID
+	CreateUser     int         `gorm:"type:int" json:"createUser"`                        //新增记录操作用户ID
 	UpdateTime     time.Time   `gorm:"type:datetime" json:"updateTime"`                   //修改时间
 	UpdateTime     time.Time   `gorm:"type:datetime" json:"updateTime"`                   //修改时间
-	UpdateUser     int64       `gorm:"type:bigint" json:"updateUser"`                     //修改用户
+	UpdateUser     int         `gorm:"type:int" json:"updateUser"`                        //修改用户
 	IsDeleted      int         `gorm:"type:int;default 0" json:"isDeleted"`               //是否删除 0=未删除,1=删除
 	IsDeleted      int         `gorm:"type:int;default 0" json:"isDeleted"`               //是否删除 0=未删除,1=删除
 	Status         int         `gorm:"type:int" json:"status"`                            //状态 0=正常,1=异常
 	Status         int         `gorm:"type:int" json:"status"`                            //状态 0=正常,1=异常
 	Tag            string      `gorm:"type:varchar(255)" json:"tag"`                      //标签,保留字段(逗号区分)
 	Tag            string      `gorm:"type:varchar(255)" json:"tag"`                      //标签,保留字段(逗号区分)

+ 2 - 2
app/device/dao/timeConditionDao.go

@@ -10,9 +10,9 @@ type TimeCondition struct {
 	Luminance  int       `gorm:"type:int " json:"luminance"`          //开灯亮度
 	Luminance  int       `gorm:"type:int " json:"luminance"`          //开灯亮度
 	Remark     string    `gorm:"type:varchar(255)" json:"remark"`     //备注
 	Remark     string    `gorm:"type:varchar(255)" json:"remark"`     //备注
 	CreateTime time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
 	CreateTime time.Time `gorm:"type:datetime" json:"createTime"`     //新增时间
-	CreateUser int64     `gorm:"type:bigint" json:"createUser"`       //新增记录操作用户ID
+	CreateUser int       `gorm:"type:int" json:"createUser"`          //新增记录操作用户ID
 	UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
 	UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"`     //修改时间
-	UpdateUser int64     `gorm:"type:bigint" json:"updateUser"`       //修改用户
+	UpdateUser int       `gorm:"type:int" json:"updateUser"`          //修改用户
 	IsDeleted  int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 	IsDeleted  int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
 	Sunshine   int       `gorm:"type:int;default 1" json:"sunshine"`  //日出日落 设置 2=开启,1=不开启
 	Sunshine   int       `gorm:"type:int;default 1" json:"sunshine"`  //日出日落 设置 2=开启,1=不开启
 }
 }

+ 2 - 2
app/device/dao/transformerDao.go

@@ -21,9 +21,9 @@ type Transformer struct {
 	InstallTime     *time.Time `gorm:"type:date" json:"installTime"`                      //安装时间
 	InstallTime     *time.Time `gorm:"type:date" json:"installTime"`                      //安装时间
 	TenantId        string     `gorm:"type:varchar(12)" json:"tenantId"`                  //租户id
 	TenantId        string     `gorm:"type:varchar(12)" json:"tenantId"`                  //租户id
 	CreateTime      time.Time  `gorm:"type:datetime" json:"createTime"`                   //新增时间
 	CreateTime      time.Time  `gorm:"type:datetime" json:"createTime"`                   //新增时间
-	CreateUser      int64      `gorm:"type:bigint" json:"createUser"`                     //新增记录操作用户ID
+	CreateUser      int        `gorm:"type:int" json:"createUser"`                        //新增记录操作用户ID
 	UpdateTime      time.Time  `gorm:"type:datetime" json:"updateTime"`                   //修改时间
 	UpdateTime      time.Time  `gorm:"type:datetime" json:"updateTime"`                   //修改时间
-	UpdateUser      int64      `gorm:"type:bigint" json:"updateUser"`                     //修改用户
+	UpdateUser      int        `gorm:"type:int" json:"updateUser"`                        //修改用户
 	IsDeleted       int        `gorm:"type:int;default 0" json:"isDeleted"`               //是否删除 0=未删除,1=删除
 	IsDeleted       int        `gorm:"type:int;default 0" json:"isDeleted"`               //是否删除 0=未删除,1=删除
 	Status          int        `gorm:"type:int" json:"status"`                            //状态 0=正常,1=异常
 	Status          int        `gorm:"type:int" json:"status"`                            //状态 0=正常,1=异常
 	CountNum        int64      `gorm:"-" json:"countNum"`                                 //关联供电箱数量
 	CountNum        int64      `gorm:"-" json:"countNum"`                                 //关联供电箱数量

+ 2 - 2
app/device/dao/venderDao.go

@@ -13,9 +13,9 @@ type DeviceVendor struct {
 	DeviceType  int       `gorm:"type:int" json:"deviceType"`           //设备类型
 	DeviceType  int       `gorm:"type:int" json:"deviceType"`           //设备类型
 	TenantId    string    `gorm:"type:varchar(12)" json:"tenantId"`     //租户id
 	TenantId    string    `gorm:"type:varchar(12)" json:"tenantId"`     //租户id
 	CreateTime  time.Time `gorm:"type:datetime" json:"createTime"`      //新增时间
 	CreateTime  time.Time `gorm:"type:datetime" json:"createTime"`      //新增时间
-	CreateUser  int64     `gorm:"type:bigint" json:"createUser"`        //新增记录操作用户ID
+	CreateUser  int       `gorm:"type:int" json:"createUser"`           //新增记录操作用户ID
 	UpdateTime  time.Time `gorm:"type:datetime" json:"updateTime"`      //修改时间
 	UpdateTime  time.Time `gorm:"type:datetime" json:"updateTime"`      //修改时间
-	UpdateUser  int64     `gorm:"type:bigint" json:"updateUser"`        //修改用户
+	UpdateUser  int       `gorm:"type:int" json:"updateUser"`           //修改用户
 	IsDeleted   int       `gorm:"type:int" json:"isDeleted"`            //是否删除 0=未删除,1=删除
 	IsDeleted   int       `gorm:"type:int" json:"isDeleted"`            //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 100 - 25
app/device/dao/workbenchDao.go

@@ -1,14 +1,17 @@
 package dao
 package dao
 
 
 import (
 import (
+	"fmt"
 	"strings"
 	"strings"
 )
 )
 
 
+// 工作台
 type CountDevice struct {
 type CountDevice struct {
 	CountNum   int    `json:"countNum"`
 	CountNum   int    `json:"countNum"`
 	DeviceType string `json:"deviceType"`
 	DeviceType string `json:"deviceType"`
 }
 }
 
 
+// 获取所有设备的数量
 func GetDeviceCount(tenantId string) ([]CountDevice, error) {
 func GetDeviceCount(tenantId string) ([]CountDevice, error) {
 	var result []CountDevice
 	var result []CountDevice
 	var count CountDevice
 	var count CountDevice
@@ -75,9 +78,80 @@ type Notification struct {
 	Title    string `json:"title"`
 	Title    string `json:"title"`
 }
 }
 
 
-func GetNotification(tenantId string) (*Notification, error) {
-	var notification Notification
-	return &notification, nil
+//	func GetNotification(tenantId string) (*Notification, error) {
+//		var notification Notification
+//		return &notification, nil
+//	}
+type DeviceState struct {
+	DeviceType string `json:"deviceType"` //设备类型
+	Name       string `json:"name"`       //设备名称
+	Sn         string `json:"sn"`         //设备序列号
+}
+
+// 获取设备离线的状态
+func GetNotification(tenantId string) ([]DeviceState, error) {
+	var result []DeviceState
+	//灯杆设备
+	Db.Model(&LampPole{}).Select(" pole_name as  name, pole_sn as sn,status,'灯杆设备' device_type").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&result)
+	result = append(result)
+	////摄像机
+	var camera []DeviceState
+	Db.Model(&CameraDevice{}).Select(" device_name as name,device_sn as sn,'摄像机' device_type ").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&camera)
+	result = append(result, camera...)
+	//网关
+	var gateway []DeviceState
+	Db.Model(&Gateway{}).Select(" gateway_name as name ,gateway_sn as sn,'网关' device_type ").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&gateway)
+	result = append(result, gateway...)
+	//灯控
+	var light []DeviceState
+	Db.Model(&LightControl{}).Select(" name,sn,'灯控' device_type").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&light)
+	result = append(result, light...)
+	//供电箱
+	var box []DeviceState
+	Db.Model(&SwitchBox{}).Select(" box_name as name ,box_sn as sn,'供电箱' device_type ").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&box)
+	result = append(result, box...)
+	//信息基本屏
+	var info []DeviceState
+	Db.Model(&InfoBoard{}).Select(" 'info_name as name,sn,'信息基本屏' device_type ").
+		Where("  tenant_id = ? and is_enable!=1", tenantId).Find(&info)
+	result = append(result, info...)
+	//集控器
+	var sensor []DeviceState
+	Db.Model(&OptoSensor{}).Select(" name,sn,'集控器' device_type ").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&sensor)
+	result = append(result, sensor...)
+	//Zigbee集控器
+	var zig []DeviceState
+	Db.Model(&Zigbee{}).Select("name,sn,'Zigbee集控器' device_type").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&zig)
+	result = append(result, zig...)
+	//一键求助终端
+	var terminal []DeviceState
+	Db.Model(&AlarmTerminal{}).Select(" terminal_name as name ,terminal_sn as sn,'一键求助终端' device_type").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&terminal)
+	result = append(result, terminal...)
+	//一键求助管理机
+	var alarm []DeviceState
+	Db.Model(&Alarm{}).Select("serve_name as name ,serve_sn as sn,'一键求助管理机' device_type").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&alarm)
+	result = append(result, alarm...)
+	//ip音柱
+	var cast []DeviceState
+	Db.Model(&IpBroadcast{}).Select("cast_name as name,cast_sn as sn,'ip音柱' device_type ").
+		Where("tenant_id = ? and  is_deleted!=0", tenantId).Find(&cast)
+	result = append(result, cast...)
+	//桥梁传感器
+	var bridge []DeviceState
+	Db.Model(&BridgeSensor{}).Select("name,sn,'桥梁传感器' device_type").
+		Where("tenant_id = ? and status!=-1", tenantId).Find(&bridge)
+	result = append(result, bridge...)
+	fmt.Println(result)
+	return result, nil
 }
 }
 
 
 type AqiData struct {
 type AqiData struct {
@@ -110,34 +184,35 @@ type OptoSensorVO struct {
 
 
 }
 }
 
 
+// 获取aqi
 func GetAqi(tenantId string) (*OptoSensorVO, error) {
 func GetAqi(tenantId string) (*OptoSensorVO, error) {
-	var sensorVO OptoSensorVO
-	var optoSensor OptoSensor
-	optoSensor.TenantId = tenantId
-	optoSensor.IsDefault = 1
-	isSet := len(optoSensor.GetDevicesByTenantId())
-	if isSet == 0 {
-		optoSensor.IsDefault = 0
+	var sensorVO OptoSensorVO                       // 声明一个OptoSensorVO类型的变量sensorVO
+	var optoSensor OptoSensor                       // 声明一个OptoSensor类型的变量optoSensor
+	optoSensor.TenantId = tenantId                  // 将传入的tenantId赋值给optoSensor的TenantId字段
+	optoSensor.IsDefault = 1                        // 将optoSensor的IsDefault字段设置为1
+	isSet := len(optoSensor.GetDevicesByTenantId()) // 调用optoSensor的GetDevicesByTenantId方法获取设备数量,并将结果赋值给isSet
+	if isSet == 0 {                                 // 如果isSet为0,即没有设备
+		optoSensor.IsDefault = 0 // 将optoSensor的IsDefault字段设置为0
 	}
 	}
-	list := optoSensor.getList(optoSensor)
-	if isSet == 0 {
-		for _, sensor := range list {
-			if sensor.NetworkState == 1 {
-				sensorVO = sensor
-				break
+	list := optoSensor.getList(optoSensor) // 调用optoSensor的getList方法获取设备列表,并将结果赋值给list
+	if isSet == 0 {                        // 如果isSet为0,即没有设备
+		for _, sensor := range list { // 遍历设备列表
+			if sensor.NetworkState == 1 { // 如果设备的NetworkState字段为1
+				sensorVO = sensor // 将该设备赋值给sensorVO
+				break             // 跳出循环
 			}
 			}
 		}
 		}
-	} else {
-		if len(list) != 0 {
-			sensorVO = list[0]
+	} else { // 如果isSet不为0,即有设备
+		if len(list) != 0 { // 如果设备列表不为空
+			sensorVO = list[0] // 将设备列表的第一个设备赋值给sensorVO
 		}
 		}
 	}
 	}
-	if sensorVO.RealTimeTemperature != "" {
-		temp := strings.Split(sensorVO.RealTimeTemperature, " ")
-		if len(temp) == 2 {
-			temperature := temp[0] + " " + temp[1]
-			sensorVO.RealTimeTemperature = temperature
+	if sensorVO.RealTimeTemperature != "" { // 如果sensorVO的RealTimeTemperature字段不为空
+		temp := strings.Split(sensorVO.RealTimeTemperature, " ") // 使用空格将RealTimeTemperature字段拆分成字符串数组temp
+		if len(temp) == 2 {                                      // 如果拆分后的数组长度为2
+			temperature := temp[0] + " " + temp[1]     // 将temp数组的第一个元素和第二个元素拼接成字符串,并赋值给temperature
+			sensorVO.RealTimeTemperature = temperature // 将temperature赋值给sensorVO的RealTimeTemperature字段
 		}
 		}
 	}
 	}
-	return &sensorVO, nil
+	return &sensorVO, nil // 返回sensorVO的地址和nil作为错误值
 }
 }

+ 2 - 2
app/device/dao/zigbeeDao.go

@@ -28,9 +28,9 @@ type Zigbee struct {
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`              //安装时间
 	InstallTime      common.Time `gorm:"type:date" json:"installTime"`              //安装时间
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`          //租户id
 	TenantId         string      `gorm:"type:varchar(12)" json:"tenantId"`          //租户id
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`           //新增时间
 	CreateTime       time.Time   `gorm:"type:datetime" json:"createTime"`           //新增时间
-	CreateUser       int64       `gorm:"type:bigint" json:"createUser"`             //新增记录操作用户ID
+	CreateUser       int         `gorm:"type:int" json:"createUser"`                //新增记录操作用户ID
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`           //修改时间
 	UpdateTime       time.Time   `gorm:"type:datetime" json:"updateTime"`           //修改时间
-	UpdateUser       int64       `gorm:"type:bigint" json:"updateUser"`             //修改用户
+	UpdateUser       int         `gorm:"type:int" json:"updateUser"`                //修改用户
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`       //是否删除 0=未删除,1=删除
 	IsDeleted        int         `gorm:"type:int;default 0" json:"isDeleted"`       //是否删除 0=未删除,1=删除
 	Status           int         `gorm:"type:int" json:"status"`                    //状态0=正常 状态0=正常,1=异常
 	Status           int         `gorm:"type:int" json:"status"`                    //状态0=正常 状态0=正常,1=异常
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`              //标签,保留字段(逗号区分)
 	Tag              string      `gorm:"type:varchar(255)" json:"tag"`              //标签,保留字段(逗号区分)

+ 2 - 2
app/device/service/LightStrategyService.go

@@ -39,7 +39,7 @@ func (s *lightStrategyService) Get(id int) (*model.LightStrategyDetail, *common.
 	return lightStrategy, nil
 	return lightStrategy, nil
 }
 }
 
 
-func (s *lightStrategyService) CreateOrUpdate(userId int64, tenantId string, req *model.LightStrategyDetail) *common.Errors {
+func (s *lightStrategyService) CreateOrUpdate(userId int, tenantId string, req *model.LightStrategyDetail) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	strategy := req
 	strategy := req
 	logger.Logger.Errorf("CreateOrUpdate strategy = %+v \n", strategy)
 	logger.Logger.Errorf("CreateOrUpdate strategy = %+v \n", strategy)
@@ -235,7 +235,7 @@ func (s *lightStrategyService) List(searchValue string, current, size int) ([]mo
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *lightStrategyService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *lightStrategyService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	strategy := &dao.LightStrategy{
 	strategy := &dao.LightStrategy{
 		ID:         id,
 		ID:         id,

+ 51 - 44
app/device/service/alarmService.go

@@ -16,56 +16,58 @@ var AlarmService = new(alarmService)
 
 
 type alarmService struct{}
 type alarmService struct{}
 
 
+// 根据id获取设备信息
 func (s *alarmService) Get(id int) (*dao.Alarm, *common.Errors) {
 func (s *alarmService) Get(id int) (*dao.Alarm, *common.Errors) {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Alarm{
 	device := &dao.Alarm{
 		ID: id,
 		ID: id,
 	}
 	}
-	err := device.GetDevice()
+	err := device.GetDevice() //调用device的GetDevice方法,将返回值赋给err
 	if err != nil {
 	if err != nil {
-		return nil, common.FailResponse(err.Error(), nil)
+		return nil, common.FailResponse(err.Error(), nil) //如果err不为nil,则返回一个空指针和错误信息
 	}
 	}
-	device.CountRel = int(dao.AlarmTerminal{}.GetTerminalCount(device.ID))
-	return device, nil
+	device.CountRel = int(dao.AlarmTerminal{}.GetTerminalCount(device.ID)) //调用一键报警服务中的获取终端计数的方法,将返回值转换为整数并赋值给device.CountRel
+	return device, nil                                                     //返回设备和nil
 }
 }
 
 
-func (s *alarmService) CreateOrUpdate(userId int64, tenantId string, req dao.Alarm) *common.Errors {
-	device := req
+// 添加设备或者修改设备
+func (s *alarmService) CreateOrUpdate(userId int, tenantId string, req dao.Alarm) *common.Errors {
+	device := req //创建一个名为device的变量,将传入的req赋值给它
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
 	device.UpdateTime = time.Now()
 	device.UpdateTime = time.Now()
+	if req.ID == 0 { //判断传入的req是否没有ID
+		device.CreateTime = time.Now() //如果req.ID为0,则为device的成员变量CreateTime赋值当前时间
+		device.CreateUser = userId     //device的成员变量CreateUser为传入的userid
 
 
-	if req.ID == 0 {
-		device.CreateTime = time.Now()
-		device.CreateUser = userId
-
-		if device.IsExistedBySN() {
-			logger.Logger.Errorf("Create IsExistedBySN \n")
-			return common.ParamsInvalidResponse(model.RepeatedName, nil)
+		if device.IsExistedBySN() { //判断设备是否已经存在
+			logger.Logger.Errorf("Create IsExistedBySN \n")              //如果设备已经存在,则记录错误日志
+			return common.ParamsInvalidResponse(model.RepeatedName, nil) //返回参数无效的错误响应
 		}
 		}
-		if err := device.Create(); err != nil {
-			logger.Logger.Errorf("Create err = %s \n", err.Error())
-			return common.FailResponse(err.Error(), nil)
+		if err := device.Create(); err != nil { //尝试创建设备
+			logger.Logger.Errorf("Create err = %s \n", err.Error()) //如果创建失败,则记录错误日志
+			return common.FailResponse(err.Error(), nil)            //返回创建失败的错误响应
 		}
 		}
 		service.OperationHisService.Save(userId, tenantId, common.OperationCreate, common.ModuleTypeDevice,
 		service.OperationHisService.Save(userId, tenantId, common.OperationCreate, common.ModuleTypeDevice,
-			common.DeviceTypeAlarmServer, common.GetDeviceObject(device.ID, device.ServeName), common.OperationSuccess)
-		return common.SuccessResponse(common.Succeeded, nil)
+			common.DeviceTypeAlarmServer, common.GetDeviceObject(device.ID, device.ServeName), common.OperationSuccess) //保存操作历史记录
+		return common.SuccessResponse(common.Succeeded, nil) //返回成功响应
 	}
 	}
 
 
-	if device.IsExistedByNameAndCode() {
-		logger.Logger.Errorf("Update IsExistedByNameAndCode \n")
-		return common.ParamsInvalidResponse(model.RepeatedName, nil)
+	if device.IsExistedByNameAndCode() { //判断设备是否已经存在
+		logger.Logger.Errorf("Update IsExistedByNameAndCode \n")     //如果设备已经存在,则记录错误日志
+		return common.ParamsInvalidResponse(model.RepeatedName, nil) //返回参数无效的错误响应
 	}
 	}
-	if err := device.Update(); err != nil {
-		logger.Logger.Errorf("Update err = %s \n", err.Error())
-		return common.FailResponse(err.Error(), nil)
+	if err := device.Update(); err != nil { //尝试更新设备
+		logger.Logger.Errorf("Update err = %s \n", err.Error()) //如果更新失败,则记录错误日志
+		return common.FailResponse(err.Error(), nil)            //返回更新失败的错误响应
 	}
 	}
 
 
 	service.OperationHisService.Save(userId, tenantId, common.OperationUpdate, common.ModuleTypeDevice,
 	service.OperationHisService.Save(userId, tenantId, common.OperationUpdate, common.ModuleTypeDevice,
-		common.DeviceTypeAlarmServer, common.GetDeviceObject(device.ID, device.ServeName), common.OperationSuccess)
-	return common.SuccessResponse(common.Succeeded, nil)
+		common.DeviceTypeAlarmServer, common.GetDeviceObject(device.ID, device.ServeName), common.OperationSuccess) //保存操作历史记录
+	return common.SuccessResponse(common.Succeeded, nil) //返回成功响应
 }
 }
 
 
+// 获取所有设备
 func (s *alarmService) List(poleGroupName string, current, size int) ([]dao.Alarm, int64, *common.Errors) {
 func (s *alarmService) List(poleGroupName string, current, size int) ([]dao.Alarm, int64, *common.Errors) {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Alarm{}
 	device := &dao.Alarm{}
@@ -81,7 +83,8 @@ func (s *alarmService) List(poleGroupName string, current, size int) ([]dao.Alar
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *alarmService) Remove(userId int64, tenantId string, id int) *common.Errors {
+// 移除设备
+func (s *alarmService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Alarm{
 	device := &dao.Alarm{
 		ID:         id,
 		ID:         id,
@@ -98,36 +101,40 @@ func (s *alarmService) Remove(userId int64, tenantId string, id int) *common.Err
 	return nil
 	return nil
 }
 }
 
 
+// 获取设备列表
 func (s *alarmService) GetList(tenantId string) ([]*dao.Alarm, *common.Errors) {
 func (s *alarmService) GetList(tenantId string) ([]*dao.Alarm, *common.Errors) {
-	var devices []*dao.Alarm
-	err := cache.Redis.Get(getAlarmListRedisKey(tenantId)).Scan(&devices)
-	if err == nil {
-		return devices, nil
+	var devices []*dao.Alarm                                              //声明一个名为devices的变量,类型为指向dao.Alarm结构体的指针的切片
+	err := cache.Redis.Get(getAlarmListRedisKey(tenantId)).Scan(&devices) //从Redis缓存中获取指定租户ID的设备列表,并将结果存储在devices变量中
+	if err == nil {                                                       //判断是否成功从Redis缓存中获取设备列表                                                  //
+		return devices, nil //如果成功获取设备列表,则返回设备列表和nil错误
 	}
 	}
-	device := &dao.Alarm{
+	device := &dao.Alarm{ //创建一个新的dao.Alarm结构体实例,并将其赋值给device变量
 		TenantId:  tenantId,
 		TenantId:  tenantId,
 		IsDeleted: 0,
 		IsDeleted: 0,
 	}
 	}
-	devices, err = device.GetAllDevices()
-	if err != nil {
-		return nil, common.FailResponse(err.Error(), nil)
+	devices, err = device.GetAllDevices() //调用device的GetAllDevices方法,获取所有设备列表,并将结果存储在devices变量中
+	if err != nil {                       //判断是否获取设备列表时发生错误
+		return nil, common.FailResponse(err.Error(), nil) //如果发生错误,则返回nil和错误响应
 	}
 	}
-	_ = cache.Redis.Set(getAlarmListRedisKey(tenantId), devices, 0).Err()
-	return devices, nil
+	_ = cache.Redis.Set(getAlarmListRedisKey(tenantId), devices, 0).Err() //将获取到的设备列表存储到Redis缓存中,并设置过期时间为0
+	return devices, nil                                                   //返回设备列表和nil错误
 }
 }
 
 
+// 获取报警列表redis密钥
 func getAlarmListRedisKey(tenantId string) string {
 func getAlarmListRedisKey(tenantId string) string {
-	return fmt.Sprintf(model.AlarmList, tenantId)
+	return fmt.Sprintf(model.AlarmList, tenantId) //使用fmt.Sprintf函数将model.AlarmList和tenantId格式化为一个字符串,并将其作为方法的返回值
 }
 }
 
 
+// 获取设备的数量
 func (s *alarmService) DeviceCount() dao.DeviceStatus {
 func (s *alarmService) DeviceCount() dao.DeviceStatus {
-	var rsp dao.DeviceStatus
-	d := dao.Alarm{}
-	rsp.Set(d.DeviceCount1())
-	return rsp
+	var rsp dao.DeviceStatus  //声明一个名为rsp的变量,类型为指向dao.DeviceStatus结构体的指针
+	d := dao.Alarm{}          //声明一个名为d的变量,类型为dao.Alarm结构体
+	rsp.Set(d.DeviceCount1()) //调用rsp的Set方法,将d.DeviceCount1()的结果作为参数传入
+	return rsp                //返回rsp变量
 }
 }
 
 
+// 设备列表
 func (s *alarmService) ListDevices() []dao.Device {
 func (s *alarmService) ListDevices() []dao.Device {
-	d := dao.Alarm{}
-	return d.ListDevices1()
+	d := dao.Alarm{}        //声明一个d的变量,类型为dao.Alarm结构体
+	return d.ListDevices1() //返回设备的列表
 }
 }

+ 10 - 2
app/device/service/alarmTerminalService.go

@@ -15,6 +15,7 @@ var AlarmTerminalService = new(alarmTerminalService)
 
 
 type alarmTerminalService struct{}
 type alarmTerminalService struct{}
 
 
+// 获取单个设备信息
 func (s *alarmTerminalService) Get(id int) (*model.AlarmTerminalDetail, *common.Errors) {
 func (s *alarmTerminalService) Get(id int) (*model.AlarmTerminalDetail, *common.Errors) {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.AlarmTerminal{
 	device := &dao.AlarmTerminal{
@@ -33,7 +34,8 @@ func (s *alarmTerminalService) Get(id int) (*model.AlarmTerminalDetail, *common.
 	}, nil
 	}, nil
 }
 }
 
 
-func (s *alarmTerminalService) CreateOrUpdate(userId int64, tenantId string, req dao.AlarmTerminal) *common.Errors {
+// 添加或者修改设备信息
+func (s *alarmTerminalService) CreateOrUpdate(userId int, tenantId string, req dao.AlarmTerminal) *common.Errors {
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -71,6 +73,7 @@ func (s *alarmTerminalService) CreateOrUpdate(userId int64, tenantId string, req
 	return common.SuccessResponse(common.Succeeded, nil)
 	return common.SuccessResponse(common.Succeeded, nil)
 }
 }
 
 
+// 获取设备信息
 func (s *alarmTerminalService) List(poleGroupName string, current, size int) ([]model.AlarmTerminalDetail, int64, *common.Errors) {
 func (s *alarmTerminalService) List(poleGroupName string, current, size int) ([]model.AlarmTerminalDetail, int64, *common.Errors) {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.AlarmTerminal{}
 	device := &dao.AlarmTerminal{}
@@ -93,7 +96,8 @@ func (s *alarmTerminalService) List(poleGroupName string, current, size int) ([]
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *alarmTerminalService) Remove(userId int64, tenantId string, id int) *common.Errors {
+// 移除设备信息
+func (s *alarmTerminalService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.AlarmTerminal{
 	device := &dao.AlarmTerminal{
 		ID:         id,
 		ID:         id,
@@ -110,6 +114,7 @@ func (s *alarmTerminalService) Remove(userId int64, tenantId string, id int) *co
 	return nil
 	return nil
 }
 }
 
 
+// 根据网关获取设备信息
 func (s *alarmTerminalService) GetByGateway(id int) []dao.AlarmTerminal {
 func (s *alarmTerminalService) GetByGateway(id int) []dao.AlarmTerminal {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.AlarmTerminal{
 	device := &dao.AlarmTerminal{
@@ -118,6 +123,7 @@ func (s *alarmTerminalService) GetByGateway(id int) []dao.AlarmTerminal {
 	return device.GetDevicesByGateway()
 	return device.GetDevicesByGateway()
 }
 }
 
 
+// 根据灯杆设备获取设备信息
 func (s *alarmTerminalService) GetByLampPole(id int) []dao.AlarmTerminal {
 func (s *alarmTerminalService) GetByLampPole(id int) []dao.AlarmTerminal {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.AlarmTerminal{
 	device := &dao.AlarmTerminal{
@@ -126,6 +132,7 @@ func (s *alarmTerminalService) GetByLampPole(id int) []dao.AlarmTerminal {
 	return device.GetDevicesByLampPole()
 	return device.GetDevicesByLampPole()
 }
 }
 
 
+// 获取设备的数量
 func (s *alarmTerminalService) DeviceCount() dao.DeviceStatus {
 func (s *alarmTerminalService) DeviceCount() dao.DeviceStatus {
 	var rsp dao.DeviceStatus
 	var rsp dao.DeviceStatus
 	d := dao.AlarmTerminal{}
 	d := dao.AlarmTerminal{}
@@ -133,6 +140,7 @@ func (s *alarmTerminalService) DeviceCount() dao.DeviceStatus {
 	return rsp
 	return rsp
 }
 }
 
 
+// 获取设备列表
 func (s *alarmTerminalService) ListDevices() []dao.Device {
 func (s *alarmTerminalService) ListDevices() []dao.Device {
 	d := dao.AlarmTerminal{}
 	d := dao.AlarmTerminal{}
 	return d.ListDevices1()
 	return d.ListDevices1()

+ 20 - 2
app/device/service/bigService.go

@@ -14,6 +14,7 @@ var BigServer = new(bigService)
 type bigService struct {
 type bigService struct {
 }
 }
 
 
+// 设备的数量
 func (big *bigService) DeviceNum(queryType string) deviceDao.QueryDevices {
 func (big *bigService) DeviceNum(queryType string) deviceDao.QueryDevices {
 	var server BigService
 	var server BigService
 	server = getService(queryType)
 	server = getService(queryType)
@@ -25,6 +26,7 @@ func (big *bigService) DeviceNum(queryType string) deviceDao.QueryDevices {
 	}
 	}
 }
 }
 
 
+// 获取灯杆的数量
 func (big *bigService) GetLampCount() (int64, int64) {
 func (big *bigService) GetLampCount() (int64, int64) {
 	dao := deviceDao.LampPole{}
 	dao := deviceDao.LampPole{}
 	all, err1 := dao.CountAll()
 	all, err1 := dao.CountAll()
@@ -38,12 +40,13 @@ func (big *bigService) GetLampCount() (int64, int64) {
 	return all, fault
 	return all, fault
 }
 }
 
 
+// 获取设备的状态
 func (big *bigService) DevicesStatus() []deviceDao.DeviceStatus {
 func (big *bigService) DevicesStatus() []deviceDao.DeviceStatus {
 	//1.灯杆 2.灯控 3.摄像头 4.led 5.环境传感器 6.网关 7. 报警器 8.管理端
 	//1.灯杆 2.灯控 3.摄像头 4.led 5.环境传感器 6.网关 7. 报警器 8.管理端
 	//9.路面状况传感器 10.ip音柱 11.集控器 12.抓拍单元
 	//9.路面状况传感器 10.ip音柱 11.集控器 12.抓拍单元
 	var names = []string{"camera", "wisdomGateway", "lightControl", "switchBox", "infoBoard",
 	var names = []string{"camera", "wisdomGateway", "lightControl", "switchBox", "infoBoard",
 		"optoSensor", "zigBee", "aKeyAlarmTerminal", "aKeyAlarmServe", "lampPole", "captureUnit", "bridgeSensor", "ipCast", "manhole"}
 		"optoSensor", "zigBee", "aKeyAlarmTerminal", "aKeyAlarmServe", "lampPole", "captureUnit", "bridgeSensor", "ipCast", "manhole"}
-	var rsp = make([]deviceDao.DeviceStatus, 0, 14)
+	var rsp = make([]deviceDao.DeviceStatus, 0, 14) //创建了一个长度为0、容量为14的切片
 	for _, v := range names {
 	for _, v := range names {
 		ds := getService(v).DeviceCount()
 		ds := getService(v).DeviceCount()
 		ds.DeviceType = v
 		ds.DeviceType = v
@@ -51,10 +54,12 @@ func (big *bigService) DevicesStatus() []deviceDao.DeviceStatus {
 	}
 	}
 	return rsp
 	return rsp
 }
 }
+
+// 报警状态
 func (big *bigService) AlarmStatus() []deviceDao.DeviceStatus {
 func (big *bigService) AlarmStatus() []deviceDao.DeviceStatus {
 	var names = []string{"camera", "lightControl", "infoBoard", "optoSensor",
 	var names = []string{"camera", "lightControl", "infoBoard", "optoSensor",
 		"zigBee", "lampPole", "captureUnit"}
 		"zigBee", "lampPole", "captureUnit"}
-	var rsp = make([]deviceDao.DeviceStatus, 0, 6)
+	var rsp = make([]deviceDao.DeviceStatus, 0, 6) //创建了一个长度为0、容量为6的切片
 	for _, v := range names {
 	for _, v := range names {
 		ds := getService(v).DeviceCount()
 		ds := getService(v).DeviceCount()
 		ds.DeviceType = v
 		ds.DeviceType = v
@@ -63,6 +68,7 @@ func (big *bigService) AlarmStatus() []deviceDao.DeviceStatus {
 	return rsp
 	return rsp
 }
 }
 
 
+// 根据设备名称获取服务
 func getService(deviceName string) BigService {
 func getService(deviceName string) BigService {
 	switch deviceName {
 	switch deviceName {
 	case "camera":
 	case "camera":
@@ -98,36 +104,48 @@ func getService(deviceName string) BigService {
 	}
 	}
 }
 }
 
 
+// 获取能量
 func (big *bigService) GetEnergy(start, end string) []deviceDao.Energy {
 func (big *bigService) GetEnergy(start, end string) []deviceDao.Energy {
 	return deviceDao.GetEnergy(start, end)
 	return deviceDao.GetEnergy(start, end)
 }
 }
 
 
+// 获取灯控状态
 func (big *bigService) GetLightRate(tenant string) []interface{} {
 func (big *bigService) GetLightRate(tenant string) []interface{} {
 	return deviceDao.GetLightRate(tenant)
 	return deviceDao.GetLightRate(tenant)
 }
 }
 
 
+// 获取报警信息
 func (big *bigService) GetAlarmInfo() deviceDao.AlarmList {
 func (big *bigService) GetAlarmInfo() deviceDao.AlarmList {
 	return deviceDao.GetAlarmInfo()
 	return deviceDao.GetAlarmInfo()
 }
 }
 
 
+// 获取环境监测
 func (big *bigService) GetEnv(deviceId string) deviceDao.Environment {
 func (big *bigService) GetEnv(deviceId string) deviceDao.Environment {
 	return deviceDao.GetEnvData(deviceId)
 	return deviceDao.GetEnvData(deviceId)
 }
 }
 
 
+// 获取led程序
 func (big *bigService) GetLEDProgram(tenantId string) []deviceDao.InfoBoardProgram {
 func (big *bigService) GetLEDProgram(tenantId string) []deviceDao.InfoBoardProgram {
 	return deviceDao.GetLEDProgramList(tenantId)
 	return deviceDao.GetLEDProgramList(tenantId)
 }
 }
+
+// 获取程序路径
 func (big *bigService) GetProgramUrl(id string) deviceDao.Program {
 func (big *bigService) GetProgramUrl(id string) deviceDao.Program {
 	return deviceDao.GetProgramUrl(id)
 	return deviceDao.GetProgramUrl(id)
 }
 }
+
+// 获取桥接传感器
 func (big *bigService) GetBridgeSensors(tenantId string) []deviceDao.Sensor {
 func (big *bigService) GetBridgeSensors(tenantId string) []deviceDao.Sensor {
 	return deviceDao.GetBridgeSensors(tenantId)
 	return deviceDao.GetBridgeSensors(tenantId)
 }
 }
 
 
+// 概述
 func (big *bigService) OverView(tenantId, padScreen string) []deviceDao.OverViewInfo {
 func (big *bigService) OverView(tenantId, padScreen string) []deviceDao.OverViewInfo {
 	dao := deviceDao.OverView{}
 	dao := deviceDao.OverView{}
 	return dao.Query(tenantId, padScreen)
 	return dao.Query(tenantId, padScreen)
 }
 }
+
+// 提交
 func (big *bigService) Submit(data []deviceDao.OverView) {
 func (big *bigService) Submit(data []deviceDao.OverView) {
 	dao := deviceDao.OverView{}
 	dao := deviceDao.OverView{}
 	for _, v := range data {
 	for _, v := range data {

+ 3 - 3
app/device/service/bridgeSensorService.go

@@ -26,7 +26,7 @@ func (s *bridgeSensorService) Get(id int) (*dao.BridgeSensor, *common.Errors) {
 	return device, nil
 	return device, nil
 }
 }
 
 
-func (s *bridgeSensorService) CreateOrUpdate(userId int64, tenantId string, req dao.BridgeSensor) *common.Errors {
+func (s *bridgeSensorService) CreateOrUpdate(userId int, tenantId string, req dao.BridgeSensor) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantID = tenantId
 	device.TenantID = tenantId
@@ -77,7 +77,7 @@ func (s *bridgeSensorService) List(searchValue string, current, size int) ([]dao
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *bridgeSensorService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *bridgeSensorService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.BridgeSensor{
 	device := &dao.BridgeSensor{
 		ID:         id,
 		ID:         id,
@@ -94,7 +94,7 @@ func (s *bridgeSensorService) Remove(userId int64, tenantId string, id int) *com
 	return nil
 	return nil
 }
 }
 
 
-func (s *bridgeSensorService) GetList(tenantId string, ) ([]*dao.BridgeSensor, *common.Errors) {
+func (s *bridgeSensorService) GetList(tenantId string) ([]*dao.BridgeSensor, *common.Errors) {
 	var devices []*dao.BridgeSensor
 	var devices []*dao.BridgeSensor
 	err := cache.Redis.Get(getTransformerListRedisKey(tenantId)).Scan(&devices)
 	err := cache.Redis.Get(getTransformerListRedisKey(tenantId)).Scan(&devices)
 	if err == nil {
 	if err == nil {

+ 2 - 2
app/device/service/bridgeService.go

@@ -24,7 +24,7 @@ func (s *bridgeService) Get(id int) (*dao.Bridge, *common.Errors) {
 	return device, nil
 	return device, nil
 }
 }
 
 
-func (s *bridgeService) CreateOrUpdate(userId int64, tenantId string, req dao.Bridge) *common.Errors {
+func (s *bridgeService) CreateOrUpdate(userId int, tenantId string, req dao.Bridge) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -76,7 +76,7 @@ func (s *bridgeService) List(searchValue string, current, size int) ([]dao.Bridg
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *bridgeService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *bridgeService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Bridge{
 	device := &dao.Bridge{
 		ID:         id,
 		ID:         id,

+ 3 - 2
app/device/service/cameraService.go

@@ -16,7 +16,7 @@ var CameraService = new(cameraService)
 
 
 type cameraService struct{}
 type cameraService struct{}
 
 
-func (s *cameraService) CreateOrUpdate(userId int64, tenantId string, req *model.CameraDetail) *common.Errors {
+func (s *cameraService) CreateOrUpdate(userId int, tenantId string, req *model.CameraDetail) *common.Errors {
 	device := req.CameraDevice
 	device := req.CameraDevice
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -122,7 +122,7 @@ func (s *cameraService) List(searchValue, cameraType string, current, size int)
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *cameraService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *cameraService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.CameraDevice{
 	device := &dao.CameraDevice{
 		ID:         id,
 		ID:         id,
@@ -188,6 +188,7 @@ func (s *cameraService) GetByLampPole(id int) []dao.CameraDevice {
 	return device.GetDevicesByLampPole()
 	return device.GetDevicesByLampPole()
 }
 }
 
 
+// 根据灯杆组获取
 func (s *cameraService) GetByLampPoleGroup(id int) []dao.CameraDevice {
 func (s *cameraService) GetByLampPoleGroup(id int) []dao.CameraDevice {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.CameraDevice{
 	device := &dao.CameraDevice{

+ 5 - 4
app/device/service/captureUintService.go

@@ -15,7 +15,8 @@ var CaptureUintService = new(captureUintService)
 
 
 type captureUintService struct{}
 type captureUintService struct{}
 
 
-func (s *captureUintService) CaptureSubmit(userId int64, tenantId string, req *model.CaptureDetail) *common.Errors {
+// 捕获提交
+func (s *captureUintService) CaptureSubmit(userId int, tenantId string, req *model.CaptureDetail) *common.Errors {
 	device := req.CaptureUnit
 	device := req.CaptureUnit
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -126,7 +127,7 @@ func (s *captureUintService) GetPoint(id int) (*dao.CheckPoint, *common.Errors)
 	return device, nil
 	return device, nil
 }
 }
 
 
-func (s *captureUintService) PointSubmit(userId int64, tenantId string, req *dao.CheckPoint) *common.Errors {
+func (s *captureUintService) PointSubmit(userId int, tenantId string, req *dao.CheckPoint) *common.Errors {
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -190,7 +191,7 @@ func (s *captureUintService) PointGetList(tenantId string) ([]*dao.CheckPoint, *
 	return devices, nil
 	return devices, nil
 }
 }
 
 
-func (s *captureUintService) RemoveCapture(userId int64, tenantId string, id int) *common.Errors {
+func (s *captureUintService) RemoveCapture(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.CaptureUnit{
 	device := &dao.CaptureUnit{
 		ID:         id,
 		ID:         id,
@@ -207,7 +208,7 @@ func (s *captureUintService) RemoveCapture(userId int64, tenantId string, id int
 	return nil
 	return nil
 }
 }
 
 
-func (s *captureUintService) RemovePoint(userId int64, tenantId string, id int) *common.Errors {
+func (s *captureUintService) RemovePoint(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.CheckPoint{
 	device := &dao.CheckPoint{
 		ID:         id,
 		ID:         id,

+ 4 - 4
app/device/service/garbageService.go

@@ -28,7 +28,7 @@ func (s *garbageService) Get(id int) (*dao.Garbage, *common.Errors) {
 
 
 }
 }
 
 
-func (s *garbageService) CreateOrUpdate(userId int64, tenantId string, req dao.Garbage) *common.Errors {
+func (s *garbageService) CreateOrUpdate(userId int, tenantId string, req dao.Garbage) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -78,7 +78,7 @@ func (s *garbageService) List(searchValue string, current, size int) ([]dao.Garb
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *garbageService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *garbageService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Garbage{
 	device := &dao.Garbage{
 		ID:         id,
 		ID:         id,
@@ -95,7 +95,7 @@ func (s *garbageService) Remove(userId int64, tenantId string, id int) *common.E
 	return nil
 	return nil
 }
 }
 
 
-func (s *garbageService) GetList(tenantId string, ) ([]*dao.Garbage, *common.Errors) {
+func (s *garbageService) GetList(tenantId string) ([]*dao.Garbage, *common.Errors) {
 	var devices []*dao.Garbage
 	var devices []*dao.Garbage
 	err := cache.Redis.Get(getGarbageListRedisKey(tenantId)).Scan(&devices)
 	err := cache.Redis.Get(getGarbageListRedisKey(tenantId)).Scan(&devices)
 	if err == nil {
 	if err == nil {
@@ -113,7 +113,7 @@ func (s *garbageService) GetList(tenantId string, ) ([]*dao.Garbage, *common.Err
 	return devices, nil
 	return devices, nil
 }
 }
 
 
-func getGarbageListRedisKey(tenantId string, ) string {
+func getGarbageListRedisKey(tenantId string) string {
 	return fmt.Sprintf(model.GarbageList, tenantId)
 	return fmt.Sprintf(model.GarbageList, tenantId)
 }
 }
 
 

+ 3 - 3
app/device/service/garbageWayGroupService.go

@@ -28,7 +28,7 @@ func (s *garbageWayGroupService) Get(id int) (*dao.GarbageWayGroup, *common.Erro
 
 
 }
 }
 
 
-func (s *garbageWayGroupService) CreateOrUpdate(userId int64, tenantId string, req dao.GarbageWayGroup) *common.Errors {
+func (s *garbageWayGroupService) CreateOrUpdate(userId int, tenantId string, req dao.GarbageWayGroup) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -78,7 +78,7 @@ func (s *garbageWayGroupService) List(searchValue string, current, size int) ([]
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *garbageWayGroupService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *garbageWayGroupService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.GarbageWayGroup{
 	device := &dao.GarbageWayGroup{
 		ID:         id,
 		ID:         id,
@@ -95,7 +95,7 @@ func (s *garbageWayGroupService) Remove(userId int64, tenantId string, id int) *
 	return nil
 	return nil
 }
 }
 
 
-func (s *garbageWayGroupService) GetList(tenantId string, ) ([]*dao.GarbageWayGroup, *common.Errors) {
+func (s *garbageWayGroupService) GetList(tenantId string) ([]*dao.GarbageWayGroup, *common.Errors) {
 	var devices []*dao.GarbageWayGroup
 	var devices []*dao.GarbageWayGroup
 	err := cache.Redis.Get(getGarbageWayGroupListRedisKey("000000")).Scan(&devices)
 	err := cache.Redis.Get(getGarbageWayGroupListRedisKey("000000")).Scan(&devices)
 	if err == nil {
 	if err == nil {

+ 2 - 2
app/device/service/gatewayService.go

@@ -42,7 +42,7 @@ func (s *gatewayService) Get(id int) (*model.GatewayDetail, *common.Errors) {
 	return detail, nil
 	return detail, nil
 }
 }
 
 
-func (s *gatewayService) CreateOrUpdate(userId int64, tenantId string, req *model.GatewayDetail) *common.Errors {
+func (s *gatewayService) CreateOrUpdate(userId int, tenantId string, req *model.GatewayDetail) *common.Errors {
 	device := req.Gateway
 	device := req.Gateway
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -125,7 +125,7 @@ func (s *gatewayService) List(searchValue string, current, size int) ([]model.Ga
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *gatewayService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *gatewayService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Gateway{
 	device := &dao.Gateway{
 		ID:         id,
 		ID:         id,

+ 35 - 35
app/device/service/infoBoardServiceTime.go

@@ -32,7 +32,7 @@ func (s *infoBoardService) Get(id int) (model.InfoBoardDetail, *common.Errors) {
 	return detail, nil
 	return detail, nil
 }
 }
 
 
-func (s *infoBoardService) CreateOrUpdate(userId int64, tenantId string, req dao.InfoBoard) *common.Errors {
+func (s *infoBoardService) CreateOrUpdate(userId int, tenantId string, req dao.InfoBoard) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -90,62 +90,62 @@ func (s *infoBoardService) List(searchValue string, current, size int) ([]model.
 
 
 // 从缓存中读取真实状态
 // 从缓存中读取真实状态
 func (s *infoBoardService) rewriteBoardDetail(d dao.InfoBoard) model.InfoBoardDetail {
 func (s *infoBoardService) rewriteBoardDetail(d dao.InfoBoard) model.InfoBoardDetail {
-	endTime, state := cache.GetDeviceState(d.Sn)
+	endTime, state := cache.GetDeviceState(d.Sn) //调用cache对象的GetDeviceState方法获取设备状态,并将结果赋值给变量endTime和state
 
 
-	detail := model.InfoBoardDetail{
+	detail := model.InfoBoardDetail{ //创建一个类型为model.InfoBoardDetail的变量detail,用于存储返回的结果
 		InfoBoard:    d,
 		InfoBoard:    d,
 		RunState:     state,
 		RunState:     state,
 		NetworkState: state,
 		NetworkState: state,
 		EndLineTime:  endTime,
 		EndLineTime:  endTime,
 	}
 	}
-	cacheMap := cache.GetDeviceLedData(d.Sn)
+	cacheMap := cache.GetDeviceLedData(d.Sn) //调用cache对象的GetDeviceLedData方法获取设备LED数据,并将结果赋值给变量cacheMap
 
 
-	if cacheMap != nil {
-		marshal, err := json.Marshal(cacheMap)
-		if err != nil {
-			logger.Logger.Errorf("rewriteBoardDetail err1 = %v \n", err)
-			return detail
+	if cacheMap != nil { //判断cacheMap是否为空
+		marshal, err := json.Marshal(cacheMap) //将cacheMap转换为JSON格式的字节数组,并将结果赋值给变量marshal
+		if err != nil {                        //判断转换过程中是否出现错误
+			logger.Logger.Errorf("rewriteBoardDetail err1 = %v \n", err) //记录错误日志
+			return detail                                                //返回detail
 		}
 		}
 
 
-		var cltData model.CltledData
-		err = json.Unmarshal(marshal, &cltData)
-		if err != nil {
-			logger.Logger.Errorf("rewriteBoardDetail err2 = %v \n", err)
-			return detail
+		var cltData model.CltledData            //声明一个类型为信息屏 数据的变量cltData
+		err = json.Unmarshal(marshal, &cltData) //将JSON格式的字节数组marshal转换为model.CltledData类型的对象,并将结果赋值给变量err
+		if err != nil {                         //判断转换过程中是否出现错误
+			logger.Logger.Errorf("rewriteBoardDetail err2 = %v \n", err) //记录错误日志
+			return detail                                                //返回detail
 		}
 		}
-		detail.Power = "边缘程序未升级"
+		detail.Power = "边缘程序未升级" //初始化detail的Power字段
 
 
-		if cltData.RealWidth != "" {
-			detail.ResolutionName = fmt.Sprintf("%v * %v", cltData.RealWidth, cltData.RealHeight)
-			detail.OnTheAir = cltData.Playing
+		if cltData.RealWidth != "" { //判断cltData.RealWidth是否为空
+			detail.ResolutionName = fmt.Sprintf("%v * %v", cltData.RealWidth, cltData.RealHeight) //将cltData.RealWidth和cltData.RealHeight拼接成字符串,并赋值给detail的ResolutionName字段
+			detail.OnTheAir = cltData.Playing                                                     //将cltData.Playing赋值给detail的OnTheAir字段
 
 
-			detail.Temperature = cltData.Colortemperature
-			f, err := strconv.ParseFloat(cltData.Brightness, 64)
-			if err != nil {
-				logger.Logger.Errorf("rewriteBoardDetail err3 = %v \n", err)
+			detail.Temperature = cltData.Colortemperature        //将cltData.Colortemperature赋值给detail的Temperature字段
+			f, err := strconv.ParseFloat(cltData.Brightness, 64) //将字符串cltData.Brightness转换为浮点数,并将结果赋值给变量f
+			if err != nil {                                      //判断是否有错误
+				logger.Logger.Errorf("rewriteBoardDetail err3 = %v \n", err) //记录错误日志
 				return detail
 				return detail
 			}
 			}
-			mapRange := common.MapRange(f, 0, 255, 1, 100)
-			detail.Luminance = fmt.Sprintf("%v %%", int(mapRange))
+			mapRange := common.MapRange(f, 0, 255, 1, 100)         //调用common.MapRange函数计算亮度映射范围,并将结果赋值给变量mapRange
+			detail.Luminance = fmt.Sprintf("%v %%", int(mapRange)) //将亮度映射范围转换为百分比字符串,并赋值给detail的Luminance字段
 
 
-			f, err = strconv.ParseFloat(cltData.Musicvolume, 64)
-			if err != nil {
-				logger.Logger.Errorf("rewriteBoardDetail err3 = %v \n", err)
+			f, err = strconv.ParseFloat(cltData.Musicvolume, 64) //将字符串cltData.Musicvolume转换为浮点数,并将结果赋值给变量f
+			if err != nil {                                      //判断转换过程中是否出现错误
+				logger.Logger.Errorf("rewriteBoardDetail err3 = %v \n", err) //记录错误日志
 				return detail
 				return detail
 			}
 			}
 			mapRange = common.MapRange(f, 0, 15, 1, 100)
 			mapRange = common.MapRange(f, 0, 15, 1, 100)
-			detail.Volume = fmt.Sprintf("%v %%", int(mapRange))
+			detail.Volume = fmt.Sprintf("%v %%", int(mapRange)) //将音量映射范围转换为百分比字符串,并赋值给detail的Volume字段
 
 
-			detail.RebootTime = cltData.RebootTime
-			detail.Power = "开机"
-			if cltData.Powerstatus != "1" {
+			detail.RebootTime = cltData.RebootTime //将cltData.RebootTime赋值给detail的RebootTime字段
+			detail.Power = "开机"                    //将power设置为开机
+			if cltData.Powerstatus != "1" {        //判断cltData.Powerstatus是否不等于1
 				detail.Power = "关机" //真实其实是睡眠状态
 				detail.Power = "关机" //真实其实是睡眠状态
 			}
 			}
-			if cltData.WakeupTime != "" {
-				detail.NeverCloseDown = 2
+			if cltData.WakeupTime != "" { //如果开机时间不等与空
+				detail.NeverCloseDown = 2 //将永不关机设置为取消
 				//detail.BootStartTime = cltData.WakeupTime
 				//detail.BootStartTime = cltData.WakeupTime
 				//detail.BootEndTime = cltData.SleepTime
 				//detail.BootEndTime = cltData.SleepTime
-				detail.RealStartAndEndTime = fmt.Sprintf("%v-%v", cltData.WakeupTime, cltData.SleepTime)
+				detail.RealStartAndEndTime = fmt.Sprintf("%v-%v", cltData.WakeupTime, cltData.SleepTime) //将时间区间格式化为字符串,并赋值给detail的RealStartAndEndTime字段
 			}
 			}
 		}
 		}
 	}
 	}
@@ -153,7 +153,7 @@ func (s *infoBoardService) rewriteBoardDetail(d dao.InfoBoard) model.InfoBoardDe
 	return detail
 	return detail
 }
 }
 
 
-func (s *infoBoardService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *infoBoardService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.InfoBoard{
 	device := &dao.InfoBoard{
 		ID:         id,
 		ID:         id,

+ 7 - 3
app/device/service/intelligentLightingService.go

@@ -14,8 +14,10 @@ import (
 
 
 var IntelligentLightingService = new(intelligentLightingService)
 var IntelligentLightingService = new(intelligentLightingService)
 
 
+// 智能照明服务
 type intelligentLightingService struct{}
 type intelligentLightingService struct{}
 
 
+// 根据灯控获取详细信息
 func (s *intelligentLightingService) GetDetailByLight(tenantId string, id int, reqType int) (model.RspIntelligentLightDetail,
 func (s *intelligentLightingService) GetDetailByLight(tenantId string, id int, reqType int) (model.RspIntelligentLightDetail,
 	*common.Errors) {
 	*common.Errors) {
 	detail := model.RspIntelligentLightDetail{}
 	detail := model.RspIntelligentLightDetail{}
@@ -47,6 +49,7 @@ func (s *intelligentLightingService) GetDetailByLight(tenantId string, id int, r
 	return detail, nil
 	return detail, nil
 }
 }
 
 
+// 根据灯光策略
 func (s *intelligentLightingService) GetLightRelation(tenantId string, rId, relationType int) model.IntelligentLightSimple {
 func (s *intelligentLightingService) GetLightRelation(tenantId string, rId, relationType int) model.IntelligentLightSimple {
 	detail := model.IntelligentLightSimple{}
 	detail := model.IntelligentLightSimple{}
 
 
@@ -96,6 +99,7 @@ func (s *intelligentLightingService) GetLightRelation(tenantId string, rId, rela
 	return detail
 	return detail
 }
 }
 
 
+// 批量获取
 func (s *intelligentLightingService) BatchGet(ids []int) []dao.IntelligentLight {
 func (s *intelligentLightingService) BatchGet(ids []int) []dao.IntelligentLight {
 	// 创建查询实例
 	// 创建查询实例
 	intelligent := &dao.IntelligentLight{}
 	intelligent := &dao.IntelligentLight{}
@@ -155,7 +159,7 @@ func (s *intelligentLightingService) List(tenantId string, searchValue string, c
 }
 }
 
 
 // Relation 保存策略
 // Relation 保存策略
-func (s *intelligentLightingService) Relation(userId int64, tenantId string, publicId int, lightId int, relationType int) error {
+func (s *intelligentLightingService) Relation(userId int, tenantId string, publicId int, lightId int, relationType int) error {
 	intelligent := &dao.IntelligentLight{
 	intelligent := &dao.IntelligentLight{
 		LightID:      lightId,
 		LightID:      lightId,
 		Rid:          publicId,
 		Rid:          publicId,
@@ -179,7 +183,7 @@ func (s *intelligentLightingService) Relation(userId int64, tenantId string, pub
 }
 }
 
 
 // Recovery 恢复到分组
 // Recovery 恢复到分组
-func (s *intelligentLightingService) Recovery(userId int64, tenantId string, groupId int, id int) error {
+func (s *intelligentLightingService) Recovery(userId int, tenantId string, groupId int, id int) error {
 	//1.IntelligentLight查出 `relation_type` = '2' AND `rid` = '67'  查出组中的 light_id
 	//1.IntelligentLight查出 `relation_type` = '2' AND `rid` = '67'  查出组中的 light_id
 	//2.IntelligentLight保存 上面 的light_id 到 id中
 	//2.IntelligentLight保存 上面 的light_id 到 id中
 	intelligent := &dao.IntelligentLight{
 	intelligent := &dao.IntelligentLight{
@@ -204,7 +208,7 @@ func (s *intelligentLightingService) Recovery(userId int64, tenantId string, gro
 }
 }
 
 
 // ChangeHandSwitch 开灯控制
 // ChangeHandSwitch 开灯控制
-func (s *intelligentLightingService) ChangeHandSwitch(userId int64, tenantId string, handSwitch int, handType int, publicId int, handTime int, luminance int, explain string, name string) error {
+func (s *intelligentLightingService) ChangeHandSwitch(userId int, tenantId string, handSwitch int, handType int, publicId int, handTime int, luminance int, explain string, name string) error {
 	light, err := s.GetDetailByLight(tenantId, publicId, handType)
 	light, err := s.GetDetailByLight(tenantId, publicId, handType)
 	if err != nil {
 	if err != nil {
 		panic(err)
 		panic(err)

+ 3 - 2
app/device/service/ipBroadcastService.go

@@ -10,6 +10,7 @@ import (
 	"time"
 	"time"
 )
 )
 
 
+// ip音柱
 var IpBroadcastService = new(ipBroadcastService)
 var IpBroadcastService = new(ipBroadcastService)
 
 
 type ipBroadcastService struct{}
 type ipBroadcastService struct{}
@@ -51,7 +52,7 @@ func (s *ipBroadcastService) Get(id int) (*model.IpBroadcastDetail, *common.Erro
 	}, nil
 	}, nil
 }
 }
 
 
-func (s *ipBroadcastService) CreateOrUpdate(userId int64, tenantId string, req dao.IpBroadcast) *common.Errors {
+func (s *ipBroadcastService) CreateOrUpdate(userId int, tenantId string, req dao.IpBroadcast) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -131,7 +132,7 @@ func (s *ipBroadcastService) List(searchValue string, current, size int) ([]mode
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *ipBroadcastService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *ipBroadcastService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.IpBroadcast{
 	device := &dao.IpBroadcast{
 		ID:         id,
 		ID:         id,

+ 2 - 2
app/device/service/lampPoleGroupService.go

@@ -28,7 +28,7 @@ func (s *lampPoleGroupService) Get(id int) (*dao.LampPoleGroup, *common.Errors)
 	return device, nil
 	return device, nil
 }
 }
 
 
-func (s *lampPoleGroupService) CreateOrUpdate(userId int64, tenantId string, req *dao.LampPoleGroup) *common.Errors {
+func (s *lampPoleGroupService) CreateOrUpdate(userId int, tenantId string, req *dao.LampPoleGroup) *common.Errors {
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -87,7 +87,7 @@ func (s *lampPoleGroupService) List(poleGroupName string, current, size int) ([]
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *lampPoleGroupService) Remove(userId int64, tenantId string, id int, name string) *common.Errors {
+func (s *lampPoleGroupService) Remove(userId int, tenantId string, id int, name string) *common.Errors {
 	device := &dao.LampPoleGroup{
 	device := &dao.LampPoleGroup{
 		ID:         id,
 		ID:         id,
 		IsDeleted:  1,
 		IsDeleted:  1,

+ 2 - 2
app/device/service/lampPoleService.go

@@ -50,7 +50,7 @@ func (s *lampPoleService) GetRelevanceDetail(id int) (*model.LampPoleDetail, *co
 	}, nil
 	}, nil
 }
 }
 
 
-func (s *lampPoleService) CreateOrUpdate(userId int64, tenantId string, req *dao.LampPole) *common.Errors {
+func (s *lampPoleService) CreateOrUpdate(userId int, tenantId string, req *dao.LampPole) *common.Errors {
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.CoordType = 1
 	device.CoordType = 1
@@ -103,7 +103,7 @@ func (s *lampPoleService) List(searchValue, groupId, boxId string, current, size
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *lampPoleService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *lampPoleService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.LampPole{
 	device := &dao.LampPole{
 		ID:         id,
 		ID:         id,

+ 1 - 1
app/device/service/lightConditionService.go

@@ -37,7 +37,7 @@ func (s *lightConditionService) CreateOrUpdate(req dao.LightCondition) *common.E
 	return nil
 	return nil
 }
 }
 
 
-func (s *lightConditionService) Remove(userId int64, id int) *common.Errors {
+func (s *lightConditionService) Remove(userId int, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Gateway{
 	device := &dao.Gateway{
 		ID:         id,
 		ID:         id,

+ 2 - 2
app/device/service/lightControlService.go

@@ -36,7 +36,7 @@ func (s *lightControlService) Get(id int) (*model.LightControlDetail, *common.Er
 	return &detail, nil
 	return &detail, nil
 }
 }
 
 
-func (s *lightControlService) CreateOrUpdate(userId int64, tenantId string, req *dao.LightControl) *common.Errors {
+func (s *lightControlService) CreateOrUpdate(userId int, tenantId string, req *dao.LightControl) *common.Errors {
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -152,7 +152,7 @@ func (s *lightControlService) List(searchValue, controlType, zigbeeId string, cu
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *lightControlService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *lightControlService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.LightControl{
 	device := &dao.LightControl{
 		ID:         id,
 		ID:         id,

+ 2 - 2
app/device/service/manholeCoverService.go

@@ -27,7 +27,7 @@ func (s *manholeCoverService) Get(id int) (*dao.ManholeCover, *common.Errors) {
 
 
 }
 }
 
 
-func (s *manholeCoverService) CreateOrUpdate(userId int64, tenantId string, req dao.ManholeCover) *common.Errors {
+func (s *manholeCoverService) CreateOrUpdate(userId int, tenantId string, req dao.ManholeCover) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -78,7 +78,7 @@ func (s *manholeCoverService) List(searchValue string, current, size int) ([]dao
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *manholeCoverService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *manholeCoverService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.ManholeCover{
 	device := &dao.ManholeCover{
 		ID:         id,
 		ID:         id,

+ 4 - 4
app/device/service/onDemandGroupService.go

@@ -30,7 +30,7 @@ func (s *onDemandGroupService) Get(id int) (*dao.OnDemandGroup, *common.Errors)
 	return device, nil
 	return device, nil
 }
 }
 
 
-func (s *onDemandGroupService) CreateOrUpdate(userId int64, tenantId string, req *dao.OnDemandGroup) *common.Errors {
+func (s *onDemandGroupService) CreateOrUpdate(userId int, tenantId string, req *dao.OnDemandGroup) *common.Errors {
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
 	device.UpdateUser = userId
 	device.UpdateUser = userId
@@ -80,7 +80,7 @@ func (s *onDemandGroupService) List(searchValue string, current, size int) ([]da
 	return devices, nil
 	return devices, nil
 }
 }
 
 
-func (s *onDemandGroupService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *onDemandGroupService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.OnDemandGroup{
 	device := &dao.OnDemandGroup{
 		ID:         id,
 		ID:         id,
@@ -97,7 +97,7 @@ func (s *onDemandGroupService) Remove(userId int64, tenantId string, id int) *co
 	return nil
 	return nil
 }
 }
 
 
-func (s *onDemandGroupService) GetList(tenantId string, ) ([]*dao.OnDemandGroup, *common.Errors) {
+func (s *onDemandGroupService) GetList(tenantId string) ([]*dao.OnDemandGroup, *common.Errors) {
 	var devices []*dao.OnDemandGroup
 	var devices []*dao.OnDemandGroup
 	err := cache.Redis.Get(getOnDemandGroupListRedisKey(tenantId)).Scan(&devices)
 	err := cache.Redis.Get(getOnDemandGroupListRedisKey(tenantId)).Scan(&devices)
 	if err == nil {
 	if err == nil {
@@ -117,7 +117,7 @@ func (s *onDemandGroupService) GetList(tenantId string, ) ([]*dao.OnDemandGroup,
 	return devices, nil
 	return devices, nil
 }
 }
 
 
-func getOnDemandGroupListRedisKey(tenantId string, ) string {
+func getOnDemandGroupListRedisKey(tenantId string) string {
 	return fmt.Sprintf(model.OnDemandGroupList, tenantId)
 	return fmt.Sprintf(model.OnDemandGroupList, tenantId)
 }
 }
 
 

+ 2 - 2
app/device/service/onDemandSensorService.go

@@ -25,7 +25,7 @@ func (s *onDemandSensorService) Get(id int) (*dao.OnDemandSensor, *common.Errors
 
 
 }
 }
 
 
-func (s *onDemandSensorService) CreateOrUpdate(userId int64, tenantId string, req dao.OnDemandSensor) *common.Errors {
+func (s *onDemandSensorService) CreateOrUpdate(userId int, tenantId string, req dao.OnDemandSensor) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -76,7 +76,7 @@ func (s *onDemandSensorService) List(searchValue string, current, size int) ([]d
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *onDemandSensorService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *onDemandSensorService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.OnDemandSensor{
 	device := &dao.OnDemandSensor{
 		ID:         id,
 		ID:         id,

+ 2 - 2
app/device/service/optoSensoService.go

@@ -32,7 +32,7 @@ func (s *optoSensorService) Get(id int) (*model.OptoSensorDetail, *common.Errors
 	}, nil
 	}, nil
 }
 }
 
 
-func (s *optoSensorService) CreateOrUpdate(userId int64, tenantId string, req dao.OptoSensor) *common.Errors {
+func (s *optoSensorService) CreateOrUpdate(userId int, tenantId string, req dao.OptoSensor) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -93,7 +93,7 @@ func (s *optoSensorService) List(searchValue string, current, size int) ([]model
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *optoSensorService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *optoSensorService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.OptoSensor{
 	device := &dao.OptoSensor{
 		ID:         id,
 		ID:         id,

+ 2 - 2
app/device/service/switchBoxService.go

@@ -28,7 +28,7 @@ func (s *switchBoxService) Get(id int) (*dao.SwitchBox, *common.Errors) {
 
 
 }
 }
 
 
-func (s *switchBoxService) CreateOrUpdate(userId int64, tenantId string, req dao.SwitchBox) *common.Errors {
+func (s *switchBoxService) CreateOrUpdate(userId int, tenantId string, req dao.SwitchBox) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -87,7 +87,7 @@ func (s *switchBoxService) List(searchValue string, current, size int) ([]dao.Sw
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *switchBoxService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *switchBoxService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.SwitchBox{
 	device := &dao.SwitchBox{
 		ID:         id,
 		ID:         id,

+ 4 - 4
app/device/service/transformerService.go

@@ -28,7 +28,7 @@ func (s *transformerService) Get(id int) (*dao.Transformer, *common.Errors) {
 
 
 }
 }
 
 
-func (s *transformerService) CreateOrUpdate(userId int64, tenantId string, req dao.Transformer) *common.Errors {
+func (s *transformerService) CreateOrUpdate(userId int, tenantId string, req dao.Transformer) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -84,7 +84,7 @@ func (s *transformerService) List(searchValue string, current, size int) ([]dao.
 	return devices, total, nil
 	return devices, total, nil
 }
 }
 
 
-func (s *transformerService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *transformerService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Transformer{
 	device := &dao.Transformer{
 		ID:         id,
 		ID:         id,
@@ -101,7 +101,7 @@ func (s *transformerService) Remove(userId int64, tenantId string, id int) *comm
 	return nil
 	return nil
 }
 }
 
 
-func (s *transformerService) GetList(tenantId string, ) ([]*dao.Transformer, *common.Errors) {
+func (s *transformerService) GetList(tenantId string) ([]*dao.Transformer, *common.Errors) {
 	var devices []*dao.Transformer
 	var devices []*dao.Transformer
 	err := cache.Redis.Get(getTransformerListRedisKey(tenantId)).Scan(&devices)
 	err := cache.Redis.Get(getTransformerListRedisKey(tenantId)).Scan(&devices)
 	if err == nil {
 	if err == nil {
@@ -121,6 +121,6 @@ func (s *transformerService) GetList(tenantId string, ) ([]*dao.Transformer, *co
 	return devices, nil
 	return devices, nil
 }
 }
 
 
-func getTransformerListRedisKey(tenantId string, ) string {
+func getTransformerListRedisKey(tenantId string) string {
 	return fmt.Sprintf(model.TransformerList, tenantId)
 	return fmt.Sprintf(model.TransformerList, tenantId)
 }
 }

+ 2 - 1
app/device/service/workbenchService.go

@@ -41,7 +41,8 @@ func (s *workbenchService) CountJobTodo(tenantId string) (*dao.CountAlarm, *comm
 	return count, nil
 	return count, nil
 }
 }
 
 
-func (s *workbenchService) Notification(tenantId string) (*dao.Notification, *common.Errors) {
+// 显示设备离线的状态
+func (s *workbenchService) Notification(tenantId string) ([]dao.DeviceState, *common.Errors) {
 	notification, err := dao.GetNotification(tenantId)
 	notification, err := dao.GetNotification(tenantId)
 	if err != nil {
 	if err != nil {
 		return nil, common.FailResponse(err.Error(), nil)
 		return nil, common.FailResponse(err.Error(), nil)

+ 2 - 2
app/device/service/zigbeeService.go

@@ -33,7 +33,7 @@ func (s *zigbeeService) Get(id int) (*model.ZigbeeDetail, *common.Errors) {
 
 
 }
 }
 
 
-func (s *zigbeeService) CreateOrUpdate(userId int64, tenantId string, req dao.Zigbee) *common.Errors {
+func (s *zigbeeService) CreateOrUpdate(userId int, tenantId string, req dao.Zigbee) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := req
 	device := req
 	device.TenantId = tenantId
 	device.TenantId = tenantId
@@ -92,7 +92,7 @@ func (s *zigbeeService) List(searchValue string, current, size int) ([]model.Zig
 	return details, total, nil
 	return details, total, nil
 }
 }
 
 
-func (s *zigbeeService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *zigbeeService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.Zigbee{
 	device := &dao.Zigbee{
 		ID:         id,
 		ID:         id,

+ 3 - 3
app/middleware/token.go

@@ -17,13 +17,13 @@ var EmptyKeyFunc = func(t *jwt.Token) (interface{}, error) { return []byte(confi
 type Claims struct {
 type Claims struct {
 	jwt.StandardClaims
 	jwt.StandardClaims
 	TenantId string `json:"tenant_id"`
 	TenantId string `json:"tenant_id"`
-	UserId   int64  `json:"user_id"`
-	RoleId   int64  `json:"role_id"`
+	UserId   int    `json:"user_id"`
+	RoleId   int    `json:"role_id"`
 	UserName string `json:"user_name"`
 	UserName string `json:"user_name"`
 	Random   string `json:"random"`
 	Random   string `json:"random"`
 }
 }
 
 
-func GetAccessToken(userId, roleId int64, tenantId string, userName string, random string) (string, error) {
+func GetAccessToken(userId, roleId int, tenantId string, userName string, random string) (string, error) {
 	jwtToken := Claims{StandardClaims: jwt.StandardClaims{
 	jwtToken := Claims{StandardClaims: jwt.StandardClaims{
 		Audience:  Audience,
 		Audience:  Audience,
 		Issuer:    Issuer,
 		Issuer:    Issuer,

+ 2 - 2
app/multimedia/dao/libraryDao.go

@@ -18,9 +18,9 @@ type Library struct {
 	SysType         int       `gorm:"type:int" json:"sysType"`                    //系统类型:0-信息发布系统,1-广播系统
 	SysType         int       `gorm:"type:int" json:"sysType"`                    //系统类型:0-信息发布系统,1-广播系统
 	TenantId        string    `gorm:"type:varchar(12)" json:"tenantId"`           //租户ID
 	TenantId        string    `gorm:"type:varchar(12)" json:"tenantId"`           //租户ID
 	CreateTime      time.Time `gorm:"type:datetime" json:"createTime"`            //新增时间
 	CreateTime      time.Time `gorm:"type:datetime" json:"createTime"`            //新增时间
-	CreateUser      int64     `gorm:"type:bigint" json:"createUser"`              //新增记录操作用户ID
+	CreateUser      int       `gorm:"type:int" json:"createUser"`                 //新增记录操作用户ID
 	UpdateTime      time.Time `gorm:"type:datetime" json:"updateTime"`            //修改时间
 	UpdateTime      time.Time `gorm:"type:datetime" json:"updateTime"`            //修改时间
-	UpdateUser      int64     `gorm:"type:bigint" json:"updateUser"`              //修改用户
+	UpdateUser      int       `gorm:"type:int" json:"updateUser"`                 //修改用户
 	IsDeleted       int       `gorm:"type:int;default 0" json:"isDeleted"`        //是否删除 0=未删除,1=删除
 	IsDeleted       int       `gorm:"type:int;default 0" json:"isDeleted"`        //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 2 - 2
app/multimedia/dao/programDao.go

@@ -15,9 +15,9 @@ type Program struct {
 	SysType     int       `gorm:"type:int" json:"sysTrecordype"`         //系统类型:0-信息发布系统,1-广播系统
 	SysType     int       `gorm:"type:int" json:"sysTrecordype"`         //系统类型:0-信息发布系统,1-广播系统
 	TenantId    string    `gorm:"type:varchar(12)" json:"tenantId"`      //租户ID
 	TenantId    string    `gorm:"type:varchar(12)" json:"tenantId"`      //租户ID
 	CreateTime  time.Time `gorm:"type:datetime" json:"createTime"`       //新增时间
 	CreateTime  time.Time `gorm:"type:datetime" json:"createTime"`       //新增时间
-	CreateUser  int64     `gorm:"type:bigint" json:"createUser"`         //新增记录操作用户ID
+	CreateUser  int       `gorm:"type:int" json:"createUser"`            //新增记录操作用户ID
 	UpdateTime  time.Time `gorm:"type:datetime" json:"updateTime"`       //修改时间
 	UpdateTime  time.Time `gorm:"type:datetime" json:"updateTime"`       //修改时间
-	UpdateUser  int64     `gorm:"type:bigint" json:"updateUser"`         //修改用户
+	UpdateUser  int       `gorm:"type:int" json:"updateUser"`            //修改用户
 	IsDeleted   int       `gorm:"type:int;default 0" json:"isDeleted"`   //是否删除 0=未删除,1=删除
 	IsDeleted   int       `gorm:"type:int;default 0" json:"isDeleted"`   //是否删除 0=未删除,1=删除
 }
 }
 
 

+ 18 - 16
app/multimedia/dao/publishLibrariesDao.go

@@ -17,22 +17,24 @@ type PublishLibraries struct {
 	EndTime          common.Time `gorm:"column:end_time;type:date;comment:播放结束时间" json:"endTime"`                                       // 播放结束时间
 	EndTime          common.Time `gorm:"column:end_time;type:date;comment:播放结束时间" json:"endTime"`                                       // 播放结束时间
 	NotificationType string      `gorm:"column:notification_type;type:varchar(60);comment:通知类型 组合1短信2邮件3电话4微信" json:"notificationType"` // 通知类型 组合1短信2邮件3电话4微信
 	NotificationType string      `gorm:"column:notification_type;type:varchar(60);comment:通知类型 组合1短信2邮件3电话4微信" json:"notificationType"` // 通知类型 组合1短信2邮件3电话4微信
 	CreateTime       time.Time   `gorm:"column:create_time;type:datetime;comment:新增时间" json:"createTime"`                               // 新增时间
 	CreateTime       time.Time   `gorm:"column:create_time;type:datetime;comment:新增时间" json:"createTime"`                               // 新增时间
-	CreateUser       int64       `gorm:"column:create_user;type:varchar(60);comment:增记录操作用户ID" json:"createUser"`                       // 新增记录操作用户ID
-	CreateName       string      `gorm:"column:create_name;type:varchar(64);comment:新增用户姓名" json:"createName"`                          // 新增用户姓名
-	UpdateTime       time.Time   `gorm:"column:update_time;type:datetime;comment:修改时间" json:"updateTime"`                               // 修改时间
-	UpdateUser       string      `gorm:"column:update_user;type:varchar(60);comment:修改用户" json:"updateUser"`                            // 修改用户
-	IsDeleted        int         `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除 0=未删除,1=删除" json:"isDeleted"`             // 是否删除 0=未删除,1=删除
-	Status           int         `gorm:"column:status;type:int(11);comment:状态 0审核1播放2暂停3取消4过期5审核不通过" json:"status"`                     // 状态 0审核1播放2暂停3取消4过期5审核不通过
-	TenantId         string      `gorm:"column:tenant_id;type:varchar(12);comment:租户ID" json:"tenantTd"`                                // 租户ID
-	Remarks          string      `gorm:"column:remarks;type:varchar(4000);comment:系统类型:0-多媒体系统,1-广播系统" json:"remarks"`                  // 备注
-	SysType          int         `gorm:"column:sys_type;type:int(11);default:0;comment:编号" json:"sysStype"`                             // 系统类型:0-多媒体系统,1-广播系统
-	KsTime           string      `gorm:"column:ks_time;type:varchar(50);comment:播放开始时间" json:"ksTime"`                                  // 播放开始时间
-	JsTime           string      `gorm:"column:js_time;type:varchar(50);comment:播放结束时间" json:"jsTime"`                                  // 播放结束时间
-	Ptype            int         `gorm:"-" json:"ptype"`                                                                                // 1mp3 2文字
-	FileId           int         `gorm:"column:file_id;type:int(11);comment:文件ID,系统类型为广播系统时使用" json:"fileId"`                           // 文件ID,系统类型为广播系统时使用
-	TaskId           int         `gorm:"column:task_id;type:int(11);comment:任务ID,发布后才有用于控制启动与停止" json:"taskId"`                         // 任务ID,发布后才有用于控制启动与停止
-	PlayTime         int         `gorm:"column:play_time;type:int(11);default:1;comment:播放次数(1-100)" json:"playTime"`                   // 播放次数(1-100)
-	PlayInterval     int         `gorm:"column:play_interval;type:int(11);default:0;comment: 播放间隔(0-360秒)" json:"playInterval"`         // 播放间隔(0-360秒)
+	CreateUser       int         `gorm:"column:create_user;type:int;comment:增记录操作用户ID" json:"createUser
+"` // 新增记录操作用户ID
+	CreateName string    `gorm:"column:create_name;type:varchar(64);comment:新增用户姓名" json:"createName"` // 新增用户姓名
+	UpdateTime time.Time `gorm:"column:update_time;type:datetime;comment:修改时间" json:"updateTime"`      // 修改时间
+	UpdateUser int       `gorm:"column:update_user;type:int;comment:修改用户" json:"updateUser
+"` // 修改用户
+	IsDeleted    int    `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除 0=未删除,1=删除" json:"isDeleted"`     // 是否删除 0=未删除,1=删除
+	Status       int    `gorm:"column:status;type:int(11);comment:状态 0审核1播放2暂停3取消4过期5审核不通过" json:"status"`             // 状态 0审核1播放2暂停3取消4过期5审核不通过
+	TenantId     string `gorm:"column:tenant_id;type:varchar(12);comment:租户ID" json:"tenantTd"`                        // 租户ID
+	Remarks      string `gorm:"column:remarks;type:varchar(4000);comment:系统类型:0-多媒体系统,1-广播系统" json:"remarks"`          // 备注
+	SysType      int    `gorm:"column:sys_type;type:int(11);default:0;comment:编号" json:"sysStype"`                     // 系统类型:0-多媒体系统,1-广播系统
+	KsTime       string `gorm:"column:ks_time;type:varchar(50);comment:播放开始时间" json:"ksTime"`                          // 播放开始时间
+	JsTime       string `gorm:"column:js_time;type:varchar(50);comment:播放结束时间" json:"jsTime"`                          // 播放结束时间
+	Ptype        int    `gorm:"-" json:"ptype"`                                                                        // 1mp3 2文字
+	FileId       int    `gorm:"column:file_id;type:int(11);comment:文件ID,系统类型为广播系统时使用" json:"fileId"`                   // 文件ID,系统类型为广播系统时使用
+	TaskId       int    `gorm:"column:task_id;type:int(11);comment:任务ID,发布后才有用于控制启动与停止" json:"taskId"`                 // 任务ID,发布后才有用于控制启动与停止
+	PlayTime     int    `gorm:"column:play_time;type:int(11);default:1;comment:播放次数(1-100)" json:"playTime"`           // 播放次数(1-100)
+	PlayInterval int    `gorm:"column:play_interval;type:int(11);default:0;comment: 播放间隔(0-360秒)" json:"playInterval"` // 播放间隔(0-360秒)
 
 
 	PlayPeriod     string `gorm:"-"  json:"playPeriod"`              //播放期间
 	PlayPeriod     string `gorm:"-"  json:"playPeriod"`              //播放期间
 	ResolutionName string `gorm:"-" json:"resolutionName"`           //分辨率
 	ResolutionName string `gorm:"-" json:"resolutionName"`           //分辨率

+ 2 - 2
app/multimedia/service/libraryService.go

@@ -58,7 +58,7 @@ func (s *libraryService) List(tenantId string, searchValue string, current, size
 	return rsp, total, nil
 	return rsp, total, nil
 }
 }
 
 
-func (s *libraryService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *libraryService) Remove(userId int, tenantId string, id int) *common.Errors {
 	library := &dao.Library{
 	library := &dao.Library{
 		ID:         id,
 		ID:         id,
 		IsDeleted:  1,
 		IsDeleted:  1,
@@ -153,7 +153,7 @@ func (s *libraryService) UploadFile(tenantId string, fileHeader *multipart.FileH
 	}, nil
 	}, nil
 }
 }
 
 
-func (s *libraryService) Submit(tenantId string, userId int64, req dao.Library) *common.Errors {
+func (s *libraryService) Submit(tenantId string, userId int, req dao.Library) *common.Errors {
 	library := &req
 	library := &req
 	library.TenantId = tenantId
 	library.TenantId = tenantId
 	library.UpdateUser = userId
 	library.UpdateUser = userId

+ 2 - 2
app/multimedia/service/programService.go

@@ -53,7 +53,7 @@ func (s *programService) List(tenantId string, searchValue string, current, size
 	return rsp, total, nil
 	return rsp, total, nil
 }
 }
 
 
-func (s *programService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *programService) Remove(userId int, tenantId string, id int) *common.Errors {
 	relation := &dao.ProgramRelation{
 	relation := &dao.ProgramRelation{
 		ProgramId: id,
 		ProgramId: id,
 		TenantId:  tenantId,
 		TenantId:  tenantId,
@@ -92,7 +92,7 @@ func (s *programService) GetList(tenantId string, name string) ([]dao.Program, *
 	return libraries, nil
 	return libraries, nil
 }
 }
 
 
-func (s *programService) Submit(tenantId string, userId int64, req model.ReqProgramSubmit) *common.Errors {
+func (s *programService) Submit(tenantId string, userId int, req model.ReqProgramSubmit) *common.Errors {
 	program := &dao.Program{
 	program := &dao.Program{
 		Name:        req.Name,
 		Name:        req.Name,
 		Resolution:  req.Resolution,
 		Resolution:  req.Resolution,

+ 2 - 3
app/multimedia/service/publishLibrariesService.go

@@ -79,7 +79,6 @@ func (s *publishLibrariesService) Create(program *dao.Program, req model.ReqProg
 		CreateUser:       program.CreateUser,
 		CreateUser:       program.CreateUser,
 		CreateName:       "",
 		CreateName:       "",
 		UpdateTime:       time.Now(),
 		UpdateTime:       time.Now(),
-		UpdateUser:       "",
 		IsDeleted:        0,
 		IsDeleted:        0,
 		Status:           1,
 		Status:           1,
 		TenantId:         program.TenantId,
 		TenantId:         program.TenantId,
@@ -126,12 +125,12 @@ func (s *publishLibrariesService) UpdateStatus(tenantId string, id int, status i
 	return true, nil
 	return true, nil
 }
 }
 
 
-func (s *publishLibrariesService) Remove(userId int64, tenantId string, id int) *common.Errors {
+func (s *publishLibrariesService) Remove(userId int, tenantId string, id int) *common.Errors {
 	// 创建查询实例
 	// 创建查询实例
 	device := &dao.PublishLibraries{
 	device := &dao.PublishLibraries{
 		ID:         int64(id),
 		ID:         int64(id),
 		IsDeleted:  1,
 		IsDeleted:  1,
-		UpdateUser: strconv.Itoa(int(userId)),
+		UpdateUser: userId,
 		UpdateTime: time.Now(),
 		UpdateTime: time.Now(),
 	}
 	}
 	err := device.Delete()
 	err := device.Delete()

+ 0 - 3
app/record/dao/aKeyAlarmDao.go

@@ -21,8 +21,6 @@ type AkeyAlarmRecord struct {
 	Remark         string    `gorm:"column:remark;type:varchar(1000);comment:备注" json:"remark"`
 	Remark         string    `gorm:"column:remark;type:varchar(1000);comment:备注" json:"remark"`
 	TenantId       string    `gorm:"column:tenant_id;type:varchar(12);comment:租户ID" json:"tenantId"`
 	TenantId       string    `gorm:"column:tenant_id;type:varchar(12);comment:租户ID" json:"tenantId"`
 	CreateTime     time.Time `gorm:"column:create_time;type:datetime;comment:创建时间" json:"createTime"`
 	CreateTime     time.Time `gorm:"column:create_time;type:datetime;comment:创建时间" json:"createTime"`
-	UpdateTime     time.Time `gorm:"column:update_time;type:timestamp;comment:更新时间" json:"updateTime"`
-	UpdateUser     string    `gorm:"column:update_user;type:varchar(255);comment:修改用户ID" json:"updateUser"`
 	IsDeleted      int       `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除:0-否-1删除" json:"isDeleted"`
 	IsDeleted      int       `gorm:"column:is_deleted;type:int(11);default:0;comment:是否删除:0-否-1删除" json:"isDeleted"`
 }
 }
 
 
@@ -88,7 +86,6 @@ func (a AkeyAlarmRecord) assembleRecordHis(records []edge_service.RecordAlarmSos
 		lightRecord.IsDispose = 0
 		lightRecord.IsDispose = 0
 		lightRecord.TerminalSn = record.Code
 		lightRecord.TerminalSn = record.Code
 		lightRecord.CreateTime = time.Now()
 		lightRecord.CreateTime = time.Now()
-		lightRecord.UpdateTime = time.Now()
 		realLightRecords = append(realLightRecords, lightRecord)
 		realLightRecords = append(realLightRecords, lightRecord)
 	}
 	}
 	return realLightRecords, nil
 	return realLightRecords, nil

+ 1 - 1
app/security/service/multiscreenService.go

@@ -70,7 +70,7 @@ func (s multiscreenService) Save(claims *middleware.Claims, site, id int) error
 	return nil
 	return nil
 }
 }
 
 
-func (s multiscreenService) getSlot(userId int64) string {
+func (s multiscreenService) getSlot(userId int) string {
 	user := &dao.User{ID: userId}
 	user := &dao.User{ID: userId}
 	err := user.GetUser()
 	err := user.GetUser()
 	if err != nil {
 	if err != nil {

+ 5 - 7
app/system/controller/menu.go

@@ -17,7 +17,7 @@ type menu struct{}
 
 
 func (c *menu) GetDetail(ctx *gin.Context) {
 func (c *menu) GetDetail(ctx *gin.Context) {
 	id := ctx.Query("id")
 	id := ctx.Query("id")
-	iId, err := strconv.ParseInt(id, 10, 64)
+	iId, err := strconv.Atoi(id)
 	if err != nil {
 	if err != nil {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 		return
@@ -39,9 +39,9 @@ func (c *menu) LazyList(ctx *gin.Context) {
 	name := ctx.Query("name")
 	name := ctx.Query("name")
 	code := ctx.Query("code")
 	code := ctx.Query("code")
 	alias := ctx.Query("alias")
 	alias := ctx.Query("alias")
-	var parentId int64 = -1
+	parentId := -1
 	if id != "" {
 	if id != "" {
-		parentId, _ = strconv.ParseInt(id, 10, 64)
+		parentId, _ = strconv.Atoi(id)
 	}
 	}
 
 
 	menus, err := service.MenuService.LazyList(parentId, name, code, alias)
 	menus, err := service.MenuService.LazyList(parentId, name, code, alias)
@@ -109,8 +109,7 @@ func (c *menu) Buttons(ctx *gin.Context) {
 		if menu.Children != nil {
 		if menu.Children != nil {
 			for _, child := range menu.Children {
 			for _, child := range menu.Children {
 				var menus3 []model.MenuRouteDetail
 				var menus3 []model.MenuRouteDetail
-				var i int64
-				i = 1
+				i := 1
 				for k, v := range subMenus {
 				for k, v := range subMenus {
 					var menu4 model.MenuRouteDetail
 					var menu4 model.MenuRouteDetail
 					menu4.ID = child.ID + i
 					menu4.ID = child.ID + i
@@ -160,8 +159,7 @@ func (c *menu) GrantTree(ctx *gin.Context) {
 }
 }
 
 
 func (c *menu) RoleTreeKeys(ctx *gin.Context) {
 func (c *menu) RoleTreeKeys(ctx *gin.Context) {
-	i, _ := strconv.Atoi(ctx.Query("roleIds"))
-	roleIds := int64(i)
+	roleIds, _ := strconv.Atoi(ctx.Query("roleIds"))
 	menuIds := service.RoleMenuService.GetMenuIdByRoleId(roleIds)
 	menuIds := service.RoleMenuService.GetMenuIdByRoleId(roleIds)
 	rsp := model.ResMenuIds{
 	rsp := model.ResMenuIds{
 		Menu:      menuIds,
 		Menu:      menuIds,

+ 1 - 1
app/system/controller/role.go

@@ -17,7 +17,7 @@ type role struct{}
 
 
 func (c *role) GetDetail(ctx *gin.Context) {
 func (c *role) GetDetail(ctx *gin.Context) {
 	id := ctx.Query("id")
 	id := ctx.Query("id")
-	iId, err := strconv.ParseInt(id, 10, 64)
+	iId, err := strconv.Atoi(id)
 	if err != nil {
 	if err != nil {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 		return

+ 1 - 1
app/system/controller/tenant.go

@@ -24,7 +24,7 @@ func (c *tenant) GetInfo(ctx *gin.Context) {
 
 
 func (c *tenant) GetDetail(ctx *gin.Context) {
 func (c *tenant) GetDetail(ctx *gin.Context) {
 	id := ctx.Query("id")
 	id := ctx.Query("id")
-	iId, err := strconv.ParseInt(id, 10, 64)
+	iId, err := strconv.Atoi(id)
 	if err != nil {
 	if err != nil {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 		return

+ 1 - 1
app/system/controller/token.go

@@ -246,7 +246,7 @@ func judgeTenant(tenant *dao.Tenant) bool {
 	return true
 	return true
 }
 }
 
 
-func getAccessTokenKey(tenantId string, uId int64, random string) string {
+func getAccessTokenKey(tenantId string, uId int, random string) string {
 	return fmt.Sprintf("access_token_%d_%d_%s", tenantId, uId, random)
 	return fmt.Sprintf("access_token_%d_%d_%s", tenantId, uId, random)
 }
 }
 
 

+ 1 - 1
app/system/controller/user.go

@@ -22,7 +22,7 @@ type user struct{}
 
 
 func (c *user) GetDetail(ctx *gin.Context) {
 func (c *user) GetDetail(ctx *gin.Context) {
 	id := ctx.Query("id")
 	id := ctx.Query("id")
-	iId, err := strconv.ParseInt(id, 10, 64)
+	iId, err := strconv.Atoi(id)
 	if err != nil {
 	if err != nil {
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		ctx.JSON(http.StatusOK, common.ParamsInvalidResponse(err.Error(), nil))
 		return
 		return

+ 17 - 17
app/system/dao/menu.go

@@ -2,19 +2,19 @@ package dao
 
 
 // Menu 角色
 // Menu 角色
 type Menu struct {
 type Menu struct {
-	ID        int64  `gorm:"primary_key" json:"id"`                  //编号
-	ParentId  int64  `gorm:"type:bigint; default 0" json:"parentId"` //父级菜单
-	Code      string `gorm:"type:varchar(255)" json:"code"`          //菜单编号
-	Name      string `gorm:"type:varchar(255)" json:"name"`          //菜单名称
-	Alias     string `gorm:"type:varchar(255)" json:"alias"`         //菜单别名
-	Path      string `gorm:"type:varchar(255)" json:"path"`          //请求地址
-	Source    string `gorm:"type:varchar(255)" json:"source"`        //菜单资源
-	Sort      int    `gorm:"type:int" json:"sort"`                   //排序
-	Category  int    `gorm:"type:int" json:"category"`               //菜单类型
-	Action    int    `gorm:"type:int;default 0" json:"action"`       //操作按钮类型
-	IsOpen    int    `gorm:"type:int;default 1" json:"isOpen"`       //是否打开新页面
-	Remark    string `gorm:"type:varchar(255)" json:"remark"`        //备注
-	IsDeleted int    `gorm:"type:int" json:"isDeleted"`              //是否删除
+	ID        int    `gorm:"type:int;primary_key" json:"id"`     //编号
+	ParentId  int    `gorm:"type:int;default 0" json:"parentId"` //父级菜单
+	Code      string `gorm:"type:varchar(255)" json:"code"`      //菜单编号
+	Name      string `gorm:"type:varchar(255)" json:"name"`      //菜单名称
+	Alias     string `gorm:"type:varchar(255)" json:"alias"`     //菜单别名
+	Path      string `gorm:"type:varchar(255)" json:"path"`      //请求地址
+	Source    string `gorm:"type:varchar(255)" json:"source"`    //菜单资源
+	Sort      int    `gorm:"type:int" json:"sort"`               //排序
+	Category  int    `gorm:"type:int" json:"category"`           //菜单类型
+	Action    int    `gorm:"type:int;default 0" json:"action"`   //操作按钮类型
+	IsOpen    int    `gorm:"type:int;default 1" json:"isOpen"`   //是否打开新页面
+	Remark    string `gorm:"type:varchar(255)" json:"remark"`    //备注
+	IsDeleted int    `gorm:"type:int" json:"isDeleted"`          //是否删除
 }
 }
 
 
 func (Menu) TableName() string {
 func (Menu) TableName() string {
@@ -59,14 +59,14 @@ func (c *Menu) GetByParentId() ([]Menu, error) {
 	return menus, err
 	return menus, err
 }
 }
 
 
-func (c *Menu) HasChildren(parentIds []int64) (map[int64]bool, error) {
+func (c *Menu) HasChildren(parentIds []int) (map[int]bool, error) {
 	type hasChildren struct {
 	type hasChildren struct {
-		ParentId int64 `gorm:"type:bigint"`
-		Count    int   `gorm:"type:int"`
+		ParentId int `gorm:"type:int"`
+		Count    int `gorm:"type:int"`
 	}
 	}
 	var result []hasChildren
 	var result []hasChildren
 	err := Db.Table("menu").Select("parent_id, count(*) count").Where(" is_deleted = 0 and parent_id in (?)", parentIds).Group("parent_id").Find(&result).Error
 	err := Db.Table("menu").Select("parent_id, count(*) count").Where(" is_deleted = 0 and parent_id in (?)", parentIds).Group("parent_id").Find(&result).Error
-	m := make(map[int64]bool)
+	m := make(map[int]bool)
 	for _, item := range result {
 	for _, item := range result {
 		m[item.ParentId] = item.Count > 0
 		m[item.ParentId] = item.Count > 0
 	}
 	}

+ 1 - 1
app/system/dao/operationHisDao.go

@@ -12,7 +12,7 @@ type OperationHistory struct {
 	DeviceType    int       `gorm:"type:int" json:"deviceType"`       //操作模块
 	DeviceType    int       `gorm:"type:int" json:"deviceType"`       //操作模块
 	Object        string    `gorm:"type:varchar(48)" json:"object"`   //操作对象 一般为设备ID+Name
 	Object        string    `gorm:"type:varchar(48)" json:"object"`   //操作对象 一般为设备ID+Name
 	Result        int       `gorm:"type:int" json:"result"`           //0 成功 1失败
 	Result        int       `gorm:"type:int" json:"result"`           //0 成功 1失败
-	HandleUserId  int64     `gorm:"type:bigint" json:"handleUserId"`  //操作用户ID
+	HandleUserId  int       `gorm:"type:int" json:"handleUserId"`     //操作用户ID
 	HandleTime    time.Time `gorm:"type:timestamp" json:"handleTime"` //操作时间
 	HandleTime    time.Time `gorm:"type:timestamp" json:"handleTime"` //操作时间
 	TenantId      string    `gorm:"type:varchar(12)" json:"tenantId"` //租户ID
 	TenantId      string    `gorm:"type:varchar(12)" json:"tenantId"` //租户ID
 }
 }

+ 2 - 2
app/system/dao/role.go

@@ -2,9 +2,9 @@ package dao
 
 
 // Role 角色
 // Role 角色
 type Role struct {
 type Role struct {
-	ID        int64  `gorm:"primary_key" json:"id"`                             //编号
+	ID        int    `gorm:"primary_key" json:"id"`                             //编号
 	TenantId  string `gorm:"type:varchar(12);default '000000'" json:"tenantId"` //租户id
 	TenantId  string `gorm:"type:varchar(12);default '000000'" json:"tenantId"` //租户id
-	ParentId  int64  `gorm:"type:bigint" json:"parentId"`                       //父主键
+	ParentId  int    `gorm:"type:int" json:"parentId"`                          //父主键
 	RoleName  string `gorm:"type:varchar(255)" json:"roleName"`                 //角色别名
 	RoleName  string `gorm:"type:varchar(255)" json:"roleName"`                 //角色别名
 	Sort      int    `gorm:"type:int" json:"sort"`                              //排序
 	Sort      int    `gorm:"type:int" json:"sort"`                              //排序
 	RoleAlias string `gorm:"type:varchar(255)" json:"roleAlias"`                //角色别名
 	RoleAlias string `gorm:"type:varchar(255)" json:"roleAlias"`                //角色别名

+ 4 - 4
app/system/dao/roleMenu.go

@@ -1,9 +1,9 @@
 package dao
 package dao
 
 
 type RoleMenu struct {
 type RoleMenu struct {
-	ID     int64 `gorm:"primary_key" json:"id"`     //编号
-	MenuId int64 `gorm:"type:bigint" json:"menuId"` //菜单id
-	RoleId int64 `gorm:"type:bigint" json:"roleId"` //角色id
+	ID     int `gorm:"primary_key" json:"id"`  //编号
+	MenuId int `gorm:"type:int" json:"menuId"` //菜单id
+	RoleId int `gorm:"type:int" json:"roleId"` //角色id
 }
 }
 
 
 func (RoleMenu) TableName() string {
 func (RoleMenu) TableName() string {
@@ -18,7 +18,7 @@ func (c *RoleMenu) BatchSave(menus []RoleMenu) error {
 	return Db.Model(&c).Save(&menus).Error
 	return Db.Model(&c).Save(&menus).Error
 }
 }
 
 
-func (c *RoleMenu) DeleteRoleIds(roleIds []int64) error {
+func (c *RoleMenu) DeleteRoleIds(roleIds []int) error {
 	return Db.Model(&c).Where("role_id in ?", roleIds).Delete(&c).Error
 	return Db.Model(&c).Where("role_id in ?", roleIds).Delete(&c).Error
 }
 }
 
 

+ 3 - 3
app/system/dao/tenant.go

@@ -6,7 +6,7 @@ import (
 
 
 // 租户
 // 租户
 type Tenant struct {
 type Tenant struct {
-	ID               int64     `gorm:"primary_key" json:"id"`                    //编号
+	ID               int       `gorm:"primary_key" json:"id"`                    //编号
 	TenantId         string    `gorm:"type:varchar(12)" json:"tenantId"`         //租户ID
 	TenantId         string    `gorm:"type:varchar(12)" json:"tenantId"`         //租户ID
 	TenantName       string    `gorm:"type:varchar(50)" json:"tenantName"`       //租户名称
 	TenantName       string    `gorm:"type:varchar(50)" json:"tenantName"`       //租户名称
 	Domain           string    `gorm:"type:varchar(255)" json:"domain"`          //域名地址
 	Domain           string    `gorm:"type:varchar(255)" json:"domain"`          //域名地址
@@ -20,10 +20,10 @@ type Tenant struct {
 	DatasourceId     int64     `gorm:"type:bigint" json:"datasourceId"`          //数据源
 	DatasourceId     int64     `gorm:"type:bigint" json:"datasourceId"`          //数据源
 	LicenseKey       string    `gorm:"type:varchar(1000)" json:"licenseKey"`     //授权码
 	LicenseKey       string    `gorm:"type:varchar(1000)" json:"licenseKey"`     //授权码
 	BigScreenName    string    `gorm:"type:varchar(60)" json:"bigScreenName"`    //大屏端显示名称
 	BigScreenName    string    `gorm:"type:varchar(60)" json:"bigScreenName"`    //大屏端显示名称
-	CreateUser       int64     `gorm:"type:bigint" json:"createUser"`            //创建人
+	CreateUser       int       `gorm:"type:bigint" json:"createUser"`            //创建人
 	CreateDept       int64     `gorm:"type:bigint" json:"createDept"`            //创建部门
 	CreateDept       int64     `gorm:"type:bigint" json:"createDept"`            //创建部门
 	CreateTime       time.Time `gorm:"type:datetime" json:"createTime"`          //新增时间
 	CreateTime       time.Time `gorm:"type:datetime" json:"createTime"`          //新增时间
-	UpdateUser       int64     `gorm:"type:bigint" json:"updateUser"`            //修改人
+	UpdateUser       int       `gorm:"type:bigint" json:"updateUser"`            //修改人
 	UpdateTime       time.Time `gorm:"type:datetime" json:"updateTime"`          //修改时间
 	UpdateTime       time.Time `gorm:"type:datetime" json:"updateTime"`          //修改时间
 	Status           int       `gorm:"type:int  " json:"status"`                 //状态
 	Status           int       `gorm:"type:int  " json:"status"`                 //状态
 	IsDeleted        int       `gorm:"type:int" json:"isDeleted"`                //是否删除 0=未删除,1=删除
 	IsDeleted        int       `gorm:"type:int" json:"isDeleted"`                //是否删除 0=未删除,1=删除

+ 7 - 7
app/system/dao/user.go

@@ -6,7 +6,7 @@ import (
 
 
 // User 用户
 // User 用户
 type User struct {
 type User struct {
-	ID                      int64     `gorm:"primary_key;type:bigint" json:"id"`                                  //编号
+	ID                      int       `gorm:"primary_key;type:int" json:"id"`                                     //编号
 	TenantId                string    `gorm:"type:varchar(12)" json:"tenantId"`                                   //租户ID
 	TenantId                string    `gorm:"type:varchar(12)" json:"tenantId"`                                   //租户ID
 	Code                    string    `gorm:"type:varchar(12)" json:"code"`                                       //用户编号
 	Code                    string    `gorm:"type:varchar(12)" json:"code"`                                       //用户编号
 	Account                 string    `gorm:"type:varchar(45)" json:"account"`                                    //账号
 	Account                 string    `gorm:"type:varchar(45)" json:"account"`                                    //账号
@@ -18,11 +18,11 @@ type User struct {
 	Phone                   string    `gorm:"type:varchar(45)" json:"phone"`                                      //手机
 	Phone                   string    `gorm:"type:varchar(45)" json:"phone"`                                      //手机
 	Birthday                string    `gorm:"type:string" json:"birthday"`                                        //生日
 	Birthday                string    `gorm:"type:string" json:"birthday"`                                        //生日
 	Sex                     int       `gorm:"type:smallint" json:"sex"`                                           //生日
 	Sex                     int       `gorm:"type:smallint" json:"sex"`                                           //生日
-	RoleId                  int64     `gorm:"type:bigint" json:"roleId"`                                          //角色id 数组,分隔
-	CreateUser              int64     `gorm:"type:bigint" json:"createUser"`                                      //创建人
-	CreateDept              int64     `gorm:"type:bigint" json:"createDept"`                                      //创建部门
+	RoleId                  int       `gorm:"type:bigint" json:"roleId"`                                          //角色id 数组,分隔
+	CreateUser              int       `gorm:"type:int" json:"createUser"`                                         //创建人
+	CreateDept              int       `gorm:"type:int" json:"createDept"`                                         //创建部门
 	CreateTime              time.Time `gorm:"autoCreateTime;column:create_time;type:datetime;" json:"createTime"` //新增时间
 	CreateTime              time.Time `gorm:"autoCreateTime;column:create_time;type:datetime;" json:"createTime"` //新增时间
-	UpdateUser              int64     `gorm:"type:bigint" json:"updateUser"`                                      //修改人
+	UpdateUser              int       `gorm:"type:int" json:"updateUser"`                                         //修改人
 	UpdateTime              time.Time `gorm:"autoUpdateTime;column:update_time;type:datetime;" json:"updateTime"` //修改时间
 	UpdateTime              time.Time `gorm:"autoUpdateTime;column:update_time;type:datetime;" json:"updateTime"` //修改时间
 	Status                  int       `gorm:"type:int  " json:"status"`                                           //状态
 	Status                  int       `gorm:"type:int  " json:"status"`                                           //状态
 	IsDeleted               int       `gorm:"type:int" json:"isDeleted"`                                          //是否删除 0=未删除,1=删除
 	IsDeleted               int       `gorm:"type:int" json:"isDeleted"`                                          //是否删除 0=未删除,1=删除
@@ -52,7 +52,7 @@ func (c *User) GetUserByPwd() error {
 	return Db.Model(&c).Where("tenant_id = ? and account = ? and password = ? and is_deleted = 0", c.TenantId, c.Account, c.Password).First(&c).Error
 	return Db.Model(&c).Where("tenant_id = ? and account = ? and password = ? and is_deleted = 0", c.TenantId, c.Account, c.Password).First(&c).Error
 }
 }
 
 
-func (c *User) GetUsers(offset, limit int) ([]User, int64, error) {
+func (c *User) GetUsers(offset, limit int) ([]User, int, error) {
 	var users []User
 	var users []User
 	var counts int64
 	var counts int64
 	db := Db.Model(&c)
 	db := Db.Model(&c)
@@ -66,7 +66,7 @@ func (c *User) GetUsers(offset, limit int) ([]User, int64, error) {
 	err := db.Where("is_deleted = 0").Offset(offset).Limit(limit).Find(&users).Error
 	err := db.Where("is_deleted = 0").Offset(offset).Limit(limit).Find(&users).Error
 	db1 := Db.Model(&c)
 	db1 := Db.Model(&c)
 	db1.Where("is_deleted = 0").Count(&counts)
 	db1.Where("is_deleted = 0").Count(&counts)
-	return users, counts, err
+	return users, int(counts), err
 }
 }
 
 
 func (c *User) Save() error {
 func (c *User) Save() error {

+ 5 - 5
app/system/model/menu.go

@@ -27,8 +27,8 @@ type MenuTreeDetail struct {
 }
 }
 
 
 type MenuSubmit struct {
 type MenuSubmit struct {
-	ID       int64  `json:"id"`
-	ParentId string `json:"parentId"` //父级菜单
+	ID       int    `json:"id"`
+	ParentId int    `json:"parentId"` //父级菜单
 	Code     string `json:"code"`     //菜单编号
 	Code     string `json:"code"`     //菜单编号
 	Name     string ` json:"name"`    //菜单名称
 	Name     string ` json:"name"`    //菜单名称
 	Alias    string `json:"alias"`    //菜单别名
 	Alias    string `json:"alias"`    //菜单别名
@@ -51,9 +51,9 @@ type MenuLazyListDetail struct {
 }
 }
 
 
 type ResMenuIds struct {
 type ResMenuIds struct {
-	Menu      []int64 `json:"menu"`
-	DataScope []int   `json:"dataScope"` //类型还未确定
-	ApiScope  []int   `json:"apiScope"`  //类型还未确定
+	Menu      []int `json:"menu"`
+	DataScope []int `json:"dataScope"` //类型还未确定
+	ApiScope  []int `json:"apiScope"`  //类型还未确定
 }
 }
 
 
 type ResGrantTree struct {
 type ResGrantTree struct {

+ 10 - 10
app/system/model/role.go

@@ -9,10 +9,10 @@ type RsqRoleList struct {
 }
 }
 
 
 type RoleVO struct {
 type RoleVO struct {
-	ID         int64  `gorm:"primary_key" json:"id"`                             //编号
+	ID         int    `gorm:"primary_key" json:"id"`                             //编号
 	TenantId   string `gorm:"type:varchar(12);default '000000'" json:"tenantId"` //
 	TenantId   string `gorm:"type:varchar(12);default '000000'" json:"tenantId"` //
 	ParentName string `json:"parentName"`
 	ParentName string `json:"parentName"`
-	ParentId   int64  `gorm:"type:bigint" json:"parentId"`        //父主键
+	ParentId   int    `gorm:"type:bigint" json:"parentId"`        //父主键
 	RoleName   string `gorm:"type:varchar(255)" json:"roleName"`  //角色别名
 	RoleName   string `gorm:"type:varchar(255)" json:"roleName"`  //角色别名
 	Sort       int    `gorm:"type:int" json:"sort"`               //排序
 	Sort       int    `gorm:"type:int" json:"sort"`               //排序
 	RoleAlias  string `gorm:"type:varchar(255)" json:"roleAlias"` //角色别名
 	RoleAlias  string `gorm:"type:varchar(255)" json:"roleAlias"` //角色别名
@@ -20,15 +20,15 @@ type RoleVO struct {
 }
 }
 
 
 type ReqRoleRemove struct {
 type ReqRoleRemove struct {
-	IDs  int64  `json:"ids"`
+	IDs  int    `json:"ids"`
 	Name string `json:"name"`
 	Name string `json:"name"`
 }
 }
 
 
 type ReqRoleGrant struct {
 type ReqRoleGrant struct {
-	RoleIds      []int64 `json:"roleIds"`      //角色ID
-	MenuIds      []int64 `json:"menuIds"`      //菜单权限ID
-	DataScopeIds []int64 `json:"dataScopeIds"` //数据权限ID
-	ApiScopeIds  []int64 `json:"apiScopeIds"`  //接口权限ID
+	RoleIds      []int `json:"roleIds"`      //角色ID
+	MenuIds      []int `json:"menuIds"`      //菜单权限ID
+	DataScopeIds []int `json:"dataScopeIds"` //数据权限ID
+	ApiScopeIds  []int `json:"apiScopeIds"`  //接口权限ID
 }
 }
 
 
 type RspRoleTree struct {
 type RspRoleTree struct {
@@ -37,8 +37,8 @@ type RspRoleTree struct {
 
 
 type RoleDetail struct {
 type RoleDetail struct {
 	HasChildren bool         `json:"hasChildren"`
 	HasChildren bool         `json:"hasChildren"`
-	ID          int64        `json:"id"`
-	ParentId    int64        `json:"parentId"`
+	ID          int          `json:"id"`
+	ParentId    int          `json:"parentId"`
 	Title       string       `json:"title"`
 	Title       string       `json:"title"`
 	Key         string       `json:"key"`
 	Key         string       `json:"key"`
 	Value       string       `json:"value"`
 	Value       string       `json:"value"`
@@ -47,7 +47,7 @@ type RoleDetail struct {
 
 
 // 绑定前端json数据的中间结构体
 // 绑定前端json数据的中间结构体
 type BindRole struct {
 type BindRole struct {
-	ID        int64  `json:"id"`
+	ID        int    `json:"id"`
 	TenantId  string `json:"tenantId"`
 	TenantId  string `json:"tenantId"`
 	ParentId  string `json:"parentId"`
 	ParentId  string `json:"parentId"`
 	RoleName  string `json:"roleName"`
 	RoleName  string `json:"roleName"`

+ 1 - 1
app/system/model/tenant.go

@@ -15,7 +15,7 @@ type RsqTenantList struct {
 }
 }
 
 
 type ReqTenantRemove struct {
 type ReqTenantRemove struct {
-	IDs  int64  `json:"ids"`
+	IDs  int    `json:"ids"`
 	Name string `json:"name"`
 	Name string `json:"name"`
 }
 }
 
 

+ 2 - 2
app/system/model/token.go

@@ -20,8 +20,8 @@ type UserInfo struct {
 
 
 type RspToken struct {
 type RspToken struct {
 	TenantId     string `json:"tenant_id"`
 	TenantId     string `json:"tenant_id"`
-	UserId       int64  `json:"user_id"`
-	RoleId       int64  `json:"role_id"`
+	UserId       int    `json:"user_id"`
+	RoleId       int    `json:"role_id"`
 	OauthId      string `json:"oauth_id"`
 	OauthId      string `json:"oauth_id"`
 	Account      string `json:"account"`
 	Account      string `json:"account"`
 	UserName     string `json:"user_name"`
 	UserName     string `json:"user_name"`

+ 3 - 3
app/system/model/user.go

@@ -14,16 +14,16 @@ type RsqUserList struct {
 	Current int          `json:"current"` //当前分页
 	Current int          `json:"current"` //当前分页
 	Size    int          `json:"size"`    //每页数量
 	Size    int          `json:"size"`    //每页数量
 	Pages   int          `json:"pages"`   //总页数
 	Pages   int          `json:"pages"`   //总页数
-	Total   int64        `json:"total"`   //总数
+	Total   int          `json:"total"`   //总数
 }
 }
 
 
 type ReqUserRemove struct {
 type ReqUserRemove struct {
-	IDs  int64  `json:"ids"`
+	IDs  int    `json:"ids"`
 	Name string `json:"name"`
 	Name string `json:"name"`
 }
 }
 
 
 type ReqUserResetPwd struct {
 type ReqUserResetPwd struct {
-	IDs int64 `json:"ids"`
+	IDs int `json:"ids"`
 }
 }
 
 
 type ReqUserGrant struct {
 type ReqUserGrant struct {

+ 21 - 16
app/system/service/menuService.go

@@ -12,7 +12,7 @@ var MenuService = new(menuService)
 
 
 type menuService struct{}
 type menuService struct{}
 
 
-func (s *menuService) Get(id int64) (*dao.Menu, error) {
+func (s *menuService) Get(id int) (*dao.Menu, error) {
 	menu := &dao.Menu{
 	menu := &dao.Menu{
 		ID: id,
 		ID: id,
 	}
 	}
@@ -24,10 +24,9 @@ func (s *menuService) Get(id int64) (*dao.Menu, error) {
 }
 }
 
 
 func (s *menuService) Submit(req model.MenuSubmit) *common.Errors {
 func (s *menuService) Submit(req model.MenuSubmit) *common.Errors {
-	pId, _ := strconv.ParseInt(req.ParentId, 10, 64)
 	menu := &dao.Menu{
 	menu := &dao.Menu{
 		ID:        req.ID,
 		ID:        req.ID,
-		ParentId:  pId,
+		ParentId:  req.ParentId,
 		Code:      req.Code,
 		Code:      req.Code,
 		Name:      req.Name,
 		Name:      req.Name,
 		Alias:     req.Alias,
 		Alias:     req.Alias,
@@ -41,10 +40,16 @@ func (s *menuService) Submit(req model.MenuSubmit) *common.Errors {
 		IsDeleted: 0,
 		IsDeleted: 0,
 	}
 	}
 	if menu.ID == 0 {
 	if menu.ID == 0 {
+		menu.IsOpen = 1
 		err := menu.Save()
 		err := menu.Save()
 		if err != nil {
 		if err != nil {
 			return common.FailResponse(err.Error(), nil)
 			return common.FailResponse(err.Error(), nil)
 		}
 		}
+		roleMenu := dao.RoleMenu{
+			MenuId: menu.ID,
+			RoleId: 1,
+		}
+		roleMenu.Save()
 		return common.SuccessResponse(common.Succeeded, nil)
 		return common.SuccessResponse(common.Succeeded, nil)
 	}
 	}
 	err := menu.Update()
 	err := menu.Update()
@@ -67,7 +72,7 @@ func (s *menuService) Tree() ([]model.MenuTreeDetail, error) {
 	allMenus := s.GetAll()
 	allMenus := s.GetAll()
 	var rsp []model.MenuTreeDetail
 	var rsp []model.MenuTreeDetail
 	//上级角色——多个下级角色数组
 	//上级角色——多个下级角色数组
-	tmp := make(map[int64][]dao.Menu)
+	tmp := make(map[int][]dao.Menu)
 	for _, menu := range allMenus {
 	for _, menu := range allMenus {
 		childes, isExist := tmp[menu.ParentId]
 		childes, isExist := tmp[menu.ParentId]
 		if isExist {
 		if isExist {
@@ -87,9 +92,9 @@ func (s *menuService) Tree() ([]model.MenuTreeDetail, error) {
 	return rsp, nil
 	return rsp, nil
 }
 }
 
 
-func (s *menuService) Routes(roleId int64) ([]model.MenuRouteDetail, error) {
+func (s *menuService) Routes(roleId int) ([]model.MenuRouteDetail, error) {
 	allMenus := s.GetAll()
 	allMenus := s.GetAll()
-	menuMap := make(map[int64]dao.Menu)
+	menuMap := make(map[int]dao.Menu)
 	for _, menu := range allMenus {
 	for _, menu := range allMenus {
 		menuMap[menu.ID] = menu
 		menuMap[menu.ID] = menu
 	}
 	}
@@ -97,7 +102,7 @@ func (s *menuService) Routes(roleId int64) ([]model.MenuRouteDetail, error) {
 	roleMenus := RoleMenuService.GetMenuByRole(roleId)
 	roleMenus := RoleMenuService.GetMenuByRole(roleId)
 	var rsp []model.MenuRouteDetail
 	var rsp []model.MenuRouteDetail
 	//上级角色——多个下级角色数组
 	//上级角色——多个下级角色数组
-	tmp := make(map[int64][]dao.Menu)
+	tmp := make(map[int][]dao.Menu)
 	for _, roleMenu := range roleMenus {
 	for _, roleMenu := range roleMenus {
 		if menu, isExist := menuMap[roleMenu.MenuId]; isExist {
 		if menu, isExist := menuMap[roleMenu.MenuId]; isExist {
 			childes, isExist := tmp[menu.ParentId]
 			childes, isExist := tmp[menu.ParentId]
@@ -125,7 +130,7 @@ func (s *menuService) Routes(roleId int64) ([]model.MenuRouteDetail, error) {
 	return rsp, nil
 	return rsp, nil
 }
 }
 
 
-func menuDfs(result []model.MenuRouteDetail, menus []dao.Menu, tmp map[int64][]dao.Menu) []model.MenuRouteDetail {
+func menuDfs(result []model.MenuRouteDetail, menus []dao.Menu, tmp map[int][]dao.Menu) []model.MenuRouteDetail {
 	if len(menus) == 0 {
 	if len(menus) == 0 {
 		return nil
 		return nil
 	}
 	}
@@ -145,17 +150,17 @@ func menuDfs(result []model.MenuRouteDetail, menus []dao.Menu, tmp map[int64][]d
 	return result
 	return result
 }
 }
 
 
-func menuTreeDfs(result []model.MenuTreeDetail, menus []dao.Menu, tmp map[int64][]dao.Menu) []model.MenuTreeDetail {
+func menuTreeDfs(result []model.MenuTreeDetail, menus []dao.Menu, tmp map[int][]dao.Menu) []model.MenuTreeDetail {
 	if len(menus) == 0 {
 	if len(menus) == 0 {
 		return nil
 		return nil
 	}
 	}
 	for _, child := range menus {
 	for _, child := range menus {
 		detail := model.MenuTreeDetail{}
 		detail := model.MenuTreeDetail{}
 		detail.Title = child.Name
 		detail.Title = child.Name
-		detail.ID = strconv.FormatInt(child.ID, 10)
-		detail.ParentId = strconv.FormatInt(child.ParentId, 10)
-		detail.Key = strconv.FormatInt(child.ID, 10)
-		detail.Value = strconv.FormatInt(child.ID, 10)
+		detail.ID = strconv.Itoa(child.ID)
+		detail.ParentId = strconv.Itoa(child.ParentId)
+		detail.Key = strconv.Itoa(child.ID)
+		detail.Value = strconv.Itoa(child.ID)
 		childes, isExist := tmp[child.ID]
 		childes, isExist := tmp[child.ID]
 		if isExist {
 		if isExist {
 			detail.HasChildren = true
 			detail.HasChildren = true
@@ -169,7 +174,7 @@ func menuTreeDfs(result []model.MenuTreeDetail, menus []dao.Menu, tmp map[int64]
 	return result
 	return result
 }
 }
 
 
-func (s *menuService) LazyList(parentId int64, name, code, alias string) ([]model.MenuLazyListDetail, error) {
+func (s *menuService) LazyList(parentId int, name, code, alias string) ([]model.MenuLazyListDetail, error) {
 	menu := &dao.Menu{
 	menu := &dao.Menu{
 		ParentId: parentId,
 		ParentId: parentId,
 		Name:     name,
 		Name:     name,
@@ -180,7 +185,7 @@ func (s *menuService) LazyList(parentId int64, name, code, alias string) ([]mode
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	var parentIds []int64
+	var parentIds []int
 	for _, m := range menus {
 	for _, m := range menus {
 		parentIds = append(parentIds, m.ID)
 		parentIds = append(parentIds, m.ID)
 	}
 	}
@@ -200,7 +205,7 @@ func (s *menuService) LazyList(parentId int64, name, code, alias string) ([]mode
 }
 }
 
 
 func (s *menuService) GetTree() ([]model.MenuRouteDetail, error) {
 func (s *menuService) GetTree() ([]model.MenuRouteDetail, error) {
-	menuDao := dao.Menu{ParentId: int64(0)}
+	menuDao := dao.Menu{ParentId: 0}
 	var menuDetails []model.MenuRouteDetail
 	var menuDetails []model.MenuRouteDetail
 	var temp model.MenuRouteDetail
 	var temp model.MenuRouteDetail
 
 

+ 1 - 1
app/system/service/operationHisService.go

@@ -14,7 +14,7 @@ var OperationHisService = new(operationHisService)
 
 
 type operationHisService struct{}
 type operationHisService struct{}
 
 
-func (s *operationHisService) Save(userId int64, tenantId string, handleType, handleModuleType, deviceType int,
+func (s *operationHisService) Save(userId int, tenantId string, handleType, handleModuleType, deviceType int,
 	handleObject string, handleResult int) {
 	handleObject string, handleResult int) {
 	operation := dao.OperationHistory{
 	operation := dao.OperationHistory{
 		OperationType: handleType,
 		OperationType: handleType,

+ 4 - 4
app/system/service/roleMenuService.go

@@ -10,7 +10,7 @@ var RoleMenuService = new(roleMenuService)
 
 
 type roleMenuService struct{}
 type roleMenuService struct{}
 
 
-func (s *roleMenuService) UpdateRoleMenus(roleIds, menuIds []int64) error {
+func (s *roleMenuService) UpdateRoleMenus(roleIds []int, menuIds []int) error {
 	roleMenu := &dao.RoleMenu{}
 	roleMenu := &dao.RoleMenu{}
 	err := roleMenu.DeleteRoleIds(roleIds)
 	err := roleMenu.DeleteRoleIds(roleIds)
 	if err != nil {
 	if err != nil {
@@ -29,7 +29,7 @@ func (s *roleMenuService) UpdateRoleMenus(roleIds, menuIds []int64) error {
 	return roleMenu.BatchSave(roleMenus)
 	return roleMenu.BatchSave(roleMenus)
 }
 }
 
 
-func (s *roleMenuService) GetMenuByRole(roleId int64) []dao.RoleMenu {
+func (s *roleMenuService) GetMenuByRole(roleId int) []dao.RoleMenu {
 	roleMenu := &dao.RoleMenu{RoleId: roleId}
 	roleMenu := &dao.RoleMenu{RoleId: roleId}
 	if common.IsAdmin(roleId) {
 	if common.IsAdmin(roleId) {
 		menus, err := roleMenu.GetAll()
 		menus, err := roleMenu.GetAll()
@@ -45,13 +45,13 @@ func (s *roleMenuService) GetMenuByRole(roleId int64) []dao.RoleMenu {
 		return menus
 		return menus
 	}
 	}
 }
 }
-func (s *roleMenuService) GetMenuIdByRoleId(roleId int64) []int64 {
+func (s *roleMenuService) GetMenuIdByRoleId(roleId int) []int {
 	rmDao := &dao.RoleMenu{RoleId: roleId}
 	rmDao := &dao.RoleMenu{RoleId: roleId}
 	menus, err := rmDao.GetMenusByRole()
 	menus, err := rmDao.GetMenusByRole()
 	if err != nil {
 	if err != nil {
 		return nil
 		return nil
 	}
 	}
-	var ids []int64
+	var ids []int
 	for _, menu := range menus {
 	for _, menu := range menus {
 		ids = append(ids, menu.MenuId)
 		ids = append(ids, menu.MenuId)
 	}
 	}

+ 4 - 4
app/system/service/roleService.go

@@ -15,7 +15,7 @@ var RoleService = new(roleService)
 
 
 type roleService struct{}
 type roleService struct{}
 
 
-func (s *roleService) Get(id int64) (*dao.Role, error) {
+func (s *roleService) Get(id int) (*dao.Role, error) {
 	role := &dao.Role{
 	role := &dao.Role{
 		ID: id,
 		ID: id,
 	}
 	}
@@ -89,7 +89,7 @@ func (s *roleService) GetList() ([]dao.Role, error) {
 	return roles, nil
 	return roles, nil
 }
 }
 
 
-func (s *roleService) Remove(id int64) *common.Errors {
+func (s *roleService) Remove(id int) *common.Errors {
 	role := &dao.Role{
 	role := &dao.Role{
 		ID:        id,
 		ID:        id,
 		IsDeleted: 1,
 		IsDeleted: 1,
@@ -120,7 +120,7 @@ func (s *roleService) Grant(req *model.ReqRoleGrant) error {
 
 
 const RoleNameKey = "%d:sys:role_name:%d"
 const RoleNameKey = "%d:sys:role_name:%d"
 
 
-func (s *roleService) GetRoleName(tenantId string, roleId int64) string {
+func (s *roleService) GetRoleName(tenantId string, roleId int) string {
 	var name string
 	var name string
 	key := fmt.Sprintf(RoleNameKey, tenantId, roleId)
 	key := fmt.Sprintf(RoleNameKey, tenantId, roleId)
 	name, err := cache.Redis.Get(key).Result()
 	name, err := cache.Redis.Get(key).Result()
@@ -137,7 +137,7 @@ func (s *roleService) GetRoleName(tenantId string, roleId int64) string {
 }
 }
 
 
 func (s *roleService) GetTree() ([]model.RoleDetail, error) {
 func (s *roleService) GetTree() ([]model.RoleDetail, error) {
-	roleDao := dao.Role{ParentId: int64(0)}
+	roleDao := dao.Role{ParentId: 0}
 	var results []model.RoleDetail
 	var results []model.RoleDetail
 	var temp model.RoleDetail
 	var temp model.RoleDetail
 	//所有role包装为roleDetail
 	//所有role包装为roleDetail

+ 2 - 2
app/system/service/tenantService.go

@@ -36,7 +36,7 @@ func (s *tenantService) GetOne(tenantId string) (*dao.Tenant, error) {
 	return tenant, nil
 	return tenant, nil
 }
 }
 
 
-func (s *tenantService) Get(id int64) (*dao.Tenant, error) {
+func (s *tenantService) Get(id int) (*dao.Tenant, error) {
 	tenant := &dao.Tenant{
 	tenant := &dao.Tenant{
 		ID: id,
 		ID: id,
 	}
 	}
@@ -108,7 +108,7 @@ func (s *tenantService) GetList() ([]dao.Tenant, error) {
 	return tenants, nil
 	return tenants, nil
 }
 }
 
 
-func (s *tenantService) Remove(userId, id int64) *common.Errors {
+func (s *tenantService) Remove(userId, id int) *common.Errors {
 	tenant := &dao.Tenant{
 	tenant := &dao.Tenant{
 		ID:         id,
 		ID:         id,
 		IsDeleted:  1,
 		IsDeleted:  1,

+ 6 - 6
app/system/service/userService.go

@@ -21,7 +21,7 @@ var UserService = new(userService)
 
 
 type userService struct{}
 type userService struct{}
 
 
-func (s *userService) Get(id int64) (*model.UserDetail, error) {
+func (s *userService) Get(id int) (*model.UserDetail, error) {
 	user := &dao.User{
 	user := &dao.User{
 		ID: id,
 		ID: id,
 	}
 	}
@@ -66,7 +66,7 @@ func (s *userService) GetOne(tenantId string, account, password string) *dao.Use
 	return user
 	return user
 }
 }
 
 
-func (s *userService) List(account, realName string, current, size int) ([]model.UserDetail, int64, *common.Errors) {
+func (s *userService) List(account, realName string, current, size int) ([]model.UserDetail, int, *common.Errors) {
 	user := dao.User{}
 	user := dao.User{}
 	offset := (current - 1) * size
 	offset := (current - 1) * size
 	limit := size
 	limit := size
@@ -127,7 +127,7 @@ func (s *userService) Update(req dao.User) *common.Errors {
 	return nil
 	return nil
 }
 }
 
 
-func (s *userService) Remove(userId, id int64) *common.Errors {
+func (s *userService) Remove(userId, id int) *common.Errors {
 	user := &dao.User{
 	user := &dao.User{
 		ID:         id,
 		ID:         id,
 		IsDeleted:  1,
 		IsDeleted:  1,
@@ -141,7 +141,7 @@ func (s *userService) Remove(userId, id int64) *common.Errors {
 	return nil
 	return nil
 }
 }
 
 
-func (s *userService) ResetPwd(id int64) *common.Errors {
+func (s *userService) ResetPwd(id int) *common.Errors {
 	user := &dao.User{ID: id}
 	user := &dao.User{ID: id}
 	err := user.UpdatePwd(model.DefaultPwd)
 	err := user.UpdatePwd(model.DefaultPwd)
 	if err != nil {
 	if err != nil {
@@ -166,7 +166,7 @@ func (s *userService) Grant(userIds []string, roleIds string) error {
 
 
 const UserKey = "%d:sys:user:%d"
 const UserKey = "%d:sys:user:%d"
 
 
-func (s *userService) GetUserName(tenantId string, id int64) string {
+func (s *userService) GetUserName(tenantId string, id int) string {
 	var name string
 	var name string
 	key := fmt.Sprintf(UserKey, tenantId, id)
 	key := fmt.Sprintf(UserKey, tenantId, id)
 	name, err := cache.Redis.Get(key).Result()
 	name, err := cache.Redis.Get(key).Result()
@@ -187,7 +187,7 @@ func (s *userService) IsExist(user dao.User) bool {
 }
 }
 
 
 // UpAvatar  上传头像
 // UpAvatar  上传头像
-func (s *userService) UpAvatar(tenantId string, userId int64, fileHeader *multipart.FileHeader) *model.Link {
+func (s *userService) UpAvatar(tenantId string, userId int, fileHeader *multipart.FileHeader) *model.Link {
 	//检查是否已有头像,成功上传后将其删除
 	//检查是否已有头像,成功上传后将其删除
 	dao := &dao.User{TenantId: tenantId, ID: userId}
 	dao := &dao.User{TenantId: tenantId, ID: userId}
 	dao.GetAvatar()
 	dao.GetAvatar()

+ 1 - 1
app/warn/service/noticeSetService.go

@@ -188,7 +188,7 @@ func (s noticeSetService) GetReceiveList(deviceType int, sn string, armSource in
 
 
 		for _, userId := range usersArr {
 		for _, userId := range usersArr {
 			var user systemDao.User
 			var user systemDao.User
-			parseInt, _ := strconv.ParseInt(userId, 10, 64)
+			parseInt, _ := strconv.Atoi(userId)
 			user.ID = parseInt
 			user.ID = parseInt
 			user.GetUser()
 			user.GetUser()
 			for _, noticeModeStr := range noticeModesArr {
 			for _, noticeModeStr := range noticeModesArr {

+ 1 - 1
util/common/common.go

@@ -149,7 +149,7 @@ func MlParseTime(strTime string) (time.Time, error) {
 	return time.ParseInLocation("2006-01-02 15:04:05", strTime, mLocation)
 	return time.ParseInLocation("2006-01-02 15:04:05", strTime, mLocation)
 }
 }
 
 
-func IsAdmin(roleId int64) bool {
+func IsAdmin(roleId int) bool {
 	return roleId == 1
 	return roleId == 1
 }
 }