Browse Source

修改MAX函数由null 转int

hongze 5 months ago
parent
commit
04c0eb57de
2 changed files with 5 additions and 5 deletions
  1. 1 1
      models/report.go
  2. 4 4
      models/system/sys_role.go

+ 1 - 1
models/report.go

@@ -444,7 +444,7 @@ func GetReportStage(classifyIdFirst, classifyIdSecond, classifyIdThird int) (cou
 	}
 	yearStart := time.Date(time.Now().Local().Year(), 1, 1, 0, 0, 0, 0, time.Local)
 
-	sql := `SELECT MAX(stage) AS max_stage FROM report WHERE create_time > ? `
+	sql := `SELECT COALESCE(MAX(stage),0) AS count FROM report WHERE create_time > ? `
 	if classifyIdThird > 0 {
 		sql += " AND classify_id_third = ? "
 	} else if classifyIdSecond > 0 {

+ 4 - 4
models/system/sys_role.go

@@ -133,10 +133,10 @@ type RoleMenu struct {
 }
 
 type RoleMenuList struct {
-	MenuId    int    `description:"导航唯一标识"`
-	Name      string `description:"导航名称"`
-	NameEn    string `description:"导航名称(英文)"`
-	Child     []*RoleMenu
+	MenuId    int         `description:"导航唯一标识"`
+	Name      string      `description:"导航名称"`
+	NameEn    string      `description:"导航名称(英文)"`
+	Child     []*RoleMenu `gorm:"-"`
 	CheckList []int
 }