浏览代码

Merge branch 'develop' of http://code.dashoo.cn/chengjian/opms_backend into develop

liuyaqi 2 年之前
父节点
当前提交
ba89532b38

+ 434 - 0
opms_parent/app/dao/sys_report/internal/sys_report.go

@@ -0,0 +1,434 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"dashoo.cn/micro/app/model/sys_report"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+)
+
+// SysReportDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type SysReportDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns sysReportColumns
+}
+
+// SysReportColumns defines and stores column names for table sys_report.
+type sysReportColumns struct {
+	Id          string // 主键
+	ReportType  string // 报表类型(10数值指标,20数据报表)
+	ReportIcon  string // 报表图标
+	ReportCode  string // 报表代码
+	ReportName  string // 报表名称
+	ReportDesc  string // 报表描述
+	Remark      string // 备注
+	CreatedBy   string // 创建者
+	CreatedName string // 创建人
+	CreatedTime string // 创建时间
+	UpdatedBy   string // 更新者
+	UpdatedName string // 更新人
+	UpdatedTime string // 更新时间
+	DeletedTime string // 删除时间
+}
+
+var (
+	// SysReport is globally public accessible object for table sys_report operations.
+	SysReport = SysReportDao{
+		M:     g.DB("default").Model("sys_report").Safe(),
+		DB:    g.DB("default"),
+		Table: "sys_report",
+		Columns: sysReportColumns{
+			Id:          "id",
+			ReportType:  "report_type",
+			ReportIcon:  "report_icon",
+			ReportCode:  "report_code",
+			ReportName:  "report_name",
+			ReportDesc:  "report_desc",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+)
+
+func NewSysReportDao(tenant string) SysReportDao {
+	var dao SysReportDao
+	dao = SysReportDao{
+		M:     g.DB(tenant).Model("sys_report").Safe(),
+		DB:    g.DB(tenant),
+		Table: "sys_report",
+		Columns: sysReportColumns{
+			Id:          "id",
+			ReportType:  "report_type",
+			ReportIcon:  "report_icon",
+			ReportCode:  "report_code",
+			ReportName:  "report_name",
+			ReportDesc:  "report_desc",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+	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 *SysReportDao) Ctx(ctx context.Context) *SysReportDao {
+	return &SysReportDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *SysReportDao) As(as string) *SysReportDao {
+	return &SysReportDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *SysReportDao) TX(tx *gdb.TX) *SysReportDao {
+	return &SysReportDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *SysReportDao) Master() *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Slave() *SysReportDao {
+	return &SysReportDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *SysReportDao) Args(args ...interface{}) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) LeftJoin(table ...string) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) RightJoin(table ...string) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) InnerJoin(table ...string) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Fields(fieldNamesOrMapStruct ...interface{}) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *SysReportDao {
+	return &SysReportDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *SysReportDao) Option(option int) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) OmitEmpty() *SysReportDao {
+	return &SysReportDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *SysReportDao) Filter() *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Where(where interface{}, args ...interface{}) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) WherePri(where interface{}, args ...interface{}) *SysReportDao {
+	return &SysReportDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *SysReportDao) And(where interface{}, args ...interface{}) *SysReportDao {
+	return &SysReportDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *SysReportDao) Or(where interface{}, args ...interface{}) *SysReportDao {
+	return &SysReportDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *SysReportDao) Group(groupBy string) *SysReportDao {
+	return &SysReportDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *SysReportDao) Order(orderBy ...string) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Limit(limit ...int) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Offset(offset int) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Page(page, limit int) *SysReportDao {
+	return &SysReportDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *SysReportDao) Batch(batch int) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Cache(duration time.Duration, name ...string) *SysReportDao {
+	return &SysReportDao{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 *SysReportDao) Data(data ...interface{}) *SysReportDao {
+	return &SysReportDao{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.SysReport.
+// 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 *SysReportDao) All(where ...interface{}) ([]*sys_report.SysReport, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*sys_report.SysReport
+	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.SysReport.
+// 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 *SysReportDao) One(where ...interface{}) (*sys_report.SysReport, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *sys_report.SysReport
+	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 *SysReportDao) FindOne(where ...interface{}) (*sys_report.SysReport, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *sys_report.SysReport
+	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 *SysReportDao) FindAll(where ...interface{}) ([]*sys_report.SysReport, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*sys_report.SysReport
+	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 *SysReportDao) 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 *SysReportDao) 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 *SysReportDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *SysReportDao) Chunk(limit int, callback func(entities []*sys_report.SysReport, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*sys_report.SysReport
+		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 *SysReportDao) LockUpdate() *SysReportDao {
+	return &SysReportDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *SysReportDao) LockShared() *SysReportDao {
+	return &SysReportDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *SysReportDao) Unscoped() *SysReportDao {
+	return &SysReportDao{M: d.M.Unscoped()}
+}

+ 425 - 0
opms_parent/app/dao/sys_report/internal/sys_role_report.go

@@ -0,0 +1,425 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"dashoo.cn/micro/app/model/sys_report"
+	"database/sql"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"time"
+)
+
+// SysRoleReportDao is the manager for logic model data accessing
+// and custom defined data operations functions management.
+type SysRoleReportDao struct {
+	gmvc.M
+	DB      gdb.DB
+	Table   string
+	Columns sysRoleReportColumns
+}
+
+// SysRoleReportColumns defines and stores column names for table sys_role_report.
+type sysRoleReportColumns struct {
+	Id          string // 主键
+	RoleId      string // 角色ID
+	ReportId    string // 报表ID
+	Remark      string // 备注
+	CreatedBy   string // 创建者
+	CreatedName string // 创建人
+	CreatedTime string // 创建时间
+	UpdatedBy   string // 更新者
+	UpdatedName string // 更新人
+	UpdatedTime string // 更新时间
+	DeletedTime string // 删除时间
+}
+
+var (
+	// SysRoleReport is globally public accessible object for table sys_role_report operations.
+	SysRoleReport = SysRoleReportDao{
+		M:     g.DB("default").Model("sys_role_report").Safe(),
+		DB:    g.DB("default"),
+		Table: "sys_role_report",
+		Columns: sysRoleReportColumns{
+			Id:          "id",
+			RoleId:      "role_id",
+			ReportId:    "report_id",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+)
+
+func NewSysRoleReportDao(tenant string) SysRoleReportDao {
+	var dao SysRoleReportDao
+	dao = SysRoleReportDao{
+		M:     g.DB(tenant).Model("sys_role_report").Safe(),
+		DB:    g.DB(tenant),
+		Table: "sys_role_report",
+		Columns: sysRoleReportColumns{
+			Id:          "id",
+			RoleId:      "role_id",
+			ReportId:    "report_id",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+	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 *SysRoleReportDao) Ctx(ctx context.Context) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.Ctx(ctx)}
+}
+
+// As sets an alias name for current table.
+func (d *SysRoleReportDao) As(as string) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.As(as)}
+}
+
+// TX sets the transaction for current operation.
+func (d *SysRoleReportDao) TX(tx *gdb.TX) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.TX(tx)}
+}
+
+// Master marks the following operation on master node.
+func (d *SysRoleReportDao) Master() *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Slave() *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.Slave()}
+}
+
+// Args sets custom arguments for model operation.
+func (d *SysRoleReportDao) Args(args ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) LeftJoin(table ...string) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) RightJoin(table ...string) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) InnerJoin(table ...string) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Fields(fieldNamesOrMapStruct ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...)}
+}
+
+// Option sets the extra operation option for the model.
+func (d *SysRoleReportDao) Option(option int) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) OmitEmpty() *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.OmitEmpty()}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+func (d *SysRoleReportDao) Filter() *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Where(where interface{}, args ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) WherePri(where interface{}, args ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.WherePri(where, args...)}
+}
+
+// And adds "AND" condition to the where statement.
+func (d *SysRoleReportDao) And(where interface{}, args ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.And(where, args...)}
+}
+
+// Or adds "OR" condition to the where statement.
+func (d *SysRoleReportDao) Or(where interface{}, args ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.Or(where, args...)}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *SysRoleReportDao) Group(groupBy string) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.Group(groupBy)}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *SysRoleReportDao) Order(orderBy ...string) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Limit(limit ...int) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Offset(offset int) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Page(page, limit int) *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.Page(page, limit)}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *SysRoleReportDao) Batch(batch int) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Cache(duration time.Duration, name ...string) *SysRoleReportDao {
+	return &SysRoleReportDao{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 *SysRoleReportDao) Data(data ...interface{}) *SysRoleReportDao {
+	return &SysRoleReportDao{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.SysRoleReport.
+// 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 *SysRoleReportDao) All(where ...interface{}) ([]*sys_report.SysRoleReport, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*sys_report.SysRoleReport
+	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.SysRoleReport.
+// 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 *SysRoleReportDao) One(where ...interface{}) (*sys_report.SysRoleReport, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *sys_report.SysRoleReport
+	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 *SysRoleReportDao) FindOne(where ...interface{}) (*sys_report.SysRoleReport, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *sys_report.SysRoleReport
+	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 *SysRoleReportDao) FindAll(where ...interface{}) ([]*sys_report.SysRoleReport, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*sys_report.SysRoleReport
+	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 *SysRoleReportDao) 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 *SysRoleReportDao) 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 *SysRoleReportDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *SysRoleReportDao) Chunk(limit int, callback func(entities []*sys_report.SysRoleReport, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*sys_report.SysRoleReport
+		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 *SysRoleReportDao) LockUpdate() *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.LockUpdate()}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *SysRoleReportDao) LockShared() *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.LockShared()}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *SysRoleReportDao) Unscoped() *SysRoleReportDao {
+	return &SysRoleReportDao{M: d.M.Unscoped()}
+}

