excel_info.go 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511
  1. package models
  2. import (
  3. "eta_gn/eta_chart_lib/global"
  4. "eta_gn/eta_chart_lib/utils"
  5. "fmt"
  6. "time"
  7. )
  8. // ExcelInfo excel表格详情表
  9. // type ExcelInfo struct {
  10. // ExcelInfoId int `orm:"column(excel_info_id);pk"`
  11. // Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  12. // ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  13. // ExcelName string `description:"表格名称"`
  14. // UniqueCode string `description:"表格唯一编码"`
  15. // ExcelClassifyId int `description:"表格分类id"`
  16. // SysUserId int `description:"操作人id"`
  17. // SysUserRealName string `description:"操作人真实姓名"`
  18. // Content string `description:"表格内容"`
  19. // ExcelImage string `description:"表格图片"`
  20. // FileUrl string `description:"表格下载地址"`
  21. // Sort int `description:"排序字段,数字越小越排前面"`
  22. // IsDelete int `description:"是否删除,0:未删除,1:已删除"`
  23. // ModifyTime time.Time `description:"最近修改日期"`
  24. // CreateTime time.Time `description:"创建日期"`
  25. // }
  26. // ExcelInfo excel表格详情表
  27. type ExcelInfo struct {
  28. ExcelInfoId int `gorm:"column:excel_info_id;primaryKey" description:"表格ID"`
  29. Source int `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  30. ExcelType int `gorm:"column:excel_type" description:"表格类型,1:指标列,2:日期列,默认:1"`
  31. ExcelName string `gorm:"column:excel_name" description:"表格名称"`
  32. UniqueCode string `gorm:"column:unique_code" description:"表格唯一编码"`
  33. ExcelClassifyId int `gorm:"column:excel_classify_id" description:"表格分类id"`
  34. SysUserId int `gorm:"column:sys_user_id" description:"操作人id"`
  35. SysUserRealName string `gorm:"column:sys_user_real_name" description:"操作人真实姓名"`
  36. Content string `gorm:"column:content" description:"表格内容"`
  37. ExcelImage string `gorm:"column:excel_image" description:"表格图片"`
  38. FileUrl string `gorm:"column:file_url" description:"表格下载地址"`
  39. Sort int `gorm:"column:sort" description:"排序字段,数字越小越排前面"`
  40. IsDelete int `gorm:"column:is_delete" description:"是否删除,0:未删除,1:已删除"`
  41. ModifyTime time.Time `gorm:"column:modify_time" description:"最近修改日期"`
  42. CreateTime time.Time `gorm:"column:create_time" description:"创建日期"`
  43. }
  44. func (e *ExcelInfo) TableName() string {
  45. return "excel_info"
  46. }
  47. // Update 更新 excel表格基础信息
  48. func (excelInfo *ExcelInfo) Update(cols []string) (err error) {
  49. o := global.DmSQL["data"]
  50. err = o.Model(excelInfo).Select(cols).Updates(excelInfo).Error
  51. return
  52. }
  53. // Update 更新 excel表格基础信息
  54. // func (excelInfo *ExcelInfo) Update(cols []string) (err error) {
  55. // o := orm.NewOrmUsingDB("data")
  56. // _, err = o.Update(excelInfo, cols...)
  57. // return
  58. // }
  59. // type MyExcelInfoList struct {
  60. // ExcelInfoId int `orm:"column(excel_info_id);pk"`
  61. // ExcelName string `description:"表格名称"`
  62. // UniqueCode string `description:"表格唯一编码"`
  63. // ExcelClassifyId int `description:"表格分类id"`
  64. // SysUserId int `description:"操作人id"`
  65. // SysUserRealName string `description:"操作人真实姓名"`
  66. // ExcelImage string `description:"表格图片"`
  67. // FileUrl string `description:"表格下载地址"`
  68. // Sort int `description:"排序字段,数字越小越排前面"`
  69. // ModifyTime time.Time `description:"最近修改日期"`
  70. // CreateTime time.Time `description:"创建日期"`
  71. // }
  72. type MyExcelInfoList struct {
  73. ExcelInfoId int `gorm:"column:excel_info_id;primaryKey" description:"表格ID" orm:"column(excel_info_id);pk"`
  74. ExcelName string `gorm:"column:excel_name" description:"表格名称"`
  75. UniqueCode string `gorm:"column:unique_code" description:"表格唯一编码"`
  76. ExcelClassifyId int `gorm:"column:excel_classify_id" description:"表格分类id"`
  77. SysUserId int `gorm:"column:sys_user_id" description:"操作人id"`
  78. SysUserRealName string `gorm:"column:sys_user_real_name" description:"操作人真实姓名"`
  79. ExcelImage string `gorm:"column:excel_image" description:"表格图片"`
  80. FileUrl string `gorm:"column:file_url" description:"表格下载地址"`
  81. Sort int `gorm:"column:sort" description:"排序字段,数字越小越排前面"`
  82. ModifyTime time.Time `gorm:"column:modify_time" description:"最近修改日期"`
  83. CreateTime time.Time `gorm:"column:create_time" description:"创建日期"`
  84. }
  85. // AddExcelInfo 新增表格
  86. func AddExcelInfo(excelInfo *ExcelInfo) (err error) {
  87. o := global.DmSQL["data"]
  88. // 表格信息入库
  89. err = o.Create(excelInfo).Error
  90. return
  91. }
  92. // EditExcelInfo 编辑表格
  93. func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string) (err error) {
  94. o := global.DmSQL["data"]
  95. // ETA表格信息变更
  96. err = o.Model(excelInfo).Select(updateExcelInfoParams).Updates(excelInfo).Error
  97. return
  98. }
  99. // GetExcelInfoById 根据id 获取eta表格详情
  100. func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
  101. o := global.DmSQL["data"]
  102. sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
  103. err = o.Raw(sql, excelInfoId).First(&item).Error
  104. return
  105. }
  106. func GetExcelInfoViewById(excelInfoId int) (item *ExcelInfoView, err error) {
  107. o := global.DmSQL["data"]
  108. sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
  109. err = o.Raw(sql, excelInfoId).First(&item).Error
  110. return
  111. }
  112. func GetExcelInfoCountByCondition(condition string, pars []interface{}) (count int, err error) {
  113. o := global.DmSQL["data"]
  114. sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
  115. if condition != "" {
  116. sql += condition
  117. }
  118. err = o.Raw(sql, pars...).Scan(&count).Error
  119. return
  120. }
  121. func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelInfo, err error) {
  122. o := global.DmSQL["data"]
  123. sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
  124. if condition != "" {
  125. sql += condition
  126. }
  127. err = o.Raw(sql, pars...).First(&item).Error
  128. return
  129. }
  130. // GetNextExcelInfo 根据分类id获取下一个excel表格
  131. func GetNextExcelInfo(classifyId int) (item *ExcelInfo, err error) {
  132. o := global.DmSQL["data"]
  133. sql := ` SELECT b.* FROM excel_classify AS a
  134. INNER JOIN excel_info AS b ON a.excel_classify_id=b.excel_classify_id
  135. WHERE a.excel_classify_id>? AND is_delete=0
  136. ORDER BY a.excel_classify_id ASC
  137. LIMIT 1 `
  138. err = o.Raw(sql, classifyId).First(&item).Error
  139. return
  140. }
  141. // EditExcelInfoImage 修改excel表格的图片
  142. func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
  143. o := global.DmSQL["data"]
  144. sql := ` UPDATE excel_info SET excel_image=?, modify_time = NOW() WHERE excel_info_id = ? AND is_delete=0 `
  145. err = o.Exec(sql, imageUrl, excelInfoId).Error
  146. if err != nil {
  147. fmt.Println("EditExcelInfoImage Err:", err.Error())
  148. return err
  149. }
  150. return
  151. }
  152. // GetExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
  153. func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfoView, err error) {
  154. o := global.DmSQL["data"]
  155. sql := ` SELECT * FROM excel_info WHERE unique_code=? AND is_delete=0 `
  156. err = o.Raw(sql, uniqueCode).First(&item).Error
  157. return
  158. }
  159. // GetFirstExcelInfoByClassifyId 获取当前分类下,且排序数相同 的排序第一条的数据
  160. func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error) {
  161. o := global.DmSQL["data"]
  162. sql := ` SELECT * FROM excel_info WHERE excel_classify_id=? AND is_delete=0 order by sort asc,excel_info_id asc limit 1`
  163. err = o.Raw(sql, classifyId).First(&item).Error
  164. return
  165. }
  166. // UpdateExcelInfoSortByClassifyId 根据表格id更新排序
  167. func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string) (err error) {
  168. o := global.DmSQL["data"]
  169. sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? and sort > ? AND is_delete=0 `
  170. if prevExcelInfoId > 0 {
  171. sql += ` or (excel_info_id > ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
  172. }
  173. err = o.Exec(sql, classifyId, nowSort).Error
  174. return
  175. }
  176. // AddExcelInfo 新增表格
  177. // func AddExcelInfo(excelInfo *ExcelInfo) (err error) {
  178. // o := orm.NewOrmUsingDB("data")
  179. // // 表格信息入库
  180. // lastId, err := o.Insert(excelInfo)
  181. // if err != nil {
  182. // return
  183. // }
  184. // excelInfo.ExcelInfoId = int(lastId)
  185. // return
  186. // }
  187. // // EditExcelInfo 编辑表格
  188. // func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string) (err error) {
  189. // o := orm.NewOrmUsingDB("data")
  190. // // ETA表格信息变更
  191. // _, err = o.Update(excelInfo, updateExcelInfoParams...)
  192. // return
  193. // }
  194. // // GetExcelInfoById 根据id 获取eta表格详情
  195. // func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
  196. // o := orm.NewOrmUsingDB("data")
  197. // sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
  198. // err = o.Raw(sql, excelInfoId).QueryRow(&item)
  199. // return
  200. // }
  201. // func GetExcelInfoViewById(excelInfoId int) (item *ExcelInfoView, err error) {
  202. // o := orm.NewOrmUsingDB("data")
  203. // sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
  204. // err = o.Raw(sql, excelInfoId).QueryRow(&item)
  205. // return
  206. // }
  207. // func GetExcelInfoCountByCondition(condition string, pars []interface{}) (count int, err error) {
  208. // o := orm.NewOrmUsingDB("data")
  209. // sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
  210. // if condition != "" {
  211. // sql += condition
  212. // }
  213. // err = o.Raw(sql, pars).QueryRow(&count)
  214. // return
  215. // }
  216. // func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelInfo, err error) {
  217. // o := orm.NewOrmUsingDB("data")
  218. // sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
  219. // if condition != "" {
  220. // sql += condition
  221. // }
  222. // err = o.Raw(sql, pars).QueryRow(&item)
  223. // return
  224. // }
  225. // // GetNextExcelInfo 根据分类id获取下一个excel表格
  226. // func GetNextExcelInfo(classifyId int) (item *ExcelInfo, err error) {
  227. // o := orm.NewOrmUsingDB("data")
  228. // sql := ` SELECT b.* FROM excel_classify AS a
  229. // INNER JOIN excel_info AS b ON a.excel_classify_id=b.excel_classify_id
  230. // WHERE a.excel_classify_id>? AND is_delete=0
  231. // ORDER BY a.excel_classify_id ASC
  232. // LIMIT 1 `
  233. // err = o.Raw(sql, classifyId).QueryRow(&item)
  234. // return
  235. // }
  236. // // EditExcelInfoImage 修改excel表格的图片
  237. // func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
  238. // o := orm.NewOrmUsingDB("data")
  239. // sql := ` UPDATE excel_info SET excel_image=?, modify_time = NOW() WHERE excel_info_id = ? AND is_delete=0 `
  240. // _, err = o.Raw(sql, imageUrl, excelInfoId).Exec()
  241. // if err != nil {
  242. // fmt.Println("EditExcelInfoImage Err:", err.Error())
  243. // return err
  244. // }
  245. // return
  246. // }
  247. // // GetExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
  248. // func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfoView, err error) {
  249. // o := orm.NewOrmUsingDB("data")
  250. // sql := ` SELECT * FROM excel_info WHERE unique_code=? AND is_delete=0 `
  251. // err = o.Raw(sql, uniqueCode).QueryRow(&item)
  252. // return
  253. // }
  254. // // GetFirstExcelInfoByClassifyId 获取当前分类下,且排序数相同 的排序第一条的数据
  255. // func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error) {
  256. // o := orm.NewOrmUsingDB("data")
  257. // sql := ` SELECT * FROM excel_info WHERE excel_classify_id=? AND is_delete=0 order by sort asc,excel_info_id asc limit 1`
  258. // err = o.Raw(sql, classifyId).QueryRow(&item)
  259. // return
  260. // }
  261. // // UpdateExcelInfoSortByClassifyId 根据表格id更新排序
  262. // func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string) (err error) {
  263. // o := orm.NewOrmUsingDB("data")
  264. // sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? and sort > ? AND is_delete=0 `
  265. // if prevExcelInfoId > 0 {
  266. // sql += ` or (excel_info_id > ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
  267. // }
  268. // _, err = o.Raw(sql, classifyId, nowSort).Exec()
  269. // return
  270. // }
  271. // type ExcelInfoView struct {
  272. // ExcelInfoId int `orm:"column(excel_info_id);pk"`
  273. // Source int `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  274. // ExcelType int `description:"表格类型,1:指标列,2:日期列,默认:1"`
  275. // ExcelName string `description:"表格名称"`
  276. // UniqueCode string `description:"表格唯一编码"`
  277. // ExcelClassifyId int `description:"表格分类id"`
  278. // SysUserId int `description:"操作人id"`
  279. // SysUserRealName string `description:"操作人真实姓名"`
  280. // Content string `description:"表格内容"`
  281. // ExcelImage string `description:"表格图片"`
  282. // FileUrl string `description:"表格下载地址"`
  283. // Sort int `description:"排序字段,数字越小越排前面"`
  284. // IsDelete int `description:"是否删除,0:未删除,1:已删除" json:"-"`
  285. // ModifyTime time.Time `description:"最近修改日期"`
  286. // CreateTime time.Time `description:"创建日期"`
  287. // SourcesFrom string `description:"图表来源"`
  288. // }
  289. type ExcelInfoView struct {
  290. ExcelInfoId int `gorm:"column:excel_info_id;primaryKey" description:"表格ID" orm:"column(excel_info_id);pk"`
  291. Source int `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
  292. ExcelType int `gorm:"column:excel_type" description:"表格类型,1:指标列,2:日期列,默认:1"`
  293. ExcelName string `gorm:"column:excel_name" description:"表格名称"`
  294. UniqueCode string `gorm:"column:unique_code" description:"表格唯一编码"`
  295. ExcelClassifyId int `gorm:"column:excel_classify_id" description:"表格分类id"`
  296. SysUserId int `gorm:"column:sys_user_id" description:"操作人id"`
  297. SysUserRealName string `gorm:"column:sys_user_real_name" description:"操作人真实姓名"`
  298. Content string `gorm:"column:content" description:"表格内容"`
  299. ExcelImage string `gorm:"column:excel_image" description:"表格图片"`
  300. FileUrl string `gorm:"column:file_url" description:"表格下载地址"`
  301. Sort int `gorm:"column:sort" description:"排序字段,数字越小越排前面"`
  302. IsDelete int `gorm:"column:is_delete" description:"是否删除,0:未删除,1:已删除" json:"-"`
  303. ModifyTime time.Time `gorm:"column:modify_time" description:"最近修改日期"`
  304. CreateTime time.Time `gorm:"column:create_time" description:"创建日期"`
  305. SourcesFrom string `gorm:"column:sources_from" description:"图表来源"`
  306. }
  307. // GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息
  308. func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *ExcelInfo, err error) {
  309. o := global.DmSQL["data"]
  310. sql := ` SELECT * FROM excel_info WHERE excel_classify_id = ? and excel_name=? AND is_delete=0 `
  311. err = o.Raw(sql, classifyId, excelName).First(&item).Error
  312. return
  313. }
  314. // GetExcelInfoListByUniqueCodeSlice 根据表格编码获取表格列表数据
  315. func GetExcelInfoListByUniqueCodeSlice(uniqueCodeSlice []string) (total int64, items []*ExcelInfo, err error) {
  316. num := len(uniqueCodeSlice)
  317. if num <= 0 {
  318. return
  319. }
  320. o := global.DmSQL["data"]
  321. sql := ` SELECT * FROM excel_info WHERE unique_code in ("` + utils.GetGormInReplace(num) + `") AND is_delete=0 `
  322. err = o.Raw(sql, uniqueCodeSlice).Scan(&items).Error
  323. total = int64(len(items))
  324. return
  325. }
  326. // GetExcelListByCondition 获取excel表格列表数据
  327. func GetExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
  328. o := global.DmSQL["data"]
  329. sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
  330. if condition != "" {
  331. sql += condition
  332. }
  333. //sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
  334. sql += " ORDER BY create_time DESC LIMIT ?,? "
  335. pars = append(pars, startSize, pageSize)
  336. err = o.Raw(sql, pars...).Scan(&item).Error
  337. return
  338. }
  339. // GetNoContentExcelListByCondition 获取没有content的excel表格列表数据
  340. func GetNoContentExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
  341. o := global.DmSQL["data"]
  342. sql := ` SELECT excel_info_id,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time
  343. FROM excel_info WHERE 1=1 AND is_delete=0 `
  344. if condition != "" {
  345. sql += condition
  346. }
  347. //sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
  348. sql += " ORDER BY create_time DESC LIMIT ?,? "
  349. pars = append(pars, startSize, pageSize)
  350. err = o.Raw(sql, pars...).Scan(&item).Error
  351. return
  352. }
  353. func GetExcelListCountByCondition(condition string, pars []interface{}) (count int, err error) {
  354. o := global.DmSQL["data"]
  355. sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
  356. if condition != "" {
  357. sql += condition
  358. }
  359. err = o.Raw(sql, pars...).Scan(&count).Error
  360. return
  361. }
  362. // GetExcelViewInfoByExcelInfoId 根据excelInfoId 获取ETA表格详情
  363. func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err error) {
  364. o := global.DmSQL["data"]
  365. sql := ` SELECT * FROM excel_info WHERE excel_info_id = ? AND is_delete=0 `
  366. err = o.Raw(sql, excelInfoId).First(&item).Error
  367. return
  368. }
  369. // GetExcelInfoCountByClassifyId 根据分类id获取名下表格数量
  370. func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
  371. o := global.DmSQL["data"]
  372. sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
  373. err = o.Raw(sql, classifyId).Scan(&total).Error
  374. return
  375. }
  376. func GetExcelInfoListByCondition(condition string, pars []interface{}) (items []*ExcelInfo, err error) {
  377. o := global.DmSQL["data"]
  378. sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
  379. if condition != "" {
  380. sql += condition
  381. }
  382. sql += ` ORDER BY sort asc, excel_info_id asc`
  383. err = o.Raw(sql, pars...).Scan(&items).Error
  384. return
  385. }
  386. // GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息
  387. // func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *ExcelInfo, err error) {
  388. // o := orm.NewOrmUsingDB("data")
  389. // sql := ` SELECT * FROM excel_info WHERE excel_classify_id = ? and excel_name=? AND is_delete=0 `
  390. // err = o.Raw(sql, classifyId, excelName).QueryRow(&item)
  391. // return
  392. // }
  393. // // GetExcelInfoListByUniqueCodeSlice 根据表格编码获取表格列表数据
  394. // func GetExcelInfoListByUniqueCodeSlice(uniqueCodeSlice []string) (total int64, items []*ExcelInfo, err error) {
  395. // num := len(uniqueCodeSlice)
  396. // if num <= 0 {
  397. // return
  398. // }
  399. // o := orm.NewOrmUsingDB("data")
  400. // sql := ` SELECT * FROM excel_info WHERE unique_code in ("` + utils.GetOrmInReplace(num) + `") AND is_delete=0 `
  401. // total, err = o.Raw(sql, uniqueCodeSlice).QueryRows(&items)
  402. // return
  403. // }
  404. // // GetExcelListByCondition 获取excel表格列表数据
  405. // func GetExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
  406. // o := orm.NewOrmUsingDB("data")
  407. // sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
  408. // if condition != "" {
  409. // sql += condition
  410. // }
  411. // //sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
  412. // sql += " ORDER BY create_time DESC LIMIT ?,? "
  413. // _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
  414. // return
  415. // }
  416. // // GetNoContentExcelListByCondition 获取没有content的excel表格列表数据
  417. // func GetNoContentExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
  418. // o := orm.NewOrmUsingDB("data")
  419. // sql := ` SELECT excel_info_id,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time
  420. // FROM excel_info WHERE 1=1 AND is_delete=0 `
  421. // if condition != "" {
  422. // sql += condition
  423. // }
  424. // //sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
  425. // sql += " ORDER BY create_time DESC LIMIT ?,? "
  426. // _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
  427. // return
  428. // }
  429. // func GetExcelListCountByCondition(condition string, pars []interface{}) (count int, err error) {
  430. // o := orm.NewOrmUsingDB("data")
  431. // sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
  432. // if condition != "" {
  433. // sql += condition
  434. // }
  435. // err = o.Raw(sql, pars).QueryRow(&count)
  436. // return
  437. // }
  438. // // GetExcelViewInfoByExcelInfoId 根据excelInfoId 获取ETA表格详情
  439. // func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err error) {
  440. // o := orm.NewOrmUsingDB("data")
  441. // sql := ` SELECT * FROM excel_info WHERE excel_info_id = ? AND is_delete=0 `
  442. // err = o.Raw(sql, excelInfoId).QueryRow(&item)
  443. // return
  444. // }
  445. // // GetExcelInfoCountByClassifyId 根据分类id获取名下表格数量
  446. // func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
  447. // o := orm.NewOrmUsingDB("data")
  448. // sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
  449. // err = o.Raw(sql, classifyId).QueryRow(&total)
  450. // return
  451. // }
  452. // func GetExcelInfoListByCondition(condition string, pars []interface{}) (items []*ExcelInfo, err error) {
  453. // o := orm.NewOrmUsingDB("data")
  454. // sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
  455. // if condition != "" {
  456. // sql += condition
  457. // }
  458. // sql += ` ORDER BY sort asc, excel_info_id asc`
  459. // _, err = o.Raw(sql, pars).QueryRows(&items)
  460. // return
  461. // }