package models import ( "eta_gn/eta_chart_lib/global" "time" ) type ExcelInfoRuleMapping struct { ExcelInfoRuleMappingId int `gorm:"column:excel_info_rule_mapping_id;primaryKey" description:"主键"` ExcelInfoId int `gorm:"column:excel_info_id" description:"Excel信息ID"` RuleType int `gorm:"column:rule_type" description:"规则类型"` LeftValue string `gorm:"column:left_value" description:"左值"` LeftValueShow string `gorm:"column:left_value_show" description:"左值前端显示"` LeftValueType int `gorm:"column:left_value_type" description:"左值类型"` RightValue string `gorm:"column:right_value" description:"右值"` RightValueShow string `gorm:"column:right_value_show" description:"右值前端显示"` RightValueType int `gorm:"column:right_value_type" description:"右值类型"` FontColor string `gorm:"column:font_color" description:"字体颜色"` BackgroundColor string `gorm:"column:background_color" description:"背景颜色"` Remark string `gorm:"column:remark" description:"预设颜色说明"` RemarkEn string `gorm:"column:remark_en" description:"预设颜色英文说明"` Scope string `gorm:"column:scope" description:"作用范围"` ScopeCoord string `gorm:"column:scope_coord" description:"作用范围坐标"` ScopeShow string `gorm:"column:scope_show" description:"作用范围坐标前端显示"` CreateTime time.Time `gorm:"column:create_time" description:"创建时间"` } func (e *ExcelInfoRuleMapping) TableName() string { return "excel_info_rule_mapping" } type ExcelInfoRuleMappingView struct { ExcelInfoRuleMappingId int `gorm:"column:excel_info_rule_mapping_id;primaryKey" description:"主键"` ExcelInfoId int `gorm:"column:excel_info_id" description:"Excel信息ID"` RuleType int `gorm:"column:rule_type" description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"` LeftValue string `gorm:"column:left_value" description:"左值"` LeftValueBack string `gorm:"column:left_value_back" description:"左值前端显示"` LeftValueType int `gorm:"column:left_value_type" description:"左值类型"` RightValue string `gorm:"column:right_value" description:"右值"` RightValueBack string `gorm:"column:right_value_back" description:"右值前端显示"` RightValueType int `gorm:"column:right_value_type" description:"右值类型"` FontColor string `gorm:"column:font_color" description:"字体颜色"` BackgroundColor string `gorm:"column:background_color" description:"背景颜色"` Remark string `gorm:"column:remark" description:"预设颜色说明"` RemarkEn string `gorm:"column:remark_en" description:"预设颜色英文说明"` Scope string `gorm:"column:scope" description:"作用范围"` ScopeCoord string `gorm:"column:scope_coord" description:"作用范围坐标"` ScopeShow string `gorm:"column:scope_show" description:"作用范围坐标前端显示"` CreateTime string `gorm:"column:create_time" description:"创建时间"` } func (e *ExcelInfoRuleMapping) Insert() (insertId int64, err error) { o := global.DmSQL["data"] err = o.Create(e).Error insertId = int64(e.ExcelInfoRuleMappingId) return } func (e *ExcelInfoRuleMapping) Update(cols []string) (err error) { o := global.DmSQL["data"] err = o.Model(e).Select(cols).Updates(e).Error return } func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView, err error) { o := global.DmSQL["data"] sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_id = ? ORDER BY create_time ASC` err = o.Raw(sql, id).Scan(&items).Error return } func GetExcelRuleMappingById(id int) (item *ExcelInfoRuleMappingView, err error) { o := global.DmSQL["data"] sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?` err = o.Raw(sql, id).First(&item).Error return } func DeleteExcelRuleMappingById(id int) (err error) { o := global.DmSQL["data"] sql := `DELETE FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?` err = o.Exec(sql, id).Error return }