12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package excel
- import (
- "eta/eta_chart_lib/global"
- "eta/eta_chart_lib/utils"
- "time"
- )
- type ExcelSheetData struct {
-
- ExcelDataId int `gorm:"column:excel_data_id;primaryKey"`
- ExcelInfoId int `description:"数据归属的excel_info的id"`
- ExcelSheetId int `description:"数据归属sheet"`
- Sort int `description:"数据排序"`
- Data string `description:"数据,分页存储"`
- ModifyTime time.Time `description:"最近修改日期"`
- CreateTime time.Time `description:"创建日期"`
- }
- func (ExcelSheetData *ExcelSheetData) Update(cols []string) (err error) {
-
-
- err = global.DbMap[utils.DbNameIndex].Model(&ExcelSheetData).Select(cols).Updates(&ExcelSheetData).Error
- return
- }
- func AddExcelSheetData(excelInfo *ExcelSheetData) (err error) {
-
-
-
- err = global.DbMap[utils.DbNameIndex].Create(&excelInfo).Error
- if err != nil {
- return
- }
-
- return
- }
- func GetSheetDataListBySheetIdListAndPage(excelSheetIdList []int, page int) (items []*ExcelSheetData, err error) {
- num := len(excelSheetIdList)
- if num <= 0 {
- return
- }
-
-
-
- sql := ` SELECT *
- FROM excel_sheet_data WHERE 1=1 AND excel_sheet_id in ? AND sort = ? `
-
- err = global.DbMap[utils.DbNameIndex].Raw(sql, excelSheetIdList, page).Find(&items).Error
- return
- }
- func GetAllSheetDataListByExcelInfoId(excelInfoId int) (items []*ExcelSheetData, err error) {
-
- sql := ` SELECT *
- FROM excel_sheet_data WHERE 1=1 AND excel_info_id = ? ORDER BY sort ASC `
-
- err = global.DbMap[utils.DbNameIndex].Raw(sql, excelInfoId).Find(&items).Error
- return
- }
|