Browse Source

Merge branch 'sandbox' into debug

zwxi 1 year ago
parent
commit
3e8ab3e31b

+ 18 - 20
controllers/sandbox/sandbox.go

@@ -1005,25 +1005,23 @@ func (this *SandboxController) EditSandboxClassify() {
 		return
 	}
 
-	if item.SandboxClassifyName != req.SandboxClassifyName {
-		count, err := sandbox.GetSandboxClassifyCount(req.SandboxClassifyName, item.ParentId)
-		if err != nil {
-			br.Msg = "判断名称是否已存在失败"
-			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-			return
-		}
-		if count > 0 {
-			br.Msg = "分类名称已存在,请重新输入"
-			br.IsSendEmail = false
-			return
-		}
+	//count, err := sandbox.GetSandboxClassifyCount(req.SandboxClassifyName, item.ParentId)
+	//if err != nil {
+	//	br.Msg = "判断名称是否已存在失败"
+	//	br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
+	//	return
+	//}
+	//if count > 0 {
+	//	br.Msg = "分类名称已存在,请重新输入"
+	//	br.IsSendEmail = false
+	//	return
+	//}
 
-		err = sandbox.EditSandboxClassify(req.SandboxClassifyId, req.SandboxClassifyName)
-		if err != nil {
-			br.Msg = "保存失败"
-			br.ErrMsg = "保存失败,Err:" + err.Error()
-			return
-		}
+	err = sandbox.EditSandboxClassify(req.SandboxClassifyId, req.ChartPermissionId, req.SandboxClassifyName, req.ChartPermissionName)
+	if err != nil {
+		br.Msg = "保存失败"
+		br.ErrMsg = "保存失败,Err:" + err.Error()
+		return
 	}
 	br.Ret = 200
 	br.Msg = "保存成功"
@@ -1798,9 +1796,9 @@ func (this *SandboxController) SaveV2() {
 		//缩略图为空时不更新
 		var updateSandboxColumn = []string{}
 		if req.PicUrl == "" {
-			updateSandboxColumn = []string{"Content", "MindmapData", "ModifyTime", "SandboxClassifyId","Style"}
+			updateSandboxColumn = []string{"Content", "MindmapData", "ModifyTime", "SandboxClassifyId", "Style"}
 		} else {
-			updateSandboxColumn = []string{"Content", "MindmapData", "PicUrl", "ModifyTime", "SandboxClassifyId","Style"}
+			updateSandboxColumn = []string{"Content", "MindmapData", "PicUrl", "ModifyTime", "SandboxClassifyId", "Style"}
 		}
 		err = sandboxInfo.Update(updateSandboxColumn)
 		if err != nil {

+ 1 - 1
models/sandbox/request/sandbox.go

@@ -32,7 +32,7 @@ type AddAndEditSandboxV2 struct {
 	SandboxId         int    `description:"沙盘id"`
 	Name              string `description:"沙盘名称"`
 	Content           string `description:"沙盘内容"`
-	Style             string `description:"风格"`
+	Style             int    `description:"风格"`
 	MindmapData       string `description:"思维导图内容"`
 	PicUrl            string `description:"沙盘图片地址"`
 	SvgData           string `description:"沙盘svg图片数据"`

+ 1 - 1
models/sandbox/sandbox.go

@@ -42,7 +42,7 @@ type Sandbox struct {
 	CreateTime        time.Time `description:"创建时间"`
 	SandboxClassifyId int       `description:"分类id"`
 	Sort              int       `description:"排序"`
-	Style             string    `description:"风格"`
+	Style             int       `description:"风格"`
 }
 
 // Update 沙盘字段变更

+ 6 - 5
models/sandbox/sandbox_classify.go

@@ -88,6 +88,8 @@ func GetSandboxClassifyMaxSort(parentId int) (sort int, err error) {
 type EditSandboxClassifyReq struct {
 	SandboxClassifyName string `description:"分类名称"`
 	SandboxClassifyId   int    `description:"分类id"`
+	ChartPermissionId   int    `description:"品种id"`
+	ChartPermissionName string `description:"品种名称"`
 }
 
 func GetSandboxClassifyById(classifyId int) (item *SandboxClassify, err error) {
@@ -97,10 +99,10 @@ func GetSandboxClassifyById(classifyId int) (item *SandboxClassify, err error) {
 	return
 }
 
-func EditSandboxClassify(classifyId int, sandboxClassifyName string) (err error) {
+func EditSandboxClassify(classifyId ,ChartPermissionId int, sandboxClassifyName, ChartPermissionName string) (err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := `UPDATE sandbox_classify SET sandbox_classify_name=?,modify_time=NOW() WHERE sandbox_classify_id=? `
-	_, err = o.Raw(sql, sandboxClassifyName, classifyId).Exec()
+	sql := `UPDATE sandbox_classify SET sandbox_classify_name=?,chart_permission_id = ?, chart_permission_name = ?, modify_time=NOW() WHERE sandbox_classify_id=? `
+	_, err = o.Raw(sql, sandboxClassifyName, ChartPermissionId, ChartPermissionName, classifyId).Exec()
 	return
 }
 
@@ -239,9 +241,8 @@ type SandboxLinkCheckReq struct {
 	ReportIdList    []int `description:"报告id列表"`
 }
 
-
 type SandboxLinkCheckResp struct {
 	EdbInfoIdList   []int `description:"指标id列表"`
 	ChartInfoIdList []int `description:"图库id列表"`
 	ReportIdList    []int `description:"报告id列表"`
-}
+}