소스 검색

feature(表头配置): 添加表头配置功能

ZZH-wl 2 년 전
부모
커밋
2ddc81a406

+ 99 - 30
opms_parent/app/dao/plat/internal/plat_followup.go

@@ -712,28 +712,10 @@ func (d *PlatFollowupDao) Unscoped() *PlatFollowupDao {
 }
 
 // DataScope enables the DataScope feature.
-func (d *PlatFollowupDao) DataScope(ctx context.Context, userCol ...string) *PlatFollowupDao {
+func (d *PlatFollowupDao) DataScope(ctx context.Context, args ...interface{}) *PlatFollowupDao {
 	cs := ctx.Value("contextService")
 	dataScope := gconv.Map(gconv.String(gconv.Map(cs)["dataScope"]))
 	if dataScope != nil {
-		tableAs := d.TableAs
-		if d.TableAs != "" {
-			tableAs += "."
-		}
-		userIds, ok := dataScope["userIds"]
-		delete(dataScope, "userIds")
-		var orColumns []string
-		var orValues []interface{}
-		if ok && userIds != "-1" {
-			column := "created_by"
-			if len(userCol) == 1 {
-				column = userCol[0]
-			}
-			if ok, _ := d.M.HasField(column); ok {
-				orColumns = append(orColumns, tableAs+column+" IN (?) ")
-				orValues = append(orValues, userIds)
-			}
-		}
 		// 销售工程师判断
 		var salesEngineerFlag bool
 		if roles, ok := dataScope["roles"]; ok {
@@ -742,21 +724,33 @@ func (d *PlatFollowupDao) DataScope(ctx context.Context, userCol ...string) *Pla
 				salesEngineerFlag = true
 			}
 		}
-		// 非销售工程师权限加成
-		if !salesEngineerFlag {
-			bigColumns := "is_big"
-			if ok, _ := d.M.HasField("is_big"); ok {
-				if val, ok := dataScope[bigColumns]; ok && val != "" {
-					orColumns = append(orColumns, tableAs+bigColumns+" = ? ")
-					orValues = append(orValues, val)
+		userIds, ok := dataScope["userIds"]
+		specialFlag, userCols, orColsMap := d.checkColumnsName(dataScope, args...)
+
+		var orColumns []string
+		var orValues []interface{}
+		if ok && userIds != "-1" {
+			for _, column := range userCols {
+				if ok, _ := d.M.HasField(column); ok || specialFlag {
+					orColumns = append(orColumns, column+" IN (?) ")
+					orValues = append(orValues, userIds)
 				}
-				delete(dataScope, bigColumns)
 			}
+		}
+		for col, params := range orColsMap {
+			if ok, _ := d.M.HasField(col); ok || specialFlag {
+				orColumns = append(orColumns, col+" IN (?) ")
+				orValues = append(orValues, params)
+			}
+		}
+
+		// 销售工程师权限加成
+		if !salesEngineerFlag {
 			var andColumns []string
 			var andValues []interface{}
 			for k, v := range dataScope {
-				if ok, _ := d.M.HasField(k); ok {
-					andColumns = append(andColumns, tableAs+k+" IN (?) ")
+				if ok, _ := d.M.HasField(k); ok || specialFlag {
+					andColumns = append(andColumns, k+" IN (?) ")
 					andValues = append(andValues, v)
 				}
 			}
@@ -770,5 +764,80 @@ func (d *PlatFollowupDao) DataScope(ctx context.Context, userCol ...string) *Pla
 		whereSql := strings.Join(orColumns, " OR ")
 		return &PlatFollowupDao{M: d.M.Where(whereSql, orValues...).Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
 	}
-	return d
+	return &PlatFollowupDao{M: d.M.Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// args 1、字段
+// args 2、字段、表名
+// args 3、字段对应关系
+func (d *PlatFollowupDao) checkColumnsName(dataScope map[string]interface{}, args ...interface{}) (bool, []string, map[string]interface{}) {
+	var userCols []string
+	tableAs, specialFlag := "", false
+	orColsMap, colsContrast := map[string]interface{}{}, 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 {
+		userCols = []string{"created_by"}
+		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 && val[orcols.(string)] != "" {
+				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)
+					}
+				}
+			}
+			delete(colsContrast, "orcols")
+		}
+	}
+	bigColumns := "is_big"
+	if isBig, ok := dataScope[bigColumns]; ok && isBig.(bool) {
+		if bigCol, ok := colsContrast[bigColumns]; ok {
+			orColsMap[bigCol.(string)] = isBig
+			delete(colsContrast, bigCol.(string))
+		} else {
+			orColsMap[tableAs+bigColumns] = isBig
+		}
+	}
+
+	delete(dataScope, "userIds")
+	delete(dataScope, "roles")
+	delete(dataScope, "posts")
+	delete(dataScope, bigColumns)
+	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
 }

+ 756 - 0
opms_parent/app/dao/plat/internal/plat_tablecols_config.go

@@ -0,0 +1,756 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"context"
+	"database/sql"
+	"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"
+	"strings"
+	"time"
+
+	model "dashoo.cn/micro/app/model/plat"
+)
+
+// PlatTablecolsConfigDao is the manager for logic model data accessing and custom defined data operations functions management.
+type PlatTablecolsConfigDao struct {
+	gmvc.M                             // M is the core and embedded struct that inherits all chaining operations from gdb.Model.
+	C       platTablecolsConfigColumns // 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.
+}
+
+// PlatTablecolsConfigColumns defines and stores column names for table plat_tablecols_config.
+type platTablecolsConfigColumns struct {
+	Id          string // 主键
+	UserId      string // 关联用户
+	Table       string // 表格
+	Columns     string // 显示列
+	Remark      string // 备注
+	CreatedBy   string // 创建者
+	CreatedName string // 创建人
+	CreatedTime string // 创建时间
+	UpdatedBy   string // 更新者
+	UpdatedName string // 更新人
+	UpdatedTime string // 更新时间
+	DeletedTime string // 删除时间
+}
+
+var (
+	// PlatTablecolsConfig is globally public accessible object for table plat_tablecols_config operations.
+	PlatTablecolsConfig = PlatTablecolsConfigDao{
+		M:     g.DB("default").Model("plat_tablecols_config").Safe(),
+		DB:    g.DB("default"),
+		Table: "plat_tablecols_config",
+		C: platTablecolsConfigColumns{
+			Id:          "id",
+			UserId:      "user_id",
+			Table:       "table",
+			Columns:     "columns",
+			Remark:      "remark",
+			CreatedBy:   "created_by",
+			CreatedName: "created_name",
+			CreatedTime: "created_time",
+			UpdatedBy:   "updated_by",
+			UpdatedName: "updated_name",
+			UpdatedTime: "updated_time",
+			DeletedTime: "deleted_time",
+		},
+	}
+)
+
+func NewPlatTablecolsConfigDao(tenant string) PlatTablecolsConfigDao {
+	var dao PlatTablecolsConfigDao
+	dao = PlatTablecolsConfigDao{
+		M:     g.DB(tenant).Model("plat_tablecols_config").Safe(),
+		DB:    g.DB(tenant),
+		Table: "plat_tablecols_config",
+		C: platTablecolsConfigColumns{
+			Id:          "id",
+			UserId:      "user_id",
+			Table:       "table",
+			Columns:     "columns",
+			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 *PlatTablecolsConfigDao) Ctx(ctx context.Context) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) GetCtx() context.Context {
+	return d.M.GetCtx()
+}
+
+// As sets an alias name for current table.
+func (d *PlatTablecolsConfigDao) As(as string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.As(as), Table: d.Table, TableAs: as}
+}
+
+// TX sets the transaction for current operation.
+func (d *PlatTablecolsConfigDao) TX(tx *gdb.TX) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.TX(tx), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Master marks the following operation on master node.
+func (d *PlatTablecolsConfigDao) Master() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Slave() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Slave(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Args sets custom arguments for model operation.
+func (d *PlatTablecolsConfigDao) Args(args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Handler(handlers ...gdb.ModelHandler) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) LeftJoin(table ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) RightJoin(table ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) InnerJoin(table ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Fields(fieldNamesOrMapStruct ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) FieldsEx(fieldNamesOrMapStruct ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) FieldCount(column string, as ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) FieldSum(column string, as ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) FieldMin(column string, as ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) FieldMax(column string, as ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) FieldAvg(column string, as ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Option(option int) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OmitEmpty() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OmitEmptyWhere() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OmitEmptyData() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OmitNil() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OmitNilWhere() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OmitNilData() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Filter() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Where(where interface{}, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WherePri(where interface{}, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Having(having interface{}, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Wheref(format string, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Wheref(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLT builds "column < value" statement.
+func (d *PlatTablecolsConfigDao) WhereLT(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLTE builds "column <= value" statement.
+func (d *PlatTablecolsConfigDao) WhereLTE(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGT builds "column > value" statement.
+func (d *PlatTablecolsConfigDao) WhereGT(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereGTE builds "column >= value" statement.
+func (d *PlatTablecolsConfigDao) WhereGTE(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereGTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereBetween builds "column BETWEEN min AND max" statement.
+func (d *PlatTablecolsConfigDao) WhereBetween(column string, min, max interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereLike builds "column LIKE like" statement.
+func (d *PlatTablecolsConfigDao) WhereLike(column string, like interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereIn builds "column IN (in)" statement.
+func (d *PlatTablecolsConfigDao) WhereIn(column string, in interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereNull(columns ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotBetween builds "column NOT BETWEEN min AND max" statement.
+func (d *PlatTablecolsConfigDao) WhereNotBetween(column string, min, max interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereNotBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotLike builds "column NOT LIKE like" statement.
+func (d *PlatTablecolsConfigDao) WhereNotLike(column string, like interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNot builds "column != value" statement.
+func (d *PlatTablecolsConfigDao) WhereNot(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereNot(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereNotIn builds "column NOT IN (in)" statement.
+func (d *PlatTablecolsConfigDao) WhereNotIn(column string, in interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereNotNull(columns ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOr adds "OR" condition to the where statement.
+func (d *PlatTablecolsConfigDao) WhereOr(where interface{}, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOr(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrf builds "OR" condition string using fmt.Sprintf and arguments.
+func (d *PlatTablecolsConfigDao) WhereOrf(format string, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrf(format, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLT builds "column < value" statement in "OR" conditions..
+func (d *PlatTablecolsConfigDao) WhereOrLT(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrLT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLTE builds "column <= value" statement in "OR" conditions..
+func (d *PlatTablecolsConfigDao) WhereOrLTE(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrLTE(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGT builds "column > value" statement in "OR" conditions..
+func (d *PlatTablecolsConfigDao) WhereOrGT(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrGT(column, value), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrGTE builds "column >= value" statement in "OR" conditions..
+func (d *PlatTablecolsConfigDao) WhereOrGTE(column string, value interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereOrBetween(column string, min, max interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrBetween(column, min, max), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrLike builds "column LIKE like" statement in "OR" conditions.
+func (d *PlatTablecolsConfigDao) WhereOrLike(column string, like interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrIn builds "column IN (in)" statement in "OR" conditions.
+func (d *PlatTablecolsConfigDao) WhereOrIn(column string, in interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereOrNull(columns ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereOrNotBetween(column string, min, max interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereOrNotLike(column string, like interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrNotLike(column, like), Table: d.Table, TableAs: d.TableAs}
+}
+
+// WhereOrNotIn builds "column NOT IN (in)" statement.
+func (d *PlatTablecolsConfigDao) WhereOrNotIn(column string, in interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) WhereOrNotNull(columns ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.WhereOrNotNull(columns...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Group sets the "GROUP BY" statement for the model.
+func (d *PlatTablecolsConfigDao) Group(groupBy ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) And(where interface{}, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Or(where interface{}, args ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Or(where, args...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// GroupBy sets the "GROUP BY" statement for the model.
+func (d *PlatTablecolsConfigDao) GroupBy(groupBy string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Group(groupBy), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Order sets the "ORDER BY" statement for the model.
+func (d *PlatTablecolsConfigDao) Order(orderBy ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Order(orderBy...), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderAsc sets the "ORDER BY xxx ASC" statement for the model.
+func (d *PlatTablecolsConfigDao) OrderAsc(column string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.OrderAsc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderDesc sets the "ORDER BY xxx DESC" statement for the model.
+func (d *PlatTablecolsConfigDao) OrderDesc(column string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.OrderDesc(column), Table: d.Table, TableAs: d.TableAs}
+}
+
+// OrderRandom sets the "ORDER BY RANDOM()" statement for the model.
+func (d *PlatTablecolsConfigDao) OrderRandom() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) OrderBy(orderBy string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Limit(limit ...int) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Offset(offset int) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Offset(offset), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Distinct forces the query to only return distinct results.
+func (d *PlatTablecolsConfigDao) Distinct() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Page(page, limit int) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Page(page, limit), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Batch sets the batch operation number for the model.
+func (d *PlatTablecolsConfigDao) Batch(batch int) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Cache(duration time.Duration, name ...string) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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 *PlatTablecolsConfigDao) Data(data ...interface{}) *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{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.PlatTablecolsConfig.
+// 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 *PlatTablecolsConfigDao) All(where ...interface{}) ([]*model.PlatTablecolsConfig, error) {
+	all, err := d.M.All(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.PlatTablecolsConfig
+	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.PlatTablecolsConfig.
+// 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 *PlatTablecolsConfigDao) One(where ...interface{}) (*model.PlatTablecolsConfig, error) {
+	one, err := d.M.One(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.PlatTablecolsConfig
+	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 *PlatTablecolsConfigDao) FindOne(where ...interface{}) (*model.PlatTablecolsConfig, error) {
+	one, err := d.M.FindOne(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entity *model.PlatTablecolsConfig
+	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 *PlatTablecolsConfigDao) FindAll(where ...interface{}) ([]*model.PlatTablecolsConfig, error) {
+	all, err := d.M.FindAll(where...)
+	if err != nil {
+		return nil, err
+	}
+	var entities []*model.PlatTablecolsConfig
+	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 *PlatTablecolsConfigDao) 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 *PlatTablecolsConfigDao) 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 *PlatTablecolsConfigDao) Scan(pointer interface{}, where ...interface{}) error {
+	return d.M.Scan(pointer, where...)
+}
+
+// Chunk iterates the table with given size and callback function.
+func (d *PlatTablecolsConfigDao) Chunk(limit int, callback func(entities []*model.PlatTablecolsConfig, err error) bool) {
+	d.M.Chunk(limit, func(result gdb.Result, err error) bool {
+		var entities []*model.PlatTablecolsConfig
+		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 *PlatTablecolsConfigDao) LockUpdate() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.LockUpdate(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// LockShared sets the lock in share mode for current operation.
+func (d *PlatTablecolsConfigDao) LockShared() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.LockShared(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// Unscoped enables/disables the soft deleting feature.
+func (d *PlatTablecolsConfigDao) Unscoped() *PlatTablecolsConfigDao {
+	return &PlatTablecolsConfigDao{M: d.M.Unscoped(), Table: d.Table, TableAs: d.TableAs}
+}
+
+// DataScope enables the DataScope feature.
+func (d *PlatTablecolsConfigDao) DataScope(ctx context.Context, args ...interface{}) *PlatTablecolsConfigDao {
+	cs := ctx.Value("contextService")
+	dataScope := gconv.Map(gconv.String(gconv.Map(cs)["dataScope"]))
+	if dataScope != nil {
+		var specialFlag bool
+		var tableAs string
+		if d.TableAs != "" && len(args) <= 1 {
+			tableAs = d.TableAs + "."
+		}
+		if len(args) > 1 {
+			specialFlag = true
+			if val, ok := args[1].(string); ok {
+				tableAs = val + "."
+			}
+		}
+		userIds, ok := dataScope["userIds"]
+		delete(dataScope, "userIds")
+		var orColumns []string
+		var orValues []interface{}
+		if ok && userIds != "-1" {
+			column := "created_by"
+			if len(args) > 0 {
+				column = args[0].(string)
+			}
+			if ok, _ := d.M.HasField(column); ok || specialFlag {
+				orColumns = append(orColumns, tableAs+column+" IN (?) ")
+				orValues = append(orValues, userIds)
+			}
+		}
+		// 销售工程师判断
+		var salesEngineerFlag bool
+		if roles, ok := dataScope["roles"]; ok {
+			delete(dataScope, "roles")
+			delete(dataScope, "posts")
+			arr := garray.NewArrayFrom(roles.([]interface{}), true)
+			if arr.Len() == 1 && arr.Contains("SalesEngineer") {
+				salesEngineerFlag = true
+			}
+		}
+		// 非销售工程师权限加成
+		if !salesEngineerFlag {
+			bigColumns := "is_big"
+			if ok, _ := d.M.HasField("is_big"); ok || specialFlag {
+				if val, ok := dataScope[bigColumns]; ok && val != "" {
+					orColumns = append(orColumns, tableAs+bigColumns+" = ? ")
+					orValues = append(orValues, val)
+				}
+				delete(dataScope, bigColumns)
+			}
+			var andColumns []string
+			var andValues []interface{}
+			for k, v := range dataScope {
+				if ok, _ := d.M.HasField(k); ok || specialFlag {
+					andColumns = append(andColumns, tableAs+k+" IN (?) ")
+					andValues = append(andValues, v)
+				}
+			}
+			if len(andColumns) > 0 {
+				andWhereSql := strings.Join(andColumns, " AND ")
+				orColumns = append(orColumns, "("+andWhereSql+")")
+				orValues = append(orValues, andValues...)
+			}
+		}
+
+		whereSql := strings.Join(orColumns, " OR ")
+		return &PlatTablecolsConfigDao{M: d.M.Where(whereSql, orValues...).Ctx(ctx), Table: d.Table, TableAs: d.TableAs}
+	}
+	return d
+}

+ 36 - 0
opms_parent/app/dao/plat/plat_tablecols_config.go

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

+ 0 - 1
opms_parent/app/handler/plat/ni_test.go

@@ -1 +0,0 @@
-package plat

+ 47 - 0
opms_parent/app/handler/plat/tablecols_config.go

@@ -0,0 +1,47 @@
+package plat
+
+import (
+	"context"
+
+	"dashoo.cn/common_definition/comm_def"
+	"github.com/gogf/gf/util/gvalid"
+
+	model "dashoo.cn/micro/app/model/plat"
+	platSrv "dashoo.cn/micro/app/service/plat"
+)
+
+type TableColsConfigHandler struct{}
+
+func (h *TableColsConfigHandler) GetEntityByTable(ctx context.Context, req *model.SearchPlatTablecolsConfigReq, rsp *comm_def.CommonMsg) error {
+	// 参数校验
+	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
+		return err
+	}
+	configService, err := platSrv.NewTableColsConfigService(ctx)
+	if err != nil {
+		return err
+	}
+	data, err := configService.GetEntityByTable(req)
+	if err != nil {
+		return err
+	}
+	rsp.Data = data
+	return nil
+}
+
+func (h *TableColsConfigHandler) Save(ctx context.Context, req *model.PlatTablecolsConfigReq, rsp *comm_def.CommonMsg) error {
+	// 参数校验
+	if err := gvalid.CheckStruct(ctx, req, nil); err != nil {
+		return err
+	}
+	configService, err := platSrv.NewTableColsConfigService(ctx)
+	if err != nil {
+		return err
+	}
+	lastId, err := configService.Save(req)
+	if err != nil {
+		return err
+	}
+	rsp.Data = lastId
+	return nil
+}

+ 25 - 0
opms_parent/app/model/plat/internal/plat_tablecols_config.go

@@ -0,0 +1,25 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. DO NOT EDIT THIS FILE MANUALLY.
+// ==========================================================================
+
+package internal
+
+import (
+	"github.com/gogf/gf/os/gtime"
+)
+
+// PlatTablecolsConfig is the golang structure for table plat_tablecols_config.
+type PlatTablecolsConfig struct {
+	Id          int         `orm:"id,primary"   json:"id"`          // 主键
+	UserId      int         `orm:"user_id"      json:"userId"`      // 关联用户
+	Table       string      `orm:"table"        json:"table"`       // 表格
+	Columns     string      `orm:"columns"      json:"columns"`     // 显示列
+	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"` // 删除时间
+}

+ 23 - 0
opms_parent/app/model/plat/plat_tablecols_config.go

@@ -0,0 +1,23 @@
+// ==========================================================================
+// This is auto-generated by gf cli tool. Fill this file as you wish.
+// ==========================================================================
+
+package plat
+
+import (
+	"dashoo.cn/micro/app/model/plat/internal"
+)
+
+// PlatTablecolsConfig is the golang structure for table plat_tablecols_config.
+type PlatTablecolsConfig internal.PlatTablecolsConfig
+
+// Fill with you ideas below.
+
+type SearchPlatTablecolsConfigReq struct {
+	Table string `json:"table"  v:"required#表名不能为空"`
+}
+type PlatTablecolsConfigReq struct {
+	Id      int    `json:"id"`                           // 主键
+	Table   string `json:"table"  v:"required#表名不能为空"`   // 表
+	Columns string `json:"columns" v:"required#显示列不能为空"` // 显示列
+}

+ 55 - 0
opms_parent/app/service/plat/plat_tablecols_config.go

@@ -0,0 +1,55 @@
+package plat
+
+import (
+	"context"
+	"database/sql"
+
+	"github.com/gogf/gf/util/gconv"
+
+	"dashoo.cn/micro/app/dao/plat"
+	model "dashoo.cn/micro/app/model/plat"
+	"dashoo.cn/micro/app/service"
+)
+
+type TableColsConfigService struct {
+	*service.ContextService
+	Dao *plat.PlatTablecolsConfigDao
+}
+
+func NewTableColsConfigService(ctx context.Context) (svc *TableColsConfigService, err error) {
+	svc = new(TableColsConfigService)
+	if svc.ContextService, err = svc.Init(ctx); err != nil {
+		return nil, err
+	}
+	svc.Dao = plat.NewPlatTablecolsConfigDao(svc.Tenant)
+	return svc, nil
+}
+
+func (s *TableColsConfigService) GetEntityByTable(req *model.SearchPlatTablecolsConfigReq) (config *model.PlatTablecolsConfig, err error) {
+	config, err = s.Dao.Where(s.Dao.C.UserId, s.GetCxtUserId()).Where(s.Dao.C.Table, req.Table).OrderDesc(s.Dao.C.Id).One()
+	return
+}
+
+func (s *TableColsConfigService) Save(req *model.PlatTablecolsConfigReq) (lastId int64, err error) {
+	config := new(model.PlatTablecolsConfig)
+	if err = gconv.Struct(req, config); err != nil {
+		return
+	}
+	config.UserId = s.GetCxtUserId()
+	// 填充创建信息
+	service.SetCreatedInfo(config, s.GetCxtUserId(), s.GetCxtUserName())
+	// 填充更新信息
+	service.SetUpdatedInfo(config, s.GetCxtUserId(), s.GetCxtUserName())
+	var result sql.Result
+	if config.Id != 0 {
+		updateFieldEx := append(service.UpdateFieldEx, s.Dao.C.UserId)
+		result, err = s.Dao.FieldsEx(updateFieldEx...).WherePri(config.Id).Data(config).Update()
+	} else {
+		result, err = s.Dao.Data(config).Insert()
+	}
+	if err != nil {
+		return
+	}
+	lastId, _ = result.LastInsertId()
+	return
+}

+ 10 - 0
opms_parent/config/config.toml

@@ -30,3 +30,13 @@
 
 [micro_srv]
     auth = "dashoo.opms.admin-0.0.1,127.0.0.1:8888"
+
+
+# 钉钉配置
+[dingtalk]
+    corp-id="dinga8b316209f5ee42435c2f4657eb6378f"
+    agent-id="2384115071"
+    app-key="dinguytykawticadfoht"
+    app-secret="zPlj4ZpITsUbeq2C0GrwJ78-e8knH_kIeyvznaNQacqtrSb9zbeZcOajgBKdolky"
+    aes-key="oUjmeWea8Ow1jsdK4UHoDthy6EMQKq3RGbM2rEeTgnm"
+    token="WaasHsYk8V3wqwN5xRGsCmiiRDB"

+ 1 - 0
opms_parent/main.go

@@ -63,6 +63,7 @@ func main() {
 	s.RegisterName("CustCustomerBidRecord", new(cust.CustCustomerBidRecordHandler), "")
 	s.RegisterName("CustCustomerInvoiceHeader", new(cust.CustCustomerInvoiceHeaderHandler), "")
 	s.RegisterName("Questionnaire", new(plat.QuestionnaireHandler), "")
+	s.RegisterName("TableColsConfig", new(plat.TableColsConfigHandler), "")
 
 	// 首页
 	s.RegisterName("Home", new(home.HomeHandler), "")