Documentation
¶
Index ¶
- Variables
- func CurrentLoginUserId(r *http.Request) string
- func EnableFind(moduleName string) bool
- func EnableTag(moduleName string, i int) bool
- func FreeappCfg()
- func GetNewId(iLength int, sTableName string) string
- func HasSection(sectionName string) bool
- func IsCloudApp() bool
- func IsCloudSystem() bool
- func IsNotCloudApp() bool
- func IsNotCloudSystem() bool
- func ReadConfigKey(section, key string, def interface{}) interface{}
- func SetTableKeyServiceName(name string)
- func ToEntity(entity interface{}, names ...string) *msgentity.MsgEntity
- type AopUtil
- func (au AopUtil) CallAfterFunc(funcName string, ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity
- func (au AopUtil) CallAroundFunc(funcName string, ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity
- func (au AopUtil) CallBeforeFunc(funcName string, ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity
- func (au AopUtil) RegisterAfter(funcName string, ...)
- func (au AopUtil) RegisterAround(funcName string, ...)
- func (au AopUtil) RegisterBefore(funcName string, ...)
- type BrickApp
- type Cloud
- type CommonService
- type Controller
- type ControllerBaseFunc
- func (control *ControllerBaseFunc) CheckRepeatAlone() map[string]int
- func (control *ControllerBaseFunc) CheckRepeatCombination() []string
- func (control *ControllerBaseFunc) Enable() int
- func (control *ControllerBaseFunc) GetModuleDao(controller Controller) (Dao, error)
- func (control *ControllerBaseFunc) GetModuleEntity(controller Controller) (dbinfo.Entity, error)
- func (control *ControllerBaseFunc) GetModuleService(controller Controller) (Service, error)
- func (control *ControllerBaseFunc) IdValuePrefix() string
- func (control *ControllerBaseFunc) LikeTimeLimit() int
- func (control *ControllerBaseFunc) RegisterUrl()
- func (control *ControllerBaseFunc) SetOwner(owner Controller)
- type ControllerUtil
- func (controlUtil ControllerUtil) Add(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) AddNode(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) AddRequestAttrib(ctx ginutil.Context, attribs ...[]string)
- func (controlUtil ControllerUtil) AddToGroup(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) Adds(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) ClearCache(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) Del(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) Edit(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) Edits(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindAll(ctx ginutil.Context, control Controller, attachWhere ...set.Set) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindByDate(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindByGroup(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindById(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindByPage(ctx ginutil.Context, control Controller, injectionCondition ...set.Set) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindByRow(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindByTree(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindCountByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindOneByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) FindValueByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) GetParams(ctx ginutil.Context, entity interface{}) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) GetValueByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) GetValueByFieldName(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) Group(ctx ginutil.Context, control Controller, fields map[string]string) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) GroupAndCount(ctx ginutil.Context, control Controller, fields map[string]string) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) GroupByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) HasById(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) HasByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) LookImg(ctx ginutil.Context, control Controller, modelName, filename string)
- func (controlUtil ControllerUtil) MaxByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) MinByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) ReversalByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
- func (controlUtil ControllerUtil) UpFile(ctx ginutil.Context, control Controller, modelName string) *msgentity.MsgEntity
- type Dao
- type DaoBaseFunc
- func (dao DaoBaseFunc) Add(entity dbinfo.Entity) *msgentity.MsgEntity
- func (dao DaoBaseFunc) AddCommon(entity dbinfo.Entity) *msgentity.MsgEntity
- func (dao DaoBaseFunc) AddNode(entity dbinfo.Entity) *msgentity.MsgEntity
- func (dao DaoBaseFunc) Adds(entitys []dbinfo.Entity) *msgentity.MsgEntity
- func (dao DaoBaseFunc) ChangeSetp(entity dbinfo.Entity, id interface{}, iSetp, iVersion int, sMemo string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) ChangeState(entity dbinfo.Entity, id interface{}, iState, iVersion int, sMemo string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) CommonCheckRepeatByAdd(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
- func (dao DaoBaseFunc) CommonCheckRepeatByAddAndTree(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
- func (dao DaoBaseFunc) CommonCheckRepeatByEdit(entity dbinfo.Entity, id interface{}, currentUser string) *msgentity.MsgEntity
- func (dao DaoBaseFunc) CommonCheckRepeatByEditAndTree(entity dbinfo.Entity, id interface{}, sName interface{}, currentUser string) *msgentity.MsgEntity
- func (DaoBaseFunc) Create(entity dbinfo.Entity) (dbinfo.Entity, error)
- func (dao DaoBaseFunc) Del(entity dbinfo.Entity, id interface{}, iVersion int, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) DelByMap(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) DelSign(entity dbinfo.Entity, id interface{}, iVersion int, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) DelSignByMap(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, ...) *msgentity.MsgEntity
- func (DaoBaseFunc) Delete(entity dbinfo.Entity, conds ...interface{}) (int, error)
- func (dao DaoBaseFunc) DoSql(sql string, where ...interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) Edit(entity dbinfo.Entity, id interface{}, iVersion int, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) EntityById(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
- func (dao DaoBaseFunc) EntityBySql(entityList interface{}, sql string, where map[string]interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) ExecSql(sql string, where ...interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindAll(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindByDate(entity dbinfo.Entity, sDateSt string, sDateEd string, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindByFields(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldMap map[string]string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindById(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindByPage(entity dbinfo.Entity, findByPageParam dbinfo.FindByPageParam, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindByRow(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindByTree(entity dbinfo.Entity, sGroupColumn, sGroupName, currentUser string) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindCountByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindField(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldNames []string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindOneByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) FindValueByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (DaoBaseFunc) First(entity dbinfo.Entity, conds ...interface{}) (dbinfo.Entity, error)
- func (dao DaoBaseFunc) GetFindByPageSelectSql(currentUser string, entity dbinfo.Entity, ...) (string, string, map[string]interface{})
- func (DaoBaseFunc) GetFindByPageSelectSqlByField(dataInfo *dbinfo.DataInfo, sTableName, sFieldName string, ...) (string, string)
- func (dao DaoBaseFunc) GetPath(sId, dbName, tableName string) string
- func (dao DaoBaseFunc) GetRow(sql string, where ...interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetRows(sql string, where ...interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetValue(sql string, where ...interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetValueByField(entity dbinfo.Entity, id interface{}, fieldName, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetValueByFieldName(entity dbinfo.Entity, id interface{}, fieldNames []string, currentUser string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetValueByWhere(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetiState(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GetiVersion(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GroupByField(entity dbinfo.Entity, sCreator string, fields map[string]string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GroupByFieldAndCount(entity dbinfo.Entity, sCreator string, fields map[string]string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) GroupByFieldBase(entity dbinfo.Entity, sCreator string, fields map[string]string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) HasById(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) HasByKey(entity dbinfo.Entity, keyName string, keyValue interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) MaxByField(entity dbinfo.Entity, sCreator string, field string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) MinByField(entity dbinfo.Entity, sCreator string, field string, ...) *msgentity.MsgEntity
- func (dao DaoBaseFunc) NewChildId(entity dbinfo.Entity, sPid string) *msgentity.MsgEntity
- func (dao DaoBaseFunc) ReversalByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (DaoBaseFunc) Save(entity dbinfo.Entity) (dbinfo.Entity, error)
- func (dao *DaoBaseFunc) SetOwner(owner Dao)
- func (dao DaoBaseFunc) TransactionSql(sqls map[string]map[string]interface{}) *msgentity.MsgEntity
- func (dao DaoBaseFunc) ValidEntityRepeatByAdd(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
- func (dao DaoBaseFunc) ValidEntityRepeatByEdit(entity dbinfo.Entity, id interface{}, data map[string]interface{}, ...) *msgentity.MsgEntity
- type Service
- type ServiceBaseFunc
- func (service ServiceBaseFunc) Add(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) AddCommon(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) AddList(ctx ginutil.Context, entitys []dbinfo.Entity) *msgentity.MsgEntity
- func (service ServiceBaseFunc) AddNode(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) AddToGroup(ctx ginutil.Context, entity dbinfo.Entity, sGroupName, sGroupValue string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) Adds(ctx ginutil.Context, entitys []dbinfo.Entity, list []map[string]interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ChangeSetp(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iSetp int, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ChangeState(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iState int, ...) *msgentity.MsgEntity
- func (service *ServiceBaseFunc) CheckRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
- func (service *ServiceBaseFunc) CheckRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ClearCache(ctx ginutil.Context, cacheName, sUser string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) CommonCheckRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
- func (service ServiceBaseFunc) CommonCheckRepeatByAddAndTree(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
- func (service ServiceBaseFunc) CommonCheckRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) CommonCheckRepeatByEditAndTree(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, sName interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) CreateTree(source interface{}, rootName, idFieldName, pIdFieldName, childFieldName string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) Del(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int) *msgentity.MsgEntity
- func (service ServiceBaseFunc) DelByMap(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
- func (service ServiceBaseFunc) DoSql(sql string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) Edit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) Edits(ctx ginutil.Context, entity dbinfo.Entity, datas []map[string]interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ExecSql(sql string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindAll(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByDate(ctx ginutil.Context, entity dbinfo.Entity, sDateSt string, sDateEd string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByFields(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByGroup(ctx ginutil.Context, entity dbinfo.Entity, sGroupColumn, sGroupName string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindById(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByPage(ctx ginutil.Context, entity dbinfo.Entity, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByRow(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindByTree(ctx ginutil.Context, entity dbinfo.Entity, sGroupColumn, sGroupName string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindCountByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindField(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindOneByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) FindValueByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (service *ServiceBaseFunc) GetModuleDao() (Dao, error)
- func (service ServiceBaseFunc) GetRow(sql string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetRows(sql string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetValue(sql string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetValueByField(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, fieldName string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetValueByFieldName(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, fieldNames []string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetValueByWhere(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetiState(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GetiVersion(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GroupByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) GroupByFieldAndCount(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) HasById(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
- func (service ServiceBaseFunc) HasByKey(ctx ginutil.Context, entity dbinfo.Entity, keyName string, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) HoldByEntity(entity dbinfo.Entity, data map[string]interface{}) map[string]interface{}
- func (service ServiceBaseFunc) LookImg(ctx ginutil.Context, modelName, filename string)
- func (service ServiceBaseFunc) MaxByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, field string, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) MinByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, field string, ...) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ReversalByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, ...) *msgentity.MsgEntity
- func (service *ServiceBaseFunc) SetOwner(owner Service)
- func (service ServiceBaseFunc) SupplyDbEntityAttrByAdd(ctx ginutil.Context, entity dbinfo.Entity, selfId string, idValuePrefix string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) SupplyDbEntityAttrByEdit(ctx ginutil.Context, data map[string]interface{}, entity dbinfo.Entity) *msgentity.MsgEntity
- func (service ServiceBaseFunc) UpFile(ctx ginutil.Context, modelName string) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ValidEntityRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
- func (service ServiceBaseFunc) ValidEntityRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, ...) *msgentity.MsgEntity
Constants ¶
This section is empty.
Variables ¶
var CommonDao = &DaoBaseFunc{}
Functions ¶
Types ¶
type AopUtil ¶
type AopUtil struct{}
func (AopUtil) CallAfterFunc ¶
func (au AopUtil) CallAfterFunc(funcName string, ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity
*
- 调用Aop-函数执行后调用函数
- @param funcName 被监听函数 xxservice.xx
- @param doFunc 被调用函数
- @return
func (AopUtil) CallAroundFunc ¶
func (au AopUtil) CallAroundFunc(funcName string, ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity
*
- 调用Aop-函数执行中调用函数
- @param funcName 被监听函数 xxservice.xx
- @param doFunc 被调用函数
- @return
func (AopUtil) CallBeforeFunc ¶
func (au AopUtil) CallBeforeFunc(funcName string, ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity
*
- 调用Aop-函数执行前调用函数
- @param funcName 被监听函数 xxservice.xx
- @param doFunc 被调用函数
- @return
func (AopUtil) RegisterAfter ¶
func (au AopUtil) RegisterAfter(funcName string, doFunc func(ctx ginutil.Context, params ...interface{}) *msgentity.MsgEntity)
*
- 注册Aop-函数执行后调用函数
- @param funcName 被监听函数
- @param doFunc 被调用函数
- @return
type BrickApp ¶
type BrickApp struct{}
type Cloud ¶
type Cloud struct{}
func (Cloud) CloudMonitor ¶
#region @Api {title=中心监听接口} @return {type=json explainType=MsgEntity<string> explain=返回响应} @RequestMapping {name=ServerIp type=GET value=/cloud/monitor} #endregion
type CommonService ¶
type CommonService = ServiceBaseFunc
type Controller ¶
type Controller interface {
GetModuleEntity(control Controller) (dbinfo.Entity, error) //对应模块数据实体
GetModuleService(control Controller) (Service, error) //对应模块业务实体
GetModuleDao(control Controller) (Dao, error) //对应模块数据处理实体
RegisterUrl() //http接口注册
Enable() int //控制操作,首位9不参与用7个数代表开关,0为不限制,1为限制
CheckRepeatCombination() []string //检查待新增内容是否存在重复数据(多字段组合重复即重复)集合
CheckRepeatAlone() map[string]int //检查待新增内容是否存在重复数据(单独字段重复即重复)集合,注意:int必须是1、10、100、1000
IdValuePrefix() string //记录编号值前缀,此属性用于给id字段添加前缀,以便于在分布式系统中进行数据合并,注意:前缀只有1个字符
LikeTimeLimit() int //模糊查询时是否要进行时间范围限制,默认900000天内,已经相当于不限制了
SetOwner(owner Controller) //设置父对象
}
web控制层接口定义,用于规范控制层结构体
func GetController ¶
func GetController(name string) Controller
*
- 取得已注册业务模块
- @param name 业务模块名称
- @param controller 业务模块
- @return 业务模块
func RegisterController ¶
func RegisterController(controller Controller) Controller
*
- 注册业务模块
- @param name 业务模块名称
- @param controller 业务模块
- @return 业务模块
type ControllerBaseFunc ¶
type ControllerBaseFunc struct {
// contains filtered or unexported fields
}
基类
func (*ControllerBaseFunc) CheckRepeatAlone ¶
func (control *ControllerBaseFunc) CheckRepeatAlone() map[string]int
-- 检查待新增内容是否存在重复数据(单独字段重复即重复)集合,注意:int必须是1、10、100、1000 --//
func (*ControllerBaseFunc) CheckRepeatCombination ¶
func (control *ControllerBaseFunc) CheckRepeatCombination() []string
检查待新增内容是否存在重复数据(多字段组合重复即重复)集合
func (*ControllerBaseFunc) Enable ¶
func (control *ControllerBaseFunc) Enable() int
-- 控制操作,首位9不参与用7个数代表开关,0为不限制,1为限制 --// -- 7个数的控制分别是:删除、修改、查询、导出、统计、步骤值可逆、物理删除 --// -- 其中前5个为'是否仅创建者可操作'后续为其它控制开关 --//
func (*ControllerBaseFunc) GetModuleDao ¶
func (control *ControllerBaseFunc) GetModuleDao(controller Controller) (Dao, error)
func (*ControllerBaseFunc) GetModuleEntity ¶
func (control *ControllerBaseFunc) GetModuleEntity(controller Controller) (dbinfo.Entity, error)
func (*ControllerBaseFunc) GetModuleService ¶
func (control *ControllerBaseFunc) GetModuleService(controller Controller) (Service, error)
func (*ControllerBaseFunc) IdValuePrefix ¶
func (control *ControllerBaseFunc) IdValuePrefix() string
func (*ControllerBaseFunc) LikeTimeLimit ¶
func (control *ControllerBaseFunc) LikeTimeLimit() int
func (*ControllerBaseFunc) SetOwner ¶
func (control *ControllerBaseFunc) SetOwner(owner Controller)
*
- 设置父对象
- @param owner
type ControllerUtil ¶
type ControllerUtil struct{}
func (ControllerUtil) Add ¶
func (controlUtil ControllerUtil) Add(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 新增
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) AddNode ¶
func (controlUtil ControllerUtil) AddNode(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 新增树节点
- @param ctx http请求对象
- @param entity 检查用数据结构
- @return
func (ControllerUtil) AddRequestAttrib ¶
func (controlUtil ControllerUtil) AddRequestAttrib(ctx ginutil.Context, attribs ...[]string)
*
- 增加请求属性
- 注:函数应用于模块控制器时修改或传递到通用方法时,切勿滥用
- @param ctx http请求对象
- @Param attribs 参数键值对数组,[name,value],如果value不存在则为”
func (ControllerUtil) AddToGroup ¶
func (controlUtil ControllerUtil) AddToGroup(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 添加数据到指定组下
- 警告:对象必须符合树形结构要求,如:sId、sPid
- @param ctx http请求对象
- @param control 控制层接口
- @param sGroupName 分组字段名称(树节点)
- @param sGroupValue 分组字段值(树节点)
- @param entity 实体对象
- @return
func (ControllerUtil) Adds ¶
func (controlUtil ControllerUtil) Adds(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 批量新增
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) ClearCache ¶
func (controlUtil ControllerUtil) ClearCache(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 清理指定用户的缓存
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) Del ¶
func (controlUtil ControllerUtil) Del(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 删除
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) Edit ¶
func (controlUtil ControllerUtil) Edit(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 修改
- @param ctx http请求对象
- @param control 控制层接口
- @return msgentity.MsgEntity
func (ControllerUtil) Edits ¶
func (controlUtil ControllerUtil) Edits(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 批量修改
- @param ctx http请求对象
- @param control 控制层接口
- @return msgentity.MsgEntity
func (ControllerUtil) FindAll ¶
func (controlUtil ControllerUtil) FindAll(ctx ginutil.Context, control Controller, attachWhere ...set.Set) *msgentity.MsgEntity
*
- 查询所有数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindByDate ¶
func (controlUtil ControllerUtil) FindByDate(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 查询时间范围内数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindByGroup ¶
func (controlUtil ControllerUtil) FindByGroup(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 查询组结构数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindById ¶
func (controlUtil ControllerUtil) FindById(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据主键查询数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindByKey ¶
func (controlUtil ControllerUtil) FindByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据关键值取对象集合
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindByPage ¶
func (controlUtil ControllerUtil) FindByPage(ctx ginutil.Context, control Controller, injectionCondition ...set.Set) *msgentity.MsgEntity
*
- 查询分页数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindByRow ¶
func (controlUtil ControllerUtil) FindByRow(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 查找指定行数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindByTree ¶
func (controlUtil ControllerUtil) FindByTree(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 读取树形结构数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindCountByKey ¶
func (controlUtil ControllerUtil) FindCountByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据关键值查数量
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindOneByKey ¶
func (controlUtil ControllerUtil) FindOneByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的第一个
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) FindValueByKey ¶
func (controlUtil ControllerUtil) FindValueByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的符合条件的第一条记录的指定字段
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) GetParams ¶
func (controlUtil ControllerUtil) GetParams(ctx ginutil.Context, entity interface{}) *msgentity.MsgEntity
*
- 取所有参数,并转换成对应实体属性类型(map[string]interface{})
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) GetValueByField ¶
func (controlUtil ControllerUtil) GetValueByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) GetValueByFieldName ¶
func (controlUtil ControllerUtil) GetValueByFieldName(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) Group ¶
func (controlUtil ControllerUtil) Group(ctx ginutil.Context, control Controller, fields map[string]string) *msgentity.MsgEntity
*
- 根据字段名取分组数据
- @param ctx http请求对象
- @param control 控制层接口
- @param fields 分组字段[字段名,字段别名]
func (ControllerUtil) GroupAndCount ¶
func (controlUtil ControllerUtil) GroupAndCount(ctx ginutil.Context, control Controller, fields map[string]string) *msgentity.MsgEntity
*
- 根据字段名取分组数据且取数量
- @param ctx http请求对象
- @param control 控制层接口
- @param fields 分组字段[字段名,字段别名]
func (ControllerUtil) GroupByField ¶
func (controlUtil ControllerUtil) GroupByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据字段名取分组数据
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) HasById ¶
func (controlUtil ControllerUtil) HasById(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 取表中指定字段的最小值
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) HasByKey ¶
func (controlUtil ControllerUtil) HasByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 检查关键值记录是否存在(返回1:存在;0:不存在)
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) LookImg ¶
func (controlUtil ControllerUtil) LookImg(ctx ginutil.Context, control Controller, modelName, filename string)
*
- 获取图片
- @param ctx http请求对象
- @param control 控制层接口
- @param modelName 模块名称
- @param filename 文件名
func (ControllerUtil) MaxByField ¶
func (controlUtil ControllerUtil) MaxByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 取表中指定字段的最大值
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) MinByField ¶
func (controlUtil ControllerUtil) MinByField(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 取表中指定字段的最小值
- @param ctx http请求对象
- @param control 控制层接口
- @return
func (ControllerUtil) ReversalByKey ¶
func (controlUtil ControllerUtil) ReversalByKey(ctx ginutil.Context, control Controller) *msgentity.MsgEntity
*
- 根据关键值翻转值(限布尔值类型,1转2,2转1)
- 警告:此方法只支持布尔值类型,且只支持翻转1和2
- @param ctx http请求对象
- @param control 控制层接口
- @return msgentity.MsgEntity
func (ControllerUtil) UpFile ¶
func (controlUtil ControllerUtil) UpFile(ctx ginutil.Context, control Controller, modelName string) *msgentity.MsgEntity
*
- 上传文件
- @param ctx http请求对象
- @param control 控制层接口
- @param modelName 模块名称
- @return msgentity.MsgEntity
type Dao ¶
type Dao interface {
/**
* 新增
* @param entity 待保存实体
*/
Add(entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 通用新增数据方法
* @param entity 待保存实体
*/
AddCommon(entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 新增树节点
* @param entity 检查用数据结构
*/
AddNode(entity dbinfo.Entity) *msgentity.MsgEntity
// 批量新增
Adds(entitys []dbinfo.Entity) *msgentity.MsgEntity
/**
* 修改状态
* @param entity 实体类
* @param id 编号
* @param iState 状态值
* @param iVersion 记录版本号
* @param sMemo 备注
* @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
* @return msgentity.MsgEntity 返回执行情况
*/
ChangeState(entity dbinfo.Entity, id interface{}, iState int, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
/**
* 修改步骤值(如果设置为单向则新值必须大于旧值)
* @param id 编号
* @param iSetp 步骤值
* @param iVersion 记录版本号
* @param sMemo 备注
* @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
* @param entity 实体类
* @return msgentity.MsgEntity 返回执行情况
*/
ChangeSetp(entity dbinfo.Entity, id interface{}, iSetp int, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
// 逻辑删除(非物理删除)
DelSign(entity dbinfo.Entity, id interface{}, iVersion int, currentUser string, onlyCreator bool) *msgentity.MsgEntity
// 逻辑删除(非物理删除)
DelSignByMap(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
// 删除
Del(entity dbinfo.Entity, id interface{}, iVersion int, currentUser string, onlyCreator bool) *msgentity.MsgEntity
// 删除
DelByMap(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 修改
* @param entity 对象类型
* @param id 记录编号值
* @param iVersion 记录版本号
* @param data 待更新的字段和值
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
Edit(entity dbinfo.Entity, id interface{}, iVersion int, data map[string]interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据主键查询数据
* @param entity 检查用数据结构
* @param id 主键
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
FindById(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据主键查询数据(返回结构体数据)
* @param entity 检查用数据结构
* @param id 主键
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
EntityById(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
EntityBySql(entityList interface{}, sql string, where map[string]interface{}) *msgentity.MsgEntity
/**
* 查询所有数据
* @param entity 检查用数据结构
* @param where 查询条件
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
FindAll(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 查询指定时间内数据
* @param entity 检查用数据结构
* @param sDateSt 开始时间
* @param sDateEd 结束时间
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
FindByDate(entity dbinfo.Entity, sDateSt string, sDateEd string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 查询指定行数据
* @param entity 检查用数据结构
* @param id 记录编号
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
FindByRow(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 查询分页数据
* @param entity 检查用数据结构
* @param findByPageParam 分页参数
* @param currentUser 当前用户
* @param onlyCreator 仅创建用户
* @return msgentity.MsgEntity
*/
FindByPage(entity dbinfo.Entity, findByPageParam dbinfo.FindByPageParam, currentUser string, onlyCreator bool) *msgentity.MsgEntity
// 取路径字段
GetPath(sId, dbName, tableName string) string
/**
* 取指定节点下的子节点编号
* @param tableInfo 表信息
* @param sPid 父节点
* @return
*/
NewChildId(tableInfo dbinfo.Entity, sPid string) *msgentity.MsgEntity
/**
* 验证新增数据是否存在重复
* @param entity 数据实体
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
ValidEntityRepeatByAdd(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
/**
* 验证更新数据是否存在重复
* @param entity 数据实体
* @param id 主键
* @param data 数据
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
ValidEntityRepeatByEdit(entity dbinfo.Entity, id interface{}, data map[string]interface{}, currentUser string) *msgentity.MsgEntity
/**
* 通用树型结构表添加数据时重复检查方法
* @param entity 数据实体
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
CommonCheckRepeatByAddAndTree(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
/**
* 通用树型结构表添加数据时重复检查方法
* @param entity 数据实体
* @param id 主键
* @param sName 展现名
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
CommonCheckRepeatByEditAndTree(entity dbinfo.Entity, id interface{}, sName interface{}, currentUser string) *msgentity.MsgEntity
/**
* 通用添加数据时重复检查方法
* @param entity 数据实体
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
CommonCheckRepeatByAdd(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
/**
* 通用更新数据时重复检查方法
* @param entity 数据实体
* @param id 数据主键
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
CommonCheckRepeatByEdit(entity dbinfo.Entity, id interface{}, currentUser string) *msgentity.MsgEntity
/**
* 读取树形结构数据
* @param entity 数据实体
* @param sGroupColumn 分组字段
* @param sGroupName 分组名称
* @param currentUser 当前用户
* @return msgentity.MsgEntity
*/
FindByTree(entity dbinfo.Entity, sGroupColumn, sGroupName string, currentUser string) *msgentity.MsgEntity
/**
* 根据字段名取指定记录编号的数据库表中对应字段的值
* @param entity 实体类
* @param id 记录编号
* @param fieldNames 待取数据的字段名称集合
* @param currentUser 当前用户
* @Param onlyCreator 是否只取当前用户创建的数据
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
GetValueByFieldName(entity dbinfo.Entity, id interface{}, fieldNames []string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据字段名取指定记录编号的数据库表中对应字段的值
* @param entity 实体类
* @param id 记录编号
* @param fieldName 待取数据的字段名称集合
* @param currentUser 当前用户
* @Param onlyCreator 是否只取当前用户创建的数据
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
GetValueByField(entity dbinfo.Entity, id interface{}, fieldName, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据字段名取指定条件的数据库表中对应字段的值
* @param entity 实体类
* @param whereInfo 条件
* @param fieldName 待取数据的字段名称集合
* @param currentUser 当前用户
* @Param onlyCreator 是否只取当前用户创建的数据
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
GetValueByWhere(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 取记录对应的版本号
* @param entity 实体类
* @param idName 编号
* @return
*/
GetiVersion(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
/**
* 取记录对应的状态值
* @param entity 实体类
* @param id 编号
* @return
*/
GetiState(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
/**
* 根据关键值取对象集合
* @Param entity 实体类
* @Param where 存放查询条件
* @Param currentUser 当前用户
* @Param onlyCreator 是否只取当前用户创建的数据
* @return msgentity.MsgEntity
*/
FindByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据关键值取对象集合中的第一个
* @Param entity 实体类
* @Param where 存放查询条件
* @Param currentUser 当前用户
* @param onlyCreator 是否只取当前用户创建的数据
* @param fields 指定要查询的字段集合
* @return msgentity.MsgEntity
*/
FindOneByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool, fields ...string) *msgentity.MsgEntity
/**
* 根据关键值取对象集合中的符合条件的第一条记录的指定字段
* @Param entity 实体类
* @Param where 存放查询条件
* @param fieldName 指定要查询的字段
* @param currentUser 当前用户
* @param onlyCreator 仅查询创建者
* @return msgentity.MsgEntity
*/
FindValueByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据关键值取对象集合中的符合条件的第一条记录的指定字段
* @Param entity 实体类
* @Param where 存放查询条件
* @param fieldMap 指定要查询的字段集合(原字段, 别名)
* @param currentUser 当前用户
* @param onlyCreator 仅查询创建者
* @return msgentity.MsgEntity
*/
FindByFields(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldMap map[string]string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据关键值查数量
* @Param entity 实体类
* @Param where 存放查询条件
* @param currentUser 当前用户
* @param onlyCreator 仅查询创建者
* @return msgentity.MsgEntity
*/
FindCountByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 以事务方式执行多个sql
* 注意:Mapper必须存在才能执行
* @param sqls [sql, params]
* @return msgentity.MsgEntity 一个执行失败则回滚
*/
TransactionSql(sqls map[string]map[string]interface{}) *msgentity.MsgEntity
/**
* 根据字段名取分组数据
* @param entity 实体类
* @param sCreator 指定用户
* @param fields 字段名与别名对象
* @param currentUser 当前用户
* @param onlyCreator 用户查询限制(仅创建者可见)
* @return
*/
GroupByField(entity dbinfo.Entity, sCreator string, fields map[string]string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据字段名取分组数据,并返回数量
* @param entity 实体类
* @param sCreator 指定用户
* @param fields 字段名与别名对象
* @param currentUser 当前用户
* @param onlyCreator 用户查询限制(仅创建者可见)
* @return
*/
GroupByFieldAndCount(entity dbinfo.Entity, sCreator string, fields map[string]string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据字段名取分组数据
* @param entity 实体类
* @param sCreator 指定用户
* @param fields 字段名与别名对象
* @param currentUser 当前用户
* @param onlyCreator 用户查询限制(仅创建者可见)
* @param isGroupCount 添加分组后是否添加'数量列'
* @return
*/
GroupByFieldBase(entity dbinfo.Entity, sCreator string, fields map[string]string, currentUser string, onlyCreator, isGroupCount bool) *msgentity.MsgEntity
/**
* 取表中指定字段的最大值
* @param entity 实体类
* @param sCreator 指定用户
* @param field 字段名
* @param where 查询条件
* @param currentUser 当前用户
* @param onlyCreator 用户查询限制(仅创建者可见)
* @return msgentity.MsgEntity
*/
MaxByField(entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 取表中指定字段的最小值
* @param entity 实体类
* @param sCreator 指定用户
* @param field 字段名
* @param where 查询条件
* @param currentUser 当前用户
* @param onlyCreator 用户查询限制(仅创建者可见)
* @param whereStr 查询条件字符串
* @return
*/
MinByField(entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 检查关键值记录是否存在(返回1:存在;0:不存在)
* @param entity 实体类
* @param id 记录编号
* @return msgentity.MsgEntity
*/
HasById(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
/**
* 检查关键值记录是否存在(返回1:存在;0:不存在)
* @param entity 实体类
* @Param keyName 字段名
* @Param keyValue 字段值
* @return msgentity.MsgEntity
*/
HasByKey(entity dbinfo.Entity, keyName string, keyValue interface{}) *msgentity.MsgEntity
/**
* 执行SQL脚本获取单行单列数据
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
* @param sql 待执行的SQL脚本
* @param where 存放查询条件
* @return msgentity.MsgEntity
*/
DoSql(sql string, where ...interface{}) *msgentity.MsgEntity
/**
* 执行SQL脚本获取单行单列数据
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
* @param sql 待执行的SQL脚本
* @param where 存放查询条件
* @return msgentity.MsgEntity
*/
ExecSql(sql string, where ...interface{}) *msgentity.MsgEntity
/**
* 执行SQL脚本获取单行单列数据
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
* @param sql 待执行的SQL脚本
* @param where 存放查询条件
* @return msgentity.MsgEntity
*/
GetValue(sql string, where ...interface{}) *msgentity.MsgEntity
/**
* 执行SQL脚本获取一行数据(多列)
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录
* @param sql 待执行的SQL脚本
* @param where 存放查询条件
* @return msgentity.MsgEntity
*/
GetRow(sql string, where ...interface{}) *msgentity.MsgEntity
/**
* 执行SQL脚本获取多行数据(多列)
* 注意:库名必须用${}进行包装,此脚本可返回多条记录
* @param sql SQL脚本
* @param where 存放查询条件
* @return msgentity.MsgEntity
*/
GetRows(sql string, where ...interface{}) *msgentity.MsgEntity
/**
* 根据关键值翻转值(限布尔值类型,1转2,2转1)
* @Param entity 实体类
* @Param whereInfo 存放查询条件
* @Param reversalColumn 翻转的字段名
* @Param currentUser 当前用户
* @Param onlyCreator 是否只翻转创建人创建的数据
* @return msgentity.MsgEntity
*/
ReversalByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, reversalColumn, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 根据条件仅查询指定字段名数据
* @param entity 实体类
* @param whereInfo
* @param fieldNames 待取数据的字段名称集合
* @Param currentUser 当前用户
* @Param onlyCreator 是否只翻转创建人创建的数据
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
FindField(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldNames []string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
/**
* 设置父对象
* @param owner 父对象
*/
SetOwner(owner Dao)
// 对gorm.First操作进行封装
First(entity dbinfo.Entity, conds ...interface{}) (dbinfo.Entity, error)
// 对gorm.Create操作进行封装
Create(entity dbinfo.Entity) (dbinfo.Entity, error)
// 对gorm.Save操作进行封装,
// 警告:Save是一个组合函数。 如果保存值不包含主键,它将执行 Create,否则它将执行 Update (包含所有字段)。
Save(entity dbinfo.Entity) (dbinfo.Entity, error)
// 对gorm.Delete操作进行封装
Delete(entity dbinfo.Entity, conds ...interface{}) (int, error)
}
we数据层接口定义,用于规范控制层结构体
type DaoBaseFunc ¶
type DaoBaseFunc struct {
// contains filtered or unexported fields
}
func (DaoBaseFunc) Add ¶
func (dao DaoBaseFunc) Add(entity dbinfo.Entity) *msgentity.MsgEntity
*
- 新增
- @param entity 待保存实体
func (DaoBaseFunc) AddCommon ¶
func (dao DaoBaseFunc) AddCommon(entity dbinfo.Entity) *msgentity.MsgEntity
*
- 通用新增数据方法
- @param entity 待保存实体
func (DaoBaseFunc) AddNode ¶
func (dao DaoBaseFunc) AddNode(entity dbinfo.Entity) *msgentity.MsgEntity
*
- 新增树节点
- @param entity 检查用数据结构
func (DaoBaseFunc) Adds ¶
func (dao DaoBaseFunc) Adds(entitys []dbinfo.Entity) *msgentity.MsgEntity
批量新增
func (DaoBaseFunc) ChangeSetp ¶
func (dao DaoBaseFunc) ChangeSetp(entity dbinfo.Entity, id interface{}, iSetp, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
*
- 修改步骤值(如果设置为单向则新值必须大于旧值)
- @param id 编号
- @param iSetp 步骤值
- @param iVersion 记录版本号
- @param sMemo 备注
- @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
- @param entity 实体类
- @return msgentity.MsgEntity 返回执行情况
func (DaoBaseFunc) ChangeState ¶
func (dao DaoBaseFunc) ChangeState(entity dbinfo.Entity, id interface{}, iState, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
*
- 修改状态
- @param entity 实体类
- @param id 编号
- @param iState 状态值
- @param iVersion 记录版本号
- @param sMemo 备注
- @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
- @return msgentity.MsgEntity 返回执行情况
func (DaoBaseFunc) CommonCheckRepeatByAdd ¶
func (dao DaoBaseFunc) CommonCheckRepeatByAdd(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
*
- 通用添加数据时重复检查方法
- @param entity 数据实体
- @param currentUser 当前用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) CommonCheckRepeatByAddAndTree ¶
func (dao DaoBaseFunc) CommonCheckRepeatByAddAndTree(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
*
- 通用树型结构表添加数据时重复检查方法
- @param entity 数据实体
- @param currentUser 当前用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) CommonCheckRepeatByEdit ¶
func (dao DaoBaseFunc) CommonCheckRepeatByEdit(entity dbinfo.Entity, id interface{}, currentUser string) *msgentity.MsgEntity
*
- 通用更新数据时重复检查方法
- @param entity 数据实体
- @param id 数据主键
- @param currentUser 当前用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) CommonCheckRepeatByEditAndTree ¶
func (dao DaoBaseFunc) CommonCheckRepeatByEditAndTree(entity dbinfo.Entity, id interface{}, sName interface{}, currentUser string) *msgentity.MsgEntity
*
- 通用树型结构表添加数据时重复检查方法
- @param entity 数据实体
- @param id 主键
- @param sName 展现名
- @param currentUser 当前用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) Del ¶
func (dao DaoBaseFunc) Del(entity dbinfo.Entity, id interface{}, iVersion int, currentUser string, onlyCreator bool) *msgentity.MsgEntity
删除
func (DaoBaseFunc) DelByMap ¶
func (dao DaoBaseFunc) DelByMap(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
删除
func (DaoBaseFunc) DelSign ¶
func (dao DaoBaseFunc) DelSign(entity dbinfo.Entity, id interface{}, iVersion int, currentUser string, onlyCreator bool) *msgentity.MsgEntity
逻辑删除(非物理删除)
func (DaoBaseFunc) DelSignByMap ¶
func (dao DaoBaseFunc) DelSignByMap(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
逻辑删除(非物理删除)
func (DaoBaseFunc) Delete ¶
func (DaoBaseFunc) Delete(entity dbinfo.Entity, conds ...interface{}) (int, error)
对gorm.Delete操作进行封装
func (DaoBaseFunc) DoSql ¶
func (dao DaoBaseFunc) DoSql(sql string, where ...interface{}) *msgentity.MsgEntity
*
- 执行SQL脚本获取单行单列数据
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
- @param sql 待执行的SQL脚本
- @param where 存放查询条件
- @return msgentity.MsgEntity
func (DaoBaseFunc) Edit ¶
func (dao DaoBaseFunc) Edit(entity dbinfo.Entity, id interface{}, iVersion int, data map[string]interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 修改
- @param entity 对象类型
- @param id 记录编号值
- @param iVersion 记录版本号
- @param data 待更新的字段和值
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) EntityById ¶
func (dao DaoBaseFunc) EntityById(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据主键查询数据(返回结构体数据)
- @param entity 检查用数据结构
- @param id 主键
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) EntityBySql ¶
func (dao DaoBaseFunc) EntityBySql(entityList interface{}, sql string, where map[string]interface{}) *msgentity.MsgEntity
func (DaoBaseFunc) ExecSql ¶
func (dao DaoBaseFunc) ExecSql(sql string, where ...interface{}) *msgentity.MsgEntity
*
- 执行SQL脚本获取单行单列数据
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
- @param sql 待执行的SQL脚本
- @param where 存放查询条件
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindAll ¶
func (dao DaoBaseFunc) FindAll(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 查询所有数据
- @param entity 检查用数据结构
- @param where 查询条件
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindByDate ¶
func (dao DaoBaseFunc) FindByDate(entity dbinfo.Entity, sDateSt string, sDateEd string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 查询指定时间内数据
- @param entity 检查用数据结构
- @param sDateSt 开始时间
- @param sDateEd 结束时间
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindByFields ¶
func (dao DaoBaseFunc) FindByFields(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldMap map[string]string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的符合条件的第一条记录的指定字段
- @Param entity 实体类
- @Param where 存放查询条件
- @param fieldMap 指定要查询的字段集合(原字段, 别名)
- @param currentUser 当前用户
- @param onlyCreator 仅查询创建者
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindById ¶
func (dao DaoBaseFunc) FindById(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据主键查询数据
- @param entity 检查用数据结构
- @param id 主键
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindByKey ¶
func (dao DaoBaseFunc) FindByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据关键值取对象集合
- @Param entity 实体类
- @Param where 存放查询条件
- @Param currentUser 当前用户
- @Param onlyCreator 是否只取当前用户创建的数据
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindByPage ¶
func (dao DaoBaseFunc) FindByPage(entity dbinfo.Entity, findByPageParam dbinfo.FindByPageParam, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 查询分页数据
- @param entity 检查用数据结构
- @param findByPageParam 分页参数
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindByRow ¶
func (dao DaoBaseFunc) FindByRow(entity dbinfo.Entity, id interface{}, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 查询指定行数据
- @param entity 检查用数据结构
- @param id 记录编号
- @param currentUser 当前用户
- @param onlyCreator 仅创建用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindByTree ¶
func (dao DaoBaseFunc) FindByTree(entity dbinfo.Entity, sGroupColumn, sGroupName, currentUser string) *msgentity.MsgEntity
*
- 读取树形结构数据
- @param entity 数据实体
- @param sGroupColumn 分组字段
- @param sGroupName 分组名称
- @param currentUser 当前用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindCountByKey ¶
func (dao DaoBaseFunc) FindCountByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据关键值查数量
- @Param entity 实体类
- @Param where 存放查询条件
- @param currentUser 当前用户
- @param onlyCreator 仅查询创建者
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindField ¶
func (dao DaoBaseFunc) FindField(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldNames []string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据条件仅查询指定字段名数据
- @param entity 实体类
- @param whereInfo
- @param fieldNames 待取数据的字段名称集合
- @Param currentUser 当前用户
- @Param onlyCreator 是否只翻转创建人创建的数据
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (DaoBaseFunc) FindOneByKey ¶
func (dao DaoBaseFunc) FindOneByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool, fields ...string) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的第一个
- @Param entity 实体类
- @Param whereInfo 存放查询条件
- @Param currentUser 当前用户
- @param onlyCreator 是否只取当前用户创建的数据
- @param fields 指定要查询的字段集合
- @return msgentity.MsgEntity
func (DaoBaseFunc) FindValueByKey ¶
func (dao DaoBaseFunc) FindValueByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的符合条件的第一条记录的指定字段
- @Param entity 实体类
- @Param where 存放查询条件
- @param fieldName 指定要查询的字段
- @param currentUser 当前用户
- @param onlyCreator 仅查询创建者
- @return msgentity.MsgEntity
func (DaoBaseFunc) GetFindByPageSelectSql ¶
func (dao DaoBaseFunc) GetFindByPageSelectSql(currentUser string, entity dbinfo.Entity, findByPageParam dbinfo.FindByPageParam, onlyCreator bool) (string, string, map[string]interface{})
分页数据查询部分语句,在分页查询数据及 数据搜索时使用 返回 findByPageCountSql, findByPageSql, params
func (DaoBaseFunc) GetFindByPageSelectSqlByField ¶
func (DaoBaseFunc) GetFindByPageSelectSqlByField(dataInfo *dbinfo.DataInfo, sTableName, sFieldName string, oTherJoin map[string]string) (string, string)
取分页查询的字段信息
func (DaoBaseFunc) GetPath ¶
func (dao DaoBaseFunc) GetPath(sId, dbName, tableName string) string
取路径字段
func (DaoBaseFunc) GetRow ¶
func (dao DaoBaseFunc) GetRow(sql string, where ...interface{}) *msgentity.MsgEntity
*
- 执行SQL脚本获取一行数据(多列)
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录
- @param sql 待执行的SQL脚本
- @param where 存放查询条件
- @return msgentity.MsgEntity
func (DaoBaseFunc) GetRows ¶
func (dao DaoBaseFunc) GetRows(sql string, where ...interface{}) *msgentity.MsgEntity
*
- 执行SQL脚本获取多行数据(多列)
- 注意:库名必须用${}进行包装,此脚本可返回多条记录
- @param sql SQL脚本
- @param where 存放查询条件
- @return msgentity.MsgEntity
func (DaoBaseFunc) GetValue ¶
func (dao DaoBaseFunc) GetValue(sql string, where ...interface{}) *msgentity.MsgEntity
*
- 执行SQL脚本获取单行单列数据
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
- @param sql 待执行的SQL脚本
- @param where 存放查询条件
- @return msgentity.MsgEntity
func (DaoBaseFunc) GetValueByField ¶
func (dao DaoBaseFunc) GetValueByField(entity dbinfo.Entity, id interface{}, fieldName, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param entity 实体类
- @param id 记录编号
- @param fieldName 待取数据的字段名称集合
- @param currentUser 当前用户
- @Param onlyCreator 是否只取当前用户创建的数据
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (DaoBaseFunc) GetValueByFieldName ¶
func (dao DaoBaseFunc) GetValueByFieldName(entity dbinfo.Entity, id interface{}, fieldNames []string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param entity 实体类
- @param id 记录编号
- @param fieldNames 待取数据的字段名称集合
- @param currentUser 当前用户
- @Param onlyCreator 是否只取当前用户创建的数据
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (DaoBaseFunc) GetValueByWhere ¶
func (dao DaoBaseFunc) GetValueByWhere(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据字段名取指定条件的数据库表中对应字段的值
- @param entity 实体类
- @param whereInfo 条件
- @param fieldName 待取数据的字段名称集合
- @param currentUser 当前用户
- @Param onlyCreator 是否只取当前用户创建的数据
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (DaoBaseFunc) GetiState ¶
func (dao DaoBaseFunc) GetiState(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 取记录对应的状态值
- @param entity 实体类
- @param id 编号
- @return
func (DaoBaseFunc) GetiVersion ¶
func (dao DaoBaseFunc) GetiVersion(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 取记录对应的版本号
- @param entity 实体类
- @param idName 编号
- @return
func (DaoBaseFunc) GroupByField ¶
func (dao DaoBaseFunc) GroupByField(entity dbinfo.Entity, sCreator string, fields map[string]string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据字段名取分组数据
- @param entity 实体类
- @param sCreator 指定用户
- @param fields 字段名与别名对象
- @param currentUser 当前用户
- @param onlyCreator 用户查询限制(仅创建者可见)
- @return
func (DaoBaseFunc) GroupByFieldAndCount ¶
func (dao DaoBaseFunc) GroupByFieldAndCount(entity dbinfo.Entity, sCreator string, fields map[string]string, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据字段名取分组数据,并返回数量
- @param entity 实体类
- @param sCreator 指定用户
- @param fields 字段名与别名对象
- @param currentUser 当前用户
- @param onlyCreator 用户查询限制(仅创建者可见)
- @return
func (DaoBaseFunc) GroupByFieldBase ¶
func (dao DaoBaseFunc) GroupByFieldBase(entity dbinfo.Entity, sCreator string, fields map[string]string, currentUser string, onlyCreator, isGroupCount bool) *msgentity.MsgEntity
*
- 根据字段名取分组数据
- @param entity 实体类
- @param sCreator 指定用户
- @param fields 字段名与别名对象
- @param currentUser 当前用户
- @param onlyCreator 用户查询限制(仅创建者可见)
- @param isGroupCount 添加分组后是否添加'数量列'
- @return
func (DaoBaseFunc) HasById ¶
func (dao DaoBaseFunc) HasById(entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 检查关键值记录是否存在(返回1:存在;0:不存在)
- @param entity 实体类
- @param id 记录编号
- @return msgentity.MsgEntity
func (DaoBaseFunc) HasByKey ¶
func (dao DaoBaseFunc) HasByKey(entity dbinfo.Entity, keyName string, keyValue interface{}) *msgentity.MsgEntity
*
- 检查关键值记录是否存在(返回1:存在;0:不存在)
- @param entity 实体类
- @Param keyName 字段名
- @Param keyValue 字段值
- @return msgentity.MsgEntity
func (DaoBaseFunc) MaxByField ¶
func (dao DaoBaseFunc) MaxByField(entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 取表中指定字段的最大值
- @param entity 实体类
- @param sCreator 指定用户
- @param field 字段名
- @param where 查询条件
- @param currentUser 当前用户
- @param onlyCreator 用户查询限制(仅创建者可见)
- @return msgentity.MsgEntity
func (DaoBaseFunc) MinByField ¶
func (dao DaoBaseFunc) MinByField(entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 取表中指定字段的最小值
- @param entity 实体类
- @param sCreator 指定用户
- @param field 字段名
- @param where 查询条件
- @param currentUser 当前用户
- @param onlyCreator 用户查询限制(仅创建者可见)
- @param whereStr 查询条件字符串
- @return
func (DaoBaseFunc) ReversalByKey ¶
func (dao DaoBaseFunc) ReversalByKey(entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, reversalColumn, currentUser string, onlyCreator bool) *msgentity.MsgEntity
*
- 根据关键值翻转值(限布尔值类型,1转2,2转1)
- @Param entity 实体类
- @Param whereInfo 存放查询条件
- @Param reversalColumn 翻转的字段名
- @Param currentUser 当前用户
- @Param onlyCreator 是否只翻转创建人创建的数据
- @return msgentity.MsgEntity
func (DaoBaseFunc) Save ¶
对gorm.Save操作进行封装, 警告:Save是一个组合函数。 如果保存值不包含主键,它将执行 Create,否则它将执行 Update (包含所有字段)。
func (DaoBaseFunc) TransactionSql ¶
func (dao DaoBaseFunc) TransactionSql(sqls map[string]map[string]interface{}) *msgentity.MsgEntity
*
- 以事务方式执行多个sql
- 注意:Mapper必须存在才能执行
- @param sqls [sql, params]
- @return msgentity.MsgEntity 一个执行失败则回滚
func (DaoBaseFunc) ValidEntityRepeatByAdd ¶
func (dao DaoBaseFunc) ValidEntityRepeatByAdd(entity dbinfo.Entity, currentUser string) *msgentity.MsgEntity
*
- 验证新增数据是否存在重复
- @param entity 数据实体
- @param currentUser 当前用户
- @return msgentity.MsgEntity
func (DaoBaseFunc) ValidEntityRepeatByEdit ¶
func (dao DaoBaseFunc) ValidEntityRepeatByEdit(entity dbinfo.Entity, id interface{}, data map[string]interface{}, currentUser string) *msgentity.MsgEntity
*
- 验证更新数据是否存在重复
- @param entity 数据实体
- @param id 主键
- @param data 数据
- @param currentUser 当前用户
- @return msgentity.MsgEntity
type Service ¶
type Service interface {
/**
* 取对应模块数据层实体,若子类未设置则返回DaoBaseFunc
*/
GetModuleDao() (Dao, error) //对应模块数据层实体
/**
* 验证新增数据是否存在重复 (一旦使用则覆盖通用方法)
* @param ctx gin请求对象
* @param entity 验证数据
* @return *MsgEntity 返回验证结果
*/
CheckRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 验证更新数据是否存在重复 (一旦使用则覆盖通用方法)
* @param ctx gin请求对象
* @param entity 待验证数据
* @return *MsgEntity 返回验证结果
*/
CheckRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 新增
* entity 检查用数据结构
* data 数据
*/
Add(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
/**
* 新增普通数据
* entity 检查用数据结构
* data 数据
*/
AddCommon(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
/**
* 新增树节点
* entity 检查用数据结构
* data 数据
*/
AddNode(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
// 批量新增
Adds(ctx ginutil.Context, entitys []dbinfo.Entity, list []map[string]interface{}) *msgentity.MsgEntity
// 批量新增
AddList(ctx ginutil.Context, entitys []dbinfo.Entity) *msgentity.MsgEntity
/**
* 修改状态
* @param entity 实体类
* @param id 编号
* @param iState 状态值
* @param iVersion 记录版本号
* @param sMemo 备注
* @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
* @return msgentity.MsgEntity 返回执行情况
*/
ChangeState(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iState int, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
/**
* 修改步骤值(如果设置为单向则新值必须大于旧值)
* @param id 编号
* @param iSetp 步骤值
* @param iVersion 记录版本号
* @param sMemo 备注
* @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
* @param entity 实体类
* @return msgentity.MsgEntity 返回执行情况
*/
ChangeSetp(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iSetp int, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
/**
* 删除
* @param entity 对象类型
* @param id 记录编号值
* @param iVersion 记录版本号
* @return msgentity.MsgEntity
*/
Del(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int) *msgentity.MsgEntity
/**
* 删除
* @param entity 对象类型
* @param where 执行条件
* @return msgentity.MsgEntity
*/
DelByMap(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
/**
* 按实体保留map中的数据
* entity 参考的结构体
* data 数据
*/
HoldByEntity(entity dbinfo.Entity, data map[string]interface{}) map[string]interface{}
/**
* 修改
* @param entity 对象类型
* @param id 记录编号值
* @param iVersion 记录版本号
* @param data 待更新的字段和值
* @return msgentity.MsgEntity
*/
Edit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int, data map[string]interface{}) *msgentity.MsgEntity
/**
* 批量修改
* @param entity 对象类型
* @param datas 待更新的字段和值集合
* @return msgentity.MsgEntity
*/
Edits(ctx ginutil.Context, entity dbinfo.Entity, datas []map[string]interface{}) *msgentity.MsgEntity
/**
* 根据主键查询数据
* id 主键
* entity 检查用数据结构
*/
FindById(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
// 查询所有数据
FindAll(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
// 查询指定时间内数据
FindByDate(ctx ginutil.Context, entity dbinfo.Entity, sDateSt string, sDateEd string) *msgentity.MsgEntity
// 查询指定行数据
FindByRow(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
// 查询分页数据
FindByPage(ctx ginutil.Context, entity dbinfo.Entity, findByPageParam dbinfo.FindByPageParam) *msgentity.MsgEntity
/**
* 补充数据库实体类的数据--新增
* @param entity
* @param selfId 自提供的编号,防止从序列中获取
* @param idValuePrefix Id前缀
* @return
*/
SupplyDbEntityAttrByAdd(ctx ginutil.Context, entity dbinfo.Entity, selfId string, idValuePrefix string) *msgentity.MsgEntity
/**
* 补充数据库实体类的数据--修改
* @param ctx
* @param data 待修改的数据
* @param entity 参照结构体
* @return
*/
SupplyDbEntityAttrByEdit(ctx ginutil.Context, data map[string]interface{}, entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 验证新增数据是否存在重复
*
*/
ValidEntityRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 验证更新数据是否存在重复
*
*/
ValidEntityRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, data map[string]interface{}) *msgentity.MsgEntity
/**
* 通用树型结构表添加数据时重复检查方法
* entity
*/
CommonCheckRepeatByAddAndTree(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 通用树型结构表添加数据时重复检查方法
* entity
*/
CommonCheckRepeatByEditAndTree(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, sName interface{}) *msgentity.MsgEntity
/**
* 通用添加数据时重复检查方法
* entity
*/
CommonCheckRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
/**
* 通用更新数据时重复检查方法
* entity
*/
CommonCheckRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, data map[string]interface{}) *msgentity.MsgEntity
/**
* 读取树形结构数据
* @param entity
* @param sGroupColumn
* @param sGroupName
* @return
*/
FindByTree(ctx ginutil.Context, entity dbinfo.Entity, sGroupColumn, sGroupName string) *msgentity.MsgEntity
/**
* List转树形结构
* @param source Map或切片结构
* @param rootName
* @param idFieldName
* @param pIdFieldName
* @param childFieldName
* @return
*/
CreateTree(source interface{}, rootName, idFieldName, pIdFieldName, childFieldName string) *msgentity.MsgEntity
/**
* 根据字段名取指定记录编号的数据库表中对应字段的值
* @param entity 实体类
* @param id
* @param fieldNames 待取数据的字段名称集合
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
GetValueByFieldName(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, fieldNames []string) *msgentity.MsgEntity
/**
* 根据字段名取指定记录编号的数据库表中对应字段的值
* @param entity 实体类
* @param id
* @param fieldName 待取数据的字段名称集合
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
GetValueByField(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, fieldName string) *msgentity.MsgEntity
/**
* 根据字段名取指定条件的数据库表中对应字段的值
* @param entity 实体类
* @param whereInfo 条件
* @param fieldName 待取数据的字段名称集合
* @param currentUser 当前用户
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
GetValueByWhere(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName string) *msgentity.MsgEntity
/**
* 取记录对应的版本号
* @param entity 实体类
* @param idName 编号
* @return
*/
GetiVersion(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
/**
* 取记录对应的状态值
* @param entity 实体类
* @param idName 编号
* @return
*/
GetiState(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
/**
* 根据关键值取对象集合
* @Param entity 实体类
* @Param where 存放查询条件
* @return msgentity.MsgEntity
*/
FindByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
/**
* 根据关键值取对象集合中的第一个
* @Param entity 实体类
* @Param where 存放查询条件
* @param fields 指定要查询的字段集合
* @return msgentity.MsgEntity
*/
FindOneByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fields ...string) *msgentity.MsgEntity
/**
* 根据关键值取对象集合中的符合条件的第一条记录的指定字段
* @Param entity 实体类
* @Param where 存放查询条件
* @param fieldName 指定要查询的字段
* @return msgentity.MsgEntity
*/
FindValueByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName string) *msgentity.MsgEntity
/**
* 根据指定字段进行分组查询
* @Param entity 实体类
* @Param where 存放查询条件
* @param fieldMap 指定要查询的字段集合(原字段, 别名)
* @return msgentity.MsgEntity
*/
FindByFields(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldMap map[string]string) *msgentity.MsgEntity
/**
* 根据关键值查数量
* @Param entity 实体类
* @Param where 存放查询条件
* @return msgentity.MsgEntity
*/
FindCountByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
/**
* 根据字段名取分组数据
* @param entity 实体类
* @param sCreator 指定用户
* @param fields 字段名与别名对象
* @return
*/
GroupByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, fields map[string]string) *msgentity.MsgEntity
/**
* 根据字段名取分组数据及分组后数量
* @param entity 实体类
* @param sCreator 指定用户
* @param fields 字段名与别名对象
* @return
*/
GroupByFieldAndCount(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, fields map[string]string) *msgentity.MsgEntity
/**
* 取表中指定字段的最大值
* @param entity 实体类
* @param sCreator 指定用户
* @param field 字段名
* @param where 查询条件字符串
* @return msgentity.MsgEntity
*/
MaxByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
/**
* 取表中指定字段的最小值
* @param entity 实体类
* @param sCreator 指定用户
* @param field 字段名
* @param where 查询条件
* @return msgentity.MsgEntity
*/
MinByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
/**
* 检查关键值记录是否存在(返回1:存在;0:不存在)
* @param entity 实体类
* @Param id
* @return msgentity.MsgEntity
*/
HasById(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
/**
* 检查关键值记录是否存在(返回1:存在;0:不存在)
* @param entity 实体类
* @Param keyName 字段名
* @Param keyValue 字段值
* @return msgentity.MsgEntity
*/
HasByKey(ctx ginutil.Context, entity dbinfo.Entity, keyName string, keyValue interface{}) *msgentity.MsgEntity
/**
* 清理指定用户的缓存
* @param cacheName 缓存名
* @Param sUser 用户名
* @return msgentity.MsgEntity
*/
ClearCache(ctx ginutil.Context, cacheName string, sUser string) *msgentity.MsgEntity
/**
* 查询组结构数据
* @param ctx Http请求对象
* @param entity 实体类
* @param sGroupColumn 分组名(树节点)所在字段名
* @param sGroupName 分组名(树节点)
* @return
*/
FindByGroup(ctx ginutil.Context, entity dbinfo.Entity, sGroupColumn, sGroupName string) *msgentity.MsgEntity
/**
* 添加数据到指定组下
* 警告:对象必须符合树形结构要求,如:sId、sPid
* @param ctx Http请求对象
* @param sGroupName 分组字段名称(树节点)
* @param sGroupValue 分组字段值(树节点)
* @param entity 实体对象
* @return
*/
AddToGroup(ctx ginutil.Context, entity dbinfo.Entity, sGroupName, sGroupValue string) *msgentity.MsgEntity
/**
* 执行SQL脚本获取单行单列数据
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
* @param sql 待执行的SQL脚本
* @return msgentity.MsgEntity
*/
DoSql(sql string) *msgentity.MsgEntity
/**
* 执行SQL脚本获取单行单列数据
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
* @param sql 待执行的SQL脚本
* @return msgentity.MsgEntity
*/
ExecSql(sql string) *msgentity.MsgEntity
/**
* 执行SQL脚本获取单行单列数据
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
* @param sql 待执行的SQL脚本
* @return msgentity.MsgEntity
*/
GetValue(sql string) *msgentity.MsgEntity
/**
* 执行SQL脚本获取一行数据(多列)
* 注意:库名必须用${}进行包装,此脚本应只存在一条记录
* @param sql 待执行的SQL脚本
* @return msgentity.MsgEntity
*/
GetRow(sql string) *msgentity.MsgEntity
/**
* 执行SQL脚本获取多行数据(多列)
* 注意:库名必须用${}进行包装,此脚本可返回多条记录
* @param sql SQL脚本
* @return msgentity.MsgEntity
*/
GetRows(sql string) *msgentity.MsgEntity
/**
* 根据关键值翻转值(限布尔值类型,1转2,2转1)
* 警告:此方法只支持布尔值类型,且只支持翻转1和2
* @Param ctx http请求对象
* @Param entity 实体类
* @Param whereInfo 存放查询条件
* @Param reversalColumn 翻转的字段名
* @return msgentity.MsgEntity
*/
ReversalByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, reversalColumn string) *msgentity.MsgEntity
/**
* 根据条件仅查询指定字段名数据
* @param entity 实体类
* @param whereInfo
* @param fieldNames 待取数据的字段名称集合
* @return msgentity.MsgEntity 返回内容data中存放的是Map
*/
FindField(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldNames []string) *msgentity.MsgEntity
/**
* 上传文件
* @param ctx http请求对象
* @param modelName 模块名称
* @return msgentity.MsgEntity
*/
UpFile(ctx ginutil.Context, modelName string) *msgentity.MsgEntity
/**
* 获取图片
* @param ctx http请求对象
* @param modelName 模块名称
* @param filename 文件名
*/
LookImg(ctx ginutil.Context, modelName, filename string)
/**
* 设置父对象
* @param owner 父对象
*/
SetOwner(owner Service)
// contains filtered or unexported methods
}
we业务层接口定义,用于规范控制层结构体
type ServiceBaseFunc ¶
type ServiceBaseFunc struct {
// contains filtered or unexported fields
}
基类
func (ServiceBaseFunc) Add ¶
func (service ServiceBaseFunc) Add(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
*
- 新增
- entity 检查用数据结构
- data 数据
func (ServiceBaseFunc) AddCommon ¶
func (service ServiceBaseFunc) AddCommon(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
*
- 新增普通数据
- entity 检查用数据结构
- data 数据
func (ServiceBaseFunc) AddList ¶
func (service ServiceBaseFunc) AddList(ctx ginutil.Context, entitys []dbinfo.Entity) *msgentity.MsgEntity
批量新增
func (ServiceBaseFunc) AddNode ¶
func (service ServiceBaseFunc) AddNode(ctx ginutil.Context, entity dbinfo.Entity, data map[string]interface{}) *msgentity.MsgEntity
*
- 新增树节点
- entity 检查用数据结构
- data 数据
func (ServiceBaseFunc) AddToGroup ¶
func (service ServiceBaseFunc) AddToGroup(ctx ginutil.Context, entity dbinfo.Entity, sGroupName, sGroupValue string) *msgentity.MsgEntity
*
- 添加数据到指定组下
- 警告:对象必须符合树形结构要求,如:sId、sPid
- @param r Http请求对象
- @param sGroupName 分组字段名称(树节点)
- @param sGroupValue 分组字段值(树节点)
- @param entity 实体对象
- @return
func (ServiceBaseFunc) Adds ¶
func (service ServiceBaseFunc) Adds(ctx ginutil.Context, entitys []dbinfo.Entity, list []map[string]interface{}) *msgentity.MsgEntity
批量新增
func (ServiceBaseFunc) ChangeSetp ¶
func (service ServiceBaseFunc) ChangeSetp(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iSetp int, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
*
- 修改步骤值(如果设置为单向则新值必须大于旧值)
- @param id 编号
- @param iSetp 步骤值
- @param iVersion 记录版本号
- @param sMemo 备注
- @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
- @param entity 实体类
- @return msgentity.MsgEntity 返回执行情况
func (ServiceBaseFunc) ChangeState ¶
func (service ServiceBaseFunc) ChangeState(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iState int, iVersion int, sMemo string, unidirectional bool) *msgentity.MsgEntity
*
- 修改状态
- @param entity 实体类
- @param id 编号
- @param iState 状态值
- @param iVersion 记录版本号
- @param sMemo 备注
- @param unidirectional 是否单向 设置为单向则新值必须大于旧值才能执行
- @return msgentity.MsgEntity 返回执行情况
func (*ServiceBaseFunc) CheckRepeatByAdd ¶
func (service *ServiceBaseFunc) CheckRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
*
- 验证新增数据是否存在重复 (一旦使用则覆盖通用方法)
- @param ctx gin请求对象
- @param entity 验证数据
- @return *MsgEntity 返回验证结果
func (*ServiceBaseFunc) CheckRepeatByEdit ¶
func (service *ServiceBaseFunc) CheckRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
*
- 验证更新数据是否存在重复 (一旦使用则覆盖通用方法)
- @param ctx gin请求对象
- @param entity 待验证数据
- @return *MsgEntity 返回验证结果
func (ServiceBaseFunc) ClearCache ¶
func (service ServiceBaseFunc) ClearCache(ctx ginutil.Context, cacheName, sUser string) *msgentity.MsgEntity
*
- 清理指定用户的缓存
- @param cacheName 缓存名
- @Param sUser 用户名
- @return msgentity.MsgEntity
func (ServiceBaseFunc) CommonCheckRepeatByAdd ¶
func (service ServiceBaseFunc) CommonCheckRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
*
- 通用添加数据时重复检查方法
- entity
func (ServiceBaseFunc) CommonCheckRepeatByAddAndTree ¶
func (service ServiceBaseFunc) CommonCheckRepeatByAddAndTree(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
*
- 通用树型结构表添加数据时重复检查方法
- entity
func (ServiceBaseFunc) CommonCheckRepeatByEdit ¶
func (service ServiceBaseFunc) CommonCheckRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, data map[string]interface{}) *msgentity.MsgEntity
*
- 通用更新数据时重复检查方法
- entity
func (ServiceBaseFunc) CommonCheckRepeatByEditAndTree ¶
func (service ServiceBaseFunc) CommonCheckRepeatByEditAndTree(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, sName interface{}) *msgentity.MsgEntity
*
- 通用树型结构表添加数据时重复检查方法
- entity
func (ServiceBaseFunc) CreateTree ¶
func (service ServiceBaseFunc) CreateTree(source interface{}, rootName, idFieldName, pIdFieldName, childFieldName string) *msgentity.MsgEntity
*
- List转树形结构
- @param source Map或切片结构
- @param rootName
- @param idFieldName
- @param pIdFieldName
- @param childFieldName
- @return
func (ServiceBaseFunc) Del ¶
func (service ServiceBaseFunc) Del(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int) *msgentity.MsgEntity
*
- 删除
- @param entity 对象类型
- @param id 记录编号值
- @param iVersion 记录版本号
- @return msgentity.MsgEntity
func (ServiceBaseFunc) DelByMap ¶
func (service ServiceBaseFunc) DelByMap(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
*
- 删除
- @param entity 对象类型
- @param where 执行条件
- @return msgentity.MsgEntity
func (ServiceBaseFunc) DoSql ¶
func (service ServiceBaseFunc) DoSql(sql string) *msgentity.MsgEntity
*
- 执行SQL脚本获取单行单列数据
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
- @param sql 待执行的SQL脚本
- @return msgentity.MsgEntity
func (ServiceBaseFunc) Edit ¶
func (service ServiceBaseFunc) Edit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, iVersion int, data map[string]interface{}) *msgentity.MsgEntity
*
- 修改
- @param entity 对象类型
- @param id 记录编号值
- @param iVersion 记录版本号
- @param data 待更新的字段和值
- @return msgentity.MsgEntity
func (ServiceBaseFunc) Edits ¶
func (service ServiceBaseFunc) Edits(ctx ginutil.Context, entity dbinfo.Entity, datas []map[string]interface{}) *msgentity.MsgEntity
*
- 批量修改
- @param entity 对象类型
- @param datas 待更新的字段和值集合
- @return msgentity.MsgEntity
func (ServiceBaseFunc) ExecSql ¶
func (service ServiceBaseFunc) ExecSql(sql string) *msgentity.MsgEntity
*
- 执行SQL脚本获取单行单列数据
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
- @param sql 待执行的SQL脚本
- @return msgentity.MsgEntity
func (ServiceBaseFunc) FindAll ¶
func (service ServiceBaseFunc) FindAll(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
查询所有数据
func (ServiceBaseFunc) FindByDate ¶
func (service ServiceBaseFunc) FindByDate(ctx ginutil.Context, entity dbinfo.Entity, sDateSt string, sDateEd string) *msgentity.MsgEntity
查询指定时间内数据
func (ServiceBaseFunc) FindByFields ¶
func (service ServiceBaseFunc) FindByFields(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldMap map[string]string) *msgentity.MsgEntity
*
- 根据指定字段进行分组查询
- @Param entity 实体类
- @Param where 存放查询条件
- @param fieldMap 指定要查询的字段集合(原字段, 别名)
- @return msgentity.MsgEntity
func (ServiceBaseFunc) FindByGroup ¶
func (service ServiceBaseFunc) FindByGroup(ctx ginutil.Context, entity dbinfo.Entity, sGroupColumn, sGroupName string) *msgentity.MsgEntity
*
- 查询组结构数据
- @param r Http请求对象
- @param entity 实体类
- @param sGroupColumn 分组名(树节点)所在字段名
- @param sGroupName 分组名(树节点)
- @return
func (ServiceBaseFunc) FindById ¶
func (service ServiceBaseFunc) FindById(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 根据主键查询数据
- id 主键
- entity 检查用数据结构
func (ServiceBaseFunc) FindByKey ¶
func (service ServiceBaseFunc) FindByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
*
- 根据关键值取对象集合
- @Param entity 实体类
- @Param where 存放查询条件
- @return msgentity.MsgEntity
func (ServiceBaseFunc) FindByPage ¶
func (service ServiceBaseFunc) FindByPage(ctx ginutil.Context, entity dbinfo.Entity, findByPageParam dbinfo.FindByPageParam) *msgentity.MsgEntity
查询分页数据
func (ServiceBaseFunc) FindByRow ¶
func (service ServiceBaseFunc) FindByRow(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
查询指定行数据
func (ServiceBaseFunc) FindByTree ¶
func (service ServiceBaseFunc) FindByTree(ctx ginutil.Context, entity dbinfo.Entity, sGroupColumn, sGroupName string) *msgentity.MsgEntity
*
- 读取树形结构数据
- @param entity
- @param sGroupColumn
- @param sGroupName
- @return
func (ServiceBaseFunc) FindCountByKey ¶
func (service ServiceBaseFunc) FindCountByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
*
- 根据关键值查数量
- @Param entity 实体类
- @Param where 存放查询条件
- @return msgentity.MsgEntity
func (ServiceBaseFunc) FindField ¶
func (service ServiceBaseFunc) FindField(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldNames []string) *msgentity.MsgEntity
*
- 根据条件仅查询指定字段名数据
- @param entity 实体类
- @param whereInfo
- @param fieldNames 待取数据的字段名称集合
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (ServiceBaseFunc) FindOneByKey ¶
func (service ServiceBaseFunc) FindOneByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fields ...string) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的第一个
- @Param entity 实体类
- @Param where 存放查询条件
- @param fields 指定要查询的字段集合
- @return msgentity.MsgEntity
func (ServiceBaseFunc) FindValueByKey ¶
func (service ServiceBaseFunc) FindValueByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName string) *msgentity.MsgEntity
*
- 根据关键值取对象集合中的符合条件的第一条记录的指定字段
- @Param entity 实体类
- @Param where 存放查询条件
- @param fieldName 指定要查询的字段
- @return msgentity.MsgEntity
func (*ServiceBaseFunc) GetModuleDao ¶
func (service *ServiceBaseFunc) GetModuleDao() (Dao, error)
*
- 取对应模块数据层实体
func (ServiceBaseFunc) GetRow ¶
func (service ServiceBaseFunc) GetRow(sql string) *msgentity.MsgEntity
*
- 执行SQL脚本获取一行数据(多列)
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录
- @param sql 待执行的SQL脚本
- @return msgentity.MsgEntity
func (ServiceBaseFunc) GetRows ¶
func (service ServiceBaseFunc) GetRows(sql string) *msgentity.MsgEntity
*
- 执行SQL脚本获取多行数据(多列)
- 注意:库名必须用${}进行包装,此脚本可返回多条记录
- @param sql SQL脚本
- @return msgentity.MsgEntity
func (ServiceBaseFunc) GetValue ¶
func (service ServiceBaseFunc) GetValue(sql string) *msgentity.MsgEntity
*
- 执行SQL脚本获取单行单列数据
- 注意:库名必须用${}进行包装,此脚本应只存在一条记录且为单列
- @param sql 待执行的SQL脚本
- @return msgentity.MsgEntity
func (ServiceBaseFunc) GetValueByField ¶
func (service ServiceBaseFunc) GetValueByField(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, fieldName string) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param entity 实体类
- @param id
- @param fieldName 待取数据的字段名称集合
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (ServiceBaseFunc) GetValueByFieldName ¶
func (service ServiceBaseFunc) GetValueByFieldName(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, fieldNames []string) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param entity 实体类
- @param id
- @param fieldNames 待取数据的字段名称集合
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (ServiceBaseFunc) GetValueByWhere ¶
func (service ServiceBaseFunc) GetValueByWhere(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, fieldName string) *msgentity.MsgEntity
*
- 根据字段名取指定记录编号的数据库表中对应字段的值
- @param entity 实体类
- @param whereInfo 条件
- @param fieldName 待取数据的字段名称集合
- @param currentUser 当前用户
- @return msgentity.MsgEntity 返回内容data中存放的是Map
func (ServiceBaseFunc) GetiState ¶
func (service ServiceBaseFunc) GetiState(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 取记录对应的状态值
- @param entity 实体类
- @param idName 编号
- @return
func (ServiceBaseFunc) GetiVersion ¶
func (service ServiceBaseFunc) GetiVersion(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 取记录对应的版本号
- @param entity 实体类
- @param idName 编号
- @return
func (ServiceBaseFunc) GroupByField ¶
func (service ServiceBaseFunc) GroupByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, fields map[string]string) *msgentity.MsgEntity
*
- 根据字段名取分组数据
- @param entity 实体类
- @param sCreator 指定用户
- @param fields 字段名与别名对象
- @return
func (ServiceBaseFunc) GroupByFieldAndCount ¶
func (service ServiceBaseFunc) GroupByFieldAndCount(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, fields map[string]string) *msgentity.MsgEntity
*
- 根据字段名取分组数据及分组后数量
- @param entity 实体类
- @param sCreator 指定用户
- @param fields 字段名与别名对象
- @return
func (ServiceBaseFunc) HasById ¶
func (service ServiceBaseFunc) HasById(ctx ginutil.Context, entity dbinfo.Entity, id interface{}) *msgentity.MsgEntity
*
- 检查关键值记录是否存在(返回1:存在;0:不存在)
- @param entity 实体类
- @Param id
- @return msgentity.MsgEntity
func (ServiceBaseFunc) HasByKey ¶
func (service ServiceBaseFunc) HasByKey(ctx ginutil.Context, entity dbinfo.Entity, keyName string, keyValue interface{}) *msgentity.MsgEntity
*
- 检查关键值记录是否存在(返回1:存在;0:不存在)
- @param entity 实体类
- @Param keyName 字段名
- @Param keyValue 字段值
- @return msgentity.MsgEntity
func (ServiceBaseFunc) HoldByEntity ¶
func (service ServiceBaseFunc) HoldByEntity(entity dbinfo.Entity, data map[string]interface{}) map[string]interface{}
*
- 按实体保留map中的数据
- entity 参考的结构体
- data 数据
func (ServiceBaseFunc) LookImg ¶
func (service ServiceBaseFunc) LookImg(ctx ginutil.Context, modelName, filename string)
*
- 获取图片
- @param ctx http请求对象
- @param modelName 模块名称
- @param filename 文件名
func (ServiceBaseFunc) MaxByField ¶
func (service ServiceBaseFunc) MaxByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
*
- 取表中指定字段的最大值
- @param entity 实体类
- @param sCreator 指定用户
- @param field 字段名
- @param where 查询条件字符串
- @return msgentity.MsgEntity
func (ServiceBaseFunc) MinByField ¶
func (service ServiceBaseFunc) MinByField(ctx ginutil.Context, entity dbinfo.Entity, sCreator string, field string, whereInfo []dbinfo.WhereInfo) *msgentity.MsgEntity
*
- 取表中指定字段的最小值
- @param entity 实体类
- @param sCreator 指定用户
- @param field 字段名
- @param where 查询条件
- @return msgentity.MsgEntity
func (ServiceBaseFunc) ReversalByKey ¶
func (service ServiceBaseFunc) ReversalByKey(ctx ginutil.Context, entity dbinfo.Entity, whereInfo []dbinfo.WhereInfo, reversalColumn string) *msgentity.MsgEntity
*
- 根据关键值翻转值(限布尔值类型,1转2,2转1)
- 警告:此方法只支持布尔值类型,且只支持翻转1和2
- @Param ctx http请求对象
- @Param entity 实体类
- @Param whereInfo 存放查询条件
- @Param reversalColumn 翻转的字段名
- @return msgentity.MsgEntity
func (*ServiceBaseFunc) SetOwner ¶
func (service *ServiceBaseFunc) SetOwner(owner Service)
*
- 设置父对象
- @param owner
func (ServiceBaseFunc) SupplyDbEntityAttrByAdd ¶
func (service ServiceBaseFunc) SupplyDbEntityAttrByAdd(ctx ginutil.Context, entity dbinfo.Entity, selfId string, idValuePrefix string) *msgentity.MsgEntity
*
- 补充数据库实体类的数据--新增
- @param entity
- @param selfId 自提供的编号,防止从序列中获取
- @param idValuePrefix Id前缀
- @return
func (ServiceBaseFunc) SupplyDbEntityAttrByEdit ¶
func (service ServiceBaseFunc) SupplyDbEntityAttrByEdit(ctx ginutil.Context, data map[string]interface{}, entity dbinfo.Entity) *msgentity.MsgEntity
*
- 补充数据库实体类的数据--修改
- @param ctx
- @param data 待修改的数据
- @param entity 参照结构体
- @return
func (ServiceBaseFunc) UpFile ¶
*
- 上传文件
- @param ctx http请求对象
- @param modelName 模块名称
- @return msgentity.MsgEntity
func (ServiceBaseFunc) ValidEntityRepeatByAdd ¶
func (service ServiceBaseFunc) ValidEntityRepeatByAdd(ctx ginutil.Context, entity dbinfo.Entity) *msgentity.MsgEntity
*
- 验证新增数据是否存在重复 *
func (ServiceBaseFunc) ValidEntityRepeatByEdit ¶
func (service ServiceBaseFunc) ValidEntityRepeatByEdit(ctx ginutil.Context, entity dbinfo.Entity, id interface{}, data map[string]interface{}) *msgentity.MsgEntity
*
- 验证更新数据是否存在重复 *