+ 36 - 0
opms_parent/app/dao/sys_report/sys_report.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package sys_report
+
+import (
+	"dashoo.cn/micro/app/dao/sys_report/internal"
+)
+
+// sysReportDao 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 sysReportDao struct {
+	internal.SysReportDao
+}
+
+var (
+	// SysReport is globally public accessible object for table sys_report operations.
+	SysReport = sysReportDao{
+		internal.SysReport,
+	}
+)
+
+type SysReportDao struct {
+	internal.SysReportDao
+}
+
+func NewSysReportDao(tenant string) *SysReportDao {
+	dao := internal.NewSysReportDao(tenant)
+	return &SysReportDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 36 - 0
opms_parent/app/dao/sys_report/sys_role_report.go

@@ -0,0 +1,36 @@
+// ============================================================================
+// This is auto-generated by gf cli tool only once. Fill this file as you wish.
+// ============================================================================
+
+package sys_report
+
+import (
+	"dashoo.cn/micro/app/dao/sys_report/internal"
+)
+
+// sysRoleReportDao 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 sysRoleReportDao struct {
+	internal.SysRoleReportDao
+}
+
+var (
+	// SysRoleReport is globally public accessible object for table sys_role_report operations.
+	SysRoleReport = sysRoleReportDao{
+		internal.SysRoleReport,
+	}
+)
+
+type SysRoleReportDao struct {
+	internal.SysRoleReportDao
+}
+
+func NewSysRoleReportDao(tenant string) *SysRoleReportDao {
+	dao := internal.NewSysRoleReportDao(tenant)
+	return &SysRoleReportDao{
+		dao,
+	}
+}
+
+// Fill with you ideas below.

