123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- package excel
- import (
- "eta_gn/eta_api/global"
- "time"
- )
- type ExcelSheet struct {
- ExcelSheetId int `orm:"column(excel_sheet_id);pk" gorm:"primaryKey" `
- ExcelInfoId int `description:"excel的id"`
- SheetName string `description:"sheet名称"`
- PageNum int `description:"总页码数"`
- Index string `description:"excel数据中的index"`
- Sort int `description:"排序"`
- Config string `description:"配置信息"`
- CalcChain string `description:"计算公式"`
- ModifyTime time.Time `description:"最近修改日期"`
- CreateTime time.Time `description:"创建日期"`
- }
- func (excelSheet *ExcelSheet) Update(cols []string) (err error) {
-
-
- err = global.DmSQL["data"].Select(cols).Updates(excelSheet).Error
- return
- }
- func AddExcelSheet(excelInfo *ExcelSheet) (err error) {
-
-
-
-
-
-
-
- err = global.DmSQL["data"].Create(excelInfo).Error
- return
- }
- func GetAllSheetList(excelInfoId int) (item []*ExcelSheet, err error) {
-
-
-
-
-
- sql := ` SELECT *
- FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
- sql += " ORDER BY sort asc "
- err = global.DmSQL["data"].Raw(sql, excelInfoId).Find(&item).Error
- return
- }
- type SheetItem struct {
- ExcelSheetId int `orm:"column(excel_sheet_id);pk" gorm:"primaryKey" json:"-"`
- ExcelInfoId int `description:"excel的id" json:"-"`
- SheetName string `description:"sheet名称"`
- PageNum int `description:"数据总页码数"`
- Index string `description:"excel数据中的index"`
- Sort int `description:"排序"`
- Config string `description:"sheet配置"`
- CalcChain string `description:"计算公式"`
- ModifyTime time.Time `description:"最近修改日期" json:"-"`
- CreateTime time.Time `description:"创建日期"`
- Data *ExcelSheetData `description:"excel的数据"`
- }
- func GetAllSheetItemList(excelInfoId int) (item []*SheetItem, err error) {
-
-
-
-
-
- sql := ` SELECT *
- FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
- sql += " ORDER BY sort asc "
- err = global.DmSQL["data"].Raw(sql, excelInfoId).Find(&item).Error
- return
- }
- func GetAllNoConfigSheetItemList(excelInfoId int) (item []*SheetItem, err error) {
-
-
-
-
-
- sql := ` SELECT excel_sheet_id,excel_info_id,sheet_name,sort,page_num,create_time
- FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
- sql += " ORDER BY sort asc "
- err = global.DmSQL["data"].Raw(sql, excelInfoId).Find(&item).Error
- return
- }
- type AddExcelSheetParams struct {
- ExcelSheetId int `orm:"column(excel_sheet_id);pk" gorm:"primaryKey" `
- ExcelInfoId int `description:"excel的id"`
- SheetName string `description:"sheet名称"`
- Index string `description:"excel数据中的index"`
- Sort int `description:"排序"`
- Config string `description:"配置信息"`
- CalcChain string `description:"计算公式"`
- DataList []*ExcelSheetData `description:"excel的数据"`
- }
|