Browse Source

feature: 400咨询记录管理

lai 2 years ago
parent
commit
b3ac745cdb

+ 6 - 0
opms_parent/Makefile

@@ -17,6 +17,12 @@ build-win:
 clean:
 	rm -rf $(OUTPUT_DIR)
 
+testlog:
+	ssh dashoo-test "cd /home/workservices/lims_latest/ && docker-compose logs --tail 300 -f lims_latest_opms_parent"
+
+gf:
+	../gf gen dao -mode cust -t product_consult_record -l "mysql:root:Dashoo#190801@ali@tcp(192.168.0.252:3306)/dashoo_crm"
+
 help:
     @echo "make: compile packages"
     @echo "build-win: compile packages under windows"

+ 876 - 0
opms_parent/app/dao/cust/internal/product_consult_record.go

@@ -0,0 +1,876 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"fmt"
+	"strings"
+	"time"
+
+	"github.com/gogf/gf/container/garray"
+	"github.com/gogf/gf/database/gdb"
+	"github.com/gogf/gf/frame/g"
+	"github.com/gogf/gf/frame/gmvc"
+	"github.com/gogf/gf/util/gconv"
+
+	model "dashoo.cn/micro/app/model/cust"
+)
+
+// ProductConsultRecordDao is the manager for logic model data accessing and custom defined data operations functions management.
+type ProductConsultRecordDao struct {
+	gmvc.M                              // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
+	C       productConsultRecordColumns // 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.
+}
+
+// ProductConsultRecordColumns defines and stores column names for table product_consult_record.
+type productConsultRecordColumns struct {
+	Id              string // 主键
+	Code            string // 序号
+	ConsultTime     string // 日期时间
+	ProvinceId      string // 所在省ID
+	Province        string // 所在省
+	CityId          string // 所在市ID
+	City            string // 所在市
+	Unit            string // 单位名称
+	Name            string // 联系人
+	Contact         string // 联系方式
+	Product         string // 咨询产品
+	InchargeId      string // 对接人ID
+	InchargeName    string // 对接人(销售工程师)
+	Content         string // 内容
+	Progress        string // 进展
+	NextPlan        string // 下一步计划
+	DistributorId   string // 经销商ID
+	DistributorName string // 经销商
+	CustId          string // 关联客户
+	CustName        string // 客户名称
+	NboId           string // 关联项目
+	NboName         string // 项目名称
+	Remark          string // 备注
+	CreatedBy       string // 创建者
+	CreatedName     string // 创建人
+	CreatedTime     string // 创建时间
+	UpdatedBy       string // 更新者
+	UpdatedName     string // 更新人
+	UpdatedTime     string // 更新时间
+	DeletedTime     string // 删除时间
+}
+
+var (
+	// ProductConsultRecord is globally public accessible object for table product_consult_record operations.
+	ProductConsultRecord = ProductConsultRecordDao{
+		M:     g.DB("default").Model("product_consult_record").Safe(),
+		DB:    g.DB("default"),
+		Table: "product_consult_record",
+		C: productConsultRecordColumns{
+			Id:              "id",
+			Code:            "code",
+			ConsultTime:     "consult_time",
+			ProvinceId:      "province_id",
+			Province:        "province",
+			CityId:          "city_id",
+			City:            "city",
+			Unit:            "unit",
+			Name:            "name",
+			Contact:         "contact",
+			Product:         "product",
+			InchargeId:      "incharge_id",
+			InchargeName:    "incharge_name",
+			Content:         "content",
+			Progress:        "progress",
+			NextPlan:        "next_plan",
+			DistributorId:   "distributor_id",
+			DistributorName: "distributor_name",
+			CustId:          "cust_id",
+			CustName:        "cust_name",
+			NboId:           "nbo_id",
+			NboName:         "nbo_name",
+			Remark:          "remark",
+			CreatedBy:       "created_by",
+			CreatedName:     "created_name",
+			CreatedTime:     "created_time",
+			UpdatedBy:       "updated_by",
+			UpdatedName:     "updated_name",
+			UpdatedTime:     "updated_time",
+			DeletedTime:     "deleted_time",
+		},
+	}
+)
+
+func NewProductConsultRecordDao(tenant string) ProductConsultRecordDao {
+	var dao ProductConsultRecordDao
+	dao = ProductConsultRecordDao{
+		M:     g.DB(tenant).Model("product_consult_record").Safe(),
+		DB:    g.DB(tenant),
+		Table: "product_consult_record",
+		C: productConsultRecordColumns{
+			Id:              "id",
+			Code:            "code",
+			ConsultTime:     "consult_time",
+			ProvinceId:      "province_id",
+			Province:        "province",
+			CityId:          "city_id",
+			City:            "city",
+			Unit:            "unit",
+			Name:            "name",
+			Contact:         "contact",
+			Product:         "product",
+			InchargeId:      "incharge_id",
+			InchargeName:    "incharge_name",
+			Content:         "content",
+			Progress:        "progress",
+			NextPlan:        "next_plan",
+			DistributorId:   "distributor_id",
+			DistributorName: "distributor_name",
+			CustId:          "cust_id",
+			CustName:        "cust_name",
+			NboId:           "nbo_id",
+			NboName:         "nbo_name",
+			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 *ProductConsultRecordDao) Ctx(ctx context.Context) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) GetCtx() context.Context {
+	return d.M.GetCtx()
+}
+
+// As sets an alias name for current table.
+func (d *ProductConsultRecordDao) As(as string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.As(as), Table: d.Table, TableAs: as}
+}
+
+// TX sets the transaction for current operation.
+func (d *ProductConsultRecordDao) TX(tx *gdb.TX) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.TX(tx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Master marks the following operation on master node.
+func (d *ProductConsultRecordDao) Master() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Slave() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Slave(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Args sets custom arguments for model operation.
+func (d *ProductConsultRecordDao) Args(args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Handler(handlers ...gdb.ModelHandler) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) LeftJoin(table ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) RightJoin(table ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) InnerJoin(table ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Fields(fieldNamesOrMapStruct ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) FieldCount(column string, as ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) FieldSum(column string, as ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) FieldMin(column string, as ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) FieldMax(column string, as ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) FieldAvg(column string, as ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Option(option int) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OmitEmpty() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OmitEmptyWhere() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OmitEmptyData() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OmitNil() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OmitNilWhere() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OmitNilData() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Filter() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Where(where interface{}, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WherePri(where interface{}, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Having(having interface{}, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Wheref(format string, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Wheref(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLT builds "column < value" statement.
+func (d *ProductConsultRecordDao) WhereLT(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLTE builds "column <= value" statement.
+func (d *ProductConsultRecordDao) WhereLTE(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGT builds "column > value" statement.
+func (d *ProductConsultRecordDao) WhereGT(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGTE builds "column >= value" statement.
+func (d *ProductConsultRecordDao) WhereGTE(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereGTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereBetween builds "column BETWEEN min AND max" statement.
+func (d *ProductConsultRecordDao) WhereBetween(column string, min, max interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLike builds "column LIKE like" statement.
+func (d *ProductConsultRecordDao) WhereLike(column string, like interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereIn builds "column IN (in)" statement.
+func (d *ProductConsultRecordDao) WhereIn(column string, in interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereNull(columns ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
+func (d *ProductConsultRecordDao) WhereNotBetween(column string, min, max interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotLike builds "column NOT LIKE like" statement.
+func (d *ProductConsultRecordDao) WhereNotLike(column string, like interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNot builds "column != value" statement.
+func (d *ProductConsultRecordDao) WhereNot(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereNot(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotIn builds "column NOT IN (in)" statement.
+func (d *ProductConsultRecordDao) WhereNotIn(column string, in interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereNotNull(columns ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOr adds "OR" condition to the where statement.
+func (d *ProductConsultRecordDao) WhereOr(where interface{}, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOr(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
+func (d *ProductConsultRecordDao) WhereOrf(format string, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrf(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLT builds "column < value" statement in "OR" conditions..
+func (d *ProductConsultRecordDao) WhereOrLT(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLTE builds "column <= value" statement in "OR" conditions..
+func (d *ProductConsultRecordDao) WhereOrLTE(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGT builds "column > value" statement in "OR" conditions..
+func (d *ProductConsultRecordDao) WhereOrGT(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGTE builds "column >= value" statement in "OR" conditions..
+func (d *ProductConsultRecordDao) WhereOrGTE(column string, value interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereOrBetween(column string, min, max interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLike builds "column LIKE like" statement in "OR" conditions.
+func (d *ProductConsultRecordDao) WhereOrLike(column string, like interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrIn builds "column IN (in)" statement in "OR" conditions.
+func (d *ProductConsultRecordDao) WhereOrIn(column string, in interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereOrNull(columns ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereOrNotBetween(column string, min, max interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereOrNotLike(column string, like interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotIn builds "column NOT IN (in)" statement.
+func (d *ProductConsultRecordDao) WhereOrNotIn(column string, in interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) WhereOrNotNull(columns ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.WhereOrNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *ProductConsultRecordDao) Group(groupBy ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) And(where interface{}, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Or(where interface{}, args ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Or(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// GroupBy sets the "GROUP BY" statement for the model.
+func (d *ProductConsultRecordDao) GroupBy(groupBy string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Group(groupBy), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *ProductConsultRecordDao) Order(orderBy ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Order(orderBy...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
+func (d *ProductConsultRecordDao) OrderAsc(column string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.OrderAsc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
+func (d *ProductConsultRecordDao) OrderDesc(column string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.OrderDesc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
+func (d *ProductConsultRecordDao) OrderRandom() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) OrderBy(orderBy string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Limit(limit ...int) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Offset(offset int) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Offset(offset), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Distinct forces the query to only return distinct results.
+func (d *ProductConsultRecordDao) Distinct() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Page(page, limit int) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Page(page, limit), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *ProductConsultRecordDao) Batch(batch int) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Cache(duration time.Duration, name ...string) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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 *ProductConsultRecordDao) Data(data ...interface{}) *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{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.ProductConsultRecord.
+// 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 *ProductConsultRecordDao) All(where ...interface{}) ([]*model.ProductConsultRecord, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.ProductConsultRecord
+	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.ProductConsultRecord.
+// 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 *ProductConsultRecordDao) One(where ...interface{}) (*model.ProductConsultRecord, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.ProductConsultRecord
+	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 *ProductConsultRecordDao) FindOne(where ...interface{}) (*model.ProductConsultRecord, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.ProductConsultRecord
+	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 *ProductConsultRecordDao) FindAll(where ...interface{}) ([]*model.ProductConsultRecord, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.ProductConsultRecord
+	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 *ProductConsultRecordDao) 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 *ProductConsultRecordDao) 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 *ProductConsultRecordDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *ProductConsultRecordDao) Chunk(limit int, callback func(entities []*model.ProductConsultRecord, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.ProductConsultRecord
+		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 *ProductConsultRecordDao) LockUpdate() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.LockUpdate(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *ProductConsultRecordDao) LockShared() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.LockShared(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *ProductConsultRecordDao) Unscoped() *ProductConsultRecordDao {
+	return &ProductConsultRecordDao{M: d.M.Unscoped(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// DataScope enables the DataScope feature.
+func (d *ProductConsultRecordDao) DataScope(ctx context.Context, args ...interface{}) *ProductConsultRecordDao {
+	cs := ctx.Value("contextService")
+	dataScope := gconv.Map(gconv.String(gconv.Map(cs)["dataScope"]))
+	if dataScope != nil {
+		// 销售工程师判断
+		var salesEngineerFlag bool
+		if roles, ok := dataScope["roles"]; ok {
+			arr := garray.NewArrayFrom(roles.([]interface{}), true)
+			if arr.Len() == 1 && arr.Contains("SalesEngineer") {
+				salesEngineerFlag = true
+			}
+		}
+		userIds, ok := dataScope["userIds"]
+		specialFlag, userCols, orColsMap := d.checkColumnsName(dataScope, args...)
+
+		var orColumns []string
+		var orValues []interface{}
+		if ok && userIds != "-1" {
+			for _, col := range userCols {
+				if ok, _ := d.M.HasField(col); ok || specialFlag {
+					orColumns = append(orColumns, fmt.Sprintf(" ( %s IN (?) )", col))
+					orValues = append(orValues, userIds)
+				}
+			}
+		}
+		for col, params := range orColsMap {
+			if ok, _ := d.M.HasField(col); ok || specialFlag {
+				orColumns = append(orColumns, fmt.Sprintf(" ( %s IN (?) )", col))
+				orValues = append(orValues, params)
+			}
+		}
+
+		// 销售工程师权限加成
+		if !salesEngineerFlag {
+			var andColumns []string
+			var andValues []interface{}
+			for col, params := range dataScope {
+				if ok, _ := d.M.HasField(col); ok || specialFlag {
+					andColumns = append(andColumns, fmt.Sprintf(" ( %s IN (?) )", col))
+					andValues = append(andValues, params)
+				}
+			}
+			if len(andColumns) > 0 {
+				andWhereSql := strings.Join(andColumns, " AND ")
+				orColumns = append(orColumns, "("+andWhereSql+")")
+				orValues = append(orValues, andValues...)
+			}
+		}
+
+		whereSql := strings.Join(orColumns, " OR ")
+		return &ProductConsultRecordDao{M: d.M.Where(whereSql, orValues...).Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
+	}
+	return d
+}
+
+// args 1、字段
+// args 2、字段、表名
+// args 3、字段对应关系
+func (d *ProductConsultRecordDao) checkColumnsName(dataScope map[string]interface{}, args ...interface{}) (bool, []string, map[string]interface{}) {
+	var tableAs string
+	var specialFlag bool
+	var userCols []string
+	var orColsMap map[string]interface{}
+	var colsContrast map[string]interface{}
+
+	if d.TableAs != "" && len(args) <= 1 {
+		tableAs = d.TableAs + "."
+	}
+	if len(args) > 1 {
+		specialFlag = true
+		if val, ok := args[1].(string); ok {
+			tableAs = val + "."
+		}
+	}
+	if len(args) > 0 {
+		if column, ok := args[0].(string); ok {
+			userCols = []string{tableAs + column}
+		}
+		if cols, ok := args[0].([]string); ok {
+			for _, v := range cols {
+				userCols = append(userCols, tableAs+v)
+			}
+		}
+		if val, ok := args[0].(map[string]interface{}); ok {
+			specialFlag = true
+			colsContrast = val
+			if orcols, ok := val["orcols"]; ok {
+				if col, ok := orcols.(string); ok && gconv.String(val[col]) != "" {
+					orColsMap[col] = val[col]
+					delete(colsContrast, col)
+				}
+				if cols, ok := orcols.([]string); ok {
+					for _, col := range cols {
+						if gconv.String(val[col]) == "" {
+							continue
+						}
+						orColsMap[col] = val[col]
+						delete(colsContrast, col)
+					}
+				}
+			}
+		}
+	}
+	bigColumns := "is_big"
+	if isBig, ok := dataScope[bigColumns]; ok {
+		if bigCol, ok := colsContrast[bigColumns]; ok {
+			orColsMap[bigCol.(string)] = isBig
+			delete(colsContrast, bigCol.(string))
+		} else {
+			if ok, _ := d.M.HasField(bigColumns); ok && specialFlag {
+				orColsMap[tableAs+bigColumns] = isBig
+			}
+		}
+	}
+
+	delete(dataScope, "userIds")
+	delete(dataScope, "roles")
+	delete(dataScope, "posts")
+	delete(dataScope, bigColumns)
+	if specialFlag && len(args) == 1 {
+		for k, v := range dataScope {
+			if data, ok := colsContrast[k]; ok {
+				dataScope[data.(string)] = v
+			}
+			delete(dataScope, k)
+			delete(colsContrast, k)
+		}
+		for k, v := range colsContrast {
+			dataScope[k] = v
+		}
+	}
+	return specialFlag, userCols, orColsMap
+}

+ 36 - 0
opms_parent/app/dao/cust/product_consult_record.go

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

+ 86 - 0
opms_parent/app/handler/cust/product_consult_record.go

@@ -0,0 +1,86 @@
+package cust
+
+import (
+	"context"
+	model "dashoo.cn/micro/app/model/cust"
+	service "dashoo.cn/micro/app/service/cust"
+
+	"dashoo.cn/common_definition/comm_def"
+	"github.com/gogf/gf/frame/g"
+)
+
+type ProductConsultRecordHandler struct{}
+
+func (c *ProductConsultRecordHandler) Get(ctx context.Context, req *model.IdRequiredReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("ProductConsultRecordHandler.Get request %#v ", *req)
+	s, err := service.NewProductConsultRecordService(ctx)
+	if err != nil {
+		return err
+	}
+	ent, err := s.Get(ctx, req.Id)
+	if err != nil {
+		return err
+	}
+	rsp.Data = ent
+	return nil
+}
+
+func (c *ProductConsultRecordHandler) List(ctx context.Context, req *model.ProductConsultRecordListReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("ProductConsultRecordHandler.List request %#v ", *req)
+	s, err := service.NewProductConsultRecordService(ctx)
+	if err != nil {
+		return err
+	}
+	total, ent, err := s.List(ctx, req)
+	if err != nil {
+		return err
+	}
+	if ent == nil {
+		ent = []*model.ProductConsultRecord{}
+	}
+	rsp.Data = map[string]interface{}{
+		"total": total,
+		"list":  ent,
+	}
+	return nil
+}
+
+func (c *ProductConsultRecordHandler) Add(ctx context.Context, req *model.ProductConsultRecordAddReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("ProductConsultRecordHandler.Add request %#v ", *req)
+	s, err := service.NewProductConsultRecordService(ctx)
+	if err != nil {
+		return err
+	}
+	id, err := s.Add(ctx, req)
+	if err != nil {
+		return err
+	}
+	rsp.Data = id
+	return nil
+}
+
+func (c *ProductConsultRecordHandler) Update(ctx context.Context, req *model.ProductConsultRecordUpdateReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("ProductConsultRecordHandler.Update request %#v ", *req)
+	s, err := service.NewProductConsultRecordService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Update(ctx, req)
+	if err != nil {
+		return err
+	}
+	return nil
+}
+
+func (c *ProductConsultRecordHandler) Delete(ctx context.Context, req *model.IdsReq, rsp *comm_def.CommonMsg) error {
+	g.Log().Infof("ProductConsultRecordHandler.Delete request %#v ", *req)
+	s, err := service.NewProductConsultRecordService(ctx)
+	if err != nil {
+		return err
+	}
+	err = s.Delete(ctx, req.Id)
+	if err != nil {
+		return err
+	}
+	return nil
+}

+ 43 - 0
opms_parent/app/model/cust/internal/product_consult_record.go

@@ -0,0 +1,43 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// ProductConsultRecord is the golang structure for table product_consult_record.
+type ProductConsultRecord struct {
+	Id              int         `orm:"id,primary"       json:"id"`              // 主键
+	Code            string      `orm:"code"             json:"code"`            // 序号
+	ConsultTime     *gtime.Time `orm:"consult_time"     json:"consultTime"`     // 日期时间
+	ProvinceId      int         `orm:"province_id"      json:"provinceId"`      // 所在省ID
+	Province        string      `orm:"province"         json:"province"`        // 所在省
+	CityId          int         `orm:"city_id"          json:"cityId"`          // 所在市ID
+	City            string      `orm:"city"             json:"city"`            // 所在市
+	Unit            string      `orm:"unit"             json:"unit"`            // 单位名称
+	Name            string      `orm:"name"             json:"name"`            // 联系人
+	Contact         string      `orm:"contact"          json:"contact"`         // 联系方式
+	Product         string      `orm:"product"          json:"product"`         // 咨询产品
+	InchargeId      int         `orm:"incharge_id"      json:"inchargeId"`      // 对接人ID
+	InchargeName    string      `orm:"incharge_name"    json:"inchargeName"`    // 对接人(销售工程师)
+	Content         string      `orm:"content"          json:"content"`         // 内容
+	Progress        string      `orm:"progress"         json:"progress"`        // 进展
+	NextPlan        string      `orm:"next_plan"        json:"nextPlan"`        // 下一步计划
+	DistributorId   int         `orm:"distributor_id"   json:"distributorId"`   // 经销商ID
+	DistributorName string      `orm:"distributor_name" json:"distributorName"` // 经销商
+	CustId          int         `orm:"cust_id"          json:"custId"`          // 关联客户
+	CustName        string      `orm:"cust_name"        json:"custName"`        // 客户名称
+	NboId           int         `orm:"nbo_id"           json:"nboId"`           // 关联项目
+	NboName         string      `orm:"nbo_name"         json:"nboName"`         // 项目名称
+	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"`     // 删除时间
+}

+ 63 - 0
opms_parent/app/model/cust/product_consult_record.go

@@ -0,0 +1,63 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package cust
+
+import (
+	"dashoo.cn/micro/app/model/cust/internal"
+	"dashoo.cn/opms_libary/request"
+	"github.com/gogf/gf/os/gtime"
+)
+
+// ProductConsultRecord is the golang structure for table product_consult_record.
+type ProductConsultRecord internal.ProductConsultRecord
+
+// Fill with you ideas below.
+type ProductConsultRecordListReq struct {
+	request.PageReq
+	Name         string `json:"name"`         // 联系人
+	InchargeName string `json:"inchargeName"` // 对接人(销售工程师)
+	Unit         string `json:"unit"`         // 单位名称
+}
+
+type ProductConsultRecordAddReq struct {
+	Code         string      `json:"code"`                              // 序号
+	ConsultTime  *gtime.Time `json:"consultTime"  v:"required#请输入日期时间"` // 日期时间
+	ProvinceId   int         `json:"provinceId"`                        // 所在省ID
+	Province     string      `json:"province"`                          // 所在省
+	CityId       int         `json:"cityId"`                            // 所在市ID
+	City         string      `json:"city"`                              // 所在市
+	Unit         string      `json:"unit" v:"required#请输入单位名称"`         // 单位名称
+	Name         string      `json:"name" v:"required#请输入联系人"`          // 联系人
+	Contact      string      `json:"contact" v:"required#请输入联系方式"`      // 联系方式
+	Product      string      `json:"product" v:"required#请输入咨询产品"`      // 咨询产品
+	InchargeId   int         `json:"inchargeId" v:"required#请输入对接人"`    // 对接人ID
+	InchargeName string      `json:"inchargeName"`                      // 对接人(销售工程师)
+	Content      string      `json:"content" v:"required#请输入400电话内容"`   // 内容
+}
+
+type ProductConsultRecordUpdateReq struct {
+	Id              int         `json:"id" v:"required#请输入Id"`
+	ConsultTime     *gtime.Time `json:"consultTime"`     // 日期时间
+	ProvinceId      int         `json:"provinceId"`      // 所在省ID
+	Province        string      `json:"province"`        // 所在省
+	CityId          int         `json:"cityId"`          // 所在市ID
+	City            string      `json:"city"`            // 所在市
+	Unit            string      `json:"unit"`            // 单位名称
+	Name            string      `json:"name"`            // 联系人
+	Contact         string      `json:"contact"`         // 联系方式
+	Product         string      `json:"product"`         // 咨询产品
+	InchargeId      int         `json:"inchargeId"`      // 对接人ID
+	InchargeName    string      `json:"inchargeName"`    // 对接人(销售工程师)
+	Content         string      `json:"content"`         // 内容
+	Progress        string      `json:"progress"`        // 进展
+	NextPlan        string      `json:"nextPlan"`        // 下一步计划
+	DistributorId   int         `json:"distributorId"`   // 经销商ID
+	DistributorName string      `json:"distributorName"` // 经销商
+	CustId          int         `json:"custId"`          // 关联客户
+	CustName        string      `json:"custName"`        // 客户名称
+	NboId           int         `json:"nboId"`           // 关联项目
+	NboName         string      `json:"nboName"`         // 项目名称
+	Remark          string      `json:"remark"`          // 备注
+}

+ 53 - 0
opms_parent/app/service/base/config/config.toml

@@ -0,0 +1,53 @@
+# 应用系统设置
+[setting]
+    logpath = "/tmp/log/admin"
+    bind-addr = "192.168.0.119:8889"
+    bind-mutipart-addr = "192.168.0.119:9999"
+    need-advertise-addr = false
+    srv-name = "dashoo.dev.opms.parent-0.0.1"
+    env = "dev"
+    swagger = true
+    # fake-auth-for-swagger = true
+
+# 微服务注册中心配置
+[service_registry]
+    registry = "consul" # consul 或 peer2peer
+    server-addr = "192.168.0.252:18500"
+
+# 数据库连接
+[database]
+    [[database.default]]
+        Debug = true
+        createdAt = "created_time"
+        updatedAt = "updated_time"
+        deletedAt = "deleted_time"
+        link = "mysql:root:Dashoo#190801@ali@tcp(192.168.0.252:3306)/dashoo_crm"
+    [[database.cp5vbwxy]]
+        Debug = true
+        createdAt = "created_time"
+        updatedAt = "updated_time"
+        deletedAt = "deleted_time"
+        link = "mysql:root:Bgt5^yhn@tcp(sh-cynosdbmysql-grp-caipe5bm.sql.tencentcdb.com:20185)/opms"
+    [[database.prod]]
+        Debug = true
+        createdAt = "created_time"
+        updatedAt = "updated_time"
+        deletedAt = "deleted_time"
+        link = "mysql:oms_u:igFu13J6aDZUqjvs7FO6@tcp(sh-cdb-3dhdnseg.sql.tencentcdb.com:59463)/dashoo_oms?loc=Local"
+
+[micro_srv]
+    # auth = "dashoo.opms.admin-0.0.1,127.0.0.1:8888"
+    auth = "dashoo.opms.admin-0.0.1,192.168.0.252:8108"
+    # auth = "dashoo.opms.admin-0.0.1,192.168.0.218:8888"
+    tenant = "default"
+
+
+# 钉钉配置
+[dingtalk]
+    corp-id="dinga8b316209f5ee42435c2f4657eb6378f"
+    agent-id="2384115071"
+    app-key="dinguytykawticadfoht"
+    app-secret="zPlj4ZpITsUbeq2C0GrwJ78-e8knH_kIeyvznaNQacqtrSb9zbeZcOajgBKdolky"
+    aes-key="oUjmeWea8Ow1jsdK4UHoDthy6EMQKq3RGbM2rEeTgnm"
+    token="WaasHsYk8V3wqwN5xRGsCmiiRDB"
+    # disable-for-dev=true

+ 249 - 0
opms_parent/app/service/cust/product_consult_record.go

@@ -0,0 +1,249 @@
+package cust
+
+import (
+	"context"
+	"database/sql"
+	"fmt"
+
+	dao "dashoo.cn/micro/app/dao/cust"
+	model "dashoo.cn/micro/app/model/cust"
+	"dashoo.cn/micro/app/service"
+	"dashoo.cn/opms_libary/micro_srv"
+	"dashoo.cn/opms_libary/myerrors"
+	"dashoo.cn/opms_libary/request"
+
+	"github.com/gogf/gf/os/gtime"
+	"github.com/gogf/gf/util/gvalid"
+)
+
+type ProductConsultRecordService struct {
+	Dao         *dao.ProductConsultRecordDao
+	CustomerDao *dao.CustCustomerDao
+	Tenant      string
+	userInfo    request.UserInfo
+}
+
+func NewProductConsultRecordService(ctx context.Context) (*ProductConsultRecordService, error) {
+	tenant, err := micro_srv.GetTenant(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取组合码异常:%s", err.Error())
+	}
+	// 获取用户信息
+	userInfo, err := micro_srv.GetUserInfo(ctx)
+	if err != nil {
+		return nil, fmt.Errorf("获取用户信息异常:%s", err.Error())
+	}
+	return &ProductConsultRecordService{
+		Dao:         dao.NewProductConsultRecordDao(tenant),
+		CustomerDao: dao.NewCustCustomerDao(tenant),
+		Tenant:      tenant,
+		userInfo:    userInfo,
+	}, nil
+}
+
+func (s ProductConsultRecordService) Get(ctx context.Context, id int) (*model.ProductConsultRecord, error) {
+	ent, err := s.Dao.Where("Id = ?", id).One()
+	if err != nil {
+		return nil, err
+	}
+	if ent == nil {
+		return nil, myerrors.TipsError("咨询记录不存在")
+	}
+	return ent, nil
+}
+
+func (s ProductConsultRecordService) List(ctx context.Context, req *model.ProductConsultRecordListReq) (int, []*model.ProductConsultRecord, error) {
+	dao := &s.Dao.ProductConsultRecordDao
+	if req.Name != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.Name)
+		dao = dao.Where("name like ?", likestr)
+	}
+	if req.InchargeName != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.InchargeName)
+		dao = dao.Where("incharge_name like ?", likestr)
+	}
+	if req.Unit != "" {
+		likestr := fmt.Sprintf("%%%s%%", req.Unit)
+		dao = dao.Where("unit like ?", likestr)
+	}
+	// 权限限制(销售工程师看自己的)
+	if service.StringsContains(s.userInfo.Roles, "SalesEngineer") {
+		dao = dao.Where("incharge_id like ?", s.userInfo.Id)
+	}
+
+	total, err := dao.Count()
+	if err != nil {
+		return 0, nil, err
+	}
+	if req.PageNum != 0 {
+		dao = dao.Page(req.GetPage())
+	}
+	orderby := "created_time desc"
+	if req.OrderBy != "" {
+		orderby = req.OrderBy
+	}
+	dao = dao.Order(orderby)
+
+	ents := []*model.ProductConsultRecord{}
+	err = dao.Structs(&ents)
+	if err != nil && err != sql.ErrNoRows {
+		return 0, nil, err
+	}
+	return total, ents, err
+}
+
+func (s *ProductConsultRecordService) consultCode() (string, error) {
+	sequence, err := service.Sequence(s.Dao.DB, "consult_code")
+	if err != nil {
+		return "", err
+	}
+	return sequence, nil
+}
+
+func (s ProductConsultRecordService) Add(ctx context.Context, req *model.ProductConsultRecordAddReq) (int, error) {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return 0, myerrors.TipsError(validErr.Current().Error())
+	}
+	if req.Code == "" {
+		code, err := s.consultCode()
+		if err != nil {
+			return 0, nil
+		}
+		req.Code = code
+	}
+	ent, err := s.Dao.Where("code = ?", req.Code).One()
+	if err != nil {
+		return 0, err
+	}
+	if ent != nil {
+		return 0, myerrors.TipsError(fmt.Sprintf("序号:%s 已存在", req.Code))
+	}
+
+	id, err := s.Dao.InsertAndGetId(model.ProductConsultRecord{
+		Code:         req.Code,
+		ConsultTime:  req.ConsultTime,
+		ProvinceId:   req.ProvinceId,
+		Province:     req.Province,
+		CityId:       req.CityId,
+		City:         req.City,
+		Unit:         req.Unit,
+		Name:         req.Name,
+		Contact:      req.Contact,
+		Product:      req.Product,
+		InchargeId:   req.InchargeId,
+		InchargeName: req.InchargeName,
+		Content:      req.Content,
+		Remark:       "",
+		CreatedBy:    int(s.userInfo.Id),
+		CreatedName:  s.userInfo.NickName,
+		CreatedTime:  gtime.Now(),
+		UpdatedBy:    int(s.userInfo.Id),
+		UpdatedName:  s.userInfo.NickName,
+		UpdatedTime:  gtime.Now(),
+	})
+	if err != nil {
+		return 0, err
+	}
+	return int(id), err
+}
+
+func (s ProductConsultRecordService) Update(ctx context.Context, req *model.ProductConsultRecordUpdateReq) error {
+	validErr := gvalid.CheckStruct(ctx, req, nil)
+	if validErr != nil {
+		return myerrors.TipsError(validErr.Current().Error())
+	}
+
+	ent, err := s.Dao.Where("id = ?", req.Id).One()
+	if err != nil {
+		return err
+	}
+	if ent == nil {
+		return myerrors.TipsError(fmt.Sprintf("记录不存在: %d", req.Id))
+	}
+
+	dao := &s.Dao.ProductConsultRecordDao
+	toupdate := map[string]interface{}{}
+
+	if req.ConsultTime != nil {
+		toupdate["consult_time"] = req.ConsultTime
+	}
+	if req.ProvinceId != 0 {
+		toupdate["province_id"] = req.ProvinceId
+	}
+	if req.Province != "" {
+		toupdate["province"] = req.Province
+	}
+	if req.CityId != 0 {
+		toupdate["city_id"] = req.CityId
+	}
+	if req.City != "" {
+		toupdate["city"] = req.City
+	}
+	if req.Unit != "" {
+		toupdate["unit"] = req.Unit
+	}
+	if req.Name != "" {
+		toupdate["name"] = req.Name
+	}
+	if req.Contact != "" {
+		toupdate["contact"] = req.Contact
+	}
+	if req.Product != "" {
+		toupdate["product"] = req.Product
+	}
+	if req.InchargeId != 0 {
+		toupdate["incharge_id"] = req.InchargeId
+	}
+	if req.InchargeName != "" {
+		toupdate["incharge_name"] = req.InchargeName
+	}
+	if req.Content != "" {
+		toupdate["content"] = req.Content
+	}
+	if req.Progress != "" {
+		toupdate["progress"] = req.Progress
+	}
+	if req.NextPlan != "" {
+		toupdate["next_plan"] = req.NextPlan
+	}
+	if req.DistributorId != 0 {
+		toupdate["distributor_id"] = req.DistributorId
+	}
+	if req.DistributorName != "" {
+		toupdate["distributor_name"] = req.DistributorName
+	}
+	if req.CustId != 0 {
+		toupdate["cust_id"] = req.CustId
+	}
+	if req.CustName != "" {
+		toupdate["cust_name"] = req.CustName
+	}
+	if req.NboId != 0 {
+		toupdate["nbo_id"] = req.NboId
+	}
+	if req.NboName != "" {
+		toupdate["nbo_name"] = req.NboName
+	}
+	if req.Remark != "" {
+		toupdate["remark"] = req.Remark
+	}
+	if len(toupdate) != 0 {
+		toupdate["updated_by"] = int(s.userInfo.Id)
+		toupdate["updated_name"] = s.userInfo.NickName
+		toupdate["updated_time"] = gtime.Now()
+		_, err = dao.Where("Id", req.Id).Data(toupdate).Update()
+		if err != nil {
+			return err
+		}
+	}
+	return nil
+}
+
+func (s ProductConsultRecordService) Delete(ctx context.Context, id []int) error {
+	if len(id) == 0 {
+		return nil
+	}
+	_, err := s.Dao.Where("Id  IN (?)", id).Delete()
+	return err
+}

+ 1 - 0
opms_parent/main.go

@@ -75,6 +75,7 @@ func main() {
 	s.RegisterName("TableColsConfig", new(plat.TableColsConfigHandler), "")
 	s.RegisterName("ContractReport", new(contract.ContractReportHandler), "")
 	s.RegisterName("BusinessReport", new(projHandler.BusinessReportHandler), "")
+	s.RegisterName("ProductConsultRecord", new(cust.ProductConsultRecordHandler), "")
 
 	// 首页
 	s.RegisterName("Home", new(home.HomeHandler), "")

+ 1 - 0
opms_parent/schema/function.sql

@@ -52,4 +52,5 @@ DELIMITER ;
 
 -- INSERT INTO plat_sequence VALUES ('customer_code', 1000, 1, '', 1000, '系统管理员', '2023-02-09 10:27:42', null, null, null, null);
 -- INSERT INTO plat_sequence VALUES ('contract_code', 1000, 1, '', 1000, '系统管理员', '2023-02-09 10:27:42', null, null, null, null);
+-- INSERT INTO plat_sequence VALUES ('consult_code', 1000, 1, null, '', 1000, '系统管理员', '2023-02-09 10:27:42', null, null, null, null);
 -- select `nextval`('customer_code');

+ 34 - 0
opms_parent/schema/tmp.sql

@@ -191,3 +191,37 @@ CREATE TABLE work_order_feedback_trial(
 alter table work_order_dynamics modify `opn_type` varchar(90) NOT NULL COMMENT '操作类型';
 alter table plat_punch_records add `partner_contact_id` INT(11) COMMENT '合作伙伴联系人id';
 alter table plat_punch_records add `partner_contact_name` varchar(90) COMMENT '合作伙伴联系人';
+
+CREATE TABLE `product_consult_record` (
+    `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+    `code` varchar(32) NOT NULL COMMENT '序号',
+    `consult_time` datetime COMMENT '日期时间',
+    `province_id` INT(11) COMMENT '所在省ID',
+    `province` VARCHAR(90) COMMENT '所在省',
+    `city_id` INT(11) COMMENT '所在市ID',
+    `city` VARCHAR(90) COMMENT '所在市',
+    `unit` varchar(90) COMMENT '单位名称',
+    `name` varchar(90) COMMENT '联系人',
+    `contact` varchar(90) COMMENT '联系方式',
+    `product` varchar(90) COMMENT '咨询产品',
+    `incharge_id` int(11) COMMENT '对接人ID',
+    `incharge_name` varchar(90) COMMENT '对接人(销售工程师)',
+    `content` text COMMENT '内容',
+    `progress` text COMMENT '进展',
+    `next_plan` text COMMENT '下一步计划',
+    `distributor_id` int(11) DEFAULT NULL COMMENT '经销商ID',
+    `distributor_name` varchar(90) DEFAULT NULL COMMENT '经销商',
+    `cust_id` int(11) COMMENT '关联客户',
+    `cust_name` varchar(90) COMMENT '客户名称',
+    `nbo_id` int(11) COMMENT '关联项目',
+    `nbo_name` varchar(90) COMMENT '项目名称',
+    `remark` text DEFAULT NULL COMMENT '备注',
+    `created_by` int(11) NOT NULL COMMENT '创建者',
+    `created_name` varchar(90) NOT NULL COMMENT '创建人',
+    `created_time` datetime NOT NULL COMMENT '创建时间',
+    `updated_by` int(11) DEFAULT NULL COMMENT '更新者',
+    `updated_name` varchar(90) DEFAULT NULL COMMENT '更新人',
+    `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
+    `deleted_time` datetime DEFAULT NULL COMMENT '删除时间',
+    PRIMARY KEY (`id`)
+) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '产品咨询记录';