excel_info_rule_mapping.go 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package models
  2. import (
  3. "time"
  4. "github.com/beego/beego/v2/client/orm"
  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 ExcelInfoRuleMappingView struct {
  26. ExcelInfoRuleMappingId int `orm:"pk" description:"主键"`
  27. ExcelInfoId int `description:"Excel信息ID"`
  28. RuleType int `description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"`
  29. LeftValue string `description:"左值"`
  30. LeftValueBack string `description:"左值前端显示"`
  31. LeftValueType int `description:"左值类型"`
  32. RightValue string `description:"右值"`
  33. RightValueBack string `description:"右值前端显示"`
  34. RightValueType int `description:"右值类型"`
  35. FontColor string `description:"字体颜色"`
  36. BackgroundColor string `description:"背景颜色"`
  37. Remark string `description:"预设颜色说明"`
  38. RemarkEn string `description:"预设颜色英文说明"`
  39. Scope string `description:"作用范围"`
  40. ScopeCoord string `description:"作用范围坐标"`
  41. ScopeShow string `description:"作用范围坐标前端显示"`
  42. CreateTime string `description:"创建时间"`
  43. }
  44. func (e *ExcelInfoRuleMapping) Insert() (insertId int64, err error) {
  45. o := orm.NewOrmUsingDB("data")
  46. insertId, err = o.Insert(e)
  47. return
  48. }
  49. func (e *ExcelInfoRuleMapping) Update(cols []string) (err error) {
  50. o := orm.NewOrmUsingDB("data")
  51. _, err = o.Update(e, cols...)
  52. return
  53. }
  54. // GetExcelRuleMappingByExcelInfoId 根据excelInfoId获取规则映射信息
  55. func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView, err error) {
  56. o := orm.NewOrmUsingDB("data")
  57. sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_id = ? ORDER BY create_time ASC`
  58. _, err = o.Raw(sql, id).QueryRows(&items)
  59. return
  60. }
  61. // GetExcelRuleMappingById 根据主键Id获取规则映射信息
  62. func GetExcelRuleMappingById(id int) (item *ExcelInfoRuleMappingView, err error) {
  63. o := orm.NewOrmUsingDB("data")
  64. sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
  65. err = o.Raw(sql, id).QueryRow(&item)
  66. return
  67. }
  68. func DeleteExcelRuleMappingById(id int) (err error) {
  69. o := orm.NewOrmUsingDB("data")
  70. sql := `DELETE FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
  71. _, err = o.Raw(sql, id).Exec()
  72. return
  73. }