excel_info_rule_mapping.go 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. package models
  2. import (
  3. "eta_gn/eta_chart_lib/global"
  4. "time"
  5. )
  6. // type ExcelInfoRuleMapping struct {
  7. // ExcelInfoRuleMappingId int `orm:"pk" description:"主键"`
  8. // ExcelInfoId int `description:"Excel信息ID"`
  9. // RuleType int `description:"规则类型"`
  10. // LeftValue string `description:"左值"`
  11. // LeftValueShow string `description:"左值前端显示"`
  12. // LeftValueType int `description:"左值类型"`
  13. // RightValue string `description:"右值"`
  14. // RightValueShow string `description:"右值前端显示"`
  15. // RightValueType int `description:"右值类型"`
  16. // FontColor string `description:"字体颜色"`
  17. // BackgroundColor string `description:"背景颜色"`
  18. // Remark string `description:"预设颜色说明"`
  19. // RemarkEn string `description:"预设颜色英文说明"`
  20. // Scope string `description:"作用范围"`
  21. // ScopeCoord string `description:"作用范围坐标"`
  22. // ScopeShow string `description:"作用范围坐标前端显示"`
  23. // CreateTime time.Time `description:"创建时间"`
  24. // }
  25. type ExcelInfoRuleMapping struct {
  26. ExcelInfoRuleMappingId int `gorm:"column:excel_info_rule_mapping_id;primaryKey" description:"主键"`
  27. ExcelInfoId int `gorm:"column:excel_info_id" description:"Excel信息ID"`
  28. RuleType int `gorm:"column:rule_type" description:"规则类型"`
  29. LeftValue string `gorm:"column:left_value" description:"左值"`
  30. LeftValueShow string `gorm:"column:left_value_show" description:"左值前端显示"`
  31. LeftValueType int `gorm:"column:left_value_type" description:"左值类型"`
  32. RightValue string `gorm:"column:right_value" description:"右值"`
  33. RightValueShow string `gorm:"column:right_value_show" description:"右值前端显示"`
  34. RightValueType int `gorm:"column:right_value_type" description:"右值类型"`
  35. FontColor string `gorm:"column:font_color" description:"字体颜色"`
  36. BackgroundColor string `gorm:"column:background_color" description:"背景颜色"`
  37. Remark string `gorm:"column:remark" description:"预设颜色说明"`
  38. RemarkEn string `gorm:"column:remark_en" description:"预设颜色英文说明"`
  39. Scope string `gorm:"column:scope" description:"作用范围"`
  40. ScopeCoord string `gorm:"column:scope_coord" description:"作用范围坐标"`
  41. ScopeShow string `gorm:"column:scope_show" description:"作用范围坐标前端显示"`
  42. CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
  43. }
  44. func (e *ExcelInfoRuleMapping) TableName() string {
  45. return "excel_info_rule_mapping"
  46. }
  47. // type ExcelInfoRuleMappingView struct {
  48. // ExcelInfoRuleMappingId int `orm:"pk" description:"主键"`
  49. // ExcelInfoId int `description:"Excel信息ID"`
  50. // RuleType int `description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"`
  51. // LeftValue string `description:"左值"`
  52. // LeftValueBack string `description:"左值前端显示"`
  53. // LeftValueType int `description:"左值类型"`
  54. // RightValue string `description:"右值"`
  55. // RightValueBack string `description:"右值前端显示"`
  56. // RightValueType int `description:"右值类型"`
  57. // FontColor string `description:"字体颜色"`
  58. // BackgroundColor string `description:"背景颜色"`
  59. // Remark string `description:"预设颜色说明"`
  60. // RemarkEn string `description:"预设颜色英文说明"`
  61. // Scope string `description:"作用范围"`
  62. // ScopeCoord string `description:"作用范围坐标"`
  63. // ScopeShow string `description:"作用范围坐标前端显示"`
  64. // CreateTime string `description:"创建时间"`
  65. // }
  66. type ExcelInfoRuleMappingView struct {
  67. ExcelInfoRuleMappingId int `gorm:"column:excel_info_rule_mapping_id;primaryKey" description:"主键"`
  68. ExcelInfoId int `gorm:"column:excel_info_id" description:"Excel信息ID"`
  69. RuleType int `gorm:"column:rule_type" description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"`
  70. LeftValue string `gorm:"column:left_value" description:"左值"`
  71. LeftValueBack string `gorm:"column:left_value_back" description:"左值前端显示"`
  72. LeftValueType int `gorm:"column:left_value_type" description:"左值类型"`
  73. RightValue string `gorm:"column:right_value" description:"右值"`
  74. RightValueBack string `gorm:"column:right_value_back" description:"右值前端显示"`
  75. RightValueType int `gorm:"column:right_value_type" description:"右值类型"`
  76. FontColor string `gorm:"column:font_color" description:"字体颜色"`
  77. BackgroundColor string `gorm:"column:background_color" description:"背景颜色"`
  78. Remark string `gorm:"column:remark" description:"预设颜色说明"`
  79. RemarkEn string `gorm:"column:remark_en" description:"预设颜色英文说明"`
  80. Scope string `gorm:"column:scope" description:"作用范围"`
  81. ScopeCoord string `gorm:"column:scope_coord" description:"作用范围坐标"`
  82. ScopeShow string `gorm:"column:scope_show" description:"作用范围坐标前端显示"`
  83. CreateTime string `gorm:"column:create_time" description:"创建时间"`
  84. }
  85. func (e *ExcelInfoRuleMapping) Insert() (insertId int64, err error) {
  86. o := global.DmSQL["data"]
  87. err = o.Create(e).Error
  88. insertId = int64(e.ExcelInfoRuleMappingId)
  89. return
  90. }
  91. func (e *ExcelInfoRuleMapping) Update(cols []string) (err error) {
  92. o := global.DmSQL["data"]
  93. err = o.Model(e).Select(cols).Updates(e).Error
  94. return
  95. }
  96. // GetExcelRuleMappingByExcelInfoId 根据excelInfoId获取规则映射信息
  97. func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView, err error) {
  98. o := global.DmSQL["data"]
  99. sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_id = ? ORDER BY create_time ASC`
  100. err = o.Raw(sql, id).Scan(&items).Error
  101. return
  102. }
  103. // GetExcelRuleMappingById 根据主键Id获取规则映射信息
  104. func GetExcelRuleMappingById(id int) (item *ExcelInfoRuleMappingView, err error) {
  105. o := global.DmSQL["data"]
  106. sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
  107. err = o.Raw(sql, id).First(&item).Error
  108. return
  109. }
  110. func DeleteExcelRuleMappingById(id int) (err error) {
  111. o := global.DmSQL["data"]
  112. sql := `DELETE FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
  113. err = o.Exec(sql, id).Error
  114. return
  115. }
  116. // func (e *ExcelInfoRuleMapping) Insert() (insertId int64, err error) {
  117. // o := orm.NewOrmUsingDB("data")
  118. // insertId, err = o.Insert(e)
  119. // return
  120. // }
  121. // func (e *ExcelInfoRuleMapping) Update(cols []string) (err error) {
  122. // o := orm.NewOrmUsingDB("data")
  123. // _, err = o.Update(e, cols...)
  124. // return
  125. // }
  126. // // GetExcelRuleMappingByExcelInfoId 根据excelInfoId获取规则映射信息
  127. // func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView, err error) {
  128. // o := orm.NewOrmUsingDB("data")
  129. // sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_id = ? ORDER BY create_time ASC`
  130. // _, err = o.Raw(sql, id).QueryRows(&items)
  131. // return
  132. // }
  133. // // GetExcelRuleMappingById 根据主键Id获取规则映射信息
  134. // func GetExcelRuleMappingById(id int) (item *ExcelInfoRuleMappingView, err error) {
  135. // o := orm.NewOrmUsingDB("data")
  136. // sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
  137. // err = o.Raw(sql, id).QueryRow(&item)
  138. // return
  139. // }
  140. // func DeleteExcelRuleMappingById(id int) (err error) {
  141. // o := orm.NewOrmUsingDB("data")
  142. // sql := `DELETE FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
  143. // _, err = o.Raw(sql, id).Exec()
  144. // return
  145. // }