+ 80 - 0
opms_parent/app/handler/sysreport/sys_report.go

@@ -0,0 +1,80 @@
+package sysreport
+
+import (
+	"context"
+	"dashoo.cn/common_definition/comm_def"
+	model "dashoo.cn/micro/app/model/contract"
+	"dashoo.cn/micro/app/model/sys_report"
+	service "dashoo.cn/micro/app/service/sys_report"
+	"github.com/gogf/gf/frame/g"
+)
+
+type SysReportHandler struct{}
+
+// Swagger:Report 报表,测试tag 获取报表列表
+func (c *SysReportHandler) GetList(ctx context.Context, req *sys_report.SysReportListReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.List request %#v ", *req)
+	s, err := service.NewSysReportService(ctx)
+	if err != nil {
+		return err
+	}
+	total, ent, err := s.List(ctx, req)
+	if err != nil {
+		return err
+	}
+	rsp.Data = g.Map{"list": ent, "total": total}
+	return nil
+}
+
+// Swagger:Report 报表,测试tag 添加数据
+func (c *SysReportHandler) Create(ctx context.Context, req *sys_report.SysReport, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Add request %#v ", *req)
+	s, err := service.NewSysReportService(ctx)
+	if err != nil {
+		return err
+	}
+	id, err := s.Add(ctx, req)
+	rsp.Data = g.Map{"list": id}
+	return nil
+}
+
+// Swagger:Report 报表,测试tag 更新数据
+func (c *SysReportHandler) UpdateById(ctx context.Context, req *sys_report.SysReport, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Update request %#v ", *req)
+	s, err := service.NewSysReportService(ctx)
+	if err != nil {
+		return err
+	}
+	id, err := s.Update(ctx, req)
+	rsp.Data = g.Map{"list": id}
+	return nil
+}
+
+// Swagger:Report 报表,测试tag 删除数据
+func (c *SysReportHandler) DeleteByIds(ctx context.Context, req *sys_report.IdsReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Delete request %#v ", *req)
+	s, err := service.NewSysReportService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Delete(ctx, req.Id)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// Swagger:Report 报表,测试tag 数据详情
+func (c *SysReportHandler) GetEntityById(ctx context.Context, req *model.IdRequiredReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Get request %#v ", *req)
+	s, err := service.NewSysReportService(ctx)
+	if err != nil {
+		return err
+	}
+	ent, err := s.Get(ctx, req.Id)
+	if err != nil {
+		return err
+	}
+	rsp.Data = ent
+	return nil
+}

+ 5 - 0
opms_parent/app/handler/sysreport/sys_report_test.go

@@ -0,0 +1,5 @@
+package sysreport
+
+func Add() {
+
+}

+ 80 - 0
opms_parent/app/handler/sysreport/sys_role_report.go

@@ -0,0 +1,80 @@
+package sysreport
+
+import (
+	"context"
+	"dashoo.cn/common_definition/comm_def"
+	model "dashoo.cn/micro/app/model/contract"
+	"dashoo.cn/micro/app/model/sys_report"
+	service "dashoo.cn/micro/app/service/sys_report"
+	"github.com/gogf/gf/frame/g"
+)
+
+type SysRoleReportHandler struct{}
+
+// Swagger:RoleReport 获取列表数据
+func (c *SysRoleReportHandler) GetList(ctx context.Context, req *sys_report.SysRoleReportListReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.List request %#v ", *req)
+	s, err := service.NewSysRoleReportService(ctx)
+	if err != nil {
+		return err
+	}
+	total, ent, err := s.List(ctx, req)
+	if err != nil {
+		return err
+	}
+	rsp.Data = g.Map{"list": ent, "total": total}
+	return nil
+}
+
+// Swagger:RoleReport 添加数据
+func (c *SysRoleReportHandler) Add(ctx context.Context, req *sys_report.SysRoleReport, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Add request %#v ", *req)
+	s, err := service.NewSysRoleReportService(ctx)
+	if err != nil {
+		return err
+	}
+	id, err := s.Add(ctx, req)
+	rsp.Data = g.Map{"list": id}
+	return nil
+}
+
+// Swagger:RoleReport 更新数据
+func (c *SysRoleReportHandler) Update(ctx context.Context, req *sys_report.SysRoleReport, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Update request %#v ", *req)
+	s, err := service.NewSysRoleReportService(ctx)
+	if err != nil {
+		return err
+	}
+	id, err := s.Update(ctx, req)
+	rsp.Data = g.Map{"list": id}
+	return nil
+}
+
+// Swagger:RoleReport 删除数据
+func (c *SysRoleReportHandler) Delete(ctx context.Context, req *sys_report.IdsReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Delete request %#v ", *req)
+	s, err := service.NewSysRoleReportService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Delete(ctx, req.Id)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+// Swagger:RoleReport 数据详情
+func (c *SysRoleReportHandler) Get(ctx context.Context, req *model.IdRequiredReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("SysReportHandler.Get request %#v ", *req)
+	s, err := service.NewSysRoleReportService(ctx)
+	if err != nil {
+		return err
+	}
+	ent, err := s.Get(ctx, req.Id)
+	if err != nil {
+		return err
+	}
+	rsp.Data = ent
+	return nil
+}

+ 7 - 0
opms_parent/app/model/home/report.go

@@ -0,0 +1,7 @@
+package home
+
+type ReportData struct {
+	XData       []string  `json:"xData"`
+	YDataTarget []float64 `json:"yDataTarget"`
+	YDataReal   []float64 `json:"yDataReal"`
+}

+ 27 - 0
opms_parent/app/model/sys_report/internal/sys_report.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"
+)
+
+// SysReport is the golang structure for table sys_report.
+type SysReport struct {
+    Id          int         `orm:"id,primary"   json:"id"`          // 主键
+    ReportType  string      `orm:"report_type"  json:"reportType"`  // 报表类型(10数值指标,20数据报表)
+    ReportIcon  string      `orm:"report_icon"  json:"reportIcon"`  // 报表图标
+    ReportCode  string      `orm:"report_code"  json:"reportCode"`  // 报表代码
+    ReportName  string      `orm:"report_name"  json:"reportName"`  // 报表名称
+    ReportDesc  string      `orm:"report_desc"  json:"reportDesc"`  // 报表描述
+    Remark      string      `orm:"remark"       json:"remark"`      // 备注
+    CreatedBy   int         `orm:"created_by"   json:"createdBy"`   // 创建者
+    CreatedName string      `orm:"created_name" json:"createdName"` // 创建人
+    CreatedTime *gtime.Time `orm:"created_time" json:"createdTime"` // 创建时间
+    UpdatedBy   int         `orm:"updated_by"   json:"updatedBy"`   // 更新者
+    UpdatedName string      `orm:"updated_name" json:"updatedName"` // 更新人
+    UpdatedTime *gtime.Time `orm:"updated_time" json:"updatedTime"` // 更新时间
+    DeletedTime *gtime.Time `orm:"deleted_time" json:"deletedTime"` // 删除时间
+}

+ 24 - 0
opms_parent/app/model/sys_report/internal/sys_role_report.go

@@ -0,0 +1,24 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+    "github.com/gogf/gf/os/gtime"
+)
+
+// SysRoleReport is the golang structure for table sys_role_report.
+type SysRoleReport struct {
+    Id          int         `orm:"id,primary"   json:"id"`          // 主键      
+    RoleId      int         `orm:"role_id"      json:"roleId"`      // 角色ID    
+    ReportId    int         `orm:"report_id"    json:"reportId"`    // 报表ID    
+    Remark      string      `orm:"remark"       json:"remark"`      // 备注      
+    CreatedBy   int         `orm:"created_by"   json:"createdBy"`   // 创建者    
+    CreatedName string      `orm:"created_name" json:"createdName"` // 创建人    
+    CreatedTime *gtime.Time `orm:"created_time" json:"createdTime"` // 创建时间  
+    UpdatedBy   int         `orm:"updated_by"   json:"updatedBy"`   // 更新者    
+    UpdatedName string      `orm:"updated_name" json:"updatedName"` // 更新人    
+    UpdatedTime *gtime.Time `orm:"updated_time" json:"updatedTime"` // 更新时间  
+    DeletedTime *gtime.Time `orm:"deleted_time" json:"deletedTime"` // 删除时间  
+}

