ziwen 1 рік тому
батько
коміт
2abf905cd4

+ 110 - 110
controllers/sandbox/sandbox.go

@@ -32,115 +32,115 @@ type SandboxController struct {
 // @Param   Keyword   query   string  false       "搜索关键词:沙盘名称/编辑人名称"
 // @Success 200 {object} response.SandboxListResp
 // @router /list [get]
-func (this *SandboxController) List() {
-	br := new(models.BaseResponse).Init()
-	defer func() {
-		this.Data["json"] = br
-		this.ServeJSON()
-	}()
-
-	chartPermissionId, _ := this.GetInt("ChartPermissionId")
-	keyword := this.GetString("Keyword")
-
-	pageSize, _ := this.GetInt("PageSize")
-	currentIndex, _ := this.GetInt("CurrentIndex")
-
-	var startSize int
-	if pageSize <= 0 {
-		pageSize = utils.PageSize20
-	}
-	if currentIndex <= 0 {
-		currentIndex = 1
-	}
-	startSize = paging.StartIndex(currentIndex, pageSize)
-
-	var condition string
-	var pars []interface{}
-
-	if chartPermissionId > 0 {
-		condition += " AND a.chart_permission_id=? "
-		pars = append(pars, chartPermissionId)
-	}
-
-	if keyword != "" {
-		condition += ` AND  ( a.name LIKE '%` + keyword + `%'  OR  b.name LIKE '%` + keyword + `%' )`
-	}
-
-	//获取指标信息
-	total, list, err := sandbox.GetList(condition, pars, startSize, pageSize)
-	if err != nil && err.Error() != utils.ErrNoRow() {
-		br.Success = true
-		br.Msg = "获取沙盘列表失败"
-		br.ErrMsg = "获取沙盘列表失败,Err:" + err.Error()
-		return
-	}
-
-	if list == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
-		list = make([]*sandbox.SandboxListItem, 0)
-	}
-
-	if len(list) > 0 {
-		sandboxIdList := make([]int, 0)
-		for _, v := range list {
-			sandboxIdList = append(sandboxIdList, v.SandboxId)
-		}
-
-		sandboxVersionTotalList, err := sandbox.GetTotalSandboxVersionBySandboxIdList(sandboxIdList)
-		if err != nil {
-			br.Success = true
-			br.Msg = "获取沙盘版本数量失败"
-			br.ErrMsg = "获取沙盘版本数量失败,Err:" + err.Error()
-			return
-		}
-		sandboxVersionTotalMap := make(map[int]int)
-
-		for _, v := range sandboxVersionTotalList {
-			sandboxVersionTotalMap[v.SandboxId] = v.Total
-		}
-
-		for _, item := range list {
-			/*key := fmt.Sprint(`crm:sandbox:edit:`, item.SandboxId)
-			opUserId, _ := utils.Rc.RedisInt(key)
-			//如果当前没有人操作,获取当前操作人是本人,那么编辑按钮可用
-			if opUserId <= 0 || (opUserId == this.SysUser.AdminId) {
-				item.CanEdit = true
-			} else {
-				adminInfo, errAdmin := system.GetSysUserById(opUserId)
-				if errAdmin != nil {
-					br.Msg = "获取失败"
-					br.ErrMsg = "获取失败,Err:" + errAdmin.Error()
-					return
-				}
-				item.Editor = adminInfo.RealName
-			}*/
-			markStatus, err := sandboxService.UpdateSandboxEditMark(item.SandboxId, this.SysUser.AdminId, 2, this.SysUser.RealName)
-			if err != nil {
-				br.Msg = "查询标记状态失败"
-				br.ErrMsg = "查询标记状态失败,Err:" + err.Error()
-				return
-			}
-			if markStatus.Status == 0 {
-				item.CanEdit = true
-			} else {
-				item.Editor = markStatus.Editor
-			}
-
-			// 沙盘版本数量
-			versionTotal := sandboxVersionTotalMap[item.SandboxId]
-			item.VersionTotal = versionTotal
-		}
-	}
-
-	page := paging.GetPaging(currentIndex, pageSize, total)
-	resp := response.SandboxListResp{
-		Paging: page,
-		List:   list,
-	}
-	br.Ret = 200
-	br.Success = true
-	br.Msg = "获取成功"
-	br.Data = resp
-}
+//func (this *SandboxController) List() {
+//	br := new(models.BaseResponse).Init()
+//	defer func() {
+//		this.Data["json"] = br
+//		this.ServeJSON()
+//	}()
+//
+//	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+//	keyword := this.GetString("Keyword")
+//
+//	pageSize, _ := this.GetInt("PageSize")
+//	currentIndex, _ := this.GetInt("CurrentIndex")
+//
+//	var startSize int
+//	if pageSize <= 0 {
+//		pageSize = utils.PageSize20
+//	}
+//	if currentIndex <= 0 {
+//		currentIndex = 1
+//	}
+//	startSize = paging.StartIndex(currentIndex, pageSize)
+//
+//	var condition string
+//	var pars []interface{}
+//
+//	if chartPermissionId > 0 {
+//		condition += " AND a.chart_permission_id=? "
+//		pars = append(pars, chartPermissionId)
+//	}
+//
+//	if keyword != "" {
+//		condition += ` AND  ( a.name LIKE '%` + keyword + `%'  OR  b.name LIKE '%` + keyword + `%' )`
+//	}
+//
+//	//获取指标信息
+//	total, list, err := sandbox.GetList(condition, pars, startSize, pageSize)
+//	if err != nil && err.Error() != utils.ErrNoRow() {
+//		br.Success = true
+//		br.Msg = "获取沙盘列表失败"
+//		br.ErrMsg = "获取沙盘列表失败,Err:" + err.Error()
+//		return
+//	}
+//
+//	if list == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
+//		list = make([]*sandbox.SandboxListItem, 0)
+//	}
+//
+//	if len(list) > 0 {
+//		sandboxIdList := make([]int, 0)
+//		for _, v := range list {
+//			sandboxIdList = append(sandboxIdList, v.SandboxId)
+//		}
+//
+//		sandboxVersionTotalList, err := sandbox.GetTotalSandboxVersionBySandboxIdList(sandboxIdList)
+//		if err != nil {
+//			br.Success = true
+//			br.Msg = "获取沙盘版本数量失败"
+//			br.ErrMsg = "获取沙盘版本数量失败,Err:" + err.Error()
+//			return
+//		}
+//		sandboxVersionTotalMap := make(map[int]int)
+//
+//		for _, v := range sandboxVersionTotalList {
+//			sandboxVersionTotalMap[v.SandboxId] = v.Total
+//		}
+//
+//		for _, item := range list {
+//			/*key := fmt.Sprint(`crm:sandbox:edit:`, item.SandboxId)
+//			opUserId, _ := utils.Rc.RedisInt(key)
+//			//如果当前没有人操作,获取当前操作人是本人,那么编辑按钮可用
+//			if opUserId <= 0 || (opUserId == this.SysUser.AdminId) {
+//				item.CanEdit = true
+//			} else {
+//				adminInfo, errAdmin := system.GetSysUserById(opUserId)
+//				if errAdmin != nil {
+//					br.Msg = "获取失败"
+//					br.ErrMsg = "获取失败,Err:" + errAdmin.Error()
+//					return
+//				}
+//				item.Editor = adminInfo.RealName
+//			}*/
+//			markStatus, err := sandboxService.UpdateSandboxEditMark(item.SandboxId, this.SysUser.AdminId, 2, this.SysUser.RealName)
+//			if err != nil {
+//				br.Msg = "查询标记状态失败"
+//				br.ErrMsg = "查询标记状态失败,Err:" + err.Error()
+//				return
+//			}
+//			if markStatus.Status == 0 {
+//				item.CanEdit = true
+//			} else {
+//				item.Editor = markStatus.Editor
+//			}
+//
+//			// 沙盘版本数量
+//			versionTotal := sandboxVersionTotalMap[item.SandboxId]
+//			item.VersionTotal = versionTotal
+//		}
+//	}
+//
+//	page := paging.GetPaging(currentIndex, pageSize, total)
+//	resp := response.SandboxListResp{
+//		Paging: page,
+//		List:   list,
+//	}
+//	br.Ret = 200
+//	br.Success = true
+//	br.Msg = "获取成功"
+//	br.Data = resp
+//}
 
 // FirstVersionList
 // @Title 逻辑导图版本列表(列表页第一页)
