config_entity.go 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. // ==========================================================================
  2. // This is auto-generated by gf cli tool. You may not really want to edit it.
  3. // ==========================================================================
  4. package config
  5. import (
  6. "database/sql"
  7. "github.com/gogf/gf/database/gdb"
  8. )
  9. // Entity is the golang structure for table sys_config.
  10. type Entity struct {
  11. Id int `orm:"id,primary" json:"id"` // 主键
  12. Name string `orm:"name" json:"name"` // 名称
  13. Key string `orm:"key" json:"key"` // 键
  14. Value string `orm:"value" json:"value"` // 值
  15. Code string `orm:"code" json:"code"` // 编码
  16. DataType int `orm:"data_type" json:"dataType"` // 数据类型//radio/1,KV,2,字典,3,数组
  17. ParentId int `orm:"parent_id" json:"parentId"` // 类型
  18. ParentKey string `orm:"parent_key" json:"parentKey"` //
  19. Sort int `orm:"sort" json:"sort"` // 排序号
  20. ProjectId int `orm:"project_id" json:"projectId"` // 项目ID
  21. CopyStatus int `orm:"copy_status" json:"copyStatus"` // 拷贝状态 1 拷贝 2 不拷贝
  22. ChangeStatus int `orm:"change_status" json:"changeStatus"` // 1 不可更改 2 可以更改
  23. Enable int `orm:"enable" json:"enable"` // 是否启用//radio/1,启用,2,禁用
  24. UpdateTime string `orm:"update_time" json:"updateTime"` // 更新时间
  25. UpdateId int `orm:"update_id" json:"updateId"` // 更新人
  26. CreateTime string `orm:"create_time" json:"createTime"` // 创建时间
  27. CreateId int `orm:"create_id" json:"createId"` // 创建者
  28. UpdateName string `json:"updateName,omitempty" gconv:"updateName,omitempty"`
  29. CreateName string `json:"createName,omitempty" gconv:"createName,omitempty"`
  30. }
  31. // OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
  32. // the data and where attributes for empty values.
  33. func (r *Entity) OmitEmpty() *arModel {
  34. return Model.Data(r).OmitEmpty()
  35. }
  36. // Inserts does "INSERT...INTO..." statement for inserting current object into table.
  37. func (r *Entity) Insert() (result sql.Result, err error) {
  38. return Model.Data(r).Insert()
  39. }
  40. // Replace does "REPLACE...INTO..." statement for inserting current object into table.
  41. // If there's already another same record in the table (it checks using primary key or unique index),
  42. // it deletes it and insert this one.
  43. func (r *Entity) Replace() (result sql.Result, err error) {
  44. return Model.Data(r).Replace()
  45. }
  46. // Save does "INSERT...INTO..." statement for inserting/updating current object into table.
  47. // It updates the record if there's already another same record in the table
  48. // (it checks using primary key or unique index).
  49. func (r *Entity) Save() (result sql.Result, err error) {
  50. return Model.Data(r).Save()
  51. }
  52. // Update does "UPDATE...WHERE..." statement for updating current object from table.
  53. // It updates the record if there's already another same record in the table
  54. // (it checks using primary key or unique index).
  55. func (r *Entity) Update() (result sql.Result, err error) {
  56. return Model.Data(r).Where(gdb.GetWhereConditionOfStruct(r)).Update()
  57. }
  58. // Delete does "DELETE FROM...WHERE..." statement for deleting current object from table.
  59. func (r *Entity) Delete() (result sql.Result, err error) {
  60. return Model.Where(gdb.GetWhereConditionOfStruct(r)).Delete()
  61. }