Browse Source

Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	opms_parent/main.go
yanglingling 1 year ago
parent
commit
bdd243f1e5

+ 36 - 0
opms_parent/app/dao/contract/ctr_contract_sale_target.go

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

+ 36 - 0
opms_parent/app/dao/contract/ctr_contract_share.go

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

+ 790 - 0
opms_parent/app/dao/contract/internal/ctr_contract_sale_target.go

@@ -0,0 +1,790 @@
+// ==========================================================================
+// 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 "dashoo.cn/micro/app/model/contract"
+)
+
+// CtrContractSaleTargetDao is the manager for logic model data accessing and custom defined data operations functions management.
+type CtrContractSaleTargetDao struct {
+	gmvc.M                               // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
+	C       ctrContractSaleTargetColumns // C is the short type for Columns, which contains all the column names of Table for convenient usage.
+	DB      gdb.DB                       // DB is the raw underlying database management object.
+	Table   string                       // Table is the underlying table name of the DAO.
+	TableAs string                       // TableAs is the underlying table alias name of the DAO.
+}
+
+// CtrContractSaleTargetColumns defines and stores column names for table ctr_contract_sale_target.
+type ctrContractSaleTargetColumns struct {
+	Id                    string // 主键
+	SaleId                string // 归属销售
+	SaleName              string // 销售姓名
+	Year                  string // 年度
+	Plan1                 string // 1月计划
+	Complete1             string // 1月达成
+	Plan2                 string // 2月计划
+	Complete2             string // 2月达成
+	Plan3                 string // 3月计划
+	Complete3             string // 3月达成
+	QuarterPlan1          string // 第一季度计划
+	QuarterComplete1      string // 第一季度达成
+	QuarterCompleteRatio1 string // 第一季度完成率
+	Plan4                 string // 4月计划
+	Complete4             string // 4月达成
+	Plan5                 string // 5月计划
+	Complete5             string // 5月达成
+	Plan6                 string // 6月计划
+	Complete6             string // 6月达成
+	QuarterPlan2          string // 第二季度计划
+	QuarterComplete2      string // 第二季度达成
+	QuarterCompleteRatio2 string // 第二季度完成率
+	Plan7                 string // 7月计划
+	Complete7             string // 7月达成
+	Plan8                 string // 8月计划
+	Complete8             string // 8月达成
+	Plan9                 string // 9月计划
+	Complete9             string // 9月达成
+	QuarterPlan3          string // 第三季度计划
+	QuarterComplete3      string // 第三季度达成
+	QuarterCompleteRatio3 string // 第三季度完成率
+	Plan10                string // 10月计划
+	Complete10            string // 10月达成
+	Plan11                string // 11月计划
+	Complete11            string // 11月达成
+	Plan12                string // 12月计划
+	Complete12            string // 12月达成
+	YearPlan              string // 年度计划
+	YearComplete          string // 年度达成
+	YearCompleteRatio     string // 年度完成率
+	Remark                string // 备注
+	CreatedBy             string // 创建者
+	CreatedName           string // 创建人
+	CreatedTime           string // 创建时间
+	UpdatedBy             string // 更新者
+	UpdatedName           string // 更新人
+	UpdatedTime           string // 更新时间
+	DeletedTime           string // 删除时间
+}
+
+var (
+	// CtrContractSaleTarget is globally public accessible object for table ctr_contract_sale_target operations.
+	CtrContractSaleTarget = CtrContractSaleTargetDao{
+		M:     g.DB("default").Model("ctr_contract_sale_target").Safe(),
+		DB:    g.DB("default"),
+		Table: "ctr_contract_sale_target",
+		C: ctrContractSaleTargetColumns{
+			Id:                    "id",
+			SaleId:                "sale_id",
+			SaleName:              "sale_name",
+			Year:                  "year",
+			Plan1:                 "plan1",
+			Complete1:             "complete1",
+			Plan2:                 "plan2",
+			Complete2:             "complete2",
+			Plan3:                 "plan3",
+			Complete3:             "complete3",
+			QuarterPlan1:          "quarter_plan1",
+			QuarterComplete1:      "quarter_complete1",
+			QuarterCompleteRatio1: "quarter_complete_ratio1",
+			Plan4:                 "plan4",
+			Complete4:             "complete4",
+			Plan5:                 "plan5",
+			Complete5:             "complete5",
+			Plan6:                 "plan6",
+			Complete6:             "complete6",
+			QuarterPlan2:          "quarter_plan2",
+			QuarterComplete2:      "quarter_complete2",
+			QuarterCompleteRatio2: "quarter_complete_ratio2",
+			Plan7:                 "plan7",
+			Complete7:             "complete7",
+			Plan8:                 "plan8",
+			Complete8:             "complete8",
+			Plan9:                 "plan9",
+			Complete9:             "complete9",
+			QuarterPlan3:          "quarter_plan3",
+			QuarterComplete3:      "quarter_complete3",
+			QuarterCompleteRatio3: "quarter_complete_ratio3",
+			Plan10:                "plan10",
+			Complete10:            "complete10",
+			Plan11:                "plan11",
+			Complete11:            "complete11",
+			Plan12:                "plan12",
+			Complete12:            "complete12",
+			YearPlan:              "year_plan",
+			YearComplete:          "year_complete",
+			YearCompleteRatio:     "year_complete_ratio",
+			Remark:                "remark",
+			CreatedBy:             "created_by",
+			CreatedName:           "created_name",
+			CreatedTime:           "created_time",
+			UpdatedBy:             "updated_by",
+			UpdatedName:           "updated_name",
+			UpdatedTime:           "updated_time",
+			DeletedTime:           "deleted_time",
+		},
+	}
+)
+
+func NewCtrContractSaleTargetDao(tenant string) CtrContractSaleTargetDao {
+	var dao CtrContractSaleTargetDao
+	dao = CtrContractSaleTargetDao{
+		M:     g.DB(tenant).Model("ctr_contract_sale_target").Safe(),
+		DB:    g.DB(tenant),
+		Table: "ctr_contract_sale_target",
+		C: ctrContractSaleTargetColumns{
+			Id:                    "id",
+			SaleId:                "sale_id",
+			SaleName:              "sale_name",
+			Year:                  "year",
+			Plan1:                 "plan1",
+			Complete1:             "complete1",
+			Plan2:                 "plan2",
+			Complete2:             "complete2",
+			Plan3:                 "plan3",
+			Complete3:             "complete3",
+			QuarterPlan1:          "quarter_plan1",
+			QuarterComplete1:      "quarter_complete1",
+			QuarterCompleteRatio1: "quarter_complete_ratio1",
+			Plan4:                 "plan4",
+			Complete4:             "complete4",
+			Plan5:                 "plan5",
+			Complete5:             "complete5",
+			Plan6:                 "plan6",
+			Complete6:             "complete6",
+			QuarterPlan2:          "quarter_plan2",
+			QuarterComplete2:      "quarter_complete2",
+			QuarterCompleteRatio2: "quarter_complete_ratio2",
+			Plan7:                 "plan7",
+			Complete7:             "complete7",
+			Plan8:                 "plan8",
+			Complete8:             "complete8",
+			Plan9:                 "plan9",
+			Complete9:             "complete9",
+			QuarterPlan3:          "quarter_plan3",
+			QuarterComplete3:      "quarter_complete3",
+			QuarterCompleteRatio3: "quarter_complete_ratio3",
+			Plan10:                "plan10",
+			Complete10:            "complete10",
+			Plan11:                "plan11",
+			Complete11:            "complete11",
+			Plan12:                "plan12",
+			Complete12:            "complete12",
+			YearPlan:              "year_plan",
+			YearComplete:          "year_complete",
+			YearCompleteRatio:     "year_complete_ratio",
+			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 *CtrContractSaleTargetDao) Ctx(ctx context.Context) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// GetCtx returns the context for current Model.
+// It returns "context.Background() i"s there's no context previously set.
+func (d *CtrContractSaleTargetDao) GetCtx() context.Context {
+	return d.M.GetCtx()
+}
+
+// As sets an alias name for current table.
+func (d *CtrContractSaleTargetDao) As(as string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.As(as), Table: d.Table, TableAs: as}
+}
+
+// TX sets the transaction for current operation.
+func (d *CtrContractSaleTargetDao) TX(tx *gdb.TX) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.TX(tx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Master marks the following operation on master node.
+func (d *CtrContractSaleTargetDao) Master() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Master(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *CtrContractSaleTargetDao) Slave() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Slave(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Args sets custom arguments for model operation.
+func (d *CtrContractSaleTargetDao) Args(args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Args(args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Handler calls each of "handlers" on current Model and returns a new Model.
+// ModelHandler is a function that handles given Model and returns a new Model that is custom modified.
+func (d *CtrContractSaleTargetDao) Handler(handlers ...gdb.ModelHandler) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Handler(handlers...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) LeftJoin(table ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.LeftJoin(table...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) RightJoin(table ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.RightJoin(table...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) InnerJoin(table ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.InnerJoin(table...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) Fields(fieldNamesOrMapStruct ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Fields(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldCount formats and appends commonly used field "COUNT(column)" to the select fields of model.
+func (d *CtrContractSaleTargetDao) FieldCount(column string, as ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.FieldCount(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldSum formats and appends commonly used field "SUM(column)" to the select fields of model.
+func (d *CtrContractSaleTargetDao) FieldSum(column string, as ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.FieldSum(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldMin formats and appends commonly used field "MIN(column)" to the select fields of model.
+func (d *CtrContractSaleTargetDao) FieldMin(column string, as ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.FieldMin(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldMax formats and appends commonly used field "MAX(column)" to the select fields of model.
+func (d *CtrContractSaleTargetDao) FieldMax(column string, as ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.FieldMax(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldAvg formats and appends commonly used field "AVG(column)" to the select fields of model.
+func (d *CtrContractSaleTargetDao) FieldAvg(column string, as ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.FieldAvg(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Option adds extra operation option for the model.
+// Deprecated, use separate operations instead.
+func (d *CtrContractSaleTargetDao) Option(option int) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Option(option), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *CtrContractSaleTargetDao) OmitEmpty() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OmitEmpty(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitEmptyWhere sets optionOmitEmptyWhere option for the model, which automatically filers
+// the Where/Having parameters for "empty" values.
+func (d *CtrContractSaleTargetDao) OmitEmptyWhere() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OmitEmptyWhere(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitEmptyData sets optionOmitEmptyData option for the model, which automatically filers
+// the Data parameters for "empty" values.
+func (d *CtrContractSaleTargetDao) OmitEmptyData() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OmitEmptyData(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitNil sets optionOmitNil option for the model, which automatically filers
+// the data and where parameters for "nil" values.
+func (d *CtrContractSaleTargetDao) OmitNil() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OmitNil(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitNilWhere sets optionOmitNilWhere option for the model, which automatically filers
+// the Where/Having parameters for "nil" values.
+func (d *CtrContractSaleTargetDao) OmitNilWhere() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OmitNilWhere(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitNilData sets optionOmitNilData option for the model, which automatically filers
+// the Data parameters for "nil" values.
+func (d *CtrContractSaleTargetDao) OmitNilData() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OmitNilData(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+// Note that this function supports only single table operations.
+// Deprecated, filter feature is automatically enabled from GoFrame v1.16.0, it is so no longer used.
+func (d *CtrContractSaleTargetDao) Filter() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Filter(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) Where(where interface{}, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Where(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) WherePri(where interface{}, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WherePri(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Having sets the having statement for the model.
+// The parameters of this function usage are as the same as function Where.
+// See Where.
+func (d *CtrContractSaleTargetDao) Having(having interface{}, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Having(having, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Wheref builds condition string using fmt.Sprintf and arguments.
+// Note that if the number of "args" is more than the place holder in "format",
+// the extra "args" will be used as the where condition arguments of the Model.
+func (d *CtrContractSaleTargetDao) Wheref(format string, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Wheref(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLT builds "column < value" statement.
+func (d *CtrContractSaleTargetDao) WhereLT(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLTE builds "column <= value" statement.
+func (d *CtrContractSaleTargetDao) WhereLTE(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGT builds "column > value" statement.
+func (d *CtrContractSaleTargetDao) WhereGT(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGTE builds "column >= value" statement.
+func (d *CtrContractSaleTargetDao) WhereGTE(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereGTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereBetween builds "column BETWEEN min AND max" statement.
+func (d *CtrContractSaleTargetDao) WhereBetween(column string, min, max interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLike builds "column LIKE like" statement.
+func (d *CtrContractSaleTargetDao) WhereLike(column string, like interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereIn builds "column IN (in)" statement.
+func (d *CtrContractSaleTargetDao) WhereIn(column string, in interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNull builds "columns[0] IS NULL AND columns[1] IS NULL ..." statement.
+func (d *CtrContractSaleTargetDao) WhereNull(columns ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
+func (d *CtrContractSaleTargetDao) WhereNotBetween(column string, min, max interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotLike builds "column NOT LIKE like" statement.
+func (d *CtrContractSaleTargetDao) WhereNotLike(column string, like interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNot builds "column != value" statement.
+func (d *CtrContractSaleTargetDao) WhereNot(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereNot(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotIn builds "column NOT IN (in)" statement.
+func (d *CtrContractSaleTargetDao) WhereNotIn(column string, in interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotNull builds "columns[0] IS NOT NULL AND columns[1] IS NOT NULL ..." statement.
+func (d *CtrContractSaleTargetDao) WhereNotNull(columns ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOr adds "OR" condition to the where statement.
+func (d *CtrContractSaleTargetDao) WhereOr(where interface{}, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOr(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
+func (d *CtrContractSaleTargetDao) WhereOrf(format string, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrf(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLT builds "column < value" statement in "OR" conditions..
+func (d *CtrContractSaleTargetDao) WhereOrLT(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLTE builds "column <= value" statement in "OR" conditions..
+func (d *CtrContractSaleTargetDao) WhereOrLTE(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGT builds "column > value" statement in "OR" conditions..
+func (d *CtrContractSaleTargetDao) WhereOrGT(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGTE builds "column >= value" statement in "OR" conditions..
+func (d *CtrContractSaleTargetDao) WhereOrGTE(column string, value interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrGTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrBetween builds "column BETWEEN min AND max" statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrBetween(column string, min, max interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLike builds "column LIKE like" statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrLike(column string, like interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrIn builds "column IN (in)" statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrIn(column string, in interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNull builds "columns[0] IS NULL OR columns[1] IS NULL ..." statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrNull(columns ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotBetween builds "column NOT BETWEEN min AND max" statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrNotBetween(column string, min, max interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotLike builds "column NOT LIKE like" statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrNotLike(column string, like interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotIn builds "column NOT IN (in)" statement.
+func (d *CtrContractSaleTargetDao) WhereOrNotIn(column string, in interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotNull builds "columns[0] IS NOT NULL OR columns[1] IS NOT NULL ..." statement in "OR" conditions.
+func (d *CtrContractSaleTargetDao) WhereOrNotNull(columns ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.WhereOrNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *CtrContractSaleTargetDao) Group(groupBy ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Group(groupBy...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// And adds "AND" condition to the where statement.
+// Deprecated, use Where instead.
+func (d *CtrContractSaleTargetDao) And(where interface{}, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.And(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Or adds "OR" condition to the where statement.
+// Deprecated, use WhereOr instead.
+func (d *CtrContractSaleTargetDao) Or(where interface{}, args ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Or(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// GroupBy sets the "GROUP BY" statement for the model.
+func (d *CtrContractSaleTargetDao) GroupBy(groupBy string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Group(groupBy), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *CtrContractSaleTargetDao) Order(orderBy ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Order(orderBy...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
+func (d *CtrContractSaleTargetDao) OrderAsc(column string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OrderAsc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
+func (d *CtrContractSaleTargetDao) OrderDesc(column string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OrderDesc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
+func (d *CtrContractSaleTargetDao) OrderRandom() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.OrderRandom(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderBy is alias of Model.Order.
+// See Model.Order.
+// Deprecated, use Order instead.
+func (d *CtrContractSaleTargetDao) OrderBy(orderBy string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Order(orderBy), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) Limit(limit ...int) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Limit(limit...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *CtrContractSaleTargetDao) Offset(offset int) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Offset(offset), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Distinct forces the query to only return distinct results.
+func (d *CtrContractSaleTargetDao) Distinct() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Distinct(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) Page(page, limit int) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Page(page, limit), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *CtrContractSaleTargetDao) Batch(batch int) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Batch(batch), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) Cache(duration time.Duration, name ...string) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Cache(duration, name...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractSaleTargetDao) Data(data ...interface{}) *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Data(data...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.CtrContractSaleTarget.
+// 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 *CtrContractSaleTargetDao) All(where ...interface{}) ([]*model.CtrContractSaleTarget, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.CtrContractSaleTarget
+	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.CtrContractSaleTarget.
+// 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 *CtrContractSaleTargetDao) One(where ...interface{}) (*model.CtrContractSaleTarget, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.CtrContractSaleTarget
+	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 *CtrContractSaleTargetDao) FindOne(where ...interface{}) (*model.CtrContractSaleTarget, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.CtrContractSaleTarget
+	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 *CtrContractSaleTargetDao) FindAll(where ...interface{}) ([]*model.CtrContractSaleTarget, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.CtrContractSaleTarget
+	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 *CtrContractSaleTargetDao) 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 *CtrContractSaleTargetDao) 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 *CtrContractSaleTargetDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *CtrContractSaleTargetDao) Chunk(limit int, callback func(entities []*model.CtrContractSaleTarget, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.CtrContractSaleTarget
+		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 *CtrContractSaleTargetDao) LockUpdate() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.LockUpdate(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *CtrContractSaleTargetDao) LockShared() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.LockShared(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *CtrContractSaleTargetDao) Unscoped() *CtrContractSaleTargetDao {
+	return &CtrContractSaleTargetDao{M: d.M.Unscoped(), Table: d.Table, TableAs: d.TableAs}
+}

+ 697 - 0
opms_parent/app/dao/contract/internal/ctr_contract_share.go

@@ -0,0 +1,697 @@
+// ==========================================================================
+// 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 "dashoo.cn/micro/app/model/contract"
+)
+
+// CtrContractShareDao is the manager for logic model data accessing and custom defined data operations functions management.
+type CtrContractShareDao struct {
+	gmvc.M                          // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
+	C       ctrContractShareColumns // C is the short type for Columns, which contains all the column names of Table for convenient usage.
+	DB      gdb.DB                  // DB is the raw underlying database management object.
+	Table   string                  // Table is the underlying table name of the DAO.
+	TableAs string                  // TableAs is the underlying table alias name of the DAO.
+}
+
+// CtrContractShareColumns defines and stores column names for table ctr_contract_share.
+type ctrContractShareColumns struct {
+	Id               string // 主键
+	ContractId       string // 关联合同
+	ContractCode     string // 合同编号
+	ContractAmount   string // 合同金额
+	ContractSignTime string // 合同签订时间(提高统计效率,此处没有连表查询)
+	SaleId           string // 归属销售
+	SaleName         string // 销售姓名
+	ShareRatio       string // 销售分成比例
+	ShareAmount      string // 销售分成金额
+	Remark           string // 备注
+	CreatedBy        string // 创建者
+	CreatedName      string // 创建人
+	CreatedTime      string // 创建时间
+	UpdatedBy        string // 更新者
+	UpdatedName      string // 更新人
+	UpdatedTime      string // 更新时间
+	DeletedTime      string // 删除时间
+}
+
+var (
+	// CtrContractShare is globally public accessible object for table ctr_contract_share operations.
+	CtrContractShare = CtrContractShareDao{
+		M:     g.DB("default").Model("ctr_contract_share").Safe(),
+		DB:    g.DB("default"),
+		Table: "ctr_contract_share",
+		C: ctrContractShareColumns{
+			Id:               "id",
+			ContractId:       "contract_id",
+			ContractCode:     "contract_code",
+			ContractAmount:   "contract_amount",
+			ContractSignTime: "contract_sign_time",
+			SaleId:           "sale_id",
+			SaleName:         "sale_name",
+			ShareRatio:       "share_ratio",
+			ShareAmount:      "share_amount",
+			Remark:           "remark",
+			CreatedBy:        "created_by",
+			CreatedName:      "created_name",
+			CreatedTime:      "created_time",
+			UpdatedBy:        "updated_by",
+			UpdatedName:      "updated_name",
+			UpdatedTime:      "updated_time",
+			DeletedTime:      "deleted_time",
+		},
+	}
+)
+
+func NewCtrContractShareDao(tenant string) CtrContractShareDao {
+	var dao CtrContractShareDao
+	dao = CtrContractShareDao{
+		M:     g.DB(tenant).Model("ctr_contract_share").Safe(),
+		DB:    g.DB(tenant),
+		Table: "ctr_contract_share",
+		C: ctrContractShareColumns{
+			Id:               "id",
+			ContractId:       "contract_id",
+			ContractCode:     "contract_code",
+			ContractAmount:   "contract_amount",
+			ContractSignTime: "contract_sign_time",
+			SaleId:           "sale_id",
+			SaleName:         "sale_name",
+			ShareRatio:       "share_ratio",
+			ShareAmount:      "share_amount",
+			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 *CtrContractShareDao) Ctx(ctx context.Context) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// GetCtx returns the context for current Model.
+// It returns "context.Background() i"s there's no context previously set.
+func (d *CtrContractShareDao) GetCtx() context.Context {
+	return d.M.GetCtx()
+}
+
+// As sets an alias name for current table.
+func (d *CtrContractShareDao) As(as string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.As(as), Table: d.Table, TableAs: as}
+}
+
+// TX sets the transaction for current operation.
+func (d *CtrContractShareDao) TX(tx *gdb.TX) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.TX(tx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Master marks the following operation on master node.
+func (d *CtrContractShareDao) Master() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Master(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Slave marks the following operation on slave node.
+// Note that it makes sense only if there's any slave node configured.
+func (d *CtrContractShareDao) Slave() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Slave(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Args sets custom arguments for model operation.
+func (d *CtrContractShareDao) Args(args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Args(args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Handler calls each of "handlers" on current Model and returns a new Model.
+// ModelHandler is a function that handles given Model and returns a new Model that is custom modified.
+func (d *CtrContractShareDao) Handler(handlers ...gdb.ModelHandler) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Handler(handlers...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) LeftJoin(table ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.LeftJoin(table...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) RightJoin(table ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.RightJoin(table...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) InnerJoin(table ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.InnerJoin(table...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) Fields(fieldNamesOrMapStruct ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Fields(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.FieldsEx(fieldNamesOrMapStruct...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldCount formats and appends commonly used field "COUNT(column)" to the select fields of model.
+func (d *CtrContractShareDao) FieldCount(column string, as ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.FieldCount(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldSum formats and appends commonly used field "SUM(column)" to the select fields of model.
+func (d *CtrContractShareDao) FieldSum(column string, as ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.FieldSum(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldMin formats and appends commonly used field "MIN(column)" to the select fields of model.
+func (d *CtrContractShareDao) FieldMin(column string, as ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.FieldMin(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldMax formats and appends commonly used field "MAX(column)" to the select fields of model.
+func (d *CtrContractShareDao) FieldMax(column string, as ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.FieldMax(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// FieldAvg formats and appends commonly used field "AVG(column)" to the select fields of model.
+func (d *CtrContractShareDao) FieldAvg(column string, as ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.FieldAvg(column, as...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Option adds extra operation option for the model.
+// Deprecated, use separate operations instead.
+func (d *CtrContractShareDao) Option(option int) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Option(option), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitEmpty sets OPTION_OMITEMPTY option for the model, which automatically filers
+// the data and where attributes for empty values.
+func (d *CtrContractShareDao) OmitEmpty() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OmitEmpty(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitEmptyWhere sets optionOmitEmptyWhere option for the model, which automatically filers
+// the Where/Having parameters for "empty" values.
+func (d *CtrContractShareDao) OmitEmptyWhere() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OmitEmptyWhere(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitEmptyData sets optionOmitEmptyData option for the model, which automatically filers
+// the Data parameters for "empty" values.
+func (d *CtrContractShareDao) OmitEmptyData() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OmitEmptyData(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitNil sets optionOmitNil option for the model, which automatically filers
+// the data and where parameters for "nil" values.
+func (d *CtrContractShareDao) OmitNil() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OmitNil(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitNilWhere sets optionOmitNilWhere option for the model, which automatically filers
+// the Where/Having parameters for "nil" values.
+func (d *CtrContractShareDao) OmitNilWhere() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OmitNilWhere(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OmitNilData sets optionOmitNilData option for the model, which automatically filers
+// the Data parameters for "nil" values.
+func (d *CtrContractShareDao) OmitNilData() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OmitNilData(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Filter marks filtering the fields which does not exist in the fields of the operated table.
+// Note that this function supports only single table operations.
+// Deprecated, filter feature is automatically enabled from GoFrame v1.16.0, it is so no longer used.
+func (d *CtrContractShareDao) Filter() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Filter(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) Where(where interface{}, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Where(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) WherePri(where interface{}, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WherePri(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Having sets the having statement for the model.
+// The parameters of this function usage are as the same as function Where.
+// See Where.
+func (d *CtrContractShareDao) Having(having interface{}, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Having(having, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Wheref builds condition string using fmt.Sprintf and arguments.
+// Note that if the number of "args" is more than the place holder in "format",
+// the extra "args" will be used as the where condition arguments of the Model.
+func (d *CtrContractShareDao) Wheref(format string, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Wheref(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLT builds "column < value" statement.
+func (d *CtrContractShareDao) WhereLT(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLTE builds "column <= value" statement.
+func (d *CtrContractShareDao) WhereLTE(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGT builds "column > value" statement.
+func (d *CtrContractShareDao) WhereGT(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGTE builds "column >= value" statement.
+func (d *CtrContractShareDao) WhereGTE(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereGTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereBetween builds "column BETWEEN min AND max" statement.
+func (d *CtrContractShareDao) WhereBetween(column string, min, max interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLike builds "column LIKE like" statement.
+func (d *CtrContractShareDao) WhereLike(column string, like interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereIn builds "column IN (in)" statement.
+func (d *CtrContractShareDao) WhereIn(column string, in interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNull builds "columns[0] IS NULL AND columns[1] IS NULL ..." statement.
+func (d *CtrContractShareDao) WhereNull(columns ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
+func (d *CtrContractShareDao) WhereNotBetween(column string, min, max interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotLike builds "column NOT LIKE like" statement.
+func (d *CtrContractShareDao) WhereNotLike(column string, like interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNot builds "column != value" statement.
+func (d *CtrContractShareDao) WhereNot(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereNot(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotIn builds "column NOT IN (in)" statement.
+func (d *CtrContractShareDao) WhereNotIn(column string, in interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotNull builds "columns[0] IS NOT NULL AND columns[1] IS NOT NULL ..." statement.
+func (d *CtrContractShareDao) WhereNotNull(columns ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOr adds "OR" condition to the where statement.
+func (d *CtrContractShareDao) WhereOr(where interface{}, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOr(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
+func (d *CtrContractShareDao) WhereOrf(format string, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrf(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLT builds "column < value" statement in "OR" conditions..
+func (d *CtrContractShareDao) WhereOrLT(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLTE builds "column <= value" statement in "OR" conditions..
+func (d *CtrContractShareDao) WhereOrLTE(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGT builds "column > value" statement in "OR" conditions..
+func (d *CtrContractShareDao) WhereOrGT(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGTE builds "column >= value" statement in "OR" conditions..
+func (d *CtrContractShareDao) WhereOrGTE(column string, value interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrGTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrBetween builds "column BETWEEN min AND max" statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrBetween(column string, min, max interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLike builds "column LIKE like" statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrLike(column string, like interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrIn builds "column IN (in)" statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrIn(column string, in interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNull builds "columns[0] IS NULL OR columns[1] IS NULL ..." statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrNull(columns ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotBetween builds "column NOT BETWEEN min AND max" statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrNotBetween(column string, min, max interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotLike builds "column NOT LIKE like" statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrNotLike(column string, like interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotIn builds "column NOT IN (in)" statement.
+func (d *CtrContractShareDao) WhereOrNotIn(column string, in interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrNotIn(column, in), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotNull builds "columns[0] IS NOT NULL OR columns[1] IS NOT NULL ..." statement in "OR" conditions.
+func (d *CtrContractShareDao) WhereOrNotNull(columns ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.WhereOrNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *CtrContractShareDao) Group(groupBy ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Group(groupBy...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// And adds "AND" condition to the where statement.
+// Deprecated, use Where instead.
+func (d *CtrContractShareDao) And(where interface{}, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.And(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Or adds "OR" condition to the where statement.
+// Deprecated, use WhereOr instead.
+func (d *CtrContractShareDao) Or(where interface{}, args ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Or(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// GroupBy sets the "GROUP BY" statement for the model.
+func (d *CtrContractShareDao) GroupBy(groupBy string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Group(groupBy), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *CtrContractShareDao) Order(orderBy ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Order(orderBy...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
+func (d *CtrContractShareDao) OrderAsc(column string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OrderAsc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
+func (d *CtrContractShareDao) OrderDesc(column string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OrderDesc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
+func (d *CtrContractShareDao) OrderRandom() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.OrderRandom(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderBy is alias of Model.Order.
+// See Model.Order.
+// Deprecated, use Order instead.
+func (d *CtrContractShareDao) OrderBy(orderBy string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Order(orderBy), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) Limit(limit ...int) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Limit(limit...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Offset sets the "OFFSET" statement for the model.
+// It only makes sense for some databases like SQLServer, PostgreSQL, etc.
+func (d *CtrContractShareDao) Offset(offset int) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Offset(offset), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Distinct forces the query to only return distinct results.
+func (d *CtrContractShareDao) Distinct() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Distinct(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) Page(page, limit int) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Page(page, limit), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *CtrContractShareDao) Batch(batch int) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Batch(batch), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) Cache(duration time.Duration, name ...string) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Cache(duration, name...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// 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 *CtrContractShareDao) Data(data ...interface{}) *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Data(data...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// All does "SELECT FROM ..." statement for the model.
+// It retrieves the records from table and returns the result as []*model.CtrContractShare.
+// 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 *CtrContractShareDao) All(where ...interface{}) ([]*model.CtrContractShare, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.CtrContractShare
+	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.CtrContractShare.
+// 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 *CtrContractShareDao) One(where ...interface{}) (*model.CtrContractShare, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.CtrContractShare
+	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 *CtrContractShareDao) FindOne(where ...interface{}) (*model.CtrContractShare, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.CtrContractShare
+	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 *CtrContractShareDao) FindAll(where ...interface{}) ([]*model.CtrContractShare, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.CtrContractShare
+	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 *CtrContractShareDao) 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 *CtrContractShareDao) 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 *CtrContractShareDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *CtrContractShareDao) Chunk(limit int, callback func(entities []*model.CtrContractShare, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.CtrContractShare
+		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 *CtrContractShareDao) LockUpdate() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.LockUpdate(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *CtrContractShareDao) LockShared() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.LockShared(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *CtrContractShareDao) Unscoped() *CtrContractShareDao {
+	return &CtrContractShareDao{M: d.M.Unscoped(), Table: d.Table, TableAs: d.TableAs}
+}

+ 18 - 0
opms_parent/app/handler/contract/ctr_contract.go

@@ -226,3 +226,21 @@ func (c *CtrContract) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_d
 	//rsp.Msg = msg
 	return nil
 }
+
+// GetContractShareList
+// Swagger:CtrContract 合同 获取合同分成信息
+func (c *CtrContract) GetContractShareList(ctx context.Context, req *model.GetContractShareReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("CtrContract.GetContractShareList request %#v ", *req)
+	s, err := service.NewCtrContractService(ctx)
+	if err != nil {
+		return err
+	}
+	shares, err := s.GetShares(ctx, req)
+	if err != nil {
+		return err
+	}
+
+	rsp.Data = g.Map{"list": shares}
+
+	return nil
+}

+ 44 - 0
opms_parent/app/handler/contract/ctr_contract_sale_target.go

@@ -0,0 +1,44 @@
+package contract
+
+import (
+	"context"
+	"dashoo.cn/common_definition/comm_def"
+	model "dashoo.cn/micro/app/model/contract"
+	service "dashoo.cn/micro/app/service/contract"
+	"github.com/gogf/gf/frame/g"
+)
+
+type TargetHandler struct{}
+
+// Swagger:TargetHandler 销售签约指标 列表
+func (c *TargetHandler) List(ctx context.Context, req *model.SaleTargetReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("TargetHandler.List request %#v ", *req)
+	s, err := service.NewCtrContractSaleTargetService(ctx)
+	if err != nil {
+		return err
+	}
+	total, ent, err := s.List(ctx, req)
+	if err != nil {
+		return err
+	}
+	if ent == nil {
+		ent = []*model.CtrContractSaleTarget{}
+	}
+
+	rsp.Data = g.Map{"list": ent, "total": total}
+	return nil
+}
+
+// Swagger:TargetHandler 销售签约指标 导入
+func (c *TargetHandler) Import(ctx context.Context, req *model.ExcelImportReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("CtrContract.Add request %#v ", *req)
+	s, err := service.NewCtrContractSaleTargetService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Import(ctx, req)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 12 - 6
opms_parent/app/model/contract/ctr_contract.go

@@ -163,10 +163,16 @@ type CtrContractCommitReq struct {
 }
 
 type CtrContractCommitWithFileUrlReq struct {
-	Id            int    `json:"id" v:"required#请输入Id"`
-	ContractModel string `json:"contractModel"` // 合同模板 值可以是:大数模板, 客户模板
-	Terms         string `json:"terms"`         // 条款情况 值可以是:接纳全部条款, 不接纳全部条款
-	PayTerms      string `json:"payTerms"`      // 付款条件
-	FileName      string `json:"fileName" v:"required#附件名不能为空"`
-	FileUrl       string `json:"fileUrl" v:"required#附件地址不能为空"`
+	Id            int                 `json:"id" v:"required#请输入Id"`
+	ContractModel string              `json:"contractModel"` // 合同模板 值可以是:大数模板, 客户模板
+	Terms         string              `json:"terms"`         // 条款情况 值可以是:接纳全部条款, 不接纳全部条款
+	PayTerms      string              `json:"payTerms"`      // 付款条件
+	FileName      string              `json:"fileName" v:"required#附件名不能为空"`
+	FileUrl       string              `json:"fileUrl" v:"required#附件地址不能为空"`
+	Shares        []*CtrContractShare `json:"shares"` // 销售分成情况
+}
+
+// GetContractShareReq 获取合同分成信息请求
+type GetContractShareReq struct {
+	ContractId string `json:"contractId" v:"required#合同Id不能为空"`
 }

+ 40 - 0
opms_parent/app/model/contract/ctr_contract_sale_target.go

@@ -0,0 +1,40 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package contract
+
+import (
+	"dashoo.cn/micro/app/model/contract/internal"
+	"dashoo.cn/opms_libary/request"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// CtrContractSaleTarget is the golang structure for table ctr_contract_sale_target.
+type CtrContractSaleTarget internal.CtrContractSaleTarget
+
+// Fill with you ideas below.
+
+// SaleTargetReq 销售目标请求参数
+type SaleTargetReq struct {
+	request.PageReq
+	Year     string `json:"year"`     // 年度
+	SaleName string `json:"saleName"` // 销售姓名
+}
+
+type ExcelImportReq struct {
+	ExcelUrl string `json:"excelUrl" v:"required#请输入excel地址"` // excel 文件地址
+}
+
+type Share struct {
+	// 合同信息
+	ContractAmount   float64     `orm:"contract_amount"    json:"contractAmount"`   // 合同金额
+	InchargeId       int         `orm:"incharge_id"        json:"inchargeId"`       // 负责人ID
+	InchargeName     string      `orm:"incharge_name"      json:"inchargeName"`     // 负责人(销售工程师)
+	ContractSignTime *gtime.Time `orm:"contract_sign_time" json:"contractSignTime"` // 合同签订时间(提高统计效率,此处没有连表查询)
+	// 分成信息
+	Id          int     `orm:"id,primary"         json:"id"`          // 主键
+	SaleId      int     `orm:"sale_id"            json:"saleId"`      // 归属销售
+	SaleName    string  `orm:"sale_name"          json:"saleName"`    // 销售姓名
+	ShareAmount float64 `orm:"share_amount"       json:"shareAmount"` // 销售分成金额
+}

+ 14 - 0
opms_parent/app/model/contract/ctr_contract_share.go

@@ -0,0 +1,14 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package contract
+
+import (
+	"dashoo.cn/micro/app/model/contract/internal"
+)
+
+// CtrContractShare is the golang structure for table ctr_contract_share.
+type CtrContractShare internal.CtrContractShare
+
+// Fill with you ideas below.

+ 61 - 0
opms_parent/app/model/contract/internal/ctr_contract_sale_target.go

@@ -0,0 +1,61 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// CtrContractSaleTarget is the golang structure for table ctr_contract_sale_target.
+type CtrContractSaleTarget struct {
+	Id                    int         `orm:"id,primary"              json:"id"`                    // 主键
+	SaleId                int         `orm:"sale_id"                 json:"saleId"`                // 归属销售
+	SaleName              string      `orm:"sale_name"               json:"saleName"`              // 销售姓名
+	Year                  string      `orm:"year"                    json:"year"`                  // 年度
+	Plan1                 float64     `orm:"plan1"                   json:"plan1"`                 // 1月计划
+	Complete1             float64     `orm:"complete1"               json:"complete1"`             // 1月达成
+	Plan2                 float64     `orm:"plan2"                   json:"plan2"`                 // 2月计划
+	Complete2             float64     `orm:"complete2"               json:"complete2"`             // 2月达成
+	Plan3                 float64     `orm:"plan3"                   json:"plan3"`                 // 3月计划
+	Complete3             float64     `orm:"complete3"               json:"complete3"`             // 3月达成
+	QuarterPlan1          float64     `orm:"quarter_plan1"           json:"quarterPlan1"`          // 第一季度计划
+	QuarterComplete1      float64     `orm:"quarter_complete1"       json:"quarterComplete1"`      // 第一季度达成
+	QuarterCompleteRatio1 float64     `orm:"quarter_complete_ratio1" json:"quarterCompleteRatio1"` // 第一季度完成率
+	Plan4                 float64     `orm:"plan4"                   json:"plan4"`                 // 4月计划
+	Complete4             float64     `orm:"complete4"               json:"complete4"`             // 4月达成
+	Plan5                 float64     `orm:"plan5"                   json:"plan5"`                 // 5月计划
+	Complete5             float64     `orm:"complete5"               json:"complete5"`             // 5月达成
+	Plan6                 float64     `orm:"plan6"                   json:"plan6"`                 // 6月计划
+	Complete6             float64     `orm:"complete6"               json:"complete6"`             // 6月达成
+	QuarterPlan2          float64     `orm:"quarter_plan2"           json:"quarterPlan2"`          // 第二季度计划
+	QuarterComplete2      float64     `orm:"quarter_complete2"       json:"quarterComplete2"`      // 第二季度达成
+	QuarterCompleteRatio2 float64     `orm:"quarter_complete_ratio2" json:"quarterCompleteRatio2"` // 第二季度完成率
+	Plan7                 float64     `orm:"plan7"                   json:"plan7"`                 // 7月计划
+	Complete7             float64     `orm:"complete7"               json:"complete7"`             // 7月达成
+	Plan8                 float64     `orm:"plan8"                   json:"plan8"`                 // 8月计划
+	Complete8             float64     `orm:"complete8"               json:"complete8"`             // 8月达成
+	Plan9                 float64     `orm:"plan9"                   json:"plan9"`                 // 9月计划
+	Complete9             float64     `orm:"complete9"               json:"complete9"`             // 9月达成
+	QuarterPlan3          float64     `orm:"quarter_plan3"           json:"quarterPlan3"`          // 第三季度计划
+	QuarterComplete3      float64     `orm:"quarter_complete3"       json:"quarterComplete3"`      // 第三季度达成
+	QuarterCompleteRatio3 float64     `orm:"quarter_complete_ratio3" json:"quarterCompleteRatio3"` // 第三季度完成率
+	Plan10                float64     `orm:"plan10"                  json:"plan10"`                // 10月计划
+	Complete10            float64     `orm:"complete10"              json:"complete10"`            // 10月达成
+	Plan11                float64     `orm:"plan11"                  json:"plan11"`                // 11月计划
+	Complete11            float64     `orm:"complete11"              json:"complete11"`            // 11月达成
+	Plan12                float64     `orm:"plan12"                  json:"plan12"`                // 12月计划
+	Complete12            float64     `orm:"complete12"              json:"complete12"`            // 12月达成
+	YearPlan              float64     `orm:"year_plan"               json:"yearPlan"`              // 年度计划
+	YearComplete          float64     `orm:"year_complete"           json:"yearComplete"`          // 年度达成
+	YearCompleteRatio     float64     `orm:"year_complete_ratio"     json:"yearCompleteRatio"`     // 年度完成率
+	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"`           // 删除时间
+}

+ 30 - 0
opms_parent/app/model/contract/internal/ctr_contract_share.go

@@ -0,0 +1,30 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// CtrContractShare is the golang structure for table ctr_contract_share.
+type CtrContractShare struct {
+	Id               int         `orm:"id,primary"         json:"id"`               // 主键
+	ContractId       int         `orm:"contract_id"        json:"contractId"`       // 关联合同
+	ContractCode     string      `orm:"contract_code"      json:"contractCode"`     // 合同编号
+	ContractAmount   float64     `orm:"contract_amount"    json:"contractAmount"`   // 合同金额
+	ContractSignTime *gtime.Time `orm:"contract_sign_time" json:"contractSignTime"` // 合同签订时间(提高统计效率,此处没有连表查询)
+	SaleId           int         `orm:"sale_id"            json:"saleId"`           // 归属销售
+	SaleName         string      `orm:"sale_name"          json:"saleName"`         // 销售姓名
+	ShareRatio       float64     `orm:"share_ratio"        json:"shareRatio"`       // 销售分成比例
+	ShareAmount      float64     `orm:"share_amount"       json:"shareAmount"`      // 销售分成金额
+	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"`      // 删除时间
+}

+ 150 - 0
opms_parent/app/service/contract/ctr_contract.go

@@ -6,6 +6,7 @@ import (
 	"encoding/base64"
 	"encoding/json"
 	"fmt"
+	"github.com/gogf/gf/util/gconv"
 	"io"
 	"net/http"
 	"strconv"
@@ -53,6 +54,8 @@ type CtrContractService struct {
 	WorkflowDao     *workflowdao.PlatWorkflowDao
 	AppendDao       *dao.CtrContractAppendDao
 	GoalDao         *dao.CtrContractGoalDao
+	ShareDao        *dao.CtrContractShareDao
+	TargetDao       *dao.CtrContractSaleTargetDao
 
 	Tenant    string
 	userInfo  request.UserInfo
@@ -82,6 +85,8 @@ func NewCtrContractService(ctx context.Context) (*CtrContractService, error) {
 		WorkflowDao:     workflowdao.NewPlatWorkflowDao(tenant),
 		AppendDao:       dao.NewCtrContractAppendDao(tenant),
 		GoalDao:         dao.NewCtrContractGoalDao(tenant),
+		ShareDao:        dao.NewCtrContractShareDao(tenant),
+		TargetDao:       dao.NewCtrContractSaleTargetDao(tenant),
 		Tenant:          tenant,
 		userInfo:        userInfo,
 		DataScope:       userInfo.DataScope,
@@ -670,10 +675,16 @@ func (s CtrContractService) CommitWithFile(ctx context.Context, formData *multip
 }
 
 func (s CtrContractService) CommitWithFileUrl(ctx context.Context, req *model.CtrContractCommitWithFileUrlReq) error {
+	// 数据校验
 	validErr := gvalid.CheckStruct(ctx, req, nil)
 	if validErr != nil {
 		return myerrors.TipsError(validErr.Current().Error())
 	}
+	// 校验销售分成数据
+	if len(req.Shares) == 0 {
+		return myerrors.TipsError("销售分成信息不能为空")
+	}
+
 	fileinfoByte, err := baseService.UploadDingtalk(s.userInfo.DingtalkId, req.FileUrl, req.FileName)
 	if err != nil {
 		return err
@@ -709,6 +720,135 @@ func (s CtrContractService) CommitWithFileUrl(ctx context.Context, req *model.Ct
 	if err != nil {
 		return err
 	}
+	// 保存销售分成信息
+	if len(req.Shares) > 0 {
+		saleIds := ""
+		amountMap := make(map[int]float64)
+		for _, share := range req.Shares {
+			share.CreatedBy = s.userInfo.Id
+			share.CreatedName = s.userInfo.NickName
+			share.CreatedTime = gtime.Now()
+			share.UpdatedBy = s.userInfo.Id
+			share.UpdatedName = s.userInfo.NickName
+			share.UpdatedTime = gtime.Now()
+
+			amountMap[share.SaleId] += share.ShareAmount
+			if saleIds == "" {
+				saleIds += gconv.String(share.SaleId)
+			} else {
+				saleIds += "," + gconv.String(share.SaleId)
+			}
+		}
+		year := req.Shares[0].ContractSignTime.Format("Y")
+		month := req.Shares[0].ContractSignTime.Format("m")
+		// 查询需要更新的销售签约指标
+		if saleIds != "" {
+			targets, err := s.TargetDao.Where(fmt.Sprintf("sale_id IN (%v) AND year='%v'", saleIds, year)).FindAll()
+			if err != nil {
+				return err
+			}
+			// 更新数据
+			for _, target := range targets {
+				switch month {
+				case "01":
+					target.Complete1 += amountMap[target.SaleId]
+					target.QuarterComplete1 = target.Complete1 + target.Complete2 + target.Complete3
+					if target.QuarterPlan1 != 0 {
+						target.QuarterCompleteRatio1 = target.QuarterComplete1 / target.QuarterPlan1 * 100
+					}
+					break
+				case "02":
+					target.Complete2 += amountMap[target.SaleId]
+					target.QuarterComplete1 = target.Complete1 + target.Complete2 + target.Complete3
+					if target.QuarterPlan1 != 0 {
+						target.QuarterCompleteRatio1 = target.QuarterComplete1 / target.QuarterPlan1 * 100
+					}
+					break
+				case "03":
+					target.Complete3 += amountMap[target.SaleId]
+					target.QuarterComplete1 = target.Complete1 + target.Complete2 + target.Complete3
+					if target.QuarterPlan1 != 0 {
+						target.QuarterCompleteRatio1 = target.QuarterComplete1 / target.QuarterPlan1 * 100
+					}
+					break
+				case "04":
+					target.Complete4 += amountMap[target.SaleId]
+					target.QuarterComplete2 = target.Complete4 + target.Complete5 + target.Complete6
+					if target.QuarterPlan2 != 0 {
+						target.QuarterCompleteRatio2 = target.QuarterComplete2 / target.QuarterPlan2 * 100
+					}
+					break
+				case "05":
+					target.Complete5 += amountMap[target.SaleId]
+					target.QuarterComplete2 = target.Complete4 + target.Complete5 + target.Complete6
+					if target.QuarterPlan2 != 0 {
+						target.QuarterCompleteRatio2 = target.QuarterComplete2 / target.QuarterPlan2 * 100
+					}
+					break
+				case "06":
+					target.Complete6 += amountMap[target.SaleId]
+					target.QuarterComplete2 = target.Complete4 + target.Complete5 + target.Complete6
+					if target.QuarterPlan2 != 0 {
+						target.QuarterCompleteRatio2 = target.QuarterComplete2 / target.QuarterPlan2 * 100
+					}
+					break
+				case "07":
+					target.Complete7 += amountMap[target.SaleId]
+					target.QuarterComplete3 = target.Complete7 + target.Complete8 + target.Complete9
+					if target.QuarterPlan3 != 0 {
+						target.QuarterCompleteRatio3 = target.QuarterComplete3 / target.QuarterPlan3 * 100
+					}
+					break
+				case "08":
+					target.Complete8 += amountMap[target.SaleId]
+					target.QuarterComplete3 = target.Complete7 + target.Complete8 + target.Complete9
+					if target.QuarterPlan3 != 0 {
+						target.QuarterCompleteRatio3 = target.QuarterComplete3 / target.QuarterPlan3 * 100
+					}
+					break
+				case "09":
+					target.Complete9 += amountMap[target.SaleId]
+					target.QuarterComplete3 = target.Complete7 + target.Complete8 + target.Complete9
+					if target.QuarterPlan3 != 0 {
+						target.QuarterCompleteRatio3 = target.QuarterComplete3 / target.QuarterPlan3 * 100
+					}
+					break
+				case "10":
+					target.Complete10 += amountMap[target.SaleId]
+					break
+				case "11":
+					target.Complete11 += amountMap[target.SaleId]
+					break
+				case "12":
+					target.Complete12 += amountMap[target.SaleId]
+					break
+				}
+				target.UpdatedTime = gtime.Now()
+				target.UpdatedBy = s.userInfo.Id
+				target.UpdatedName = s.userInfo.NickName
+				// 年度数据
+				target.YearComplete = target.QuarterComplete1 + target.QuarterComplete2 + target.QuarterComplete3 + target.Complete10 + target.Complete11 + target.Complete12
+				if target.YearPlan != 0 {
+					target.YearCompleteRatio = target.YearComplete / target.YearPlan * 100
+				}
+			}
+
+			// 保存销售签约指标数据
+			if len(targets) > 0 {
+				_, err = s.TargetDao.Save(targets)
+				if err != nil {
+					return err
+				}
+			}
+		}
+
+		// 保存分成数据
+		_, err = s.ShareDao.Save(req.Shares)
+		if err != nil {
+			return err
+		}
+	}
+
 	return nil
 }
 
@@ -1148,6 +1288,16 @@ func (s CtrContractService) Delete(ctx context.Context, id []int) error {
 	return err
 }
 
+// GetShares 获取销售分成数据
+func (s CtrContractService) GetShares(ctx context.Context, req *model.GetContractShareReq) ([]*model.CtrContractShare, error) {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return nil, myerrors.TipsError(validErr.Current().Error())
+	}
+
+	return s.ShareDao.Where("contract_id=?", req.ContractId).FindAll()
+}
+
 func init() {
 	tenant := g.Config().GetString("micro_srv.tenant")
 	if tenant == "" {

+ 276 - 0
opms_parent/app/service/contract/ctr_contract_sale_target.go

@@ -0,0 +1,276 @@
+package service
+
+import (
+	"bytes"
+	"context"
+	dao "dashoo.cn/micro/app/dao/contract"
+	model "dashoo.cn/micro/app/model/contract"
+	"dashoo.cn/micro/app/service/partner"
+	"dashoo.cn/opms_libary/micro_srv"
+	"dashoo.cn/opms_libary/myerrors"
+	"dashoo.cn/opms_libary/request"
+	"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"
+	"github.com/xuri/excelize/v2"
+)
+
+type CtrContractSaleTargetService struct {
+	Dao       *dao.CtrContractSaleTargetDao
+	Tenant    string
+	userInfo  request.UserInfo
+	DataScope g.Map `json:"dataScope"`
+}
+
+func NewCtrContractSaleTargetService(ctx context.Context) (*CtrContractSaleTargetService, error) {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+
+		return nil, myerrors.TipsError(fmt.Sprintf("获取租户码异常:%s", err.Error())) //fmt.Errorf("获取租户码异常:%s", err.Error())
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, myerrors.TipsError(fmt.Sprintf("获取用户信息异常:%s", err.Error())) //fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+	if err != nil {
+		return nil, err
+	}
+	return &CtrContractSaleTargetService{
+		Dao:       dao.NewCtrContractSaleTargetDao(tenant),
+		Tenant:    tenant,
+		userInfo:  userInfo,
+		DataScope: userInfo.DataScope,
+	}, nil
+}
+
+// List 获取列表
+func (s CtrContractSaleTargetService) List(ctx context.Context, req *model.SaleTargetReq) (int, []*model.CtrContractSaleTarget, error) {
+	saleTargetDao := s.Dao.As("ctr_contract_sale_target")
+	if req.Year != "" {
+		saleTargetDao = saleTargetDao.Where("year = ?", req.Year)
+	}
+
+	if req.SaleName != "" {
+		likeStr := fmt.Sprintf("%%%s%%", req.SaleName)
+		saleTargetDao = saleTargetDao.Where("sale_name like ?", likeStr)
+	}
+
+	total, err := saleTargetDao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+	if req.PageNum != 0 {
+		saleTargetDao = saleTargetDao.Page(req.GetPage())
+	}
+	orderBy := "id ASC"
+	if req.OrderBy != "" {
+		orderBy = req.OrderBy
+	}
+	saleTargetDao = saleTargetDao.Order(orderBy)
+
+	results, err := saleTargetDao.FindAll()
+	return total, results, err
+}
+
+// Import excel数据导入
+func (s CtrContractSaleTargetService) Import(ctx context.Context, req *model.ExcelImportReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.TipsError(validErr.Current().Error())
+	}
+
+	// 下载文件
+	buf, err := partner.DownFile(req.ExcelUrl)
+	if err != nil {
+		return myerrors.TipsError(fmt.Sprintf("下载 excel 异常 %s", err.Error()))
+	}
+
+	// 解析excel,构造销售目标数据
+	saleTargets, minYear, err := s.parseExcel(buf)
+	if err != nil {
+		return myerrors.TipsError(fmt.Sprintf("解析 excel 异常 %s", err.Error()))
+	}
+
+	// 获取销售分成数据 人/年/月份
+	shareMap := make(map[string]map[string]map[string]float64)
+	saleMap := make(map[string]int)
+	var shares []*model.Share
+	err = s.Dao.DB.Model("ctr_contract a").LeftJoin("ctr_contract_share b", "a.id=b.contract_id").Where(fmt.Sprintf("a.contract_sign_time >= '%v'", minYear)).Fields("a.contract_amount, a.incharge_id, a.incharge_name, a.contract_sign_time, b.id, b.sale_id, b.sale_name, b.share_amount").Scan(&shares)
+	if err != nil {
+		return err
+	}
+	// 统计 人/年度/月度金额
+	for _, share := range shares {
+		id := 0
+		name := ""
+		amount := float64(0)
+		year := share.ContractSignTime.Format("Y")
+		month := share.ContractSignTime.Format("m")
+		if share.Id == 0 {
+			id = share.InchargeId
+			name = share.InchargeName
+			amount = share.ContractAmount
+		} else {
+			id = share.SaleId
+			name = share.SaleName
+			amount = share.ShareAmount
+		}
+		if _, ok := shareMap[name]; !ok {
+			shareMap[name] = make(map[string]map[string]float64)
+		}
+		if _, ok := shareMap[name][year]; !ok {
+			shareMap[name][year] = make(map[string]float64)
+		}
+		saleMap[name] = id
+		shareMap[name][year][month] += amount
+	}
+
+	// 获取历史销售目标信息
+	targetMap := make(map[string]map[string]*model.CtrContractSaleTarget)
+	targets, err := s.Dao.Where(fmt.Sprintf("year >= '%v'", minYear)).FindAll()
+	if err != nil {
+		return err
+	}
+	for index, target := range targets {
+		if _, ok := targetMap[target.SaleName]; !ok {
+			targetMap[target.SaleName] = make(map[string]*model.CtrContractSaleTarget)
+		}
+		targetMap[target.SaleName][target.Year] = targets[index]
+	}
+
+	for _, target := range saleTargets {
+		updateTargetInfo(target, targetMap, saleMap, shareMap)
+	}
+	// 保存销售目标数据
+	if len(saleTargets) > 0 {
+		_, err = s.Dao.Save(saleTargets)
+	}
+
+	return err
+}
+
+// excel解构为数据
+func (s CtrContractSaleTargetService) parseExcel(b []byte) ([]*model.CtrContractSaleTarget, string, error) {
+	f, err := excelize.OpenReader(bytes.NewBuffer(b))
+	if err != nil {
+		return nil, "", err
+	}
+	sheet := "Sheet1"
+	rows, err := f.GetRows(sheet)
+	if err != nil {
+		return nil, "", err
+	}
+	minYear := "9999"
+
+	// 序号	销售	年度	1月计划	1月达成	2月计划	2月达成	3月计划	3月达成	第一季度计划	第一季度达成	第一季度完成率	4月计划	4月达成	5月计划	5月达成	6月计划	6月达成	第二季度计划	第二季度达成	第二季度完成率	7月计划	7月达成	8月计划	8月达成	9月计划	9月达成	第三季度计划	第三季度达成	第三季度完成率	10月计划	10月达成	11月计划	11月达成	12月计划	12月达成	年度计划	年度达成	年度完成率
+	var saleTargets []*model.CtrContractSaleTarget
+	for _, row := range rows[1:] {
+		temp := &model.CtrContractSaleTarget{
+			SaleName:    row[1],
+			Year:        row[2],
+			Plan1:       gconv.Float64(row[3]),
+			Plan2:       gconv.Float64(row[5]),
+			Plan3:       gconv.Float64(row[7]),
+			Plan4:       gconv.Float64(row[12]),
+			Plan5:       gconv.Float64(row[14]),
+			Plan6:       gconv.Float64(row[16]),
+			Plan7:       gconv.Float64(row[21]),
+			Plan8:       gconv.Float64(row[23]),
+			Plan9:       gconv.Float64(row[25]),
+			Plan10:      gconv.Float64(row[30]),
+			Plan11:      gconv.Float64(row[32]),
+			Plan12:      gconv.Float64(row[34]),
+			Remark:      "",
+			CreatedBy:   s.userInfo.Id,
+			CreatedName: s.userInfo.NickName,
+			CreatedTime: gtime.Now(),
+			UpdatedBy:   s.userInfo.Id,
+			UpdatedName: s.userInfo.NickName,
+			UpdatedTime: gtime.Now(),
+		}
+		if temp.Year < minYear {
+			minYear = temp.Year
+		}
+		temp.QuarterPlan1 = temp.Plan1 + temp.Plan2 + temp.Plan3
+		temp.QuarterPlan2 = temp.Plan4 + temp.Plan5 + temp.Plan6
+		temp.QuarterPlan3 = temp.Plan7 + temp.Plan8 + temp.Plan9
+		temp.YearPlan = temp.QuarterPlan1 + temp.QuarterPlan2 + temp.QuarterPlan3 + temp.Plan10 + temp.Plan11 + temp.Plan12
+
+		saleTargets = append(saleTargets, temp)
+	}
+
+	return saleTargets, minYear, nil
+}
+
+func updateTargetInfo(target *model.CtrContractSaleTarget, targetMap map[string]map[string]*model.CtrContractSaleTarget, saleMap map[string]int, shareMap map[string]map[string]map[string]float64) {
+	// 有则更新
+	if targetMap[target.SaleName] != nil && targetMap[target.SaleName][target.Year] != nil {
+		target.Id = targetMap[target.SaleName][target.Year].Id
+		target.CreatedBy = targetMap[target.SaleName][target.Year].CreatedBy
+		target.CreatedName = targetMap[target.SaleName][target.Year].CreatedName
+		target.CreatedTime = targetMap[target.SaleName][target.Year].CreatedTime
+	} else {
+		target.SaleId = saleMap[target.SaleName]
+	}
+	if shareMap[target.SaleName] != nil && shareMap[target.SaleName][target.Year] != nil {
+		for month, amount := range shareMap[target.SaleName][target.Year] {
+			switch month {
+			case "01":
+				target.Complete1 = amount
+				break
+			case "02":
+				target.Complete2 = amount
+				break
+			case "03":
+				target.Complete3 = amount
+				break
+			case "04":
+				target.Complete4 = amount
+				break
+			case "05":
+				target.Complete5 = amount
+				break
+			case "06":
+				target.Complete6 = amount
+				break
+			case "07":
+				target.Complete7 = amount
+				break
+			case "08":
+				target.Complete8 = amount
+				break
+			case "09":
+				target.Complete9 = amount
+				break
+			case "10":
+				target.Complete10 = amount
+				break
+			case "11":
+				target.Complete11 = amount
+				break
+			case "12":
+				target.Complete12 = amount
+				break
+			}
+		}
+	}
+	target.QuarterComplete1 = target.Complete1 + target.Complete2 + target.Complete3
+	target.QuarterComplete2 = target.Complete4 + target.Complete5 + target.Complete6
+	target.QuarterComplete3 = target.Complete7 + target.Complete8 + target.Complete9
+	target.YearComplete = target.QuarterComplete1 + target.QuarterComplete2 + target.QuarterComplete3 + target.Complete10 + target.Complete11 + target.Complete12
+	if target.QuarterPlan1 != 0 {
+		target.QuarterCompleteRatio1 = target.QuarterComplete1 / target.QuarterPlan1 * 100
+	}
+	if target.QuarterPlan2 != 0 {
+		target.QuarterCompleteRatio2 = target.QuarterComplete2 / target.QuarterPlan2 * 100
+	}
+	if target.QuarterPlan3 != 0 {
+		target.QuarterCompleteRatio3 = target.QuarterComplete3 / target.QuarterPlan3 * 100
+	}
+	if target.YearPlan != 0 {
+		target.YearCompleteRatio = target.YearComplete / target.YearPlan * 100
+	}
+}

+ 1 - 0
opms_parent/main.go

@@ -79,6 +79,7 @@ func main() {
 	s.RegisterName("ProductConsultRecord", new(cust.ProductConsultRecordHandler), "")
 	s.RegisterName("SaleApply", new(train.SaleApplyHandler), "")
 	s.RegisterName("SaleApplySummary", new(train.SaleApplySummaryHandler), "")
+	s.RegisterName("SaleTarget", new(contract.TargetHandler), "")
 
 	// 首页
 	s.RegisterName("Home", new(home.HomeHandler), "")