浏览代码

feature(反馈): 反馈管理

liuyaqi 3 年之前
父节点
当前提交
868cb238c3

+ 435 - 0
dao/repair/internal/repair.go

@@ -0,0 +1,435 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+
+	model "lims_adapter/model/repair"
+)
+
+// RepairDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type RepairDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns repairColumns
+}
+
+// RepairColumns defines and stores column names for table repair.
+type repairColumns struct {
+	Id                 string // Id
+	Type               string // 报修类型
+	Status             string // 报修状态 1 未处理 2 已处理
+	Content            string // 报修内容
+	CurrentProcessorId string // 反馈内容
+	CreatedById        string // 创建者 Id
+	CreatedByName      string // 创建者用户名
+	CreatedByMobile    string // 创建者联系方式
+	CreatedByEmail     string // 创建者邮箱
+	CreatedByDeptId    string // 创建者部门 Id
+	CreatedByDeptName  string // 创建者部门名称
+	CreatedAt          string // 创建时间
+	UpdatedAt          string // 更新时间
+	DeletedAt          string // 删除时间
+}
+
+var (
+	// Repair is globally public accessible object for table repair operations.
+	Repair = RepairDao{
+		M:     g.DB("default").Model("repair").Safe(),
+		DB:    g.DB("default"),
+		Table: "repair",
+		Columns: repairColumns{
+			Id:                 "Id",
+			Type:               "Type",
+			Status:             "Status",
+			Content:            "Content",
+			CurrentProcessorId: "CurrentProcessorId",
+			CreatedById:        "CreatedById",
+			CreatedByName:      "CreatedByName",
+			CreatedByMobile:    "CreatedByMobile",
+			CreatedByEmail:     "CreatedByEmail",
+			CreatedByDeptId:    "CreatedByDeptId",
+			CreatedByDeptName:  "CreatedByDeptName",
+			CreatedAt:          "CreatedAt",
+			UpdatedAt:          "UpdatedAt",
+			DeletedAt:          "DeletedAt",
+		},
+	}
+)
+
+func NewRepairDao(tenant string) RepairDao {
+	var dao RepairDao
+	dao = RepairDao{
+		M:     g.DB(tenant).Model("repair").Safe(),
+		DB:    g.DB(tenant),
+		Table: "repair",
+		Columns: repairColumns{
+			Id:                 "Id",
+			Type:               "Type",
+			Status:             "Status",
+			Content:            "Content",
+			CurrentProcessorId: "CurrentProcessorId",
+			CreatedById:        "CreatedById",
+			CreatedByName:      "CreatedByName",
+			CreatedByMobile:    "CreatedByMobile",
+			CreatedByEmail:     "CreatedByEmail",
+			CreatedByDeptId:    "CreatedByDeptId",
+			CreatedByDeptName:  "CreatedByDeptName",
+			CreatedAt:          "CreatedAt",
+			UpdatedAt:          "UpdatedAt",
+			DeletedAt:          "DeletedAt",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *RepairDao) Ctx(ctx context.Context) *RepairDao {
+	return &RepairDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *RepairDao) As(as string) *RepairDao {
+	return &RepairDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *RepairDao) TX(tx *gdb.TX) *RepairDao {
+	return &RepairDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *RepairDao) Master() *RepairDao {
+	return &RepairDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *RepairDao) Slave() *RepairDao {
+	return &RepairDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *RepairDao) Args(args ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairDao) LeftJoin(table ...string) *RepairDao {
+	return &RepairDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairDao) RightJoin(table ...string) *RepairDao {
+	return &RepairDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairDao) InnerJoin(table ...string) *RepairDao {
+	return &RepairDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *RepairDao) Fields(fieldNamesOrMapStruct ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *RepairDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *RepairDao) Option(option int) *RepairDao {
+	return &RepairDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *RepairDao) OmitEmpty() *RepairDao {
+	return &RepairDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *RepairDao) Filter() *RepairDao {
+	return &RepairDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *RepairDao) Where(where interface{}, args ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *RepairDao) WherePri(where interface{}, args ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *RepairDao) And(where interface{}, args ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *RepairDao) Or(where interface{}, args ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *RepairDao) Group(groupBy string) *RepairDao {
+	return &RepairDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *RepairDao) Order(orderBy ...string) *RepairDao {
+	return &RepairDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *RepairDao) Limit(limit ...int) *RepairDao {
+	return &RepairDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *RepairDao) Offset(offset int) *RepairDao {
+	return &RepairDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *RepairDao) Page(page, limit int) *RepairDao {
+	return &RepairDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *RepairDao) Batch(batch int) *RepairDao {
+	return &RepairDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *RepairDao) Cache(duration time.Duration, name ...string) *RepairDao {
+	return &RepairDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *RepairDao) Data(data ...interface{}) *RepairDao {
+	return &RepairDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.Repair.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *RepairDao) All(where ...interface{}) ([]*model.Repair, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.Repair
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.Repair.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *RepairDao) One(where ...interface{}) (*model.Repair, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.Repair
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *RepairDao) FindOne(where ...interface{}) (*model.Repair, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.Repair
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *RepairDao) FindAll(where ...interface{}) ([]*model.Repair, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.Repair
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *RepairDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *RepairDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *RepairDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *RepairDao) Chunk(limit int, callback func(entities []*model.Repair, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.Repair
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *RepairDao) LockUpdate() *RepairDao {
+	return &RepairDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *RepairDao) LockShared() *RepairDao {
+	return &RepairDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *RepairDao) Unscoped() *RepairDao {
+	return &RepairDao{M: d.M.Unscoped()}
+}

+ 423 - 0
dao/repair/internal/repair_flow.go

@@ -0,0 +1,423 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+
+	model "lims_adapter/model/repair"
+)
+
+// RepairFlowDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type RepairFlowDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns repairFlowColumns
+}
+
+// RepairFlowColumns defines and stores column names for table repair_flow.
+type repairFlowColumns struct {
+	Id            string // Id
+	RepairId      string // 报修Id
+	Type          string // 流程节点 1 发起 2 转交 3 处理 4 重新激活
+	Status        string // 处理结果 1 成功
+	ProcessById   string // 处理人 Id
+	ProcessByName string // 处理人名称
+	Note          string // 备注
+	CreatedAt     string // 创建时间
+	UpdatedAt     string // 更新时间
+	DeletedAt     string // 删除时间
+}
+
+var (
+	// RepairFlow is globally public accessible object for table repair_flow operations.
+	RepairFlow = RepairFlowDao{
+		M:     g.DB("default").Model("repair_flow").Safe(),
+		DB:    g.DB("default"),
+		Table: "repair_flow",
+		Columns: repairFlowColumns{
+			Id:            "Id",
+			RepairId:      "RepairId",
+			Type:          "Type",
+			Status:        "Status",
+			ProcessById:   "ProcessById",
+			ProcessByName: "ProcessByName",
+			Note:          "Note",
+			CreatedAt:     "CreatedAt",
+			UpdatedAt:     "UpdatedAt",
+			DeletedAt:     "DeletedAt",
+		},
+	}
+)
+
+func NewRepairFlowDao(tenant string) RepairFlowDao {
+	var dao RepairFlowDao
+	dao = RepairFlowDao{
+		M:     g.DB(tenant).Model("repair_flow").Safe(),
+		DB:    g.DB(tenant),
+		Table: "repair_flow",
+		Columns: repairFlowColumns{
+			Id:            "Id",
+			RepairId:      "RepairId",
+			Type:          "Type",
+			Status:        "Status",
+			ProcessById:   "ProcessById",
+			ProcessByName: "ProcessByName",
+			Note:          "Note",
+			CreatedAt:     "CreatedAt",
+			UpdatedAt:     "UpdatedAt",
+			DeletedAt:     "DeletedAt",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *RepairFlowDao) Ctx(ctx context.Context) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *RepairFlowDao) As(as string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *RepairFlowDao) TX(tx *gdb.TX) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *RepairFlowDao) Master() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *RepairFlowDao) Slave() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *RepairFlowDao) Args(args ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairFlowDao) LeftJoin(table ...string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairFlowDao) RightJoin(table ...string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairFlowDao) InnerJoin(table ...string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *RepairFlowDao) Fields(fieldNamesOrMapStruct ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *RepairFlowDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *RepairFlowDao) Option(option int) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *RepairFlowDao) OmitEmpty() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *RepairFlowDao) Filter() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *RepairFlowDao) Where(where interface{}, args ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *RepairFlowDao) WherePri(where interface{}, args ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *RepairFlowDao) And(where interface{}, args ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *RepairFlowDao) Or(where interface{}, args ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *RepairFlowDao) Group(groupBy string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *RepairFlowDao) Order(orderBy ...string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *RepairFlowDao) Limit(limit ...int) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *RepairFlowDao) Offset(offset int) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *RepairFlowDao) Page(page, limit int) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *RepairFlowDao) Batch(batch int) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *RepairFlowDao) Cache(duration time.Duration, name ...string) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *RepairFlowDao) Data(data ...interface{}) *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.RepairFlow.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *RepairFlowDao) All(where ...interface{}) ([]*model.RepairFlow, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.RepairFlow
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.RepairFlow.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *RepairFlowDao) One(where ...interface{}) (*model.RepairFlow, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.RepairFlow
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *RepairFlowDao) FindOne(where ...interface{}) (*model.RepairFlow, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.RepairFlow
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *RepairFlowDao) FindAll(where ...interface{}) ([]*model.RepairFlow, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.RepairFlow
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *RepairFlowDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *RepairFlowDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *RepairFlowDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *RepairFlowDao) Chunk(limit int, callback func(entities []*model.RepairFlow, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.RepairFlow
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *RepairFlowDao) LockUpdate() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *RepairFlowDao) LockShared() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *RepairFlowDao) Unscoped() *RepairFlowDao {
+	return &RepairFlowDao{M: d.M.Unscoped()}
+}