+ 40 - 0
opms_parent/app/model/sys_report/sys_report.go

@@ -0,0 +1,40 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package sys_report
+
+import (
+	"dashoo.cn/micro/app/model/sys_report/internal"
+	"dashoo.cn/opms_libary/request"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// SysReport is the golang structure for table sys_report.
+type SysReport internal.SysReport
+
+// Fill with you ideas below.
+
+type SysReportListReq struct {
+	request.PageReq
+	Id          int         `json:"id"`          // 主键
+	ReportType  string      `json:"reportType"`  // 报表类型(10数值指标,20数据报表)
+	ReportIcon  string      `json:"reportIcon"`  // 报表图标
+	ReportCode  string      `json:"reportCode"`  // 报表代码
+	ReportName  string      `json:"reportName"`  // 报表名称
+	ReportDesc  string      `json:"reportDesc"`  // 报表描述
+	Remark      string      `json:"remark"`      // 备注
+	CreatedBy   int         `json:"createdBy"`   // 创建者
+	CreatedName string      `json:"createdName"` // 创建人
+	CreatedTime *gtime.Time `json:"createdTime"` // 创建时间
+	UpdatedBy   int         `json:"updatedBy"`   // 更新者
+	UpdatedName string      `json:"updatedName"` // 更新人
+	UpdatedTime *gtime.Time `json:"updatedTime"` // 更新时间
+	DeletedTime *gtime.Time `json:"deletedTime"` // 删除时间
+}
+type IdsReq struct {
+	Id []int `json:"ids"`
+}
+type IdRequiredReq struct {
+	Id int `json:"id" v:"required#请输入Id"`
+}

+ 33 - 0
opms_parent/app/model/sys_report/sys_role_report.go

@@ -0,0 +1,33 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package sys_report
+
+import (
+	"dashoo.cn/micro/app/model/sys_report/internal"
+	"dashoo.cn/opms_libary/request"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// SysRoleReport is the golang structure for table sys_role_report.
+type SysRoleReport internal.SysRoleReport
+
+// Fill with you ideas below.
+// SysRoleReport is the golang structure for table sys_role_report.
+type SysRoleReportListReq struct {
+	request.PageReq
+	Id          int         `     json:"id"`      // ID
+	RoleId      int         `     json:"roleId"`  // 角色ID
+	ReportId    int         `   json:"reportId"`  // 报表ID
+	Remark      string      ` json:"remark"`      // 备注
+	CreatedBy   int         `  json:"createdBy"`  // 创建者
+	CreatedName string      ` json:"createdName"` // 创建人
+	CreatedTime *gtime.Time ` json:"createdTime"` // 创建时间
+	UpdatedBy   int         `  json:"updatedBy"`  // 更新者
+	UpdatedName string      ` json:"updatedName"` // 更新人
+	UpdatedTime *gtime.Time ` json:"updatedTime"` // 更新时间
+	DeletedTime *gtime.Time ` json:"deletedTime"` // 删除时间
+	RoleName    string      `json:"roleName"`     // 角色名称
+	ReportName  string      `json:"reportName"`   // 报表名称
+}

+ 20 - 5
opms_parent/app/service/home/home.go

@@ -50,7 +50,7 @@ func (s *HomeService) QueryHomeNumReportData(param *home.SearchNumReportData) (r
 	for _, v := range param.ReportId {
 		numReport := new(home.NumReportResponse)
 		numReport.Id = v
-		value, _ := getReportData(v)
+		value, _ := s.getReportData(v, nil)
 		numReport.Data = value
 		numConfig = append(numConfig, numReport)
 	}
@@ -61,8 +61,9 @@ func (s *HomeService) QueryHomeNumReportData(param *home.SearchNumReportData) (r
 }
 
 func (s *HomeService) QueryHomeDataReportData(param *home.SearchDataReportData) (resp *home.DataReportResponse, err error) {
+	resp = new(home.DataReportResponse)
 	resp.Id = param.ReportId
-	value, err := getReportData(param.ReportId)
+	value, err := s.getReportData(param.ReportId, &param.Params)
 	if err != nil {
 		return nil, err
 	}
@@ -71,12 +72,26 @@ func (s *HomeService) QueryHomeDataReportData(param *home.SearchDataReportData)
 	return
 }
 
-func getReportData(id int64) (interface{}, error) {
+// 10000-20000之间:个人看板数据 TODO 疑似与 sys_report 表对应?
+// 20000-30000之间:报表数据 TODO 疑似与 sys_report 表对应?
+func (s *HomeService) getReportData(id int64, params *map[string]interface{}) (interface{}, error) {
 	switch id {
-	case 0:
+	case 10000:
+		// 个人看板数据
 		return nil, nil
+	case 20000:
+		// 报表数据   个人销售金额
+		return getPersonalContractReportData(s.ContextService.Ctx, "CONTRACT", params)
+	case 20001:
+		// 报表数据   个人销售回款
+		return getPersonalContractReportData(s.ContextService.Ctx, "COLLECTION", params)
+	case 20002:
+		// 报表数据   总部销售金额
+		return getCompanyContractReportData(s.ContextService.Ctx, "CONTRACT", params)
+	case 20003:
+		// 报表数据   总部销售回款
+		return getCompanyContractReportData(s.ContextService.Ctx, "COLLECTION", params)
 	default:
 		return nil, nil
-
 	}
 }

+ 156 - 0
opms_parent/app/service/home/report.go

@@ -0,0 +1,156 @@
+package home
+
+import (
+	"context"
+	"dashoo.cn/micro/app/model/home"
+	contractService "dashoo.cn/micro/app/service/contract"
+	"dashoo.cn/opms_libary/micro_srv"
+	"database/sql"
+	"fmt"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gconv"
+)
+
+// getPersonalContractReportData 获取个人数据
+// dataType:collection为回款;其他为合同
+func getPersonalContractReportData(ctx context.Context, dataType string, params *map[string]interface{}) (*home.ReportData, error) {
+	var reportData home.ReportData
+	targetMap := make(map[int]gdb.Record, 0)
+	realMap := make(map[int][]*gdb.Record, 0)
+	targetField := "sales_target"
+	realField := "contract_amount"
+	year := gtime.Now().Format("Y")
+	if params != nil && (*params)["year"] != nil {
+		year = gconv.String((*params)["year"])
+	}
+	// 统计字段
+	if dataType == "COLLECTION" {
+		targetField = "collection_target"
+		realField = "collection_amount"
+	}
+
+	srv, err := contractService.NewCtrContractService(ctx)
+	if err != nil {
+		return nil, err
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+
+	targets, err := srv.Dao.DB.Model("rpt_sales_target").Where("sale_user_id", userInfo.Id).Order("monthly ASC").FindAll()
+	if err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	for index, target := range targets {
+		targetMap[target["monthly"].Int()] = targets[index]
+	}
+	// 统计12个月份的数据
+	// 统计目标值
+	for index := 1; index <= 12; index++ {
+		reportData.XData = append(reportData.XData, fmt.Sprintf("%v月", index))
+		if target, ok := targetMap[index]; ok {
+			reportData.YDataTarget = append(reportData.YDataTarget, target[targetField].Float64())
+		} else {
+			reportData.YDataTarget = append(reportData.YDataTarget, 0)
+		}
+	}
+	// 统计合同值
+	contractModel := srv.Dao.DB.Model("ctr_contract").Where("ctr_contract.incharge_id", userInfo.Id)
+	if dataType != "COLLECTION" {
+		contracts, err := contractModel.Where("ctr_contract.contract_start_time LIKE ?", year+"-%").Order("ctr_contract.contract_start_time ASC").FindAll()
+		if err != nil && err != sql.ErrNoRows {
+			return nil, err
+		}
+		for index, contract := range contracts {
+			realMap[contract["contract_start_time"].GTime().Month()] = append(realMap[contract["contract_start_time"].GTime().Month()], &contracts[index])
+		}
+	} else {
+		// 回款数据统计
+		collections, err := contractModel.InnerJoin("ctr_contract_collection", "ctr_contract.id=ctr_contract_collection.contract_id").Where("ctr_contract_collection.appro_status", "20").Where("ctr_contract_collection.collection_datetime LIKE ?", year+"-%").Order("ctr_contract_collection.collection_datetime ASC").Fields("ctr_contract_collection.*").FindAll()
+		if err != nil && err != sql.ErrNoRows {
+			return nil, err
+		}
+		for index, collection := range collections {
+			realMap[collection["collection_datetime"].GTime().Month()] = append(realMap[collection["collection_datetime"].GTime().Month()], &collections[index])
+		}
+	}
+	// 统计12个月份的数据
+	// 统计实际值
+	for index := 1; index <= 12; index++ {
+		if realData, ok := realMap[index]; ok {
+			realAmount := float64(0)
+			for _, data := range realData {
+				realAmount += (*data)[realField].Float64()
+			}
+			reportData.YDataReal = append(reportData.YDataReal, realAmount)
+		} else {
+			reportData.YDataReal = append(reportData.YDataReal, 0)
+		}
+	}
+
+	return &reportData, nil
+}
+
+// getCompanyContractReportData 获取个人数据
+// dataType:collection为回款;其他为合同
+func getCompanyContractReportData(ctx context.Context, dataType string, params *map[string]interface{}) (*home.ReportData, error) {
+	var reportData home.ReportData
+	realMap := make(map[int]gdb.Record, 0)
+	targetField := "sales_target"
+	realField := "contract_amount"
+	year := gtime.Now().Format("Y")
+	if params != nil && (*params)["year"] != nil {
+		year = gconv.String((*params)["year"])
+	}
+	// 统计字段
+	if dataType == "COLLECTION" {
+		targetField = "collection_target"
+		realField = "collection_amount"
+	}
+
+	srv, err := contractService.NewCtrContractService(ctx)
+	if err != nil {
+		return nil, err
+	}
+
+	targets, err := srv.Dao.DB.Model("rpt_sales_target").Order("sale_user_id ASC").Group("sale_user_id").Fields(fmt.Sprintf("sale_user_id, sale_user_name, SUM(%v) %v", targetField, targetField)).FindAll()
+	if err != nil && err != sql.ErrNoRows {
+		return nil, err
+	}
+	// 统计合同值
+	contractModel := srv.Dao.DB.Model("ctr_contract").Group("ctr_contract.incharge_id").Order("ctr_contract.incharge_id ASC")
+	if dataType != "COLLECTION" {
+		contracts, err := contractModel.Where("ctr_contract.contract_start_time LIKE ?", year+"-%").Fields("ctr_contract.incharge_id, ctr_contract.incharge_name, SUM(ctr_contract.contract_amount) contract_amount").FindAll()
+		if err != nil && err != sql.ErrNoRows {
+			return nil, err
+		}
+		for index, contract := range contracts {
+			realMap[contract["incharge_id"].Int()] = contracts[index]
+		}
+	} else {
+		// 回款数据统计
+		collections, err := contractModel.InnerJoin("ctr_contract_collection", "ctr_contract.id=ctr_contract_collection.contract_id").Where("ctr_contract_collection.appro_status", "20").Where("ctr_contract_collection.collection_datetime LIKE ?", year+"-%").Fields("ctr_contract.incharge_id, ctr_contract.incharge_name, SUM(ctr_contract_collection.collection_amount) collection_amount").FindAll()
+		if err != nil && err != sql.ErrNoRows {
+			return nil, err
+		}
+		for index, collection := range collections {
+			realMap[collection["incharge_id"].Int()] = collections[index]
+		}
+	}
+
+	// 统计目标值和实际值
+	for _, target := range targets {
+		reportData.XData = append(reportData.XData, target["sale_user_name"].String())
+		reportData.YDataTarget = append(reportData.YDataTarget, target[targetField].Float64())
+		if realData, ok := realMap[target["sale_user_id"].Int()]; ok {
+			reportData.YDataReal = append(reportData.YDataReal, realData[realField].Float64())
+		} else {
+			reportData.YDataReal = append(reportData.YDataReal, 0)
+		}
+	}
+
+	return &reportData, nil
+}

+ 3 - 0
opms_parent/app/service/plat/plat_followup.go

@@ -127,6 +127,9 @@ func (s *followupService) GetListByDay(req *model.SearchPlatFollowupReq) (total
 	if req.ManagerId != "" {
 		followupModel = followupModel.Where("created_by", req.ManagerId)
 	}
+	if req.IsMyself == "1" {
+		followupModel = followupModel.Where("created_by", s.GetCxtUserId())
+	}
 	// 日期条件
 	if req.DaysBeforeToday >= 0 { // 获取前N天的跟进记录
 		now := gtime.Now()

+ 121 - 0
opms_parent/app/service/sys_report/sys_report.go

@@ -0,0 +1,121 @@
+package service
+
+import (
+	"context"
+	dao "dashoo.cn/micro/app/dao/sys_report"
+	"dashoo.cn/micro/app/model/sys_report"
+	model "dashoo.cn/micro/app/model/sys_report"
+	"dashoo.cn/opms_libary/micro_srv"
+	"dashoo.cn/opms_libary/myerrors"
+	"dashoo.cn/opms_libary/request"
+	"database/sql"
+	"fmt"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gconv"
+	"github.com/gogf/gf/util/gvalid"
+)
+
+type SysReportService struct {
+	Dao      *dao.SysReportDao
+	Tenant   string
+	userInfo request.UserInfo
+}
+
+func NewSysReportService(ctx context.Context) (*SysReportService, error) {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		err = myerrors.TipsError(fmt.Sprintf("获取租户码异常:%s", err.Error()))
+		return nil, err //fmt.Errorf("获取租户码异常:%s", err.Error())
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+	return &SysReportService{
+		Dao:      dao.NewSysReportDao(tenant),
+		Tenant:   tenant,
+		userInfo: userInfo,
+	}, nil
+}
+func (s SysReportService) List(ctx context.Context, req *sys_report.SysReportListReq) (int, interface{}, error) {
+
+	dao := &s.Dao.SysReportDao
+	if req.ReportName != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.ReportName)
+		dao = dao.Where("(report_name LIKE ? || report_name LIKE ?)", likestr, likestr)
+	}
+	if req.ReportType != "" {
+		dao = dao.Where("report_type=?", req.ReportType)
+	}
+	total, err := dao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+	if req.PageNum != 0 {
+		dao = dao.Page(req.GetPage())
+	}
+	orderby := "created_time desc"
+	if req.OrderBy != "" {
+		orderby = req.OrderBy
+	}
+	dao = dao.Order(orderby)
+
+	ents := []*model.SysReport{}
+	err = dao.Structs(&ents)
+	if err != nil && err != sql.ErrNoRows {
+		return 0, nil, err
+	}
+	if len(ents) > 0 {
+		
+	}
+
+	return total, ents, err
+}
+func (s SysReportService) Add(ctx context.Context, req *sys_report.SysReport) (int, error) {
+
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.TipsError(validErr.Current().Error())
+	}
+	req.CreatedBy = s.userInfo.Id
+	req.CreatedName = s.userInfo.UserName
+	req.CreatedTime = gtime.Now()
+	res, err := s.Dao.Insert(req)
+	if err != nil {
+		return 0, err
+	}
+	id, err := res.LastInsertId()
+	return gconv.Int(id), err
+}
+func (s SysReportService) Update(ctx context.Context, req *sys_report.SysReport) (int, error) {
+
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.TipsError(validErr.Current().Error())
+	}
+	req.UpdatedBy = s.userInfo.Id
+	req.UpdatedName = s.userInfo.UserName
+	req.UpdatedTime = gtime.Now()
+	res, err := s.Dao.Where("Id=?", req.Id).Data(req).Update()
+	if err != nil {
+		return 0, err
+	}
+	id, err := res.LastInsertId()
+	return gconv.Int(id), err
+}
+func (s SysReportService) Delete(ctx context.Context, Id []int) error {
+	if len(Id) == 0 {
+		return nil
+	}
+	_, err := s.Dao.Where("Id  IN (?)", Id).Data(g.Map{"deleted_time": gtime.Now()}).Update()
+	return err
+}
+func (s SysReportService) Get(ctx context.Context, id int) (entity model.SysReport, err error) {
+	err = s.Dao.Where("Id = ?", id).Scan(&entity)
+	if err != nil {
+		return entity, err
+	}
+	return entity, err
+}

+ 118 - 0
opms_parent/app/service/sys_report/sys_role_report.go

@@ -0,0 +1,118 @@
+package service
+
+import (
+	"context"
+	dao "dashoo.cn/micro/app/dao/sys_report"
+	"dashoo.cn/micro/app/model/sys_report"
+	model "dashoo.cn/micro/app/model/sys_report"
+	"dashoo.cn/opms_libary/micro_srv"
+	"dashoo.cn/opms_libary/myerrors"
+	"dashoo.cn/opms_libary/request"
+	"database/sql"
+	"fmt"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gconv"
+	"github.com/gogf/gf/util/gvalid"
+)
+
+type SysRoleReportService struct {
+	Dao      *dao.SysRoleReportDao
+	Tenant   string
+	userInfo request.UserInfo
+}
+
+func NewSysRoleReportService(ctx context.Context) (*SysRoleReportService, error) {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		err = myerrors.TipsError(fmt.Sprintf("获取租户码异常:%s", err.Error()))
+		return nil, err //fmt.Errorf("获取租户码异常:%s", err.Error())
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+	return &SysRoleReportService{
+		Dao:      dao.NewSysRoleReportDao(tenant),
+		Tenant:   tenant,
+		userInfo: userInfo,
+	}, nil
+}
+func (s SysRoleReportService) List(ctx context.Context, req *sys_report.SysRoleReportListReq) (int, []model.SysRoleReportListReq, error) {
+
+	dao := s.Dao.Unscoped().As("a").
+		LeftJoin("sys_role b", "a.role_id = b.id AND b.deleted_time is  null ").
+		LeftJoin("sys_report c", "c.id=a.report_id  AND c.deleted_time is  null ").Where("a.report_id=? and a.deleted_time is null", req.ReportId)
+	total, err := dao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+	if req.PageNum != 0 {
+		dao = dao.Page(req.GetPage())
+	}
+	orderby := "a.created_time desc"
+	if req.OrderBy != "" {
+		orderby = req.OrderBy
+	}
+	dao = dao.Fields("a.*,b.role_name,c.report_name").Order(orderby)
+
+	ents := []model.SysRoleReportListReq{}
+	err = dao.Scan(&ents)
+	if err != nil && err != sql.ErrNoRows {
+		return 0, nil, err
+	}
+	return total, ents, err
+}
+func (s SysRoleReportService) Add(ctx context.Context, req *sys_report.SysRoleReport) (int, error) {
+
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.TipsError(validErr.Current().Error())
+	}
+	req.CreatedBy = s.userInfo.Id
+	req.CreatedName = s.userInfo.UserName
+	req.CreatedTime = gtime.Now()
+	res, err := s.Dao.Insert(req)
+	if err != nil {
+		return 0, err
+	}
+	id, err := res.LastInsertId()
+	return gconv.Int(id), err
+}
+func (s SysRoleReportService) Update(ctx context.Context, req *sys_report.SysRoleReport) (int, error) {
+
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.TipsError(validErr.Current().Error())
+	}
+	req.UpdatedBy = s.userInfo.Id
+	req.UpdatedName = s.userInfo.UserName
+	req.UpdatedTime = gtime.Now()
+	res, err := s.Dao.Where("Id=?", req.Id).Data(req).Update()
+	if err != nil {
+		return 0, err
+	}
+	id, err := res.LastInsertId()
+	if err != nil {
+		return 0, err
+	}
+	return gconv.Int(id), err
+}
+func (s SysRoleReportService) Delete(ctx context.Context, Id []int) error {
+	if len(Id) == 0 {
+		return nil
+	}
+	_, err := s.Dao.Where("Id  IN (?)", Id).Data(g.Map{"DeletedTime": gtime.Now()}).Update()
+	return err
+}
+func (s SysRoleReportService) Get(ctx context.Context, id int) (entity *model.SysRoleReport, err error) {
+	err = s.Dao.Where("Id = ?", id).Scan(entity)
+	if err != nil {
+		return nil, err
+	}
+	if entity == nil {
+		return nil, myerrors.TipsError("不存在")
+	}
+	return entity, err
+}

+ 6 - 0
opms_parent/main.go

@@ -5,6 +5,8 @@ import (
 	"net/http"
 
 	"dashoo.cn/micro/app/handler/dingtalk"
+	"dashoo.cn/micro/app/handler/home"
+	"dashoo.cn/micro/app/handler/sysreport"
 	"dashoo.cn/micro/app/handler/workflow"
 	"dashoo.cn/opms_libary/dynamic"
 	"dashoo.cn/opms_libary/myerrors"
@@ -57,6 +59,10 @@ func main() {
 	s.RegisterName("Schedule", new(plat.ScheduleHeader), "")
 	s.RegisterName("PlatWorkflow", new(workflow.PlatWorkflowHandler), "")
 	s.RegisterName("DingUpload", new(dingtalk.DingUploadHandler), "")
+	s.RegisterName("Report", new(sysreport.SysReportHandler), "")
+	s.RegisterName("RoleReport", new(sysreport.SysRoleReportHandler), "")
+	// 首页
+	s.RegisterName("Home", new(home.HomeHandler), "")
 
 	// 钉钉回调接口
 	s.RegisterName("DingEvent", new(dingtalk.DingHandler), "")