classify.go 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. package cross_variety
  2. import (
  3. "encoding/json"
  4. "eta_gn/eta_api/controllers"
  5. "eta_gn/eta_api/models"
  6. "eta_gn/eta_api/models/data_manage"
  7. "eta_gn/eta_api/services/data"
  8. "eta_gn/eta_api/utils"
  9. "time"
  10. )
  11. // ClassifyController
  12. // @Description: 跨品种分析分类
  13. type ClassifyController struct {
  14. controllers.BaseAuthController
  15. }
  16. // List
  17. // @Title 跨品种分析分类列表
  18. // @Description 跨品种分析分类列表接口
  19. // @Param Source query int true "图表类型,3:跨品种分析,4:滚动跨品种分析"
  20. // @Success 200 {object} data_manage.ChartClassifyListResp
  21. // @router /classify/list [get]
  22. func (c *ClassifyController) List() {
  23. br := new(models.BaseResponse).Init()
  24. defer func() {
  25. c.Data["json"] = br
  26. c.ServeJSON()
  27. }()
  28. resp := new(data_manage.ChartClassifyListResp)
  29. // 获取当前账号的不可见指标
  30. noPermissionChartIdMap := make(map[int]bool)
  31. {
  32. obj := data_manage.EdbInfoNoPermissionAdmin{}
  33. confList, err := obj.GetAllChartListByAdminId(c.SysUser.AdminId)
  34. if err != nil && !utils.IsErrNoRow(err) {
  35. br.Msg = "获取失败"
  36. br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
  37. return
  38. }
  39. for _, v := range confList {
  40. noPermissionChartIdMap[v.ChartInfoId] = true
  41. }
  42. }
  43. source, _ := c.GetInt("Source")
  44. if source <= 0 {
  45. source = utils.CHART_SOURCE_CROSS_HEDGING
  46. }
  47. rootList, err := data_manage.GetChartClassifyByParentId(0, utils.CHART_SOURCE_CROSS_HEDGING, c.SysUser.AdminId)
  48. if err != nil && !utils.IsErrNoRow(err) {
  49. br.Msg = "获取失败"
  50. br.ErrMsg = "获取数据失败,Err:" + err.Error()
  51. return
  52. }
  53. allChartInfo, err := data_manage.GetChartInfoAll([]int{source}, c.SysUser.AdminId)
  54. if err != nil && !utils.IsErrNoRow(err) {
  55. br.Msg = "获取失败"
  56. br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
  57. return
  58. }
  59. chartInfoMap := make(map[int][]*data_manage.ChartClassifyItems)
  60. for _, v := range allChartInfo {
  61. if v.SysUserId != c.SysUser.AdminId {
  62. continue
  63. }
  64. chartInfoMap[v.ChartClassifyId] = append(chartInfoMap[v.ChartClassifyId], v)
  65. }
  66. rootChildMap := make(map[int][]*data_manage.ChartClassifyItems)
  67. // 移除没有图表的分类
  68. allNodes := make([]*data_manage.ChartClassifyItems, 0)
  69. for _, v := range rootList {
  70. if v.SysUserId == c.SysUser.AdminId || c.SysUser.RoleTypeCode == utils.ROLE_TYPE_CODE_ADMIN {
  71. v.Button.OpButton = true
  72. }
  73. rootChildMap[v.ParentId] = append(rootChildMap[v.ParentId], v)
  74. if existItems, ok := chartInfoMap[v.ChartClassifyId]; ok {
  75. v.Children = existItems
  76. allNodes = append(allNodes, v)
  77. }
  78. }
  79. // 移除没有权限的图表
  80. allNodes = data.HandleNoPermissionChart(allNodes, noPermissionChartIdMap, c.SysUser.AdminId)
  81. resp.AllNodes = allNodes
  82. br.Ret = 200
  83. br.Success = true
  84. br.Msg = "获取成功"
  85. br.Data = resp
  86. }
  87. // EditChartClassify
  88. // @Title 修改跨品种分析图表分类
  89. // @Description 修改跨品种分析图表分类接口
  90. // @Param request body data_manage.EditChartClassifyReq true "type json string"
  91. // @Success 200 Ret=200 修改成功
  92. // @router /classify/edit [post]
  93. func (c *ClassifyController) EditChartClassify() {
  94. br := new(models.BaseResponse).Init()
  95. defer func() {
  96. c.Data["json"] = br
  97. c.ServeJSON()
  98. }()
  99. var req data_manage.EditChartClassifyReq
  100. err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
  101. if err != nil {
  102. br.Msg = "参数解析异常!"
  103. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  104. return
  105. }
  106. if req.ChartClassifyName == "" {
  107. br.Msg = "请输入分类名称"
  108. br.IsSendEmail = false
  109. return
  110. }
  111. if req.ChartClassifyId <= 0 {
  112. br.Msg = "参数错误"
  113. br.IsSendEmail = false
  114. return
  115. }
  116. // 编辑图表分类
  117. _, err, errMsg, isSendEmail := data.EditChartClassify(req.ChartClassifyId, utils.CHART_SOURCE_CROSS_HEDGING, req.ChartClassifyName, c.Lang, c.SysUser)
  118. if err != nil {
  119. br.Msg = errMsg
  120. br.ErrMsg = "保存分类失败,Err:" + err.Error()
  121. br.IsSendEmail = isSendEmail
  122. return
  123. }
  124. br.Ret = 200
  125. br.Msg = "修改成功"
  126. br.Success = true
  127. br.IsAddLog = true
  128. }
  129. // DeleteChartClassifyCheck
  130. // @Title 删除图表检测接口
  131. // @Description 删除图表检测接口
  132. // @Param request body data_manage.ChartClassifyDeleteCheckResp true "type json string"
  133. // @Success 200 Ret=200 检测成功
  134. // @router /classify/delete/check [post]
  135. func (c *ClassifyController) DeleteChartClassifyCheck() {
  136. br := new(models.BaseResponse).Init()
  137. defer func() {
  138. c.Data["json"] = br
  139. c.ServeJSON()
  140. }()
  141. var req data_manage.ChartClassifyDeleteCheckReq
  142. err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
  143. if err != nil {
  144. br.Msg = "参数解析异常!"
  145. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  146. return
  147. }
  148. if req.ChartClassifyId < 0 && req.ChartInfoId <= 0 {
  149. br.Msg = "参数错误"
  150. br.IsSendEmail = false
  151. return
  152. }
  153. var deleteStatus int
  154. var tipsMsg string
  155. childIds := make([]int, 0)
  156. //删除分类
  157. if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
  158. //判断跨品种分析图表分类下,是否含有图表
  159. classifyAll, err := data_manage.GetChartClassifyAllBySource(utils.CHART_SOURCE_CROSS_HEDGING)
  160. if err != nil {
  161. br.Msg = "删除失败"
  162. br.ErrMsg = "获取分类数据失败,Err:" + err.Error()
  163. return
  164. }
  165. classifyAllMap := make(map[int]*data_manage.ChartClassifyItems)
  166. for _, v := range classifyAll {
  167. classifyAllMap[v.ChartClassifyId] = v
  168. }
  169. data.GetChartClassifyChildIds(req.ChartClassifyId, classifyAllMap, &childIds)
  170. condition := ``
  171. pars := make([]interface{}, 0)
  172. if len(childIds) > 0 {
  173. ids := utils.IntArr2joinString(childIds, ",")
  174. condition = ` AND chart_classify_id IN (` + ids + `) `
  175. } else {
  176. condition = ` AND chart_classify_id = ? `
  177. pars = append(pars, req.ChartClassifyId)
  178. }
  179. count, err := data_manage.GetChartInfoCountByCondition(condition, pars)
  180. if err != nil {
  181. br.Msg = "判断图表名称是否存在失败"
  182. br.ErrMsg = "判断图表名称是否存在失败,Err:" + err.Error()
  183. return
  184. }
  185. //count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
  186. //if err != nil {
  187. // br.Msg = "删除失败"
  188. // br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
  189. // return
  190. //}
  191. if count > 0 {
  192. deleteStatus = 1
  193. tipsMsg = "该分类下关联图表不可删除"
  194. }
  195. }
  196. if deleteStatus != 1 && req.ChartInfoId == 0 {
  197. //classifyCount, err := data_manage.GetChartClassifyCountByClassifyId(req.ChartClassifyId)
  198. //if err != nil && !utils.IsErrNoRow(err) {
  199. // br.Msg = "删除失败"
  200. // br.ErrMsg = "分类下是否含有图表失败,Err:" + err.Error()
  201. // return
  202. //}
  203. if len(childIds) > 0 {
  204. deleteStatus = 2
  205. tipsMsg = "确认删除当前目录及包含的子目录吗"
  206. }
  207. }
  208. if deleteStatus == 0 {
  209. tipsMsg = "可删除,进行删除操作"
  210. }
  211. resp := new(data_manage.ChartClassifyDeleteCheckResp)
  212. resp.DeleteStatus = deleteStatus
  213. resp.TipsMsg = tipsMsg
  214. br.Ret = 200
  215. br.Msg = "检测成功"
  216. br.Success = true
  217. br.Data = resp
  218. }
  219. // DeleteChartClassify
  220. // @Title 删除跨品种分析图表分类/图表
  221. // @Description 删除跨品种分析图表分类/图表接口
  222. // @Param request body data_manage.DeleteChartClassifyReq true "type json string"
  223. // @Success 200 Ret=200 删除成功
  224. // @router /classify/delete [post]
  225. func (c *ClassifyController) DeleteChartClassify() {
  226. br := new(models.BaseResponse).Init()
  227. defer func() {
  228. c.Data["json"] = br
  229. c.ServeJSON()
  230. }()
  231. sysUser := c.SysUser
  232. if sysUser == nil {
  233. br.Msg = "请登录"
  234. br.ErrMsg = "请登录,SysUser Is Empty"
  235. br.Ret = 408
  236. return
  237. }
  238. var req data_manage.DeleteChartClassifyReq
  239. err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
  240. if err != nil {
  241. br.Msg = "参数解析异常!"
  242. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  243. return
  244. }
  245. if req.ChartClassifyId < 0 && req.ChartInfoId <= 0 {
  246. br.Msg = "参数错误"
  247. br.IsSendEmail = false
  248. return
  249. }
  250. //删除分类
  251. if req.ChartClassifyId > 0 && req.ChartInfoId == 0 {
  252. //判断是否含有指标
  253. childIds := make([]int, 0)
  254. classifyAll, err := data_manage.GetChartClassifyAllBySource(utils.CHART_SOURCE_CROSS_HEDGING)
  255. if err != nil {
  256. br.Msg = "删除失败"
  257. br.ErrMsg = "获取分类数据失败,Err:" + err.Error()
  258. return
  259. }
  260. classifyAllMap := make(map[int]*data_manage.ChartClassifyItems)
  261. for _, v := range classifyAll {
  262. classifyAllMap[v.ChartClassifyId] = v
  263. }
  264. data.GetChartClassifyChildIds(req.ChartClassifyId, classifyAllMap, &childIds)
  265. condition := ``
  266. pars := make([]interface{}, 0)
  267. if len(childIds) > 0 {
  268. ids := utils.IntArr2joinString(childIds, ",")
  269. condition = ` AND chart_classify_id IN (` + ids + `) `
  270. } else {
  271. condition = ` AND chart_classify_id = ? `
  272. pars = append(pars, req.ChartClassifyId)
  273. }
  274. count, err := data_manage.GetChartInfoCountByCondition(condition, pars)
  275. if err != nil {
  276. br.Msg = "判断图表名称是否存在失败"
  277. br.ErrMsg = "判断图表名称是否存在失败,Err:" + err.Error()
  278. return
  279. }
  280. //count, err := data_manage.GetChartInfoCountByClassifyId(req.ChartClassifyId)
  281. //if err != nil && !utils.IsErrNoRow(err) {
  282. // br.Msg = "删除失败"
  283. // br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
  284. // return
  285. //}
  286. if count > 0 {
  287. br.Msg = "该目录下存在关联指标,不可删除"
  288. br.IsSendEmail = false
  289. return
  290. }
  291. delIds := append(childIds, req.ChartClassifyId)
  292. err = data_manage.DeleteChartClassifyByIds(delIds)
  293. //err = data_manage.DeleteChartClassify(req.ChartClassifyId)
  294. if err != nil {
  295. br.Msg = "删除失败"
  296. br.ErrMsg = "删除失败,Err:" + err.Error()
  297. return
  298. }
  299. }
  300. resp := new(data_manage.AddChartInfoResp)
  301. //删除图表
  302. if req.ChartInfoId > 0 {
  303. chartInfo, err := data_manage.GetChartInfoById(req.ChartInfoId)
  304. if err != nil {
  305. if utils.IsErrNoRow(err) {
  306. br.Msg = "图表已删除,请刷新页面"
  307. br.ErrMsg = "指标不存在,Err:" + err.Error()
  308. return
  309. } else {
  310. br.Msg = "删除失败"
  311. br.ErrMsg = "删除失败,获取指标信息失败,Err:" + err.Error()
  312. return
  313. }
  314. }
  315. if chartInfo == nil {
  316. br.Msg = "图表已删除,请刷新页面"
  317. return
  318. }
  319. //图表操作权限
  320. ok := data.CheckOpChartPermission(sysUser, chartInfo.SysUserId, true)
  321. if !ok {
  322. br.Msg = "没有该图表的操作权限"
  323. br.ErrMsg = "没有该图表的操作权限"
  324. return
  325. }
  326. // 获取引用该图表的MyCharts, 用于ES删除
  327. var myCond string
  328. var myPars []interface{}
  329. myCond += ` AND a.chart_info_id = ? `
  330. myPars = append(myPars, chartInfo.ChartInfoId)
  331. myCharts, e := data_manage.GetMyChartListGroupByCharyInfoIdAndAdminIdByCondition(myCond, myPars)
  332. if e != nil {
  333. br.Msg = "删除失败"
  334. br.ErrMsg = "获取引用图表的MyChats失败, Err: " + e.Error()
  335. return
  336. }
  337. myIds := make([]int, 0)
  338. for _, m := range myCharts {
  339. myIds = append(myIds, m.MyChartId)
  340. }
  341. source := chartInfo.Source // 跨品种分析图表(滚动跨品种分析)
  342. //删除图表及关联指标
  343. err = data_manage.DeleteChartInfoAndData(chartInfo.ChartInfoId)
  344. if err != nil {
  345. br.Msg = "删除失败"
  346. br.ErrMsg = "删除失败,Err:" + err.Error()
  347. return
  348. }
  349. //删除ES
  350. {
  351. go data.DeleteChartInfoToEs(chartInfo.ChartInfoId)
  352. // 删除MY ETA 图表 es数据
  353. //go data.EsDeleteMyChartInfoByChartInfoId(chartInfo.ChartInfoId)
  354. go data.EsDeleteMyChartInfoByMyChartIds(myIds)
  355. }
  356. var condition string
  357. var pars []interface{}
  358. condition += " AND chart_classify_id=? AND source = ? "
  359. pars = append(pars, chartInfo.ChartClassifyId, source)
  360. condition += " AND chart_info_id>? ORDER BY create_time ASC LIMIT 1 "
  361. pars = append(pars, req.ChartInfoId)
  362. nextItem, err := data_manage.GetChartInfoByCondition(condition, pars)
  363. if err != nil && !utils.IsErrNoRow(err) {
  364. br.Msg = "删除失败"
  365. br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
  366. return
  367. }
  368. if nextItem != nil {
  369. resp.UniqueCode = nextItem.UniqueCode
  370. resp.ChartInfoId = nextItem.ChartInfoId
  371. } else {
  372. var condition string
  373. var pars []interface{}
  374. condition += " AND level=1 "
  375. //pars = append(pars, chartInfo.ChartClassifyId)
  376. condition += " AND chart_classify_id>? ORDER BY chart_classify_id ASC LIMIT 1 "
  377. pars = append(pars, chartInfo.ChartClassifyId)
  378. classifyItem, err := data_manage.GetChartClassifyByCondition(condition, pars)
  379. if err != nil && !utils.IsErrNoRow(err) {
  380. br.Msg = "删除失败"
  381. br.ErrMsg = "获取下一级图库分类信息失败,Err:" + err.Error()
  382. return
  383. }
  384. if classifyItem != nil {
  385. nextItem, err = data_manage.GetNextChartInfo(chartInfo.ChartClassifyId)
  386. if err != nil && !utils.IsErrNoRow(err) {
  387. br.Msg = "删除失败"
  388. br.ErrMsg = "获取下一级图库信息失败,Err:" + err.Error()
  389. return
  390. }
  391. if nextItem != nil {
  392. resp.UniqueCode = nextItem.UniqueCode
  393. resp.ChartInfoId = nextItem.ChartInfoId
  394. }
  395. }
  396. }
  397. //新增操作日志
  398. {
  399. chartLog := new(data_manage.ChartInfoLog)
  400. chartLog.ChartName = chartInfo.ChartName
  401. chartLog.ChartInfoId = req.ChartInfoId
  402. chartLog.ChartClassifyId = chartInfo.ChartClassifyId
  403. chartLog.SysUserId = sysUser.AdminId
  404. chartLog.SysUserRealName = sysUser.RealName
  405. chartLog.UniqueCode = chartInfo.UniqueCode
  406. chartLog.CreateTime = time.Now()
  407. chartLog.Content = string(c.Ctx.Input.RequestBody)
  408. chartLog.Status = "删除图表"
  409. chartLog.Method = c.Ctx.Input.URI()
  410. go data_manage.AddChartInfoLog(chartLog)
  411. }
  412. }
  413. br.Ret = 200
  414. br.Msg = "删除成功"
  415. br.Success = true
  416. br.Data = resp
  417. br.IsAddLog = true
  418. }
  419. // ChartClassifyMove
  420. // @Title 相关性图表分类移动接口
  421. // @Description 相关性图表分类移动接口
  422. // @Success 200 {object} data_manage.MoveChartClassifyReq
  423. // @router /classify/move [post]
  424. func (c *ClassifyController) ChartClassifyMove() {
  425. br := new(models.BaseResponse).Init()
  426. defer func() {
  427. c.Data["json"] = br
  428. c.ServeJSON()
  429. }()
  430. sysUser := c.SysUser
  431. if sysUser == nil {
  432. br.Msg = "请登录"
  433. br.ErrMsg = "请登录,SysUser Is Empty"
  434. br.Ret = 408
  435. return
  436. }
  437. var req data_manage.MoveChartClassifyReq
  438. err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
  439. if err != nil {
  440. br.Msg = "参数解析异常!"
  441. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  442. return
  443. }
  444. if req.ClassifyId <= 0 {
  445. br.Msg = "参数错误"
  446. br.ErrMsg = "分类id小于等于0"
  447. return
  448. }
  449. //判断分类是否存在
  450. chartClassifyInfo, err := data_manage.GetChartClassifyById(req.ClassifyId)
  451. if err != nil {
  452. br.Msg = "移动失败"
  453. br.ErrMsg = "获取分类信息失败,Err:" + err.Error()
  454. return
  455. }
  456. if chartClassifyInfo.Source != utils.CHART_SOURCE_CROSS_HEDGING {
  457. br.Msg = "分类异常"
  458. br.ErrMsg = "分类异常,不是跨品种分析图表的分类"
  459. return
  460. }
  461. updateCol := make([]string, 0)
  462. //如果有传入 上一个兄弟节点分类id
  463. if req.PrevClassifyId > 0 {
  464. //上一个兄弟节点
  465. prevClassify, err := data_manage.GetChartClassifyById(req.PrevClassifyId)
  466. if err != nil {
  467. br.Msg = "移动失败"
  468. br.ErrMsg = "获取上一个兄弟节点分类信息失败,Err:" + err.Error()
  469. return
  470. }
  471. if prevClassify.Source != utils.CHART_SOURCE_CROSS_HEDGING {
  472. br.Msg = "上级节点分类异常"
  473. br.ErrMsg = "上级节点分类异常,不是跨品种分析图表的分类"
  474. return
  475. }
  476. //如果是移动在两个兄弟节点之间
  477. if req.NextClassifyId > 0 {
  478. //下一个兄弟节点
  479. nextClassify, err := data_manage.GetChartClassifyById(req.NextClassifyId)
  480. if err != nil {
  481. br.Msg = "移动失败"
  482. br.ErrMsg = "获取下一个兄弟节点分类信息失败,Err:" + err.Error()
  483. return
  484. }
  485. //如果上一个兄弟与下一个兄弟的排序权重是一致的,那么需要将下一个兄弟(以及下个兄弟的同样排序权重)的排序权重+2,自己变成上一个兄弟的排序权重+1
  486. if prevClassify.Sort == nextClassify.Sort || prevClassify.Sort == chartClassifyInfo.Sort {
  487. //变更兄弟节点的排序
  488. updateSortStr := `sort + 2`
  489. _ = data_manage.UpdateChartClassifySortByParentId(prevClassify.ParentId, prevClassify.ChartClassifyId, prevClassify.Sort, updateSortStr)
  490. } else {
  491. //如果下一个兄弟的排序权重正好是上个兄弟节点的下一层,那么需要再加一层了
  492. if nextClassify.Sort-prevClassify.Sort == 1 {
  493. //变更兄弟节点的排序
  494. updateSortStr := `sort + 1`
  495. _ = data_manage.UpdateChartClassifySortByParentId(prevClassify.ParentId, 0, prevClassify.Sort, updateSortStr)
  496. }
  497. }
  498. }
  499. chartClassifyInfo.Sort = prevClassify.Sort + 1
  500. chartClassifyInfo.ModifyTime = time.Now()
  501. updateCol = append(updateCol, "Sort", "ModifyTime")
  502. } else {
  503. firstClassify, err := data_manage.GetFirstChartClassifyByParentIdAndSource(chartClassifyInfo.ParentId, chartClassifyInfo.Source)
  504. if err != nil && !utils.IsErrNoRow(err) {
  505. br.Msg = "移动失败"
  506. br.ErrMsg = "获取跨品种分析图表分类排序第一条的分类信息失败,Err:" + err.Error()
  507. return
  508. }
  509. if firstClassify != nil && firstClassify.Source != utils.CHART_SOURCE_CROSS_HEDGING {
  510. br.Msg = "上级节点分类异常"
  511. br.ErrMsg = "上级节点分类异常,不是跨品种分析图表的分类"
  512. return
  513. }
  514. //如果该分类下存在其他分类,且第一个其他分类的排序等于0,那么需要调整排序
  515. if firstClassify != nil && firstClassify.ChartClassifyId > 0 && firstClassify.Sort == 0 {
  516. updateSortStr := ` sort + 1 `
  517. _ = data_manage.UpdateChartClassifySortByParentId(firstClassify.ParentId, firstClassify.ChartClassifyId-1, 0, updateSortStr)
  518. }
  519. chartClassifyInfo.Sort = 0 //那就是排在第一位
  520. chartClassifyInfo.ModifyTime = time.Now()
  521. updateCol = append(updateCol, "Sort", "ModifyTime")
  522. }
  523. //更新
  524. if len(updateCol) > 0 {
  525. err = chartClassifyInfo.Update(updateCol)
  526. if err != nil {
  527. br.Msg = "移动失败"
  528. br.ErrMsg = "修改失败,Err:" + err.Error()
  529. return
  530. }
  531. }
  532. br.Ret = 200
  533. br.Success = true
  534. br.Msg = "移动成功"
  535. }