+ 420 - 0
dao/repair/internal/repair_result.go

@@ -0,0 +1,420 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+
+	model "lims_adapter/model/repair"
+)
+
+// RepairResultDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type RepairResultDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns repairResultColumns
+}
+
+// RepairResultColumns defines and stores column names for table repair_result.
+type repairResultColumns struct {
+	Id            string // Id
+	RepairId      string // 报修Id
+	ProcessById   string // 处理人 Id
+	ProcessByName string // 处理人名称
+	ProcessType   string // 处理方式
+	ProcessNote   string // 处理描述
+	CreatedAt     string // 创建时间
+	UpdatedAt     string // 更新时间
+	DeletedAt     string // 删除时间
+}
+
+var (
+	// RepairResult is globally public accessible object for table repair_result operations.
+	RepairResult = RepairResultDao{
+		M:     g.DB("default").Model("repair_result").Safe(),
+		DB:    g.DB("default"),
+		Table: "repair_result",
+		Columns: repairResultColumns{
+			Id:            "Id",
+			RepairId:      "RepairId",
+			ProcessById:   "ProcessById",
+			ProcessByName: "ProcessByName",
+			ProcessType:   "ProcessType",
+			ProcessNote:   "ProcessNote",
+			CreatedAt:     "CreatedAt",
+			UpdatedAt:     "UpdatedAt",
+			DeletedAt:     "DeletedAt",
+		},
+	}
+)
+
+func NewRepairResultDao(tenant string) RepairResultDao {
+	var dao RepairResultDao
+	dao = RepairResultDao{
+		M:     g.DB(tenant).Model("repair_result").Safe(),
+		DB:    g.DB(tenant),
+		Table: "repair_result",
+		Columns: repairResultColumns{
+			Id:            "Id",
+			RepairId:      "RepairId",
+			ProcessById:   "ProcessById",
+			ProcessByName: "ProcessByName",
+			ProcessType:   "ProcessType",
+			ProcessNote:   "ProcessNote",
+			CreatedAt:     "CreatedAt",
+			UpdatedAt:     "UpdatedAt",
+			DeletedAt:     "DeletedAt",
+		},
+	}
+	return dao
+}
+
+// Ctx is a chaining function, which creates and returns a new DB that is a shallow copy
+// of current DB object and with given context in it.
+// Note that this returned DB object can be used only once, so do not assign it to
+// a global or package variable for long using.
+func (d *RepairResultDao) Ctx(ctx context.Context) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *RepairResultDao) As(as string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *RepairResultDao) TX(tx *gdb.TX) *RepairResultDao {
+	return &RepairResultDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *RepairResultDao) Master() *RepairResultDao {
+	return &RepairResultDao{M: d.M.Master()}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *RepairResultDao) Slave() *RepairResultDao {
+	return &RepairResultDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *RepairResultDao) Args(args ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Args(args...)}
+}
+
+// LeftJoin does "LEFT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").LeftJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").LeftJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairResultDao) LeftJoin(table ...string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.LeftJoin(table...)}
+}
+
+// RightJoin does "RIGHT JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").RightJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").RightJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairResultDao) RightJoin(table ...string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.RightJoin(table...)}
+}
+
+// InnerJoin does "INNER JOIN ... ON ..." statement on the model.
+// The parameter <table> can be joined table and its joined condition,
+// and also with its alias name, like:
+// Table("user").InnerJoin("user_detail", "user_detail.uid=user.uid")
+// Table("user", "u").InnerJoin("user_detail", "ud", "ud.uid=u.uid")
+func (d *RepairResultDao) InnerJoin(table ...string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.InnerJoin(table...)}
+}
+
+// Fields sets the operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *RepairResultDao) Fields(fieldNamesOrMapStruct ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Fields(fieldNamesOrMapStruct...)}
+}
+
+// FieldsEx sets the excluded operation fields of the model, multiple fields joined using char ','.
+// The parameter <fieldNamesOrMapStruct> can be type of string/map/*map/struct/*struct.
+func (d *RepairResultDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *RepairResultDao) Option(option int) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Option(option)}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *RepairResultDao) OmitEmpty() *RepairResultDao {
+	return &RepairResultDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *RepairResultDao) Filter() *RepairResultDao {
+	return &RepairResultDao{M: d.M.Filter()}
+}
+
+// Where sets the condition statement for the model. The parameter <where> can be type of
+// string/map/gmap/slice/struct/*struct, etc. Note that, if it's called more than one times,
+// multiple conditions will be joined into where statement using "AND".
+// Eg:
+// Where("uid=10000")
+// Where("uid", 10000)
+// Where("money>? AND name like ?", 99999, "vip_%")
+// Where("uid", 1).Where("name", "john")
+// Where("status IN (?)", g.Slice{1,2,3})
+// Where("age IN(?,?)", 18, 50)
+// Where(User{ Id : 1, UserName : "john"})
+func (d *RepairResultDao) Where(where interface{}, args ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Where(where, args...)}
+}
+
+// WherePri does the same logic as M.Where except that if the parameter <where>
+// is a single condition like int/string/float/slice, it treats the condition as the primary
+// key value. That is, if primary key is "id" and given <where> parameter as "123", the
+// WherePri function treats the condition as "id=123", but M.Where treats the condition
+// as string "123".
+func (d *RepairResultDao) WherePri(where interface{}, args ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *RepairResultDao) And(where interface{}, args ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *RepairResultDao) Or(where interface{}, args ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *RepairResultDao) Group(groupBy string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *RepairResultDao) Order(orderBy ...string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Order(orderBy...)}
+}
+
+// Limit sets the "LIMIT" statement for the model.
+// The parameter <limit> can be either one or two number, if passed two number is passed,
+// it then sets "LIMIT limit[0],limit[1]" statement for the model, or else it sets "LIMIT limit[0]"
+// statement.
+func (d *RepairResultDao) Limit(limit ...int) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Limit(limit...)}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *RepairResultDao) Offset(offset int) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Offset(offset)}
+}
+
+// Page sets the paging number for the model.
+// The parameter <page> is started from 1 for paging.
+// Note that, it differs that the Limit function start from 0 for "LIMIT" statement.
+func (d *RepairResultDao) Page(page, limit int) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *RepairResultDao) Batch(batch int) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Batch(batch)}
+}
+
+// Cache sets the cache feature for the model. It caches the result of the sql, which means
+// if there's another same sql request, it just reads and returns the result from cache, it
+// but not committed and executed into the database.
+//
+// If the parameter <duration> < 0, which means it clear the cache with given <name>.
+// If the parameter <duration> = 0, which means it never expires.
+// If the parameter <duration> > 0, which means it expires after <duration>.
+//
+// The optional parameter <name> is used to bind a name to the cache, which means you can later
+// control the cache like changing the <duration> or clearing the cache with specified <name>.
+//
+// Note that, the cache feature is disabled if the model is operating on a transaction.
+func (d *RepairResultDao) Cache(duration time.Duration, name ...string) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Cache(duration, name...)}
+}
+
+// Data sets the operation data for the model.
+// The parameter <data> can be type of string/map/gmap/slice/struct/*struct, etc.
+// Eg:
+// Data("uid=10000")
+// Data("uid", 10000)
+// Data(g.Map{"uid": 10000, "name":"john"})
+// Data(g.Slice{g.Map{"uid": 10000, "name":"john"}, g.Map{"uid": 20000, "name":"smith"})
+func (d *RepairResultDao) Data(data ...interface{}) *RepairResultDao {
+	return &RepairResultDao{M: d.M.Data(data...)}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.RepairResult.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *RepairResultDao) All(where ...interface{}) ([]*model.RepairResult, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.RepairResult
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// One retrieves one record from table and returns the result as *model.RepairResult.
+// It returns nil if there's no record retrieved with the given conditions from table.
+//
+// The optional parameter <where> is the same as the parameter of M.Where function,
+// see M.Where.
+func (d *RepairResultDao) One(where ...interface{}) (*model.RepairResult, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.RepairResult
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindOne retrieves and returns a single Record by M.WherePri and M.One.
+// Also see M.WherePri and M.One.
+func (d *RepairResultDao) FindOne(where ...interface{}) (*model.RepairResult, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.RepairResult
+	if err = one.Struct(&entity); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entity, nil
+}
+
+// FindAll retrieves and returns Result by by M.WherePri and M.All.
+// Also see M.WherePri and M.All.
+func (d *RepairResultDao) FindAll(where ...interface{}) ([]*model.RepairResult, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.RepairResult
+	if err = all.Structs(&entities); err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	return entities, nil
+}
+
+// Struct retrieves one record from table and converts it into given struct.
+// The parameter <pointer> should be type of *struct/**struct. If type **struct is given,
+// it can create the struct internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not nil.
+//
+// Eg:
+// user := new(User)
+// err  := dao.User.Where("id", 1).Struct(user)
+//
+// user := (*User)(nil)
+// err  := dao.User.Where("id", 1).Struct(&user)
+func (d *RepairResultDao) Struct(pointer interface{}, where ...interface{}) error {
+	return d.M.Struct(pointer, where...)
+}
+
+// Structs retrieves records from table and converts them into given struct slice.
+// The parameter <pointer> should be type of *[]struct/*[]*struct. It can create and fill the struct
+// slice internally during converting.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved with the given conditions
+// from table and <pointer> is not empty.
+//
+// Eg:
+// users := ([]User)(nil)
+// err   := dao.User.Structs(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Structs(&users)
+func (d *RepairResultDao) Structs(pointer interface{}, where ...interface{}) error {
+	return d.M.Structs(pointer, where...)
+}
+
+// Scan automatically calls Struct or Structs function according to the type of parameter <pointer>.
+// It calls function Struct if <pointer> is type of *struct/**struct.
+// It calls function Structs if <pointer> is type of *[]struct/*[]*struct.
+//
+// The optional parameter <where> is the same as the parameter of Model.Where function,
+// see Model.Where.
+//
+// Note that it returns sql.ErrNoRows if there's no record retrieved and given pointer is not empty or nil.
+//
+// Eg:
+// user  := new(User)
+// err   := dao.User.Where("id", 1).Scan(user)
+//
+// user  := (*User)(nil)
+// err   := dao.User.Where("id", 1).Scan(&user)
+//
+// users := ([]User)(nil)
+// err   := dao.User.Scan(&users)
+//
+// users := ([]*User)(nil)
+// err   := dao.User.Scan(&users)
+func (d *RepairResultDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *RepairResultDao) Chunk(limit int, callback func(entities []*model.RepairResult, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.RepairResult
+		err = result.Structs(&entities)
+		if err == sql.ErrNoRows {
+			return false
+		}
+		return callback(entities, err)
+	})
+}
+
+// LockUpdate sets the lock for update for current operation.
+func (d *RepairResultDao) LockUpdate() *RepairResultDao {
+	return &RepairResultDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *RepairResultDao) LockShared() *RepairResultDao {
+	return &RepairResultDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *RepairResultDao) Unscoped() *RepairResultDao {
+	return &RepairResultDao{M: d.M.Unscoped()}
+}

+ 36 - 0
dao/repair/repair.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package repair
+
+import (
+	"lims_adapter/dao/repair/internal"
+)
+
+// repairDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type repairDao struct {
+	internal.RepairDao
+}
+
+var (
+	// Repair is globally public accessible object for table repair operations.
+	Repair = repairDao{
+		internal.Repair,
+	}
+)
+
+type RepairDao struct {
+	internal.RepairDao
+}
+
+func NewRepairDao(tenant string) *RepairDao {
+	dao := internal.NewRepairDao(tenant)
+	return &RepairDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 36 - 0
dao/repair/repair_flow.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package repair
+
+import (
+	"lims_adapter/dao/repair/internal"
+)
+
+// repairFlowDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type repairFlowDao struct {
+	internal.RepairFlowDao
+}
+
+var (
+	// RepairFlow is globally public accessible object for table repair_flow operations.
+	RepairFlow = repairFlowDao{
+		internal.RepairFlow,
+	}
+)
+
+type RepairFlowDao struct {
+	internal.RepairFlowDao
+}
+
+func NewRepairFlowDao(tenant string) *RepairFlowDao {
+	dao := internal.NewRepairFlowDao(tenant)
+	return &RepairFlowDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 36 - 0
dao/repair/repair_result.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package repair
+
+import (
+	"lims_adapter/dao/repair/internal"
+)
+
+// repairResultDao is the manager for logic model data accessing
+// and custom defined data operations functions management. You can define
+// methods on it to extend its functionality as you wish.
+type repairResultDao struct {
+	internal.RepairResultDao
+}
+
+var (
+	// RepairResult is globally public accessible object for table repair_result operations.
+	RepairResult = repairResultDao{
+		internal.RepairResult,
+	}
+)
+
+type RepairResultDao struct {
+	internal.RepairResultDao
+}
+
+func NewRepairResultDao(tenant string) *RepairResultDao {
+	dao := internal.NewRepairResultDao(tenant)
+	return &RepairResultDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 137 - 0
handler/repair/repair.go

@@ -0,0 +1,137 @@
+package repair
+
+import (
+	"context"
+	"lims_adapter/model"
+	"lims_adapter/model/repair"
+	repairSrv "lims_adapter/service/repair"
+
+	"dashoo.cn/common_definition/comm_def"
+	"dashoo.cn/micro_libary/myerrors"
+	"github.com/gogf/gf/frame/g"
+)
+
+type Repair struct{}
+
+func (c *Repair) List(ctx context.Context, req *repair.RepairListReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.List request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+	total, ent, err := s.List(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	if ent == nil {
+		ent = []*repair.Repair{}
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = map[string]interface{}{
+		"total": total,
+		"list":  ent,
+	}
+	return nil
+}
+
+func (c *Repair) Get(ctx context.Context, req *repair.RepairGetReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.Get request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+	ent, err := s.Get(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = ent
+	return nil
+}
+
+func (c *Repair) Add(ctx context.Context, req *repair.RepairAddReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.Add request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+
+	id, err := s.Add(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = id
+	return nil
+}
+
+func (c *Repair) Trans(ctx context.Context, req *repair.RepairTransReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.Trans request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Trans(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	return nil
+}
+
+func (c *Repair) Process(ctx context.Context, req *repair.RepairProcessReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.Process request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Process(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	return nil
+}
+
+func (c *Repair) Reactivate(ctx context.Context, req *repair.RepairReactivateReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.Reactivate request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Reactivate(ctx, req)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	return nil
+}
+
+func (c *Repair) Processor(ctx context.Context, req *model.EmptyArgs, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("Repair.Get request %#v ", *req)
+	s, err := repairSrv.NewRepairService(ctx)
+	if err != nil {
+		return err
+	}
+	ent, err := s.Processor(ctx)
+	_, err, code, msg := myerrors.CheckError(err)
+	if err != nil {
+		return err
+	}
+	rsp.Code = code
+	rsp.Msg = msg
+	rsp.Data = ent
+	return nil
+}

+ 3 - 0
main.go

@@ -5,6 +5,7 @@ import (
 	"lims_adapter/handler"
 	"lims_adapter/handler/feedback"
 	"lims_adapter/handler/learning"
+	"lims_adapter/handler/repair"
 	"lims_adapter/service/timers"
 	"net/http"
 
@@ -74,6 +75,8 @@ func main() {
 		new((learning.LearningMaterialPublishRecord)), "")
 	s.RegisterName("Feedback",
 		new((feedback.Feedback)), "")
+	s.RegisterName("Repair",
+		new((repair.Repair)), "")
 
 	// 注册auth处理
 	s.AuthFunc = handleAuth

+ 27 - 0
model/repair/internal/repair.go

@@ -0,0 +1,27 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// Repair is the golang structure for table repair.
+type Repair struct {
+	Id                 int         `orm:"Id,primary"         json:"id"`                 // Id
+	Type               int         `orm:"Type"               json:"type"`               // 报修类型
+	Status             int         `orm:"Status"             json:"status"`             // 报修状态 1 未处理 2 已处理
+	Content            string      `orm:"Content"            json:"content"`            // 报修内容
+	CurrentProcessorId int         `orm:"CurrentProcessorId" json:"currentProcessorId"` // 反馈内容
+	CreatedById        int         `orm:"CreatedById"        json:"createdById"`        // 创建者 Id
+	CreatedByName      string      `orm:"CreatedByName"      json:"createdByName"`      // 创建者用户名
+	CreatedByMobile    string      `orm:"CreatedByMobile"    json:"createdByMobile"`    // 创建者联系方式
+	CreatedByEmail     string      `orm:"CreatedByEmail"     json:"createdByEmail"`     // 创建者邮箱
+	CreatedByDeptId    int         `orm:"CreatedByDeptId"    json:"createdByDeptId"`    // 创建者部门 Id
+	CreatedByDeptName  string      `orm:"CreatedByDeptName"  json:"createdByDeptName"`  // 创建者部门名称
+	CreatedAt          *gtime.Time `orm:"CreatedAt"          json:"createdAt"`          // 创建时间
+	UpdatedAt          *gtime.Time `orm:"UpdatedAt"          json:"updatedAt"`          // 更新时间
+	DeletedAt          *gtime.Time `orm:"DeletedAt"          json:"deletedAt"`          // 删除时间
+}

+ 23 - 0
model/repair/internal/repair_flow.go

@@ -0,0 +1,23 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// RepairFlow is the golang structure for table repair_flow.
+type RepairFlow struct {
+	Id            int         `orm:"Id,primary"    json:"id"`            // Id
+	RepairId      int         `orm:"RepairId"      json:"repairId"`      // 报修Id
+	Type          int         `orm:"Type"          json:"type"`          // 流程节点 1 发起 2 转交 3 处理 4 重新激活
+	Status        int         `orm:"Status"        json:"status"`        // 处理结果 1 成功
+	ProcessById   int         `orm:"ProcessById"   json:"processById"`   // 处理人 Id
+	ProcessByName string      `orm:"ProcessByName" json:"processByName"` // 处理人名称
+	Note          string      `orm:"Note"          json:"note"`          // 备注
+	CreatedAt     *gtime.Time `orm:"CreatedAt"     json:"createdAt"`     // 创建时间
+	UpdatedAt     *gtime.Time `orm:"UpdatedAt"     json:"updatedAt"`     // 更新时间
+	DeletedAt     *gtime.Time `orm:"DeletedAt"     json:"deletedAt"`     // 删除时间
+}

+ 22 - 0
model/repair/internal/repair_result.go

@@ -0,0 +1,22 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// RepairResult is the golang structure for table repair_result.
+type RepairResult struct {
+	Id            int         `orm:"Id,primary"    json:"id"`            // Id
+	RepairId      int         `orm:"RepairId"      json:"repairId"`      // 报修Id
+	ProcessById   int         `orm:"ProcessById"   json:"processById"`   // 处理人 Id
+	ProcessByName string      `orm:"ProcessByName" json:"processByName"` // 处理人名称
+	ProcessType   int         `orm:"ProcessType"   json:"processType"`   // 处理方式
+	ProcessNote   string      `orm:"ProcessNote"   json:"processNote"`   // 处理描述
+	CreatedAt     *gtime.Time `orm:"CreatedAt"     json:"createdAt"`     // 创建时间
+	UpdatedAt     *gtime.Time `orm:"UpdatedAt"     json:"updatedAt"`     // 更新时间
+	DeletedAt     *gtime.Time `orm:"DeletedAt"     json:"deletedAt"`     // 删除时间
+}

+ 63 - 0
model/repair/repair.go

@@ -0,0 +1,63 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package repair
+
+import (
+	"lims_adapter/model"
+	"lims_adapter/model/repair/internal"
+
+	"github.com/gogf/gf/os/gtime"
+)
+
+// Repair is the golang structure for table repair.
+type Repair internal.Repair
+
+// Fill with you ideas below.
+type RepairListReq struct {
+	Page           *model.Page `json:"page"`
+	Status         int         `json:"status"`         // 报修状态 1 未处理 2 已处理
+	CreatedByName  string      `json:"createdByName"`  // 创建者用户名
+	CreatedAtStart *gtime.Time `json:"createdAtStart"` // 创建时间
+	CreatedAtEnd   *gtime.Time `json:"createdAtEnd"`   // 创建时间
+}
+
+type RepairGetReq struct {
+	Id int `json:"id"` // 报修Id
+}
+
+type RepairGetRsp struct {
+	Repair
+	Flow   []*RepairFlow   `json:"flow"`
+	Result []*RepairResult `json:"result"`
+}
+
+type RepairAddReq struct {
+	Type    int    `json:"type" v:"required#请输入报修类型"`                   // 报修类型
+	Content string `json:"content" v:"required#请输入报修内容"`                // 报修内容
+	Mobile  string `json:"mobile" v:"required|phone#请输入联系方式|请输入正确的手机号"` // 联系方式
+	Email   string `json:"email" v:"required|email#请输入电子邮箱|请输入正确的电子邮箱"` // 邮箱
+}
+
+type RepairTransReq struct {
+	Id     int    `json:"id" v:"required#请输入报修 Id"`   // 报修Id
+	UserId int    `json:"userId" v:"required#请输入转交人"` // 转交人 Id
+	Note   string `json:"note" v:"required#请输入转交原因"`  // 转交原因
+}
+
+type RepairProcessReq struct {
+	Id   int    `json:"id" v:"required#请输入报修 Id"`  // 报修Id
+	Type int    `json:"type" v:"required#请输入处理方式"` // 处理方式
+	Note string `json:"note" v:"required#请输入处理描述"` // 处理描述
+}
+
+type RepairReactivateReq struct {
+	Id   int    `json:"id" v:"required#请输入报修 Id"`    // 报修Id
+	Note string `json:"note" v:"required#请输入重新激活描述"` // 重新激活描述
+}
+
+type RepairProcessorRsp struct {
+	Id       int    `json:"id"`
+	Realname string `json:"name"`
+}

+ 14 - 0
model/repair/repair_flow.go

@@ -0,0 +1,14 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package repair
+
+import (
+	"lims_adapter/model/repair/internal"
+)
+
+// RepairFlow is the golang structure for table repair_flow.
+type RepairFlow internal.RepairFlow
+
+// Fill with you ideas below.

+ 14 - 0
model/repair/repair_result.go

@@ -0,0 +1,14 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package repair
+
+import (
+	"lims_adapter/model/repair/internal"
+)
+
+// RepairResult is the golang structure for table repair_result.
+type RepairResult internal.RepairResult
+
+// Fill with you ideas below.

+ 4 - 4
service/feedback/feedback.go

@@ -15,7 +15,7 @@ import (
 	"github.com/gogf/gf/util/gvalid"
 )
 
-const PermissionFeeedbackProcess = "feeedback:process"
+const PermissionFeedbackProcess = "feedback:process"
 
 type FeedbackService struct {
 	Dao       *dao.FeedbackDao
@@ -83,7 +83,7 @@ func (s FeedbackService) List(ctx context.Context, req *feedback.FeedbackListReq
 		dao = dao.Where("CreatedAt < ?", req.CreatedAtEnd)
 	}
 
-	allow, err := Allow(s.Tenant, s.userInfo.Uuid, PermissionFeeedbackProcess)
+	allow, err := Allow(s.Tenant, s.userInfo.Uuid, PermissionFeedbackProcess)
 	if err != nil {
 		return 0, nil, err
 	}
@@ -283,11 +283,11 @@ func (s FeedbackService) Processor(ctx context.Context) ([]feedback.FeedbackProc
 	rsp := []feedback.FeedbackProcessorRsp{}
 	menu := &id{}
 	err := s.Dao.DB.Table("base_menu").
-		Where("Permission = ?", PermissionFeeedbackProcess).
+		Where("Permission = ?", PermissionFeedbackProcess).
 		Fields("Id").Struct(menu)
 	if err == sql.ErrNoRows {
 		return nil, myerrors.NewMsgError(err,
-			fmt.Sprintf("未配置权限: %s", PermissionFeeedbackProcess))
+			fmt.Sprintf("未配置权限: %s", PermissionFeedbackProcess))
 	}
 	if err != nil {
 		return nil, err

+ 343 - 0
service/repair/repair.go

@@ -0,0 +1,343 @@
+package repair
+
+import (
+	"context"
+	"database/sql"
+	"fmt"
+	dao "lims_adapter/dao/repair"
+	"lims_adapter/model/repair"
+
+	"dashoo.cn/common_definition/admin/permission_def"
+	"dashoo.cn/micro_libary/micro_srv"
+	"dashoo.cn/micro_libary/myerrors"
+	"dashoo.cn/micro_libary/request"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gvalid"
+)
+
+const PermissionRepairProcess = "repair:process"
+
+type RepairService struct {
+	Dao       *dao.RepairDao
+	DaoFlow   *dao.RepairFlowDao
+	DaoResult *dao.RepairResultDao
+	Tenant    string
+	userInfo  request.UserInfo
+}
+
+func NewRepairService(ctx context.Context) (*RepairService, error) {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取组合码异常:%s", err.Error())
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+	return &RepairService{
+		Dao:       dao.NewRepairDao(tenant),
+		DaoFlow:   dao.NewRepairFlowDao(tenant),
+		DaoResult: dao.NewRepairResultDao(tenant),
+		Tenant:    tenant,
+		userInfo:  userInfo,
+	}, nil
+}
+
+func (s RepairService) Get(ctx context.Context, req *repair.RepairGetReq) (*repair.RepairGetRsp, error) {
+	f, err := s.Dao.Where("Id = ?", req.Id).One()
+	if err != nil {
+		return nil, err
+	}
+	if f == nil {
+		return nil, myerrors.NewMsgError(nil, "报修不存在")
+	}
+	flow, err := s.DaoFlow.Where("RepairId = ?", f.Id).All()
+	if err != nil {
+		return nil, err
+	}
+	result, err := s.DaoResult.Where("RepairId = ?", f.Id).All()
+	if err != nil {
+		return nil, err
+	}
+
+	return &repair.RepairGetRsp{
+		Repair: *f,
+		Flow:   flow,
+		Result: result,
+	}, nil
+}
+
+func (s RepairService) List(ctx context.Context, req *repair.RepairListReq) (int, []*repair.Repair, error) {
+	dao := &s.Dao.RepairDao
+	if req.Status != 0 {
+		dao = dao.Where("Status = ?", req.Status)
+	}
+	if req.CreatedByName != "" {
+		dao = dao.Where("CreatedByName LIKE ?", fmt.Sprintf("%%%s%%", req.CreatedByName))
+	}
+	if req.CreatedAtStart != nil {
+		dao = dao.Where("CreatedAt > ?", req.CreatedAtStart)
+	}
+	if req.CreatedAtEnd != nil {
+		dao = dao.Where("CreatedAt < ?", req.CreatedAtEnd)
+	}
+
+	allow, err := Allow(s.Tenant, s.userInfo.Uuid, PermissionRepairProcess)
+	if err != nil {
+		return 0, nil, err
+	}
+	if !allow {
+		dao = dao.Where("CreatedById = ?", s.userInfo.Id)
+	}
+
+	total, err := dao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+
+	if req.Page != nil {
+		if req.Page.Current == 0 {
+			req.Page.Current = 1
+		}
+		if req.Page.Size == 0 {
+			req.Page.Size = 10
+		}
+		dao = dao.Page(req.Page.Current, req.Page.Size)
+	}
+
+	dao = dao.Order("CreatedAt", "desc")
+	ent, err := dao.All()
+	return total, ent, err
+}
+
+type organize struct {
+	Id       int
+	FullName string
+}
+
+func (s RepairService) Add(ctx context.Context, req *repair.RepairAddReq) (int, error) {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.NewMsgError(nil, validErr.Current().Error())
+	}
+	dept := &organize{}
+	err := s.Dao.DB.Table("base_organize").Where("Id", s.userInfo.DeptId).Struct(dept)
+	if err == sql.ErrNoRows {
+		return 0, myerrors.NewMsgError(err, fmt.Sprintf("部门不存在 %s", s.userInfo.DeptId))
+	}
+	if err != nil {
+		return 0, err
+	}
+
+	id, err := s.Dao.InsertAndGetId(repair.Repair{
+		Type:               req.Type,
+		Status:             1,
+		Content:            req.Content,
+		CurrentProcessorId: 0,
+		CreatedById:        int(s.userInfo.Id),
+		CreatedByName:      s.userInfo.RealName,
+		CreatedByMobile:    req.Mobile,
+		CreatedByEmail:     req.Email,
+		CreatedByDeptId:    dept.Id,
+		CreatedByDeptName:  dept.FullName,
+		CreatedAt:          gtime.New(),
+		UpdatedAt:          gtime.New(),
+	})
+	if err != nil {
+		return 0, err
+	}
+
+	_, err = s.DaoFlow.Insert(repair.RepairFlow{
+		RepairId:      int(id),
+		Type:          1,
+		Status:        1,
+		ProcessById:   int(s.userInfo.Id),
+		ProcessByName: s.userInfo.RealName,
+		Note:          "",
+		CreatedAt:     gtime.New(),
+		UpdatedAt:     gtime.New(),
+	})
+	return int(id), err
+}
+
+func (s RepairService) Trans(ctx context.Context, req *repair.RepairTransReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.NewMsgError(nil, validErr.Current().Error())
+	}
+	r, err := s.Dao.DB.Table("base_user").Where("Id", req.UserId).One()
+	if err != nil {
+		return err
+	}
+	if r.IsEmpty() {
+		return myerrors.NewMsgError(nil, fmt.Sprintf("转交人不存在: %d", req.UserId))
+	}
+
+	f, err := s.Dao.Where("Id = ?", req.Id).One()
+	if err != nil {
+		return err
+	}
+	if f == nil {
+		return myerrors.NewMsgError(nil, fmt.Sprintf("报修不存在: %d", req.Id))
+	}
+
+	_, err = s.Dao.Where("Id = ?", req.Id).Data("CurrentProcessorId", req.UserId).Update()
+	if err != nil {
+		return err
+	}
+	_, err = s.DaoFlow.Insert(repair.RepairFlow{
+		RepairId:      req.Id,
+		Type:          2,
+		Status:        1,
+		ProcessById:   int(s.userInfo.Id),
+		ProcessByName: s.userInfo.RealName,
+		Note:          req.Note,
+		CreatedAt:     gtime.New(),
+		UpdatedAt:     gtime.New(),
+	})
+	return err
+}
+
+func (s RepairService) Process(ctx context.Context, req *repair.RepairProcessReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.NewMsgError(nil, validErr.Current().Error())
+	}
+	f, err := s.Dao.Where("Id = ?", req.Id).One()
+	if err != nil {
+		return err
+	}
+	if f == nil {
+		return myerrors.NewMsgError(nil, fmt.Sprintf("报修不存在: %d", req.Id))
+	}
+
+	_, err = s.Dao.Where("Id = ?", req.Id).Data("Status", 2).Update()
+	if err != nil {
+		return err
+	}
+	_, err = s.DaoFlow.Insert(repair.RepairFlow{
+		RepairId:      req.Id,
+		Type:          3,
+		Status:        1,
+		ProcessById:   int(s.userInfo.Id),
+		ProcessByName: s.userInfo.RealName,
+		Note:          "",
+		CreatedAt:     gtime.New(),
+		UpdatedAt:     gtime.New(),
+	})
+	if err != nil {
+		return err
+	}
+	_, err = s.DaoResult.Insert(repair.RepairResult{
+		RepairId:      req.Id,
+		ProcessById:   int(s.userInfo.Id),
+		ProcessByName: s.userInfo.RealName,
+		ProcessType:   req.Type,
+		ProcessNote:   req.Note,
+		CreatedAt:     gtime.New(),
+		UpdatedAt:     gtime.New(),
+	})
+	return err
+}
+
+func (s RepairService) Reactivate(ctx context.Context, req *repair.RepairReactivateReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.NewMsgError(nil, validErr.Current().Error())
+	}
+	f, err := s.Dao.Where("Id = ?", req.Id).One()
+	if err != nil {
+		return err
+	}
+	if f == nil {
+		return myerrors.NewMsgError(nil, fmt.Sprintf("报修不存在: %d", req.Id))
+	}
+
+	_, err = s.Dao.Where("Id = ?", req.Id).Data(
+		map[string]interface{}{
+			"Status":             1,
+			"CurrentProcessorId": 0,
+		}).Update()
+	if err != nil {
+		return err
+	}
+	_, err = s.DaoFlow.Insert(repair.RepairFlow{
+		RepairId:      req.Id,
+		Type:          4,
+		Status:        1,
+		ProcessById:   int(s.userInfo.Id),
+		ProcessByName: s.userInfo.RealName,
+		Note:          req.Note,
+		CreatedAt:     gtime.New(),
+		UpdatedAt:     gtime.New(),
+	})
+	return err
+}
+
+type id struct {
+	Id int
+}
+
+func (s RepairService) Processor(ctx context.Context) ([]repair.RepairProcessorRsp, error) {
+	rsp := []repair.RepairProcessorRsp{}
+	menu := &id{}
+	err := s.Dao.DB.Table("base_menu").
+		Where("Permission = ?", PermissionRepairProcess).
+		Fields("Id").Struct(menu)
+	if err == sql.ErrNoRows {
+		return nil, myerrors.NewMsgError(err,
+			fmt.Sprintf("未配置权限: %s", PermissionRepairProcess))
+	}
+	if err != nil {
+		return nil, err
+	}
+
+	roles := []id{}
+	err = s.Dao.DB.Table("base_role_menu").
+		Where("find_in_set(?, `MenuIds`)", menu.Id).
+		Fields("RoleId as Id").Structs(&roles)
+	if err == sql.ErrNoRows {
+		return rsp, nil
+	}
+	if err != nil {
+		return nil, err
+	}
+	if len(roles) == 0 {
+		return rsp, nil
+	}
+
+	dao := s.Dao.DB.Table("base_user a").LeftJoin("base_user_role b", "b.UserId=a.Id")
+	orsql := ""
+	for i, r := range roles {
+		if i != 0 {
+			orsql += " OR "
+		}
+		orsql += fmt.Sprintf("find_in_set(%d, `RoleIds`)", r.Id)
+	}
+	dao = dao.Where("a.Enabled = 1").Where(fmt.Sprintf("(%s)", orsql))
+	err = dao.Fields("a.Id, a.Realname").Structs(&rsp)
+	if err == sql.ErrNoRows {
+		return rsp, nil
+	}
+	return rsp, err
+}
+
+func Allow(tenant, uuid, permission string) (bool, error) {
+	permissionSrv := micro_srv.InitMicroSrvClient("Permission", "micro_srv.admin")
+	defer permissionSrv.Close()
+	rsp := &permission_def.PermissionResp{}
+	err := permissionSrv.Call(context.TODO(), "GetAllPermissionByUser", &permission_def.UuidReq{
+		Tenant: tenant,
+		Uuid:   uuid,
+	}, rsp)
+	if err != nil {
+		return false, fmt.Errorf("获取权限失败 %s", err.Error())
+	}
+	for _, p := range rsp.UserPermissions {
+		if p == permission {
+			return true, nil
+		}
+	}
+	return false, nil
+}

+ 292 - 0
swaggerui/swagger.yml

@@ -1005,6 +1005,180 @@ paths:
                   success:
                     $ref: "#/components/examples/success"
 
+    /Repair.List:
+      post:
+        tags:
+          - 报修
+        operationId: RepairList
+        summary: 查询报修
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/RepairList'
+              examples:
+                RepairList:
+                  $ref: '#/components/examples/RepairList'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
+
+    /Repair.Add:
+      post:
+        tags:
+          - 报修
+        operationId: RepairAdd
+        summary: 新增报修
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/RepairAdd'
+              examples:
+                RepairAdd:
+                  $ref: '#/components/examples/RepairAdd'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
+
+    /Repair.Get:
+      post:
+        tags:
+          - 报修
+        operationId: RepairGet
+        summary: 报修详情
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/IdReq'
+              examples:
+                RepairGet:
+                  $ref: '#/components/examples/RepairGet'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
+
+    /Repair.Trans:
+      post:
+        tags:
+          - 报修
+        operationId: RepairTrans
+        summary: 转交
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/RepairTrans'
+              examples:
+                RepairTrans:
+                  $ref: '#/components/examples/RepairTrans'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
+
+    /Repair.Process:
+      post:
+        tags:
+          - 报修
+        operationId: RepairProcess
+        summary: 处理
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/RepairProcess'
+              examples:
+                RepairProcess:
+                  $ref: '#/components/examples/RepairProcess'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
+
+    /Repair.Reactivate:
+      post:
+        tags:
+          - 报修
+        operationId: RepairReactivate
+        summary: 重新激活
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/RepairReactivate'
+              examples:
+                RepairReactivate:
+                  $ref: '#/components/examples/RepairReactivate'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
+
+    /Repair.Processor:
+      post:
+        tags:
+          - 报修
+        operationId: RepairProcessor
+        summary: 获取具有处理报修权限的用户
+        requestBody:
+          required: true
+          content:
+            application/json:
+              schema:
+                oneOf:
+                  - $ref: '#/components/schemas/NoArgs'
+              examples:
+                RepairProcessor:
+                  $ref: '#/components/examples/NoArgs'
+        responses:
+          200:
+            description: 请求成功
+            content:
+              application/json:
+                examples:
+                  success:
+                    $ref: "#/components/examples/success"
 
 # 添加这个 swagger ui 会显示授权按钮
 security:
@@ -1746,6 +1920,98 @@ components:
         note:
           type: string
           description: 描述
+    RepairList:
+      type: object
+      properties:
+        page:
+          type: object
+          description: 分页信息,不传默认不分页,返回所有数据
+          properties:
+            current:
+              type: integer
+              description: 当前页面
+            size:
+              type: integer
+              description: 每页条数
+        enable:
+          type: integer
+          description: 是否启用 0 未启用 1 启用
+        status:
+          type: integer
+          description: 处理状态 1 未处理 2 已处理
+        createdByName:
+          type: string
+          description: 创建者用户名
+        createdAtStart:
+          type: string
+          description: 创建时间
+        createdAtEnd:
+          type: string
+          description: 创建时间
+    RepairAdd:
+      type: object
+      required:
+        - type
+        - content
+        - mobile
+        - email
+      properties:
+        type:
+          type: integer
+          description: 报修类型
+        content:
+          type: string
+          description: 报修内容
+        mobile:
+          type: string
+          description: 联系方式
+        email:
+          type: string
+          description: 邮箱
+    RepairTrans:
+      type: object
+      required:
+        - id
+        - userId
+        - note
+      properties:
+        id:
+          type: integer
+          description: 报修 id
+        userId:
+          type: integer
+          description: 转交对象
+        note:
+          type: string
+          description: 描述
+    RepairProcess:
+      type: object
+      required:
+        - id
+        - type
+        - note
+      properties:
+        id:
+          type: integer
+          description: 报修 id
+        type:
+          type: integer
+          description: 处理方式
+        note:
+          type: string
+          description: 描述
+    RepairReactivate:
+      type: object
+      required:
+        - id
+        - note
+      properties:
+        id:
+          type: integer
+          description: 报修 id
+        note:
+          type: string
+          description: 描述
 
   examples:
     success:
@@ -1981,3 +2247,29 @@ components:
       value:
         id: 2
         note: 测试重新激活
+    RepairList:
+      value:
+        createdAtStart: "2022-04-29 11:00:00"
+    RepairGet:
+      value:
+        id: 2
+    RepairAdd:
+      value:
+        type: 1
+        content: 测试
+        mobile: "18001156784"
+        email: "123@123.com"
+    RepairTrans:
+      value:
+        id: 2
+        userId: 1
+        note: 测试转交
+    RepairProcess:
+      value:
+        id: 2
+        type: 1
+        note: 测试处理
+    RepairReactivate:
+      value:
+        id: 2
+        note: 测试重新激活