@@ -800,7 +800,7 @@ func (this *SandboxController) ListByQuote() {
 	}
 
 	if list == nil || (err != nil && err.Error() == utils.ErrNoRow()) {
-		list = make([]*sandbox.SandboxListItem, 0)
+		list = make([]*sandbox.Sandbox, 0)
 	}
 
 	page := paging.GetPaging(currentIndex, pageSize, total)

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

@@ -8,7 +8,7 @@ import (
 // SandboxListResp 沙盘列表返回数据
 type SandboxListResp struct {
 	Paging *paging.PagingItem
-	List   []*sandbox.SandboxListItem
+	List   []*sandbox.Sandbox
 }
 
 // SandboxVersionListResp 沙盘版本列表返回数据

+ 2 - 2
models/sandbox/sandbox.go

@@ -195,9 +195,9 @@ type SandboxListItem struct {
 
 // GetList 获取沙盘列表页
 // todo 测试服兼容
-func GetList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*SandboxListItem, err error) {
+func GetList(condition string, pars []interface{}, startSize, pageSize int) (total int, list []*Sandbox, err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := "select a.sandbox_id,a.name,a.chart_permission_id,a.chart_permission_name,a.curr_version,a.code,a.pic_url,a.op_user_id,a.op_user_name,a.modify_time,a.create_time,b.version_code from sandbox_bak_20231018 as a join sandbox_version b on a.sandbox_id=b.sandbox_id and a.curr_version=b.curr_version where 1=1 AND a.is_delete = 0 "
+	sql := "select a.sandbox_id,a.name,a.chart_permission_id,a.chart_permission_name,a.curr_version,a.code,a.pic_url,a.op_user_id,a.op_user_name,a.modify_time,a.create_time,b.version_code from sandbox as a join sandbox_version b on a.sandbox_id=b.sandbox_id and a.curr_version=b.curr_version where 1=1 AND a.is_delete = 0 "
 	sql += condition
 	sql += ` order by a.modify_time desc,a.sandbox_id desc`
 

+ 0 - 9
routers/commentsRouter.go

@@ -4444,15 +4444,6 @@ func init() {
             Filters: nil,
             Params: nil})
 
-    beego.GlobalControllerRouter["eta/eta_api/controllers/sandbox:SandboxController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/sandbox:SandboxController"],
-        beego.ControllerComments{
-            Method: "List",
-            Router: `/list`,
-            AllowHTTPMethods: []string{"get"},
-            MethodParams: param.Make(),
-            Filters: nil,
-            Params: nil})
-
     beego.GlobalControllerRouter["eta/eta_api/controllers/sandbox:SandboxController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/sandbox:SandboxController"],
         beego.ControllerComments{
             Method: "ListV2",