models

package
v1.0.1-0...-540a35a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2021 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Overview

数据库模型.

Package models 为项目所需的模型对象定义.

Package models .

提交给merit的成果记录表

//定义一个工具包,用来管理gorm数据库连接池的初始化工作。

Index

Constants

View Source
const (
	//root matter's uuid
	MATTER_ROOT = "root"
	//cache directory name.
	MATTER_CACHE = "cache"
	//zip file temp directory.
	MATTER_ZIP             = "zip"
	MATTER_NAME_MAX_LENGTH = 200
	MATTER_NAME_MAX_DEPTH  = 32
	//matter name pattern
	MATTER_NAME_PATTERN = `[\\/:*?"<>|]`
)

Variables

View Source
var (
	// ErrMemberNoExist 用户不存在.
	ErrMemberNoExist             = errors.New("用户不存在")
	ErrMemberExist               = errors.New("用户已存在")
	ErrMemberDisabled            = errors.New("用户被禁用")
	ErrMemberEmailEmpty          = errors.New("用户邮箱不能为空")
	ErrMemberEmailExist          = errors.New("用户邮箱已被使用")
	ErrMemberDescriptionTooLong  = errors.New("用户描述必须小于500字")
	ErrMemberEmailFormatError    = errors.New("邮箱格式不正确")
	ErrMemberPasswordFormatError = errors.New("密码必须在6-50个字符之间")
	ErrMemberAccountFormatError  = errors.New("账号只能由英文字母数字组成,且在3-50个字符")
	ErrMemberRoleError           = errors.New("用户权限不正确")
	// ErrorMemberPasswordError 密码错误.
	ErrorMemberPasswordError = errors.New("用户密码错误")
	//ErrorMemberAuthMethodInvalid 不支持此认证方式
	ErrMemberAuthMethodInvalid = errors.New("不支持此认证方式")
	//ErrLDAPConnect 无法连接到LDAP服务器
	ErrLDAPConnect = errors.New("无法连接到LDAP服务器")
	//ErrLDAPFirstBind 第一次LDAP绑定失败
	ErrLDAPFirstBind = errors.New("第一次LDAP绑定失败")
	//ErrLDAPSearch LDAP搜索失败
	ErrLDAPSearch = errors.New("LDAP搜索失败")
	//ErrLDAPUserNotFoundOrTooMany
	ErrLDAPUserNotFoundOrTooMany = errors.New("LDAP用户不存在或者多于一个")

	// ErrDataNotExist 指定的服务已存在.
	ErrDataNotExist = errors.New("数据不存在")

	// ErrInvalidParameter 参数错误.
	ErrInvalidParameter = errors.New("Invalid parameter")

	ErrPermissionDenied = errors.New("Permission denied")

	ErrCommentClosed          = errors.New("评论已关闭")
	ErrCommentContentNotEmpty = errors.New("评论内容不能为空")
)

Functions

func AddAdminCalendar

func AddAdminCalendar(title, content, color string, allday, public bool, start, end time.Time) (id int64, err error)

********日历******** 添加

func AddAdminCarousel

func AddAdminCarousel(title, url string) (id int64, err error)

添加轮播动画

func AddAdminCategory

func AddAdminCategory(pid int64, title, code string, grade int) (id int64, err error)

添加

func AddAdminDepart

func AddAdminDepart(pid int64, title, code string) (id int64, err error)

添加部门

func AddAdminIpsegment

func AddAdminIpsegment(title, startip, endip string, iprole int) (id int64, err error)

添加ip地址段

func AddAdminSynchIp

func AddAdminSynchIp(pid int64, username, synchip, port string) (id int64, err error)

****项目同步ip**** 添加AdminSynchIp

func AddApplyRecharge

func AddApplyRecharge(uid int64, amount int) error

用户添加充值申请——软删除db.Delete(&User{}, 10),采用事务,如果软删除出错,则回滚

func AddArticle

func AddArticle(subtext, content string, productid int64) (id int64, err error)

添加文章作为成果的附件

func AddAttachment

func AddAttachment(filename string, filesize, downloads, productid int64) (id int64, err error)

添加附件到成果id下 如果附件名称已经存在,则不再追加写入数据库 应该用ReadOrCreate尝试从数据库读取,不存在的话就创建一个

func AddCarCalendar

func AddCarCalendar(title, content, color, ip string, allday, public bool, start, end time.Time) (id int64, err error)

********汽车日历******** 添加

func AddCatalogLink(cid int64, link string) (id int64, err error)

添加附件链接表

func AddDiary

func AddDiary(title, content, diarydate string, projectid, uid int64) (id int64, err error)

添加日记

func AddDoc

func AddDoc(code, title, label, principal string, end time.Time, uid int64) (id int64, err error)

添加成果到项目侧栏某个id下 如果这个侧栏id下的这个成果编号已经存在,则返回id //应该用ReadOrCreate尝试从数据库读取,不存在的话就创建一个

func AddFinance

func AddFinance(amount int, content, financedate string, projectid, uid int64, consider bool) (id int64, err error)

添加财务记录

func AddHistoryInputValue

func AddHistoryInputValue(userhistoryid uint, templeinputs []TempleInputs) (id uint, err error)

用户计输入算数据写入, templeinputsid

func AddHistoryOutputValue

func AddHistoryOutputValue(userhistoryid uint, templeoutputs []TempleOutputs) (id uint, err error)

用户计算输出数据写入, templeoutputsid

func AddInputAlias

func AddInputAlias(usertempleid uint, inputvalue, inputalias, resulttype, units string) (id uint, err error)

解析模板的输入参数写入数据库

func AddMathArticle

func AddMathArticle(usertempleid uint, title, subtext, content string) (id uint, err1, err2 error)

添加文章作为用户模板的附件

func AddMeetCalendar

func AddMeetCalendar(title, content, color, ip string, allday, public bool, start, end time.Time) (id int64, err error)

*******会议室日历 添加

func AddOnlyAttachment

func AddOnlyAttachment(filename string, filesize, downloads, productid int64) (id int64, err1, err2 error)

添加附件到成果id下 如果附件名称已经存在,则不再追加写入数据库 应该用ReadOrCreate尝试从数据库读取,不存在的话就创建一个

func AddOnlyChanges

func AddOnlyChanges(key, uid, uname, created string) (id int64, err1, err2 error)

添加历史版本

func AddOnlyHistory

func AddOnlyHistory(onlyattachmentid, uid int64, serverversion string, version int, key, fileurl, changesurl string, expires, created time.Time) (id int64, err1, err2 error)

添加历史版本

func AddOutputAlias

func AddOutputAlias(usertempleid uint, outputvalue, outputalias, resulttype, units string) (id uint, err error)

解析模板的输出参数写入数据库

func AddPostMerit

func AddPostMerit(catalog PostMerit) (cid int64, err error, news string)

添加成果列表

func AddProduct

func AddProduct(code, title, label, principal string, uid, Projectid, TopProjectId int64) (id int64, err error)

添加成果到项目侧栏某个id下 如果这个侧栏id下的这个成果编号已经存在,则返回id //应该用ReadOrCreate尝试从数据库读取,不存在的话就创建一个

func AddProductDocument

func AddProductDocument(dtid, documentid, productid int64) (id int64, err error)

flow程序向数据库中添加成果的流程关联数据

func AddProjCalendar

func AddProjCalendar(pid int64, title, content, color, imgurl string, allday, public, memorabilia bool, start, end time.Time) (id int64, err error)

************项目日历 ********日历******** 添加

func AddProjGant

func AddProjGant(id1, parentid int64, status, code, name, depends, description string, level, duration, progress int, start, end time.Time, startismilestone, endismilestone, haschild bool) (id int64, err error)

添加项目进度

func AddProject

func AddProject(code, title, label, principal string, parentid int64, parentidpath, parenttitlepath string, grade int) (id int64, err error)

添加项目

func AddProjectLabel

func AddProjectLabel(pid int64, label string) (id int64, err error)

func AddProjectPics

func AddProjectPics(data []string, project_pic_type string, project_id int) bool

gorm批量插入——参考用,没有意义

func AddProjectUser

func AddProjectUser(pid, uid int64) (id int64, err error)

func AddRelevancy

func AddRelevancy(prodid int64, relevancy string) (id int64, err error)

添加项目

func AddTemple

func AddTemple(classid, userid int64, templetitle, templetitleb, templepath, version string) (id uint, err error)

用户模板写入数据库

func AddTopicLike

func AddTopicLike(tid int64, openid string) (id int64, err error)

func AddTopicReply

func AddTopicReply(tid int64, openid, content, avatar, username, created string) (id int64, err error)

func AddUser

func AddUser(u *User) (int64, error)

添加用户

func AddUserAppreciation

func AddUserAppreciation(userid int64, appreciationurl string) (id int64, err error)

添加用户赞赏码

func AddUserAvator

func AddUserAvator(userid int64, avatarurl string) (id int64, err error)

添加用户头像

func AddUserOpenID

func AddUserOpenID(userid int64, openid string) (id int64, err error)

后台手工操作添加微信小程序openid和用户名

func AddUserPay

func AddUserPay(articleid, uid int64, amount int) error

添加某个文章某个用户打赏记录

func AddUserPayMath

func AddUserPayMath(templeid uint, uid int64, amount int) error

添加某个math某个用户打赏记录

func AddUserRecharge

func AddUserRecharge(uid int64, amount int) error

用户充值和提现

func AddUserRole

func AddUserRole(uid, rid int64) error

将userid和roleid存入对应数据库 如果存在,

func AddWikiMany

func AddWikiMany(title, uname, content, attachment string) (id int64, err error)

一对多模式

func AddWikiOne

func AddWikiOne(title, content, uname string) (id int64, err error)

一对一模式

func AddWikiReply

func AddWikiReply(tid, nickname, content string) error

func AddWxSubscribeMessage

func AddWxSubscribeMessage(openid, tmplid string) (id int64, err error)

存储用户订阅消息模板id和用户openid

func BackgroundConvert

func BackgroundConvert(sessionId string, bookResult *BookResult) error

后台转换

func BbsBbs

func BbsBbs(UserId int64, Desc string, SelectDate time.Time) (id int64, err error)

打卡记录写入数据库

func BusinessCheck

func BusinessCheck(businessid uint, userid int64, Lat, Lng float64, PhotoUrl, location string, SelectDate time.Time) (id uint, err error)

打卡记录写入数据库

func CheckCheck

func CheckCheck(ActivityId, UserId int64, Lat, Lng float64, PhotoUrl string, SelectDate time.Time) (id int64, err error)

打卡记录写入数据库

func CheckCreate

func CheckCreate(CreaterId, projectid int64, Caption, Desc, Location string, Lat, Lng float64, StartDate, EndDate time.Time, IfFace, IfPhoto, IfLocation bool) (id int64, err error)

func CheckUname

func CheckUname(user User) error

func CloseProjGant

func CloseProjGant(id int64) error

关闭

func Connect

func Connect()

数据库连接_这个仅作为参考,和上面重复

func CreateBusiness

func CreateBusiness(business Business) (id uint, err error)

登记出差活动

func CreateCart

func CreateCart(productid, userid int64) (id int64, err error)

func CreateLocation

func CreateLocation(location Location) (id uint, err error)

登记定位数据组

func CreateLocationNavigate

func CreateLocationNavigate(locationnavigate LocationNavigate) (id uint, err error)

定位导航写入数据库

func CreateUserBusiness

func CreateUserBusiness(businessuser BusinessUser) (id uint, err error)

添加用户~出差关联表格

func CreateUserHistory

func CreateUserHistory(userid int64, usertempleid uint, pdfurl string) (id uint, err error)

用户计算历史写入

func CreateVideo

func CreateVideo(projectid, userid int64, content, name, url string) (id int64, err error)

func DelAdminCarouselById

func DelAdminCarouselById(Id int64) (int64, error)

func DelUserById

func DelUserById(Id int64) (int64, error)

func DeletAttachment

func DeletAttachment(aid string) error

删除文章中的附件

func DeletWiki

func DeletWiki(tid string) error

func DeleteAdminCalendar

func DeleteAdminCalendar(cid int64) error

删除事件

func DeleteAdminCategory

func DeleteAdminCategory(cid int64) error

删除

func DeleteAdminDepart

func DeleteAdminDepart(cid int64) error

删除

func DeleteAdminIpsegment

func DeleteAdminIpsegment(cid int64) error

删除

func DeleteAdminSynchIp

func DeleteAdminSynchIp(cid int64) error

删除

func DeleteArticle

func DeleteArticle(id int64) error

删除

func DeleteAttachment

func DeleteAttachment(cid int64) error

删除

func DeleteCarCalendar

func DeleteCarCalendar(cid int64) error

删除事件

func DeleteDiary

func DeleteDiary(id int64) error

删除

func DeleteDoc

func DeleteDoc(cid int64) error

删除_把附件也一并删除(在controllers中实现吧)

func DeleteFinance

func DeleteFinance(id int64) error

删除

func DeleteMeetCalendar

func DeleteMeetCalendar(cid int64) error

删除事件

func DeleteOnlyAttachment

func DeleteOnlyAttachment(cid int64) error

删除附件

func DeletePostMerit

func DeletePostMerit(cid int64) error

删除成果列表

func DeleteProduct

func DeleteProduct(cid int64) error

删除_把附件也一并删除(在controllers中实现吧)

func DeleteProjCalendar

func DeleteProjCalendar(cid int64) error

删除事件

func DeleteProjGant

func DeleteProjGant(id int64) error

删除

func DeleteProject

func DeleteProject(id int64) error

删除

func DeleteRelevancy

func DeleteRelevancy(prodid int64) error

删除

func DeleteRole

func DeleteRole(Id int64) (int64, error)

func DeleteStandard

func DeleteStandard(id int64) error

func DeleteTemple

func DeleteTemple(templeid uint) error

删除模板

func DeleteTodo

func DeleteTodo(todoid int64) error

删除待办

func DeleteTopicLike

func DeleteTopicLike(openid string) error

func DeleteTopicReply

func DeleteTopicReply(id int64) error

func DeleteUserBusiness

func DeleteUserBusiness(userid int64, businessid uint) (err error)

删除用户~出差关联表格

func DeleteUserCart

func DeleteUserCart(id int64) error

删除

func DeleteUserRole

func DeleteUserRole(uid, rid int64) error

func DeleteValid

func DeleteValid(id int64) error

func DeleteWikiReply

func DeleteWikiReply(rid string) error

func Deletevideo

func Deletevideo(id int64) error

删除

func DropAdminCalendar

func DropAdminCalendar(cid int64, start, end time.Time) error

拖曳

func DropCarCalendar

func DropCarCalendar(cid int64, start, end time.Time) error

拖曳

func DropMeetCalendar

func DropMeetCalendar(cid int64, start, end time.Time) error

拖曳

func DropProjCalendar

func DropProjCalendar(cid int64, start, end time.Time) error

拖曳

func GetApplyCartCount

func GetApplyCartCount(uid int64, status int, searchText string, isadmin bool) (count int64, err error)

查询自己申请的记录总数

func GetApprovalCartCount

func GetApprovalCartCount(uid int64, status int, searchText string, isadmin bool) (count int64, err error)

查询待自己审批的记录总数

func GetAttachmentsCount

func GetAttachmentsCount(id int64) (cnt int64, err error)

根据成果id取得所有附件数量

func GetDB

func GetDB() *gorm.DB

获取gorm db对象,其他包需要执行数据库查询的时候,只要通过tools.getDB()获取db对象即可。 不用担心协程并发使用同样的db对象会共用同一个连接, db对象在调用他的方法的时候会从数据库连接池中获取新的连接 注意:使用连接池技术后,千万不要使用完db后调用db.Close关闭数据库连接, 这样会导致整个数据库连接池关闭,导致连接池没有可用的连接

func GetMathTempleCount

func GetMathTempleCount(classid int64) (count int64, err error)

查出所有模板

func GetOptionValue

func GetOptionValue(key, def string) string

func GetProductsCount

func GetProductsCount(id int64, searchText string) (count int64, err error)

取得侧栏id下成果总数

func GetProjectsCount

func GetProjectsCount(searchText string) (count int64, err error)

取得项目总数

func GetUserHistoryCount

func GetUserHistoryCount(userid int64, usertempleid uint) (count int64, err error)

func GetUserStandardCount

func GetUserStandardCount(searchText string) (count int64, err error)

查询规范记录总数

func GetUserVideoCount

func GetUserVideoCount(pid int64, searchText string) (count int64, err error)

查询某个用户借阅记录总数

func GetWxDiaryCount

func GetWxDiaryCount(pid int64) (count int64, err error)

获取日志总数

func GetWxFinanceCount

func GetWxFinanceCount(pid int64) (count int64, err error)

获取日志总数

func Getuserlist

func Getuserlist(page int64, page_size int64, sort string) (users []orm.Params, count int64)

get user list

func InitFlow

func InitFlow()

func InsertRole

func InsertRole() error

func InsertUser

func InsertUser()

*********初始化数据库中的用户********

func Insertprojtemplet

func Insertprojtemplet(pid int64, parentidpath, parenttitlepath string, nodes []*FileNode) (id int64)

递归将项目模板目录写入数据库

func ModifyCatalog

func ModifyCatalog(cid int64, fieldname, value string) error

用户修改一条成果的某个字段

func ModifyCatalogLink(id, cid int64, fieldname, value string) error

修改links

func ModifyDatabase

func ModifyDatabase() (err1 error)

删除数据表和字段测试

func ModifyWiki

func ModifyWiki(tid, title, content string) error

只修改编号、名称和内容,不修改附件及分类树状目录

func Projhasson

func Projhasson(id int64) bool

根据id查是否有下级

func ResizeAdminCalendar

func ResizeAdminCalendar(cid int64, end time.Time) error

resize

func ResizeCarCalendar

func ResizeCarCalendar(cid int64, end time.Time) error

resize

func ResizeMeetCalendar

func ResizeMeetCalendar(cid int64, end time.Time) error

resize

func ResizeProjCalendar

func ResizeProjCalendar(cid int64, end time.Time) error

resize

func SaveLibrary

func SaveLibrary(library Library) (lid int64, err error)

有效版本库存入数据库

func SaveRole

func SaveRole(role Role) (rid int64, err error)

添加权限

func SaveStandard

func SaveStandard(standard Standard) (sid int64, err error)

标准存入数据库

func SaveUser

func SaveUser(user User) (uid int64, err error)

这个是使用的,下面那个adduser不知干啥的

func TodoCreate

func TodoCreate(projectid int64, name string, userid int64) (id int64, err error)

func UpdateAdminCalendar

func UpdateAdminCalendar(cid int64, title, content, color string, allday, public bool, start, end time.Time) error

修改

func UpdateAdminCategory

func UpdateAdminCategory(cid int64, title, code string, grade int) error

修改

func UpdateAdminDepart

func UpdateAdminDepart(cid int64, title, code string) error

修改

func UpdateAdminIpsegment

func UpdateAdminIpsegment(cid int64, title, startip, endip string, iprole int) error

修改Ip地址段

func UpdateAdminSynchIp

func UpdateAdminSynchIp(cid int64, username, synchip, port string) error

修改

func UpdateApprovalCart

func UpdateApprovalCart(id int64) error

更新Status

func UpdateArticle

func UpdateArticle(id int64, subtext, content string) error

修改

func UpdateAttachment

func UpdateAttachment(cid int64, filename string, filesize, downloads int64) (err error)

修改_这个意义不大,对于附件的修改,一般是追加或删除

func UpdateAttachmentTime

func UpdateAttachmentTime(cid int64) (err error)

修改附件的日期和changesurl修改记录地址

func UpdateBusiness

func UpdateBusiness(business Business) (err error)

更新出差活动

func UpdateCarCalendar

func UpdateCarCalendar(cid int64, title, content, color string, allday, public bool, start, end time.Time) error

修改

func UpdateDatabase

func UpdateDatabase() (err1, err2, err3, err4, err5, err6, err7 error)

func UpdateDiary

func UpdateDiary(id int64, title, content string) error

修改

func UpdateDoc

func UpdateDoc(cid int64, code, title, label, principal string, end time.Time) error

修改成果信息

func UpdateDocTime

func UpdateDocTime(cid int64) error

修改成果时间信息

func UpdateFinance

func UpdateFinance(id int64, amount int, content, financedate string, consider bool) error

修改

func UpdateLocation

func UpdateLocation(location Location) (err error)

更新出差活动

func UpdateMathArticle

func UpdateMathArticle(matharticleid uint, title, subtext, content string) (err error)

编辑文章

func UpdateMeetCalendar

func UpdateMeetCalendar(cid int64, title, content, color string, allday, public bool, start, end time.Time) error

修改

func UpdateMeritBasic

func UpdateMeritBasic(cid int64, fieldname, value string) error

用户修改一个用户的某个字段

func UpdateOnlyAttachment

func UpdateOnlyAttachment(cid int64, filename string) (err error)

修改附件的日期和changesurl修改记录地址

func UpdatePostMerit

func UpdatePostMerit(id int64, fieldname, value string) error

用户修改一个用户的某个字段

func UpdateProduct

func UpdateProduct(cid int64, code, title, label, principal string) error

修改成果信息

func UpdateProductTime

func UpdateProductTime(cid int64) error

修改成果时间信息

func UpdateProductTtile

func UpdateProductTtile(pid int64, title string) error

修改成果名称

func UpdateProjCalendar

func UpdateProjCalendar(cid int64, title, content, color, url string, allday, public, memorabilia bool, start, end time.Time) error

修改

func UpdateProjGant

func UpdateProjGant(cid int64, code, title, label string) error

修改——还没改

func UpdateProject

func UpdateProject(cid int64, code, title, label, principal string) error

修改——还没改,有问题,不能用

func UpdateProjectTtile

func UpdateProjectTtile(pid int64, title string) error

修改项目名称——有问题,不能用

func UpdateRecharge

func UpdateRecharge(rid uint, amount int) error

管理员查询软删除的充值申请,同意则取消软删除,修改申请数额db.Unscoped().Where("age = 20").Find(&users) db.Model(&user).Select("Name", "Age").Updates(User{Name: "new_name", Age: 0})

func UpdateRole

func UpdateRole(role Role) (err error)

func UpdateStandard

func UpdateStandard(id, uid int64, number, title, route string) error

func UpdateTemple

func UpdateTemple(templeid uint, fieldname, value string) (err error)

修改输入参数的信息

func UpdateTempleInputs

func UpdateTempleInputs(templeinputid uint, fieldname, value string) (err error)

修改输入参数的备注信息

func UpdateTempleOutputs

func UpdateTempleOutputs(templeoutputid uint, comment string) (err error)

修改输出参数的备注信息

func UpdateTodo

func UpdateTodo(todoid int64) error

修改

func UpdateUser

func UpdateUser(cid int64, fieldname, value string) error

用户修改一个用户的某个字段

func UpdateUserlastlogintime

func UpdateUserlastlogintime(username string) error

更新用户登陆时间

func UpdateVideo

func UpdateVideo(vid int64, coverurl string) error

func ValidateUser

func ValidateUser(user User) error

Types

type Activity

type Activity struct {
	Id         int64  `json:"F_ID"`
	CreaterId  int64  `json:"userid"`
	ProjectId  int64  `json:"projectid"`
	Caption    string `json:"F_Caption"`
	Desc       string
	Location   string `json:"F_Location"`
	Lat        float64
	Lng        float64
	StartDate  time.Time `json:"F_StartDate",orm:"auto_now_add;type(date)"`
	EndDate    time.Time `json:"F_EndDate",orm:"auto_now_add;type(date)"`
	IfFace     bool
	IfLocation bool
	IfPhoto    bool
}

func CheckLike

func CheckLike(name string) (activity []*Activity, err error)
getallLike:function (str,callback) {
    var sql = 'SELECT * FROM T_activity WHERE F_Caption LIKE ? ';
    str = '%' + str + '%';
    var params = [str];
    db.connection.query(sql,params,function (err,res) {
        if(err){
            console.log(err);
            return;
        }
        callback(res);
    })
},

func GetAll

func GetAll(projectid int64) (activity []*Activity, err error)
getall: function (user_id,callback) {
    var sql = 'SELECT * FROM v_apply_activity WHERE F_ApplyerId=? ';
    var params = [user_id];
    db.connection.query(sql,params,function (err,res) {
        if(err){
            console.log(err);
            return;
        }
        callback(res);
    })
},

type AdminCalendar

type AdminCalendar struct {
	Id        int64     `json:"id",form:"-"`
	Title     string    `json:"title",form:"title;text;title:",valid:"MinSize(1);MaxSize(100)"` //orm:"unique",
	Content   string    `json:"content",orm:"sie(20)"`
	Starttime time.Time `json:"start",orm:"type(datetime)"`
	Endtime   time.Time `json:"end",orm:"null;type(datetime)"`
	Allday    bool      `json:"allDay",orm:"default(0)"`
	Color     string    `json:"color",orm:"null"`
	Public    bool      `default(true)`
}

func GetAdminCalendar

func GetAdminCalendar(start, end time.Time, public bool) (calendars []*AdminCalendar, err error)

取所有——要修改为支持时间段的,比如某个月份

func GetAdminCalendarbyid

func GetAdminCalendarbyid(id int64) (calendar AdminCalendar, err error)

根据id查询事件

func SearchAdminCalendar

func SearchAdminCalendar(title string, public bool) (calendars []*AdminCalendar, err error)

取所有——要修改为支持时间段的,比如某个月份 未测试!!!20181117修改filter为cond2

type AdminCarousel

type AdminCarousel struct {
	Id      int64     `json:"id",form:"-"`
	Title   string    `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	Url     string    `orm:"null"`
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now_add;type(datetime)"`
}

首页轮播图片

func GetAdminCarousel

func GetAdminCarousel() (carousels []*AdminCarousel, err error)

type AdminCategory

type AdminCategory struct {
	Id       int64     `form:"-"`
	ParentId int64     `orm:"null"`
	Title    string    `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	Code     string    `orm:"null"`
	Grade    int       `orm:"null"`
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
	Updated  time.Time `orm:"auto_now;type(datetime)"`
}

func GetAdminCategory

func GetAdminCategory(pid int64) (categories []*AdminCategory, err error)

根据父级id取得所有 如果父级id为空,则取所有一级category

func GetAdminCategoryTitle

func GetAdminCategoryTitle(title string) (categories []*AdminCategory, err error)

根据类别名字title查询所有下级分级category

func GetAdminCategorybyId

func GetAdminCategorybyId(id int64) (category []*AdminCategory, err error)

根据id查分级

type AdminDepartment

type AdminDepartment struct {
	Id       int64     `form:"-"`
	ParentId int64     `orm:"null"`
	Title    string    `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	Code     string    `orm:"null"`
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
	Updated  time.Time `orm:"auto_now_add;type(datetime)"`
}

科室结构

func GetAdminDepart

func GetAdminDepart(pid int64) (departs []*AdminDepartment, err error)

根据部门id取得所有科室 如果父级id为0,则取所有部门

func GetAdminDepartName

func GetAdminDepartName(title string) (AdminDepartment, error)

根据父级id取得所有 如果父级id为空,则取所有一级category

func GetAdminCategory(pid int64) (categories []*AdminDepartment, err error) {
	o := orm.NewOrm()
	categories = make([]*AdminDepartment, 0)
	qs := o.QueryTable("AdminDepartment")
	_, err = qs.Filter("parentid", pid).All(&categories)
	if err != nil {
		return nil, err
	}
	return categories, err
}

根据部门名字title返回自身

func GetAdminDepartTitle

func GetAdminDepartTitle(title string) (categories []*AdminDepartment, err error)

根据部门名字title查询所有下级科室category

func GetAdminDepartbyId

func GetAdminDepartbyId(id int64) (category AdminDepartment, err error)

根据id查科室

func GetAdminDepartbyidtitle

func GetAdminDepartbyidtitle(id int64, title string) (*AdminDepartment, error)

由分院id和科室 名称取得科室

type AdminIpsegment

type AdminIpsegment struct {
	Id      int64     `form:"-"`
	Title   string    `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	StartIp string    //`orm:"not null"`
	EndIp   string    `orm:"null"`
	Iprole  int       `orm:"null"`
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
}

func GetAdminIpsegment

func GetAdminIpsegment() (ipsegments []*AdminIpsegment, err error)

查询所有Ip地址段

type AdminSynchIp

type AdminSynchIp struct {
	Id       int64     `form:"-"`
	ParentId int64     `orm:"null"`
	UserName string    `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	SynchIp  string    //`orm:"not null"`
	Port     string    `orm:"default(80)"`
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
	Updated  time.Time `orm:"auto_now;type(datetime)"`
}

项目同步ip表

func GetAdminSynchIp

func GetAdminSynchIp(pid int64) (synchips []*AdminSynchIp, err error)

根据父级id取得所有AdminSynchIp

type Apply

type Apply struct {
	Id         int64
	ApplyerId  int64
	ActivityId int64
	ApplyDate  time.Time `orm:"auto_now_add;type(date)"`
}

报名活动

type Article

type Article struct {
	Id        int64     `json:"id",form:"-"`
	Subtext   string    `orm:"size(20)"`
	Content   string    `json:"html",orm:"size(5000)"`
	ProductId int64     `orm:"null"`
	Views     int64     `orm:"default(0)"`
	Created   time.Time `orm:"auto_now_add;type(datetime)"`
	Updated   time.Time `orm:"auto_now_add;type(datetime)"`
}

func GetArticle

func GetArticle(id int64) (Artic *Article, err error)

根据文章id取得文章

func GetArticles

func GetArticles(pid int64) (Articles []*Article, err error)

取得所有项目

func GetArticles() (Artic []*Article, err error) {
	o := orm.NewOrm()
	qs := o.QueryTable("Article") //这个表名AchievementTopic需要用驼峰式,
	_, err = qs.Filter("parentid", 0).All(&Artic)
	if err != nil {
		return Artic, err
	}
	return Artic, err
}

根据成果id取得所有文章——只返回id和prodid,因为返回content太慢了,没必要吧20171007

func GetWxArticles

func GetWxArticles(pid int64) (Articles []*Article, err error)

微信小程序,根据成果id取得所有文章——返回id和prodid,content……

type Attachment

type Attachment struct {
	Id        int64
	FileName  string
	FileSize  int64
	Downloads int64
	ProductId int64     //*Topic    `orm:"rel(fk)"`
	Created   time.Time `orm:"auto_now_add;type(datetime)"`
	Updated   time.Time `orm:"auto_now;type(datetime)"`
}

附件,attachment 和 topic 是 ManyToOne 关系,也就是 ForeignKey 为 topic

func GetAttachbyId

func GetAttachbyId(Id int64) (attach Attachment, err error)

根据附件id查询附件

func GetAttachmentTitle

func GetAttachmentTitle(title string) (cate Attachment, err error)

根据名字title查询到附件

func GetAttachments

func GetAttachments(id int64) (attachments []*Attachment, err error)

根据成果id取得所有附件

type AttachmentResult

type AttachmentResult struct {
	MindocAttachment
	IsExist       bool
	BookName      string
	DocumentName  string
	FileShortSize string
	Account       string
	LocalHttpPath string
}

func NewAttachmentResult

func NewAttachmentResult() *AttachmentResult

func (*AttachmentResult) Find

func (m *AttachmentResult) Find(id int) (*AttachmentResult, error)

type Bbs

type Bbs struct {
	Id         int64
	UserId     int64
	BbsDate    time.Time `orm:"auto_now_add;type(date)"`
	Desc       string
	SelectDate time.Time `orm:"auto_now_add;type(date)"`
}

公告记录

func BbsGetBbs

func BbsGetBbs(SelectMonth1, SelectMonth2 time.Time) (bbs []*Bbs, err error)

按月查询打卡记录

func GetBbs

func GetBbs(SelectDate time.Time) (bbs Bbs, err error)

查询选定日期记录

type Blog

type Blog struct {
	BlogId int `orm:"pk;auto;unique;column(blog_id)" json:"blog_id"`
	//文章标题
	BlogTitle string `orm:"column(blog_title);size(500)" json:"blog_title"`
	//文章标识
	BlogIdentify string `orm:"column(blog_identify);size(100);unique" json:"blog_identify"`
	//排序序号
	OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"`
	//所属用户
	MemberId int `orm:"column(member_id);type(int);default(0)" json:"member_id"`
	//用户头像
	MemberAvatar string `orm:"-" json:"member_avatar"`
	//文章类型:0 普通文章/1 链接文章
	BlogType int `orm:"column(blog_type);type(int);default(0)" json:"blog_type"`
	//链接到的项目中的文档ID
	DocumentId int `orm:"column(document_id);type(int);default(0)" json:"document_id"`
	//文章的标识
	DocumentIdentify string `orm:"-" json:"document_identify"`
	//关联文档的项目标识
	BookIdentify string `orm:"-" json:"book_identify"`
	//关联文档的项目ID
	BookId int `orm:"-" json:"book_id"`
	//文章摘要
	BlogExcerpt string `orm:"column(blog_excerpt);size(1500)" json:"blog_excerpt"`
	//文章内容
	BlogContent string `orm:"column(blog_content);type(text);null" json:"blog_content"`
	//发布后的文章内容
	BlogRelease string `orm:"column(blog_release);type(text);null" json:"blog_release"`
	//文章当前的状态,枚举enum(’publish’,’draft’,’password’)值,publish为已 发表,draft为草稿,password 为私人内容(不会被公开) 。默认为publish。
	BlogStatus string `orm:"column(blog_status);size(100);default(publish)" json:"blog_status"`
	//文章密码,varchar(100)值。文章编辑才可为文章设定一个密码,凭这个密码才能对文章进行重新强加或修改。
	Password string `orm:"column(password);size(100)" json:"-"`
	//最后修改时间
	Modified time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	//修改人id
	ModifyAt       int    `orm:"column(modify_at);type(int)" json:"-"`
	ModifyRealName string `orm:"-" json:"modify_real_name"`
	//创建时间
	Created    time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	CreateName string    `orm:"-" json:"create_name"`
	//版本号
	Version int64 `orm:"type(bigint);column(version)" json:"version"`
	//附件列表
	AttachList []*MindocAttachment `orm:"-" json:"attach_list"`
}

博文表

func NewBlog

func NewBlog() *Blog

func (*Blog) Delete

func (b *Blog) Delete(blogId int) error

删除文章

func (*Blog) Find

func (b *Blog) Find(blogId int) (*Blog, error)

根据文章ID查询文章

func (*Blog) FindByIdAndMemberId

func (b *Blog) FindByIdAndMemberId(blogId, memberId int) (*Blog, error)

查找指定用户的指定文章

func (*Blog) FindByIdentify

func (b *Blog) FindByIdentify(identify string) (*Blog, error)

根据文章标识查询文章

func (*Blog) FindFromCache

func (b *Blog) FindFromCache(blogId int) (blog *Blog, err error)

从缓存中读取文章

func (*Blog) FindToPager

func (b *Blog) FindToPager(pageIndex, pageSize int, memberId int, status string) (blogList []*Blog, totalCount int, err error)

分页查询文章列表

func (*Blog) IsExist

func (b *Blog) IsExist(identify string) bool

判断指定的文章标识是否存在

func (b *Blog) Link() (*Blog, error)

获取指定文章的链接内容

func (*Blog) LinkAttach

func (b *Blog) LinkAttach() (err error)

关联文章附件

func (*Blog) Processor

func (b *Blog) Processor() *Blog

过滤文章的危险标签,处理文章外链以及图片.

func (*Blog) QueryNext

func (b *Blog) QueryNext(blogId int) (*Blog, error)

查询下一篇文章

func (*Blog) QueryPrevious

func (b *Blog) QueryPrevious(blogId int) (*Blog, error)

查询下一篇文章

func (*Blog) Save

func (b *Blog) Save(cols ...string) error

保存文章

func (*Blog) TableEngine

func (b *Blog) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Blog) TableName

func (b *Blog) TableName() string

TableName 获取对应数据库表名.

func (*Blog) TableNameWithPrefix

func (b *Blog) TableNameWithPrefix() string

func (*Blog) TableUnique

func (b *Blog) TableUnique() [][]string

多字段唯一键

type BlogResult

type BlogResult struct {
}

type Book

type Book struct {
	BookId int `orm:"pk;auto;unique;column(book_id)" json:"book_id"`
	// BookName 项目名称.
	BookName string `orm:"column(book_name);size(500)" json:"book_name"`
	//所属项目空间
	ItemId int `orm:"column(item_id);type(int);default(1)" json:"item_id"`
	// Identify 项目唯一标识.
	Identify string `orm:"column(identify);size(100);unique" json:"identify"`
	//是否是自动发布 0 否/1 是
	AutoRelease int `orm:"column(auto_release);type(int);default(0)" json:"auto_release"`
	//是否开启下载功能 0 是/1 否
	IsDownload int `orm:"column(is_download);type(int);default(0)" json:"is_download"`
	OrderIndex int `orm:"column(order_index);type(int);default(0)" json:"order_index"`
	// Description 项目描述.
	Description string `orm:"column(description);size(2000)" json:"description"`
	//发行公司
	Publisher string `orm:"column(publisher);size(500)" json:"publisher"`
	Label     string `orm:"column(label);size(500)" json:"label"`
	// PrivatelyOwned 项目私有: 0 公开/ 1 私有
	PrivatelyOwned int `orm:"column(privately_owned);type(int);default(0)" json:"privately_owned"`
	// 当项目是私有时的访问Token.
	PrivateToken string `orm:"column(private_token);size(500);null" json:"private_token"`
	//访问密码.
	BookPassword string `orm:"column(book_password);size(500);null" json:"book_password"`
	//状态:0 正常/1 已删除
	Status int `orm:"column(status);type(int);default(0)" json:"status"`
	//默认的编辑器.
	Editor string `orm:"column(editor);size(50)" json:"editor"`
	// DocCount 包含文档数量.
	DocCount int `orm:"column(doc_count);type(int)" json:"doc_count"`
	// CommentStatus 评论设置的状态:open 为允许所有人评论,closed 为不允许评论, group_only 仅允许参与者评论 ,registered_only 仅允许注册者评论.
	CommentStatus string `orm:"column(comment_status);size(20);default(open)" json:"comment_status"`
	CommentCount  int    `orm:"column(comment_count);type(int)" json:"comment_count"`
	//封面地址
	Cover string `orm:"column(cover);size(1000)" json:"cover"`
	//主题风格
	Theme string `orm:"column(theme);size(255);default(default)" json:"theme"`
	// CreateTime 创建时间 .
	CreateTime time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	//每个文档保存的历史记录数量,0 为不限制
	HistoryCount int `orm:"column(history_count);type(int);default(0)" json:"history_count"`
	//是否启用分享,0启用/1不启用
	IsEnableShare int       `orm:"column(is_enable_share);type(int);default(0)" json:"is_enable_share"`
	MemberId      int       `orm:"column(member_id);size(100)" json:"member_id"`
	ModifyTime    time.Time `orm:"type(datetime);column(modify_time);null;auto_now" json:"modify_time"`
	Version       int64     `orm:"type(bigint);column(version)" json:"version"`
	//是否使用第一篇文章项目为默认首页,0 否/1 是
	IsUseFirstDocument int `orm:"column(is_use_first_document);type(int);default(0)" json:"is_use_first_document"`
	//是否开启自动保存:0 否/1 是
	AutoSave int `orm:"column(auto_save);type(tinyint);default(0)" json:"auto_save"`
}

Book struct .

func NewBook

func NewBook() *Book

func (*Book) Copy

func (book *Book) Copy(identify string) error

复制项目

func (*Book) Find

func (book *Book) Find(id int, cols ...string) (*Book, error)

func (*Book) FindByField

func (book *Book) FindByField(field string, value interface{}, cols ...string) ([]*Book, error)

根据指定字段查询结果集.

func (*Book) FindByFieldFirst

func (book *Book) FindByFieldFirst(field string, value interface{}) (*Book, error)

根据指定字段查询一个结果.

func (*Book) FindByIdentify

func (book *Book) FindByIdentify(identify string, cols ...string) (*Book, error)

根据项目标识查询项目

func (*Book) FindForHomeToPager

func (book *Book) FindForHomeToPager(pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

分页查找系统首页数据.

func (*Book) FindForLabelToPager

func (book *Book) FindForLabelToPager(keyword string, pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

分页全局搜索.

func (*Book) FindForRoleId

func (book *Book) FindForRoleId(bookId, memberId int) (conf.BookRole, error)

func (*Book) FindToPager

func (book *Book) FindToPager(pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

分页查询指定用户的项目

func (*Book) ImportBook

func (book *Book) ImportBook(zipPath string) error

导入项目

func (*Book) Insert

func (book *Book) Insert() error

添加一个项目

func (*Book) QueryTable

func (book *Book) QueryTable() orm.QuerySeter

func (*Book) ReleaseContent

func (book *Book) ReleaseContent(bookId int)

ReleaseContent 批量发布文档

func (*Book) ResetDocumentNumber

func (book *Book) ResetDocumentNumber(bookId int)

重置文档数量

func (*Book) String

func (book *Book) String() string

func (*Book) TableEngine

func (book *Book) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Book) TableName

func (book *Book) TableName() string

TableName 获取对应数据库表名.

func (*Book) TableNameWithPrefix

func (book *Book) TableNameWithPrefix() string

func (*Book) ThoroughDeleteBook

func (book *Book) ThoroughDeleteBook(id int) error

彻底删除项目.

func (*Book) Update

func (book *Book) Update(cols ...string) error

更新一个项目

type BookResult

type BookResult struct {
	BookId         int       `json:"book_id"`
	BookName       string    `json:"book_name"`
	ItemId         int       `json:"item_id"`
	ItemName       string    `json:"item_name"`
	Identify       string    `json:"identify"`
	OrderIndex     int       `json:"order_index"`
	Description    string    `json:"description"`
	Publisher      string    `json:"publisher"`
	PrivatelyOwned int       `json:"privately_owned"`
	PrivateToken   string    `json:"private_token"`
	BookPassword   string    `json:"book_password"`
	DocCount       int       `json:"doc_count"`
	CommentStatus  string    `json:"comment_status"`
	CommentCount   int       `json:"comment_count"`
	CreateTime     time.Time `json:"create_time"`
	CreateName     string    `json:"create_name"`
	RealName       string    `json:"real_name"`
	ModifyTime     time.Time `json:"modify_time"`
	Cover          string    `json:"cover"`
	Theme          string    `json:"theme"`
	Label          string    `json:"label"`
	MemberId       int       `json:"member_id"`
	Editor         string    `json:"editor"`
	AutoRelease    bool      `json:"auto_release"`
	HistoryCount   int       `json:"history_count"`

	//RelationshipId     int           `json:"relationship_id"`
	//TeamRelationshipId int           `json:"team_relationship_id"`
	RoleId             conf.BookRole `json:"role_id"`
	RoleName           string        `json:"role_name"`
	Status             int           `json:"status"`
	IsEnableShare      bool          `json:"is_enable_share"`
	IsUseFirstDocument bool          `json:"is_use_first_document"`

	LastModifyText   string `json:"last_modify_text"`
	IsDisplayComment bool   `json:"is_display_comment"`
	IsDownload       bool   `json:"is_download"`
	AutoSave         bool   `json:"auto_save"`
}

func NewBookResult

func NewBookResult() *BookResult

func (*BookResult) Converter

func (m *BookResult) Converter(sessionId string) (ConvertBookResult, error)

导出PDF、word等格式

func (*BookResult) ExportMarkdown

func (m *BookResult) ExportMarkdown(sessionId string) (string, error)

导出Markdown原始文件

func (*BookResult) FindByIdentify

func (m *BookResult) FindByIdentify(identify string, memberId int) (*BookResult, error)

根据项目标识查询项目以及指定用户权限的信息.

func (*BookResult) FindFirstDocumentByBookId

func (m *BookResult) FindFirstDocumentByBookId(bookId int) (*Document, error)

查询项目的第一篇文档

func (*BookResult) FindToPager

func (m *BookResult) FindToPager(pageIndex, pageSize int) (books []*BookResult, totalCount int, err error)

func (*BookResult) String

func (m *BookResult) String() string

func (*BookResult) ToBookResult

func (m *BookResult) ToBookResult(book Book) *BookResult

实体转换

type Bridge

type Bridge struct {
	// Base
	// gorm.Model
	Id        uint   `json:"id" gorm:"primary_key"`
	Uuid      string `json:"uuid" gorm:"type:char(36);index:idx_uuid"`
	CreatedAt time.Time
	UpdatedAt time.Time
	// DeletedAt *time.Time
	ShareUuid string `json:"shareUuid" gorm:"type:char(36)"`
	ProductId int64  `json:"productid" gorm:"type:bigint(20) not null;default:0"`
}

*

  • the link table for Share and Matter.

func CreateBridge

func CreateBridge(bridge *Bridge) (*Bridge, error)

func FindByShareUuid

func FindByShareUuid(shareUuid string) ([]*Bridge, error)

type Business

type Business struct {
	// gorm.Model
	ID               uint      `json:"id" gorm:"primary_key"`
	CreatedAt        time.Time `gorm:"autoCreateTime"`
	UpdatedAt        time.Time
	DeletedAt        *time.Time
	ProjectID        int64 `json:"projectid" gorm:"column:project_id;foreignkey:ProjectId;"`
	UserID           int64 `gorm:"column:user_id"` // One-To-One (属于 - 本表的BillingAddressID作外键
	Location         string
	Lat              float64
	Lng              float64
	StartDate        time.Time
	EndDate          time.Time
	Projecttitle     string
	Drivername       string
	Subsidy          int
	Carfare          int
	Hotelfee         int
	BusinessUsers    []BusinessUser
	BusinessCheckins []BusinessCheckin
	// ArticleID     int64   `gorm:"column:article_id;foreignkey:ArticleId;"`
	Article  Article `gorm:"foreignkey:ArticleId"`
	Worktime float64
	Overtime int
}

出差登记信息表

func GetAllBusiness

func GetAllBusiness(projectid, uid int64) (business []Business, err error)

查出未过期的出差活动,与自己有关的出差活动

func GetAllBusiness2

func GetAllBusiness2(projectid int64) (business []Business, err error)

查出未过期的出差活动——没有用到,试验用,保留

func GetBusinessById

func GetBusinessById(businessid int64) (business Business, err error)

查出出差活动

func GetBusinessCheckUser

func GetBusinessCheckUser(selectmonth1, selectmonth2 time.Time, limit, offset int) (business []Business, err error)

按月统计**************

type BusinessCheckin

type BusinessCheckin struct {
	gorm.Model
	BusinessID uint
	UserID     int64
	Location   string `json:"F_Location"`
	Lat        float64
	Lng        float64
	CheckTime  time.Time `gorm:"autoCreateTime"`
	SelectDate time.Time `gorm:"type:date"`
	PhotoUrl   string
	Users      User `gorm:"foreignkey:UserID"`
}

出差每天打卡,还是另外一个功能吧,不要放一起

func GetBusinessCheck

func GetBusinessCheck(businessid, UserId int64, SelectMonth1, SelectMonth2 time.Time) (check []*BusinessCheckin, err error)

按月查询打卡记录-businessid是unint,换成int64也行?

type BusinessUser

type BusinessUser struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserID     int64 // 外键 (属于), tag `index`是为该列创建索引
	BusinessID uint  `json:"businessid"` //这个对应business表中的ID
	// NickNames  NickName `gorm:"foreignkey:UserID"` //加不加这个references:UserID没所谓,奇怪
	NickNames User `gorm:"foreignkey:UserID"`
}

出差人员表

func GetBusinessUsers

func GetBusinessUsers(businessid uint) (users []*BusinessUser, err error)

根据businessid查询关联的users

type CalExplain

type CalExplain struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	Tittle      string `gorm:"column:title"` // 外键 (属于), tag `index`是为该列创建索引
	Content     string `json:"content" gorm:"column:content"`
	FrontOrBack bool   `json:"frontorback" gorm:"column:front_or_back"`
}

type CalFace

type CalFace struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	Tittle  string `gorm:"column:title;"` // 外键 (属于), tag `index`是为该列创建索引
	Content string `json:"content" gorm:"column:content"`
}

type CarCalendar

type CarCalendar struct {
	Id        int64     `json:"id",form:"-"`
	Title     string    `json:"title",form:"title;text;title:",valid:"MinSize(1);MaxSize(100)"` //orm:"unique",
	Content   string    `json:"content",orm:"sie(20)"`
	Starttime time.Time `json:"start",orm:"type(datetime)"`
	Endtime   time.Time `json:"end",orm:"type(datetime)"`
	Allday    bool      `json:"allDay",orm:"default(0)"`
	Color     string    `json:"color",orm:"null"`
	Public    bool      `default(true)`
	Ip        string    `json:"ip",orm:"null"`
}

func GetCarCalendar

func GetCarCalendar(start, end time.Time, public bool) (calendars []*CarCalendar, err error)

取所有——要修改为支持时间段的,比如某个月份

func GetCarCalendarbyid

func GetCarCalendarbyid(id int64) (calendar CarCalendar, err error)

根据id查询事件

type Cart

type Cart struct {
	// gorm.Model
	Id      int64     `json:"id"`
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now_add;type(datetime)"`
	// DeletedAt *time.Time
	UserId    int64
	ProductId int64
	Status    int `orm:"default(0)"`
}

购物车表

func GetUserCartbyId

func GetUserCartbyId(id int64) (cart Cart, err error)

查询一个cart

type CatalogLink struct {
	Id        int64
	CatalogId int64
	Url       string    `orm:"sie(500)"`
	Created   time.Time `orm:"auto_now_add;type(datetime)"`
	Updated   time.Time `orm:"auto_now_add;type(datetime)"`
}

附件链接表

func GetCatalogLinks(cid int64) (links []*CatalogLink, err error)

根据成果id查出附件链接表

type CheckUser

type CheckUser struct {
	Checkin `xorm:"extends"`
	User    `xorm:"extends"`
}

GetPkgInfosByIDs returns a list of package info by given IDs.

func GetPkgInfosByIDs(ids []int64) ([]*PkgInfo, error) {
	if len(ids) == 0 {
		return []*PkgInfo{}, nil
	}
	pkgInfos := make([]*PkgInfo, 0, len(ids))
	return pkgInfos, x.Where("id > 0").In("id", base.Int64sToStrings(ids)).Find(&pkgInfos)
}

func GetCheckUser2

func GetCheckUser2(selectmonth1, selectmonth2 time.Time, activityid int64, limit, offset int) ([]*CheckUser, error)

按月统计**************

type Checkin

type Checkin struct {
	Id         int64
	ActivityId int64
	UserId     int64
	CheckDate  time.Time `orm:"auto_now_add;type(date)"`
	PhotoUrl   string
	Lat        float64
	Lng        float64
	SelectDate time.Time `orm:"auto_now_add;type(date)"`
}

打卡记录

func CheckGetCheck

func CheckGetCheck(ActivityId, UserId int64, SelectMonth1, SelectMonth2 time.Time) (check []*Checkin, err error)

按月查询打卡记录

func GetCheckUser

func GetCheckUser(selectmonth1, selectmonth2 time.Time, activityid int64) ([]*Checkin, error)

按月统计**************这个没用 查询check里的用户Distinct("check.user_id").Limit(limit, offset)

type Comment

type Comment struct {
	CommentId int `orm:"pk;auto;unique;column(comment_id)" json:"comment_id"`
	Floor     int `orm:"column(floor);type(unsigned);default(0)" json:"floor"`
	BookId    int `orm:"column(book_id);type(int)" json:"book_id"`
	// DocumentId 评论所属的文档.
	DocumentId int `orm:"column(document_id);type(int)" json:"document_id"`
	// Author 评论作者.
	Author string `orm:"column(author);size(100)" json:"author"`
	//MemberId 评论用户ID.
	MemberId int `orm:"column(member_id);type(int)" json:"member_id"`
	// IPAddress 评论者的IP地址
	IPAddress string `orm:"column(ip_address);size(100)" json:"ip_address"`
	// 评论日期.
	CommentDate time.Time `orm:"type(datetime);column(comment_date);auto_now_add" json:"comment_date"`
	//Content 评论内容.
	Content string `orm:"column(content);size(2000)" json:"content"`
	// Approved 评论状态:0 待审核/1 已审核/2 垃圾评论/ 3 已删除
	Approved int `orm:"column(approved);type(int)" json:"approved"`
	// UserAgent 评论者浏览器内容
	UserAgent string `orm:"column(user_agent);size(500)" json:"user_agent"`
	// Parent 评论所属父级
	ParentId     int `orm:"column(parent_id);type(int);default(0)" json:"parent_id"`
	AgreeCount   int `orm:"column(agree_count);type(int);default(0)" json:"agree_count"`
	AgainstCount int `orm:"column(against_count);type(int);default(0)" json:"against_count"`
}

Comment struct

func NewComment

func NewComment() *Comment

func (*Comment) Find

func (m *Comment) Find(id int) (*Comment, error)

func (*Comment) Insert

func (m *Comment) Insert() error

Insert 添加一条评论.

func (*Comment) TableEngine

func (m *Comment) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Comment) TableName

func (m *Comment) TableName() string

TableName 获取对应数据库表名.

func (*Comment) TableNameWithPrefix

func (m *Comment) TableNameWithPrefix() string

func (*Comment) Update

func (m *Comment) Update(cols ...string) error

type CommentResult

type CommentResult struct {
	Comment
	Author       string `json:"author"`
	ReplyAccount string `json:"reply_account"`
}

func (*CommentResult) FindForDocumentToPager

func (m *CommentResult) FindForDocumentToPager(doc_id, page_index, page_size int) (comments []*CommentResult, totalCount int, err error)

type CommentVote

type CommentVote struct {
	VoteId          int       `orm:"column(vote_id);pk;auto;unique" json:"vote_id"`
	CommentId       int       `orm:"column(comment_id);type(int);index" json:"comment_id"`
	CommentMemberId int       `orm:"column(comment_member_id);type(int);index;default(0)" json:"comment_member_id"`
	VoteMemberId    int       `orm:"column(vote_member_id);type(int);index" json:"vote_member_id"`
	VoteState       int       `orm:"column(vote_state);type(int)" json:"vote_state"`
	CreateTime      time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
}

func NewCommentVote

func NewCommentVote() *CommentVote

func (*CommentVote) InsertOrUpdate

func (m *CommentVote) InsertOrUpdate() (*CommentVote, error)

func (*CommentVote) TableEngine

func (m *CommentVote) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*CommentVote) TableName

func (m *CommentVote) TableName() string

TableName 获取对应数据库表名.

func (*CommentVote) TableNameWithPrefix

func (m *CommentVote) TableNameWithPrefix() string

func (*CommentVote) TableUnique

func (u *CommentVote) TableUnique() [][]string

type Commenttopic

type Commenttopic struct {
	Id       int64
	Tid      int64
	OpenID   string `orm:"size(30)"`
	Content  string `orm:"size(100)"`
	Avatar   string
	Username string `orm:"size(20)"`
	Created  string `orm:"size(20)"`
}

文章评论

func GetAllTopicReplies

func GetAllTopicReplies(tid int64) (replies []*Commenttopic, err error)

type Commentwiki

type Commentwiki struct {
	Id      int64
	Tid     int64
	Name    string
	Content string `orm:"size(1000)"`
	Created time.Time
}

wiki评论

func GetAllWikiReplies

func GetAllWikiReplies(tid int64) (replies []*Commentwiki, err error)

type ConvertBookResult

type ConvertBookResult struct {
	PDFPath  string
	EpubPath string
	MobiPath string
	WordPath string
}

转换结果

type Dashboard

type Dashboard struct {
	BookNumber       int64 `json:"book_number"`
	DocumentNumber   int64 `json:"document_number"`
	MemberNumber     int64 `json:"member_number"`
	CommentNumber    int64 `json:"comment_number"`
	AttachmentNumber int64 `json:"attachment_number"`
}

func NewDashboard

func NewDashboard() *Dashboard

func (*Dashboard) Query

func (m *Dashboard) Query() *Dashboard

type Diary

type Diary struct {
	Id        int64     `json:"id",form:"-"`
	Title     string    `orm:"sie(20)"`
	Diarydate string    `orm:"sie(20)"`
	Content   string    `json:"html",orm:"sie(5000)"`
	ProjectId int64     `orm:"null"`
	UserId    int64     `orm:"null"`
	Views     int64     `orm:"default(0)"`
	Created   time.Time `orm:"auto_now_add;type(datetime)"`
	Updated   time.Time `orm:"auto_now_add;type(datetime)"`
}

func GetDiary

func GetDiary(id int64) (Diary1 *Diary, err error)

根据id取得日志

func GetWxDiaries

func GetWxDiaries(pid, limit, offset int64) (diaries []*Diary, err error)

微信小程序,根据projectid取得所有设代日志

type DiaryUser

type DiaryUser struct {
	Diary `xorm:"extends"`
	User  `xorm:"extends"`
}

func GetWxDiaries2

func GetWxDiaries2(pid int64, limit, offset int) ([]*DiaryUser, error)

微信小程序,根据projectid取得所有设代日志

type Document

type Document struct {
	DocumentId   int    `orm:"pk;auto;unique;column(document_id)" json:"doc_id"`
	DocumentName string `orm:"column(document_name);size(500)" json:"doc_name"`
	// Identify 文档唯一标识
	Identify  string `orm:"column(identify);size(100);null;default(null)" json:"identify"`
	BookId    int    `orm:"column(book_id);type(int)" json:"book_id"`
	ParentId  int    `orm:"column(parent_id);type(int);default(0)" json:"parent_id"`
	OrderSort int    `orm:"column(order_sort);default(0);type(int)" json:"order_sort"`
	// Markdown markdown格式文档.
	Markdown string `orm:"column(markdown);type(text);null" json:"markdown"`
	// Release 发布后的Html格式内容.
	Release string `orm:"column(release);type(text);null" json:"release"`
	// Content 未发布的 Html 格式内容.
	Content    string    `orm:"column(content);type(text);null" json:"content"`
	CreateTime time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	MemberId   int       `orm:"column(member_id);type(int)" json:"member_id"`
	ModifyTime time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	ModifyAt   int       `orm:"column(modify_at);type(int)" json:"-"`
	Version    int64     `orm:"column(version);type(bigint);" json:"version"`
	//是否展开子目录:0 否/1 是 /2 空间节点,单击时展开下一级
	IsOpen     int                 `orm:"column(is_open);type(int);default(0)" json:"is_open"`
	AttachList []*MindocAttachment `orm:"-" json:"attach"`
}

Document struct.

func NewDocument

func NewDocument() *Document

func (*Document) CreateDocumentTreeForHtml

func (item *Document) CreateDocumentTreeForHtml(bookId, selectedId int) (string, error)

func (*Document) Find

func (item *Document) Find(id int) (*Document, error)

根据文档ID查询指定文档.

func (*Document) FindByIdentityFirst

func (item *Document) FindByIdentityFirst(identify string, bookId int) (*Document, error)

根据文档识别编号和项目id获取一篇文档

func (*Document) FindDocumentTree

func (item *Document) FindDocumentTree(bookId int) ([]*DocumentTree, error)

获取项目的文档树状结构

func (*Document) FindListByBookId

func (item *Document) FindListByBookId(bookId int) (docs []*Document, err error)

根据项目ID查询文档列表.

func (*Document) FromCacheById

func (item *Document) FromCacheById(id int) (*Document, error)

从缓存获取

func (*Document) FromCacheByIdentify

func (item *Document) FromCacheByIdentify(identify string, bookId int) (*Document, error)

根据文档标识从缓存中查询文档

func (*Document) InsertOrUpdate

func (item *Document) InsertOrUpdate(cols ...string) error

插入和更新文档.

func (*Document) IsExist

func (item *Document) IsExist(documentId int) bool

判断文章是否存在

func (*Document) Processor

func (item *Document) Processor() *Document

处理文档的外链,附件,底部编辑信息等.

func (*Document) PutToCache

func (item *Document) PutToCache()

将文档写入缓存

func (*Document) RecursiveDocument

func (item *Document) RecursiveDocument(docId int) error

递归删除一个文档.

func (*Document) ReleaseContent

func (item *Document) ReleaseContent() error

发布单篇文档

func (*Document) RemoveCache

func (item *Document) RemoveCache()

清除缓存

func (*Document) TableEngine

func (item *Document) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Document) TableName

func (item *Document) TableName() string

TableName 获取对应数据库表名.

func (*Document) TableNameWithPrefix

func (item *Document) TableNameWithPrefix() string

func (*Document) TableUnique

func (item *Document) TableUnique() [][]string

多字段唯一键

type DocumentHistory

type DocumentHistory struct {
	HistoryId    int       `orm:"column(history_id);pk;auto;unique" json:"history_id"`
	Action       string    `orm:"column(action);size(255)" json:"action"`
	ActionName   string    `orm:"column(action_name);size(255)" json:"action_name"`
	DocumentId   int       `orm:"column(document_id);type(int)" json:"doc_id"`
	DocumentName string    `orm:"column(document_name);size(500)" json:"doc_name"`
	ParentId     int       `orm:"column(parent_id);type(int);default(0)" json:"parent_id"`
	Markdown     string    `orm:"column(markdown);type(text);null" json:"markdown"`
	Content      string    `orm:"column(content);type(text);null" json:"content"`
	MemberId     int       `orm:"column(member_id);type(int)" json:"member_id"`
	ModifyTime   time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	ModifyAt     int       `orm:"column(modify_at);type(int)" json:"-"`
	Version      int64     `orm:"type(bigint);column(version)" json:"version"`
	IsOpen       int       `orm:"column(is_open);type(int);default(0)" json:"is_open"`
}

func NewDocumentHistory

func NewDocumentHistory() *DocumentHistory

func (*DocumentHistory) Clear

func (m *DocumentHistory) Clear(docId int) error

清空指定文档的历史.

func (*DocumentHistory) Delete

func (m *DocumentHistory) Delete(historyId, docId int) error

删除历史.

func (*DocumentHistory) Find

func (m *DocumentHistory) Find(id int) (*DocumentHistory, error)

func (*DocumentHistory) FindToPager

func (m *DocumentHistory) FindToPager(docId, pageIndex, pageSize int) (docs []*DocumentHistorySimpleResult, totalCount int, err error)

分页查询指定文档的历史.

func (*DocumentHistory) InsertOrUpdate

func (m *DocumentHistory) InsertOrUpdate() (history *DocumentHistory, err error)

func (*DocumentHistory) Restore

func (m *DocumentHistory) Restore(historyId, docId, uid int) error

恢复指定历史的文档.

func (*DocumentHistory) TableEngine

func (m *DocumentHistory) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*DocumentHistory) TableName

func (m *DocumentHistory) TableName() string

TableName 获取对应数据库表名.

func (*DocumentHistory) TableNameWithPrefix

func (m *DocumentHistory) TableNameWithPrefix() string

type DocumentHistorySimpleResult

type DocumentHistorySimpleResult struct {
	HistoryId  int       `json:"history_id"`
	ActionName string    `json:"action_name"`
	MemberId   int       `json:"member_id"`
	Account    string    `json:"account"`
	ModifyAt   int       `json:"modify_at"`
	ModifyName string    `json:"modify_name"`
	ModifyTime time.Time `json:"modify_time"`
	Version    int64     `json:"version"`
}

type DocumentSearchResult

type DocumentSearchResult struct {
	DocumentId   int    `json:"doc_id"`
	DocumentName string `json:"doc_name"`
	// Identify 文档唯一标识
	Identify     string    `json:"identify"`
	Description  string    `json:"description"`
	Author       string    `json:"author"`
	ModifyTime   time.Time `json:"modify_time"`
	CreateTime   time.Time `json:"create_time"`
	BookId       int       `json:"book_id"`
	BookName     string    `json:"book_name"`
	BookIdentify string    `json:"book_identify"`
	SearchType   string    `json:"search_type"`
}

func NewDocumentSearchResult

func NewDocumentSearchResult() *DocumentSearchResult

func (*DocumentSearchResult) FindToPager

func (m *DocumentSearchResult) FindToPager(keyword string, pageIndex, pageSize, memberId int) (searchResult []*DocumentSearchResult, totalCount int, err error)

分页全局搜索.

func (*DocumentSearchResult) SearchDocument

func (m *DocumentSearchResult) SearchDocument(keyword string, bookId int) (docs []*DocumentSearchResult, err error)

项目内搜索.

type DocumentSelected

type DocumentSelected struct {
	Selected bool `json:"selected"`
	Opened   bool `json:"opened"`
	Disabled bool `json:"disabled"`
}

type DocumentTree

type DocumentTree struct {
	DocumentId   int                    `json:"id"`
	DocumentName string                 `json:"text"`
	ParentId     interface{}            `json:"parent"`
	Identify     string                 `json:"identify"`
	BookIdentify string                 `json:"-"`
	Version      int64                  `json:"version"`
	State        *DocumentSelected      `json:"-"`
	AAttrs       map[string]interface{} `json:"a_attr"`
}

type Error

type Error struct {
	// contains filtered or unexported fields
}

func NewError

func NewError(code int, message string) Error

func (Error) Code

func (e Error) Code() int

func (Error) Error

func (e Error) Error() string

type FileNode

type FileNode struct {
	Id        int64  `json:"id"`
	Title     string `json:"text"`
	Code      string `json:"code"` //分级目录代码
	Grade     int
	FileNodes []*FileNode `json:"nodes"`
}

树状目录数据

type Finance

type Finance struct {
	Id int64 `json:"id",form:"-"`
	// Title       string    `orm:"sie(20)"`
	Financedate string    `orm:"sie(20)"`
	Content     string    `json:"html",orm:"sie(5000)"`
	ProjectId   int64     `orm:"null"`
	UserId      int64     `orm:"null"`
	Amount      int       `json:"amount"`
	Consider    bool      `json:"consider"`
	Views       int64     `orm:"default(0)"`
	Created     time.Time `orm:"auto_now_add;type(datetime)"`
	Updated     time.Time `orm:"auto_now_add;type(datetime)"`
}

func GetFinance

func GetFinance(id int64) (Finance1 *Finance, err error)

根据id取得日志

func GetWxFinance

func GetWxFinance(pid, limit, offset int64) (finance []*Finance, err error)

微信小程序,根据projectid取得所有设代日志

type FinanceUser

type FinanceUser struct {
	Finance `xorm:"extends"`
	User    `xorm:"extends"`
}

func GetWxFinance2

func GetWxFinance2(pid int64, limit, offset int) ([]*FinanceUser, error)

微信小程序,根据projectid取得所有设代日志

type HistoryInputValue

type HistoryInputValue struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserHistoryID  uint   `json:"user_history_id" foreignkey:UserHistoryID;" gorm:"column:user_history_id"`
	TempleInputsID uint   `json:"templeinputsid" gorm:"column:temple_inputs_id"`
	InputValue     string `json:"inputvalue" gorm:"column:input_value"`
}

历史计算记录-输入参数记录表

type HistoryOutputValue

type HistoryOutputValue struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserHistoryID   uint   `foreignkey:UserHistoryID;" gorm:"column:user_history_id"` // 外键 (属于), tag `index`是为该列创建索引
	TempleOutputsID uint   `json:"templeoutputsid" gorm:"column:temple_outputs_id"`
	OutputValue     string `json:"outputvalue" gorm:"column:output_value"`
}

历史计算记录-输出参数记录表

type Itemsets

type Itemsets struct {
	ItemId      int       `orm:"column(item_id);pk;auto;unique" json:"item_id"`
	ItemName    string    `orm:"column(item_name);size(500)" json:"item_name"`
	ItemKey     string    `orm:"column(item_key);size(100);unique" json:"item_key"`
	Description string    `orm:"column(description);type(text);null" json:"description"`
	MemberId    int       `orm:"column(member_id);size(100)" json:"member_id"`
	CreateTime  time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	ModifyTime  time.Time `orm:"column(modify_time);type(datetime);null;auto_now" json:"modify_time"`
	ModifyAt    int       `orm:"column(modify_at);type(int)" json:"modify_at"`

	BookNumber       int    `orm:"-" json:"book_number"`
	CreateTimeString string `orm:"-" json:"create_time_string"`
	CreateName       string `orm:"-" json:"create_name"`
}

项目空间

func NewItemsets

func NewItemsets() *Itemsets

func (*Itemsets) Delete

func (item *Itemsets) Delete(itemId int) (err error)

删除.

func (*Itemsets) Exist

func (item *Itemsets) Exist(itemId int) bool

func (*Itemsets) FindFirst

func (item *Itemsets) FindFirst(itemKey string) (*Itemsets, error)

func (*Itemsets) FindItemsetsByItemKey

func (item *Itemsets) FindItemsetsByItemKey(key string, pageIndex, pageSize, memberId int) (books []*BookResult, totalCount int, err error)

根据项目空间标识查询项目空间的项目列表.

func (*Itemsets) FindItemsetsByName

func (item *Itemsets) FindItemsetsByName(name string, limit int) (*SelectMemberResult, error)

根据项目空间名称查询.

func (*Itemsets) FindToPager

func (item *Itemsets) FindToPager(pageIndex, pageSize int) (list []*Itemsets, totalCount int, err error)

分页查询.

func (*Itemsets) First

func (item *Itemsets) First(itemId int) (*Itemsets, error)

func (*Itemsets) Include

func (item *Itemsets) Include() (*Itemsets, error)

func (*Itemsets) QueryTable

func (item *Itemsets) QueryTable() orm.QuerySeter

func (*Itemsets) Save

func (item *Itemsets) Save() (err error)

保存

func (*Itemsets) TableEngine

func (item *Itemsets) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Itemsets) TableName

func (item *Itemsets) TableName() string

TableName 获取对应数据库表名.

func (*Itemsets) TableNameWithPrefix

func (item *Itemsets) TableNameWithPrefix() string

type KeyValueItem

type KeyValueItem struct {
	Id   int    `json:"id"`
	Text string `json:"text"`
}

type Label

type Label struct {
	LabelId    int    `orm:"column(label_id);pk;auto;unique;" json:"label_id"`
	LabelName  string `orm:"column(label_name);size(50);unique" json:"label_name"`
	BookNumber int    `orm:"column(book_number)" json:"book_number"`
}

func NewLabel

func NewLabel() *Label

func (*Label) Delete

func (m *Label) Delete() error

删除标签

func (*Label) FindFirst

func (m *Label) FindFirst(field string, value interface{}) (*Label, error)

func (*Label) FindToPager

func (m *Label) FindToPager(pageIndex, pageSize int) (labels []*Label, totalCount int, err error)

分页查找标签.

func (*Label) InsertOrUpdate

func (m *Label) InsertOrUpdate(labelName string) error

插入或更新标签.

func (*Label) InsertOrUpdateMulti

func (m *Label) InsertOrUpdateMulti(labels string)

批量插入或更新标签.

func (*Label) TableEngine

func (m *Label) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Label) TableName

func (m *Label) TableName() string

TableName 获取对应数据库表名.

func (*Label) TableNameWithPrefix

func (m *Label) TableNameWithPrefix() string

type Library

type Library struct {
	Id       int64
	Number   string //规范的编号`orm:"unique"`
	Title    string
	LiNumber string    //完整编号,含年份
	Category string    //行业分类
	Year     string    //编号里的年份
	Execute  string    //执行时间
	Content  string    `orm:"sie(5000)"`
	Created  time.Time `orm:"auto_now_add;type(datetime)"`
	Updated  time.Time `orm:"auto_now;type(datetime)"`
}

func GetAllValids

func GetAllValids() ([]*Library, error)

func SearchLiabraryName

func SearchLiabraryName(Name string) ([]*Library, error)

由法规名称精确搜索有效版本库

func SearchLiabraryNumber

func SearchLiabraryNumber(Category, Number string) (*Library, error)

由分类SL和编号搜索有效版本库

type Like

type Like struct {
	Id      int64
	Tid     int64
	OpenID  string `json:"openID"`
	Created time.Time
}
type Topic struct {
	Id                int64
	Uid               int64
	Title             string
	Tnumber           string //`orm:"unique"`
	Category          string
	CategoryId        int64
	Content           string `orm:"sie(5000)"`
	Attachment        string
	Created           time.Time `orm:"auto_now_add;type(datetime)"`
	Updated           time.Time `orm:"auto_now;type(datetime)"`
	Views             int64
	Author            string
	ReplyTime         time.Time
	ReplyCount        int64
	ReplyLastUserName string
	// Attachments     []*Attachment `orm:"reverse(many)"` // fk 的反向关系
}

文章点赞

func GetAllTopicLikes

func GetAllTopicLikes(tid int64) (likes []*Like, err error)

type Location

type Location struct {
	// gorm.Model
	ID                uint      `json:"id" gorm:"primary_key"`
	CreatedAt         time.Time `gorm:"autoCreateTime"`
	UpdatedAt         time.Time
	DeletedAt         *time.Time
	ProjectID         int64  `json:"projectid" gorm:"column:project_id;foreignkey:ProjectId;"`
	UserID            int64  `gorm:"column:user_id"` // One-To-One (属于 - 本表的BillingAddressID作外键
	Title             string `json:"title"`
	Describe          string `json:"describe"`
	Sort              int
	LocationNavigates []LocationNavigate `json:"locationnavigates"`
}

定位组表

func GetAllLocation

func GetAllLocation(projectid int64) (location []Location, err error)

查出定位组及里面的定位导航

func GetAllLocation2

func GetAllLocation2(projectid int64) (location []Location, err error)

查出未过期的出差活动——没有用到,试验用,保留

func GetLocationById

func GetLocationById(locationid int64) (location Location, err error)

查出定位导航

func GetLocationCheckUser

func GetLocationCheckUser(selectmonth1, selectmonth2 time.Time, limit, offset int) (location []Location, err error)

按月统计**************

type LocationNavigate

type LocationNavigate struct {
	gorm.Model
	LocationID uint    `json:"locationid"`
	Title      string  `json:"title"`
	Label      string  `json:"label"`
	Location   string  `json:"F_Location"`
	Address    string  `json:"F_Address"`
	Lat        float64 `json:"lat"`
	Lng        float64 `json:"lng"`
	Sort       int
}

定位数据表

type Logger

type Logger struct {
	LoggerId int64 `orm:"pk;auto;unique;column(log_id)" json:"log_id"`
	MemberId int   `orm:"column(member_id);type(int)" json:"member_id"`
	// 日志类别:operate 操作日志/ system 系统日志/ exception 异常日志 / document 文档操作日志
	Category     string    `orm:"column(category);size(255);default(operate)" json:"category"`
	Content      string    `orm:"column(content);type(text)" json:"content"`
	OriginalData string    `orm:"column(original_data);type(text)" json:"original_data"`
	PresentData  string    `orm:"column(present_data);type(text)" json:"present_data"`
	CreateTime   time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	UserAgent    string    `orm:"column(user_agent);size(500)" json:"user_agent"`
	IPAddress    string    `orm:"column(ip_address);size(255)" json:"ip_address"`
}

Logger struct .

func NewLogger

func NewLogger() *Logger

func (*Logger) Add

func (m *Logger) Add() error

func (*Logger) TableEngine

func (m *Logger) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Logger) TableName

func (m *Logger) TableName() string

TableName 获取对应数据库表名.

func (*Logger) TableNameWithPrefix

func (m *Logger) TableNameWithPrefix() string

type MathArticle

type MathArticle struct {
	gorm.Model
	UserTempleID uint
	Title        string `json:"title" gorm:"column:title;size:20"`
	Subtext      string `json:"subtext" gorm:"column:subtext;size:20"`
	Content      string `json:"html" gorm:"column:content;size:5000"`
}

mathcad的文章

func GetMathArticle

func GetMathArticle(matharticleid uint) (matharticle MathArticle, err error)

根据matharticle取得文章

type Matter

type Matter struct {
	// Base
	Puuid    string    `json:"puuid" gorm:"type:char(36);index:idx_puuid"`
	UserUuid string    `json:"userUuid" gorm:"type:char(36);index:idx_uu"`
	Username string    `json:"username" gorm:"type:varchar(45) not null"`
	Dir      bool      `json:"dir" gorm:"type:tinyint(1) not null;default:0"`
	Name     string    `json:"name" gorm:"type:varchar(255) not null"`
	Md5      string    `json:"md5" gorm:"type:varchar(45)"`
	Size     int64     `json:"size" gorm:"type:bigint(20) not null;default:0"`
	Privacy  bool      `json:"privacy" gorm:"type:tinyint(1) not null;default:0"`
	Path     string    `json:"path" gorm:"type:varchar(1024)"`
	Times    int64     `json:"times" gorm:"type:bigint(20) not null;default:0"`
	Parent   *Matter   `json:"parent" gorm:"-"`
	Children []*Matter `json:"-" gorm:"-"`
}

type MeetCalendar

type MeetCalendar struct {
	Id        int64     `json:"id",form:"-"`
	Title     string    `json:"title",form:"title;text;title:",valid:"MinSize(1);MaxSize(100)"` //orm:"unique",
	Content   string    `json:"content",orm:"sie(20)"`
	Starttime time.Time `json:"start",orm:"type(datetime)"`
	Endtime   time.Time `json:"end",orm:"type(datetime)"`
	Allday    bool      `json:"allDay",orm:"default(0)"`
	Color     string    `json:"color",orm:"null"`
	Public    bool      `default(true)`
	Ip        string    `json:"ip",orm:"null"`
}

func GetMeetCalendar

func GetMeetCalendar(start, end time.Time, public bool) (calendars []*MeetCalendar, err error)

取所有——要修改为支持时间段的,比如某个月份

func GetMeetCalendarbyid

func GetMeetCalendarbyid(id int64) (calendar MeetCalendar, err error)

根据id查询事件

func SearchMeetCalendar

func SearchMeetCalendar(title string, public bool) (calendars []*MeetCalendar, err error)

取所有——要修改为支持时间段的,比如某个月份 未测试20181117修改filter为cond3

type Member

type Member struct {
	MemberId int    `orm:"pk;auto;unique;column(member_id)" json:"member_id"`
	Account  string `orm:"size(100);unique;column(account)" json:"account"`
	RealName string `orm:"size(255);column(real_name)" json:"real_name"`
	Password string `orm:"size(1000);column(password)" json:"-"`
	//认证方式: local 本地数据库 /ldap LDAP
	AuthMethod  string `orm:"column(auth_method);default(local);size(50);" json:"auth_method"`
	Description string `orm:"column(description);size(2000)" json:"description"`
	Email       string `orm:"size(100);column(email);unique" json:"email"`
	Phone       string `orm:"size(255);column(phone);null;default(null)" json:"phone"`
	Avatar      string `orm:"size(1000);column(avatar)" json:"avatar"`
	//用户角色:0 超级管理员 /1 管理员/ 2 普通用户 .
	Role          conf.SystemRole `orm:"column(role);type(int);default(1)" json:"role"`
	RoleName      string          `orm:"-" json:"role_name"`
	Status        int             `orm:"column(status);type(int);default(0)" json:"status"` //用户状态:0 正常/1 禁用
	CreateTime    time.Time       `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	CreateAt      int             `orm:"type(int);column(create_at)" json:"create_at"`
	LastLoginTime time.Time       `orm:"type(datetime);column(last_login_time);null" json:"last_login_time"`
}

func NewMember

func NewMember() *Member

func (*Member) Add

func (m *Member) Add() error

Add 添加一个用户.

func (*Member) Delete

func (m *Member) Delete(oldId int, newId int) error

删除一个用户.

func (*Member) Find

func (m *Member) Find(id int, cols ...string) (*Member, error)

func (*Member) FindByAccount

func (m *Member) FindByAccount(account string) (*Member, error)

根据账号查找用户.

func (*Member) FindByAccountList

func (m *Member) FindByAccountList(accounts ...string) ([]*Member, error)

批量查询用户

func (*Member) FindByFieldFirst

func (m *Member) FindByFieldFirst(field string, value interface{}) (*Member, error)

根据指定字段查找用户.

func (*Member) FindToPager

func (m *Member) FindToPager(pageIndex, pageSize int) ([]*Member, int, error)

分页查找用户.

func (*Member) IsAdministrator

func (m *Member) IsAdministrator() bool

func (*Member) Login

func (m *Member) Login(account string, password string) (*Member, error)

Login 用户登录.

func (*Member) ResolveRoleName

func (m *Member) ResolveRoleName()

func (*Member) TableEngine

func (m *Member) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Member) TableName

func (m *Member) TableName() string

TableName 获取对应数据库表名.

func (*Member) TableNameWithPrefix

func (m *Member) TableNameWithPrefix() string

func (*Member) Update

func (m *Member) Update(cols ...string) error

Update 更新用户信息.

func (*Member) Valid

func (m *Member) Valid(is_hash_password bool) error

校验用户.

type MemberRelationshipResult

type MemberRelationshipResult struct {
	MemberId       int             `json:"member_id"`
	Account        string          `json:"account"`
	RealName       string          `json:"real_name"`
	Description    string          `json:"description"`
	Email          string          `json:"email"`
	Phone          string          `json:"phone"`
	Avatar         string          `json:"avatar"`
	Role           conf.SystemRole `json:"role"`   //用户角色:0 管理员/ 1 普通用户
	Status         int             `json:"status"` //用户状态:0 正常/1 禁用
	CreateTime     time.Time       `json:"create_time"`
	CreateAt       int             `json:"create_at"`
	RelationshipId int             `json:"relationship_id"`
	BookId         int             `json:"book_id"`
	// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
	RoleId   conf.BookRole `json:"role_id"`
	RoleName string        `json:"role_name"`
}

func NewMemberRelationshipResult

func NewMemberRelationshipResult() *MemberRelationshipResult

func (*MemberRelationshipResult) FindForUsersByBookId

func (m *MemberRelationshipResult) FindForUsersByBookId(bookId, pageIndex, pageSize int) ([]*MemberRelationshipResult, int, error)

根据项目ID查询用户

func (*MemberRelationshipResult) FindNotJoinUsersByAccount

func (m *MemberRelationshipResult) FindNotJoinUsersByAccount(bookId, limit int, account string) ([]*Member, error)

查询指定文档中不存在的用户列表

func (*MemberRelationshipResult) FindNotJoinUsersByAccountOrRealName

func (m *MemberRelationshipResult) FindNotJoinUsersByAccountOrRealName(bookId, limit int, keyWord string) ([]*Member, error)

根据姓名以及用户名模糊查询指定文档中不存在的用户列表

func (*MemberRelationshipResult) FromMember

func (*MemberRelationshipResult) ResolveRoleName

func (m *MemberRelationshipResult) ResolveRoleName() *MemberRelationshipResult

type MemberToken

type MemberToken struct {
	TokenId   int       `orm:"column(token_id);pk;auto;unique" json:"token_id"`
	MemberId  int       `orm:"column(member_id);type(int)" json:"member_id"`
	Token     string    `orm:"column(token);size(150)" json:"token"`
	Email     string    `orm:"column(email);size(255)" json:"email"`
	IsValid   bool      `orm:"column(is_valid)" json:"is_valid"`
	ValidTime time.Time `orm:"column(valid_time);null" json:"valid_time"`
	SendTime  time.Time `orm:"column(send_time);auto_now_add;type(datetime)" json:"send_time"`
}

func NewMemberToken

func NewMemberToken() *MemberToken

func (*MemberToken) FindByFieldFirst

func (m *MemberToken) FindByFieldFirst(field string, value interface{}) (*MemberToken, error)

func (*MemberToken) FindSendCount

func (m *MemberToken) FindSendCount(mail string, start_time time.Time, end_time time.Time) (int, error)

func (*MemberToken) InsertOrUpdate

func (m *MemberToken) InsertOrUpdate() (*MemberToken, error)

func (*MemberToken) TableEngine

func (m *MemberToken) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*MemberToken) TableName

func (m *MemberToken) TableName() string

TableName 获取对应数据库表名.

func (*MemberToken) TableNameWithPrefix

func (m *MemberToken) TableNameWithPrefix() string

type MeritBasic

type MeritBasic struct {
	Id         int64  `PK`
	Username   string `orm:"unique"` //这个拼音的简写
	Nickname   string //中文名,注意这里,很多都要查询中文名才行`orm:"unique;size(32)" form:"Nickname" valid:"Required;MaxSize(20);MinSize(2)"`
	Password   string
	Repassword string `orm:"-" form:"Repassword" valid:"Required" form:"-"`
	Ip         string //ip地址
	Port       string
	EcmsIp     string    //用户engineercms的ip地址
	EcmsPort   string    //用户engineercms的端口
	Createtime time.Time `orm:"type(datetime);auto_now_add" `
	Updated    time.Time `orm:"type(datetime);auto_now_add" `
}

用户表

func GetMeritBasic

func GetMeritBasic() (meritbasic MeritBasic, err error)

查出merit基本信息 取到一个数据,不是数组,所以table无法显示

type Migration

type Migration struct {
	MigrationId int       `orm:"column(migration_id);pk;auto;unique;" json:"migration_id"`
	Name        string    `orm:"column(name);size(500)" json:"name"`
	Statements  string    `orm:"column(statements);type(text);null" json:"statements"`
	Status      string    `orm:"column(status);default(update)" json:"status"`
	CreateTime  time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	Version     int64     `orm:"type(bigint);column(version);unique" json:"version"`
}

func NewMigration

func NewMigration() *Migration

func (*Migration) FindFirst

func (m *Migration) FindFirst() (*Migration, error)

func (*Migration) TableEngine

func (m *Migration) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Migration) TableName

func (m *Migration) TableName() string

TableName 获取对应数据库表名.

func (*Migration) TableNameWithPrefix

func (m *Migration) TableNameWithPrefix() string

type MindocAttachment

type MindocAttachment struct {
	AttachmentId int       `orm:"column(attachment_id);pk;auto;unique" json:"attachment_id"`
	BookId       int       `orm:"column(book_id);type(int)" json:"book_id"`
	DocumentId   int       `orm:"column(document_id);type(int);null" json:"doc_id"`
	FileName     string    `orm:"column(file_name);size(255)" json:"file_name"`
	FilePath     string    `orm:"column(file_path);size(2000)" json:"file_path"`
	FileSize     float64   `orm:"column(file_size);type(float)" json:"file_size"`
	HttpPath     string    `orm:"column(http_path);size(2000)" json:"http_path"`
	FileExt      string    `orm:"column(file_ext);size(50)" json:"file_ext"`
	CreateTime   time.Time `orm:"type(datetime);column(create_time);auto_now_add" json:"create_time"`
	CreateAt     int       `orm:"column(create_at);type(int)" json:"create_at"`
}

Attachment struct .

func NewAttachment

func NewAttachment() *MindocAttachment

func (*MindocAttachment) Delete

func (m *MindocAttachment) Delete() error

func (*MindocAttachment) Find

func (m *MindocAttachment) Find(id int) (*MindocAttachment, error)

func (*MindocAttachment) FindListByDocumentId

func (m *MindocAttachment) FindListByDocumentId(docId int) (attaches []*MindocAttachment, err error)

查询指定文档的附件列表

func (*MindocAttachment) FindToPager

func (m *MindocAttachment) FindToPager(pageIndex, pageSize int) (attachList []*AttachmentResult, totalCount int, err error)

分页查询附件

func (*MindocAttachment) Insert

func (m *MindocAttachment) Insert() error

func (*MindocAttachment) TableEngine

func (m *MindocAttachment) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*MindocAttachment) TableName

func (m *MindocAttachment) TableName() string

TableName 获取对应数据库表名.

func (*MindocAttachment) TableNameWithPrefix

func (m *MindocAttachment) TableNameWithPrefix() string

func (*MindocAttachment) Update

func (m *MindocAttachment) Update() error

type Model

type Model struct {
}

type Money

type Money struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserID int64 `gorm:"column:user_id;foreignkey:UserId;"` // 外键 (属于), tag `index`是为该列创建索引
	Amount int   `json:"amount" gorm:"column:amount"`
	User   User  `gorm:"foreignkey:UserId"`
}

余额表

func GetUserMoney

func GetUserMoney(uid int64) (money Money, err error)

查询某个用户账户余额

type NickName

type NickName struct {
	gorm.Model
	NickName string
}

按道理,上面应该是`gorm:"foreignkey:ID;references:UserID"`,即主表businessuser中的USERID= =从表中的ID啊 这个是测试用的,实际用的是user

type OnlyAttachment

type OnlyAttachment struct {
	Id        int64
	FileName  string
	FileSize  int64
	Downloads int64
	DocId     int64 //*Topic `orm:"rel(fk)"`
	// Changesurl string    `orm:"null"` //文件修改记录
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
}

附件

func GetOnlyAttachbyId

func GetOnlyAttachbyId(Id int64) (attach OnlyAttachment, err error)

根据附件id查询附件

func GetOnlyAttachbyName

func GetOnlyAttachbyName(name string) (attach OnlyAttachment, err error)

根据附件id查询附件

func GetOnlyAttachments

func GetOnlyAttachments(id int64) (attachments []*OnlyAttachment, err error)

根据成果id取得所有附件

type OnlyChanges

type OnlyChanges struct {
	Id         int64
	HistoryKey string `orm:"sie(19)"`
	UserId     string `orm:"sie(10)"`
	UserName   string `orm:"sie(20)"`
	Created    string `orm:"sie(19)"`
}

修改情况

func GetOnlyChanges

func GetOnlyChanges(key string) (onlychanges []*OnlyChanges, err error)

根据附件历史版本key获取历史版本修改信息

type OnlyHistory

type OnlyHistory struct {
	Id            int64
	AttachId      int64
	UserId        int64
	ServerVersion string
	Version       int
	FileUrl       string
	ChangesUrl    string    //`orm:"null"`
	HistoryKey    string    `orm:"sie(19)"`
	Expires       time.Time `orm:"type(datetime)"`
	Created       time.Time `orm:"type(datetime)"`
}

历史版本

func GetOnlyHistory

func GetOnlyHistory(onlyattachmentid int64) (onlyhistories []*OnlyHistory, err error)

根据附件id获取历史版本信息

func GetOnlyHistoryVersion

func GetOnlyHistoryVersion(onlyattachmentid int64) (onlyhistories []OnlyHistory, err error)

获取附件id历史版本号

type OnlyOffice

type OnlyOffice struct {
	Id        int64     `form:"-"`
	Code      string    `orm:"null"`
	Title     string    `orm:"null"`
	Label     string    `orm:"null"`
	End       time.Time `orm:"null;type(datetime)"`
	Principal string    `orm:"null"`
	// Ext     string    `orm:"null"`
	Uid     int64     `orm:"null"`
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
}

func GetDocs

func GetDocs() (docs []*OnlyOffice, err error)

取得所有项目

func Getdocbyid

func Getdocbyid(id int64) (doc OnlyOffice, err error)

根据docid获得docuid

type OnlyOfficeAttach

type OnlyOfficeAttach struct {
	OnlyOffice     `xorm:"extends"`
	OnlyAttachment `xorm:"extends"`
	User           `xorm:"extends"`
}

func GetDocList

func GetDocList(offset, limit int) (docs []*OnlyOfficeAttach, err error)

分页取得所有项目

type OpenidTmplId

type OpenidTmplId struct {
	Id     int64
	OpenID string
	TmplId string
}

type Option

type Option struct {
	OptionId    int    `orm:"column(option_id);pk;auto;unique;" json:"option_id"`
	OptionTitle string `orm:"column(option_title);size(500)" json:"option_title"`
	OptionName  string `orm:"column(option_name);unique;size(80)" json:"option_name"`
	OptionValue string `orm:"column(option_value);type(text);null" json:"option_value"`
	Remark      string `orm:"column(remark);type(text);null" json:"remark"`
}

Option struct .

func NewOption

func NewOption() *Option

func (*Option) All

func (p *Option) All() ([]*Option, error)

func (*Option) Find

func (p *Option) Find(id int) (*Option, error)

func (*Option) FindByKey

func (p *Option) FindByKey(key string) (*Option, error)

func (*Option) Init

func (m *Option) Init() error

func (*Option) InsertMulti

func (p *Option) InsertMulti(option ...Option) error

func (*Option) InsertOrUpdate

func (p *Option) InsertOrUpdate() error

func (*Option) TableEngine

func (m *Option) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Option) TableName

func (m *Option) TableName() string

TableName 获取对应数据库表名.

func (*Option) TableNameWithPrefix

func (m *Option) TableNameWithPrefix() string

type OrderPair

type OrderPair struct {
	Key   string
	Value string
}

type Pager

type Pager struct {
	Page       int         `json:"page"`
	PageSize   int         `json:"pageSize"`
	TotalItems int         `json:"totalItems"`
	TotalPages int         `json:"totalPages"`
	Data       interface{} `json:"data"`
}

pager

type Pay

type Pay struct {
	// gorm.Model
	ID        uint `json:"id" gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
	UserID    int64   `gorm:"column:user_id;foreignkey:UserId;"` // One-To-One (属于 - 本表的BillingAddressID作外键
	User2ID   int64   `gorm:"column:user2_id;foreignkey:User2Id;"`
	ArticleID int64   `gorm:"column:article_id;foreignkey:ArticleId;"`
	Amount    int     `gorm:"column:amount"`
	User      User    `gorm:"foreignkey:UserId"` //这个外键难道不是错的么?应该是UserID?没错,因为column:user_id
	Article   Article `gorm:"foreignkey:ArticleId"`
}

打赏文章表

func GetPay

func GetPay(id int64) (pay Pay, err error)

查询某个打赏记录

func GetUserGetAppreciation

func GetUserGetAppreciation(uid int64, limit, offset int) (pays []*Pay, err error)

查询某个用户获得赞赏(别人赞赏自己)的记录

func GetUserPay

func GetUserPay(uid int64, limit, offset int) (pays []*Pay, err error)

查询某个用户花费赞赏 和 获得 文章 赞赏记录

func GetUserPayAppreciation

func GetUserPayAppreciation(uid int64, limit, offset int) (pays []*Pay, err error)

查询某个用户 花费 赞赏(赞赏别人)文章 的记录

type PayMath

type PayMath struct {
	gorm.Model
	// ID         uint `json:"id" gorm:"primary_key"`
	// CreatedAt  time.Time
	// UpdatedAt  time.Time
	// DeletedAt  *time.Time
	UserID       int64 `gorm:"column:user_id;foreignkey:UserId;"` // One-To-One (属于 - 本表的BillingAddressID作外键
	User2ID      int64 `gorm:"column:user2_id;foreignkey:User2Id;"`
	UserTempleID uint  `gorm:"column:user_temple_id;foreignkey:UserTempleID;"`
	Amount       int   `gorm:"column:amount"`
	User         User  //`gorm:"foreignkey:UserId"` //对于preload来说,这个后面不影响
	User2        User  //`gorm:"foreignkey:User2Id"`
	UserTemple   UserTemple
}

用户付费计算表

func GetUserGetMathAppreciation

func GetUserGetMathAppreciation(uid int64, limit, offset int) (paymaths []*PayMath, err error)

查询某个用户 获得 赞赏(别人赞赏自己)amth 的记录

func GetUserPayMath

func GetUserPayMath(uid int64, limit, offset int) (paymaths []*PayMath, err error)

查询某个用户花费赞赏 和 获得 math 赞赏记录

func GetUserPayMathAppreciation

func GetUserPayMathAppreciation(uid int64, limit, offset int) (paymaths []*PayMath, err error)

查询某个用户 花费 赞赏(赞赏别人)math 的记录

type Pidstruct

type Pidstruct struct {
	ParentId        int64
	ParentTitle     string
	ParentIdPath    string
	ParentTitlePath string
}

func Insertproj

func Insertproj(pid []Pidstruct, nodes []*AdminCategory, igrade, height int) (cid []Pidstruct)

递归将分级目录写入数据库

type PostMerit

type PostMerit struct {
	Id            int64     `json:"id"`
	ProjectNumber string    //项目编号
	ProjectName   string    //项目名称
	DesignStage   string    //阶段
	Section       string    //专业
	Tnumber       string    //成果编号
	Name          string    //成果名称
	Category      string    //成果类型
	Page          string    //成果计量单位
	Count         float64   //成果数量
	Drawn         string    //编制、绘制
	Designd       string    //设计
	Checked       string    //校核
	Examined      string    //审查
	Verified      string    //核定
	Approved      string    //批准
	Complex       float64   //难度系数
	Drawnratio    float64   //编制、绘制占比系数
	Designdratio  float64   //设计系数
	Checkedratio  float64   //校核系数
	Examinedratio float64   //审查系数
	Datestring    string    //保存字符型日期
	Date          time.Time `orm:"null;auto_now_add;type(datetime)"`
	Created       time.Time `orm:"auto_now_add;type(datetime)"`
	Updated       time.Time `orm:"auto_now_add;type(datetime)"`
	Author        string    //上传者
	State         int       //1编写状态,未提交;2编写者提交,
}

func GetPostMerit

func GetPostMerit(id int64) (postmerit PostMerit, err error)

根据成果id取得成果

func GetPostMerits

func GetPostMerits(status int) (postmerit []*PostMerit, err error)

查出所有成果

type Product

type Product struct {
	Id           int64
	Code         string `orm:"null"`                                              //编号                                          //编号                                             //编号
	Title        string `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	Label        string `orm:"null"`                                              //关键字                                           //标签
	Uid          int64  `orm:"null"`
	Principal    string `orm:"null"`       //提供人                                            //负责人id
	ProjectId    int64  `orm:"null"`       //侧栏id
	TopProjectId int64  `orm:"default(0)"` //项目id
	// Content      string    `orm:"sie(5000)"` //内容
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
}

func FindByUuids

func FindByUuids(uuids []int64) ([]*Product, error)

func GetAllProducts

func GetAllProducts() (products []*Product, err error)

直接把所有成果都查出来。——全表,避免使用

func GetProd

func GetProd(id int64) (prod Product, err error)

根据成果id取得成果

func GetProducts

func GetProducts(id int64) (products []*Product, err error)

根据侧栏id查出所有成果——按编号排序

func GetProductsPage

func GetProductsPage(id, limit, offset, uid int64, searchText string) (products []*Product, err error)

根据侧栏id分页查出所有成果——按编号排序

func GetProjProducts

func GetProjProducts(id int64, number int) (count int64, products []*Product, err error)

根据项目顶级id查出所有成果 这个不优雅,应该用循环子孙id,查询字段在id数组中,参考SearchProjProductPage 直接把所有成果都查出来。getallproduct

func SearchProduct

func SearchProduct(key string) (prod []*Product, err error)

搜索本地成果

func SearchProductPage

func SearchProductPage(limit, offset int64, key string) (prod []*Product, err error)

搜索本地成果,分页

func SearchProjProduct

func SearchProjProduct(pid, limit, offset int64, key, searchtext string) (count int64, prod []*Product, err error)

搜索某个项目里的成果:article的全文,待完善

func SearchProjProductPage

func SearchProjProductPage(pid, limit, offset int64, key string) (prod []*Product, err error)

搜索某个项目里的成果,分页, 递归出所有子孙项目,这个厉害

type ProductAttachment

type ProductAttachment struct {
	Product         `xorm:"extends"`
	Attachment      `xorm:"extends"`
	Article         `xorm:"extends"`
	Relevancy       `xorm:"extends"`
	ProductDocument `xorm:"extends"` //跨数据库,暂不支持
}

func GetProductAttachment

func GetProductAttachment(id int64, limit, offset int) (products []*ProductAttachment, err error)

根据侧栏id分页查出所有成果——按编号排序_联合查询

type ProductDocument

type ProductDocument struct {
	Id         int64
	DocTypeId  int64
	DocumentId int64
	ProductId  int64
}

增加一个表:product——flow document-flow.DocTypeID(dtID), flow.DocumentID(docID)

func GetDocumentProduct

func GetDocumentProduct(docid int64) (proddoc ProductDocument, err error)

根据flowdocumentid和doctypeid查询productid

func GetProductDocument

func GetProductDocument(id int64) (proddoc ProductDocument, err error)

根据productid查询productdocument的flow docstate

type ProjCalendar

type ProjCalendar struct {
	Id          int64     `json:"id",form:"-"`
	ProjectId   int64     `json:"projectid"`
	Title       string    `json:"title",form:"title;text;title:",valid:"MinSize(1);MaxSize(100)"` //orm:"unique",
	Content     string    `json:"content",orm:"sie(20)"`
	Starttime   time.Time `json:"start",orm:"type(datetime)"`
	Endtime     time.Time `json:"end",orm:"null;type(datetime)"`
	Allday      bool      `json:"allDay",orm:"default(true)"`
	Memorabilia bool      `json:"memorabilia",orm:"default(false)"` //是否属于大事记
	Image       string    `json:"image",orm:"null"`                 //图片链接地址
	Color       string    `json:"color",orm:"null"`
	Public      bool      `default(true)` //是否公开

}

func GetAllProjCalendar

func GetAllProjCalendar(pid int64, public bool) (calendars []*ProjCalendar, err error)

取出所有日历日程

func GetProjCalendar

func GetProjCalendar(pid int64, start, end time.Time, public bool) (calendars []*ProjCalendar, err error)

取所有——要修改为支持时间段的,比如某个月份

func GetProjCalendarbyid

func GetProjCalendarbyid(id int64) (calendar ProjCalendar, err error)

根据id查询事件

func ListPostsByOffsetAndLimit

func ListPostsByOffsetAndLimit(pid int64, set, postsPerPage int, public bool) ([]*ProjCalendar, error)

取出分页的日历

type ProjGant

type ProjGant struct {
	Id               int64  `form:"-"`
	ParentId         int64  `orm:"null"`
	Status           string `orm:"null"` //STATUS_ACTIVE, STATUS_DONE, STATUS_FAILED, STATUS_SUSPENDED, STATUS_UNDEFINED
	Level            int    `orm:"null"`
	Code             string `orm:"null"` //编号
	Name             string `orm:"null"` //项目名称
	StartIsMilestone bool
	Start            time.Time `orm:"type(datetime)"`
	EndIsMilestone   bool
	End              time.Time `orm:"null;type(datetime)"`
	Duration         int       `orm:"null"`
	Progress         int       `orm:"null"`
	Depends          string    `orm:"null"`
	HasChild         bool      `orm:"null"`
	Description      string    `orm:"null"`
	Show             bool
	Created          time.Time `orm:"null","auto_now_add;type(datetime)"`
	Updated          time.Time `orm:"null","auto_now_add;type(datetime)"`
}

func GetProjGant

func GetProjGant(id int64) (projgant ProjGant, err error)

根据id取得项目进度

func GetProjGantName

func GetProjGantName(code, name string) (projgant ProjGant, err error)

根据编号code和名字name查询到项目进度

func GetProjGantParent

func GetProjGantParent(name string, parentid int64) (projgant ProjGant, err error)

根据名字name和parentid查询到项目进度

func GetProjGants

func GetProjGants() (projgant []*ProjGant, err error)

取得所有项目进度,按结束时间早到晚排列。

type Project

type Project struct {
	Id              int64     `form:"-"`
	Code            string    `orm:"null"`                                              //编号
	Title           string    `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	Label           string    `orm:"null"`                                              //标签
	Principal       string    `orm:"null"`                                              //负责人id
	ParentId        int64     `orm:"null"`
	ParentIdPath    string    `orm:"null"`
	ParentTitlePath string    `orm:"null"`
	Grade           int       `orm:"null"`
	Created         time.Time `orm:"null","auto_now_add;type(datetime)"`
	Updated         time.Time `orm:"null","auto_now_add;type(datetime)"`
}

func GetAllProjects

func GetAllProjects() (proj []*Project, err error)

取得所有项目目录

func GetProj

func GetProj(id int64) (proj Project, err error)

根据id取得项目目录

func GetProjSonbyId

func GetProjSonbyId(id int64) (projects []*Project, err error)

根据id查出所有儿子

func GetProjbyParentidTitle

func GetProjbyParentidTitle(parentid int64, title string) (proj Project, err error)

根据parentid和title取得proj目录

func GetProjbyParenttitlepath

func GetProjbyParenttitlepath(parenttitlepath, title string) (proj Project, err error)

根据parenttitlepath和title取得proj目录

func GetProjectCodeTitle

func GetProjectCodeTitle(code, title string) (proj Project, err error)

根据名字title查询到项目目录

func GetProjects

func GetProjects() (proj []*Project, err error)

取得所有项目

func GetProjectsbyPid

func GetProjectsbyPid(id int64) (projects []*Project, err error)

根据id查出所有子孙,用ParentIdPath 逻辑错误:110-210-310包含了10???? 20180107完美解决这个问题。同ProdModel.go中GetProjProducts一致 通过Id为projid,查出本级 parentid是projid,查出二级 parentidpath包含projid-,查出三级,以及往下 还是不严谨,projid-前面还有数据呢?必须前后都有限定符号才行 差点按照无闻的视频,将parentidpath存成$id1#$id2#$id3# 存:parentidpath="$"+id1+"#" 查:__contains,"$"+id1+"#" 取:stings.replace(stings.replace(parentidpath,"#",","-1),"$",""-1) 输出:strings.split(上面的,",")

func SearchProject

func SearchProject(key string) (proj []*Project, err error)

搜索本地项目

type ProjectLabel

type ProjectLabel struct {
	Id        int64
	ProjectId int64
	Label     string
}

type ProjectPic

type ProjectPic struct {
	Id        int    `json:"id"`
	ProjectId int    `json:"project_id"`
	Url       string `json:"url"`
	Type      string `json:"type"`
}

声明project_pics数据表结构

type ProjectUser

type ProjectUser struct {
	Id        int64
	ProjectId int64
	UserId    int64
}

type Recharge

type Recharge struct {
	gorm.Model
	// ID       int    `gorm:"primary_key"`
	UserID int64 `gorm:"column:user_id;foreignkey:UserId;"` // 外键 (属于), tag `index`是为该列创建索引
	Amount int   `gorm:"column:amount"`
	User   User  `gorm:"foreignkey:UserId"`
}

用户充值记录

func GetApplyRecharge

func GetApplyRecharge(limit, offset int) (recharge []Recharge, err error)

管理员查询到所有申请

type Relationship

type Relationship struct {
	RelationshipId int `orm:"pk;auto;unique;column(relationship_id)" json:"relationship_id"`
	MemberId       int `orm:"column(member_id);type(int)" json:"member_id"`
	BookId         int `orm:"column(book_id);type(int)" json:"book_id"`
	// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
	RoleId conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"`
}

func NewRelationship

func NewRelationship() *Relationship

func (*Relationship) DeleteByBookIdAndMemberId

func (m *Relationship) DeleteByBookIdAndMemberId(book_id, member_id int) error

func (*Relationship) Find

func (m *Relationship) Find(id int) (*Relationship, error)

func (*Relationship) FindByBookIdAndMemberId

func (m *Relationship) FindByBookIdAndMemberId(book_id, member_id int) (*Relationship, error)

func (*Relationship) FindForRoleId

func (m *Relationship) FindForRoleId(bookId, memberId int) (conf.BookRole, error)

func (*Relationship) FindFounder

func (m *Relationship) FindFounder(book_id int) (*Relationship, error)

查询指定项目的创始人.

func (*Relationship) Insert

func (m *Relationship) Insert() error

func (*Relationship) QueryTable

func (m *Relationship) QueryTable() orm.QuerySeter

func (*Relationship) TableEngine

func (m *Relationship) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Relationship) TableName

func (m *Relationship) TableName() string

TableName 获取对应数据库表名.

func (*Relationship) TableNameWithPrefix

func (m *Relationship) TableNameWithPrefix() string

func (*Relationship) TableUnique

func (m *Relationship) TableUnique() [][]string

联合唯一键

func (*Relationship) Transfer

func (m *Relationship) Transfer(book_id, founder_id, receive_id int) error

func (*Relationship) Update

func (m *Relationship) Update() error

func (*Relationship) UpdateRoleId

func (m *Relationship) UpdateRoleId(bookId, memberId int, roleId conf.BookRole) (*Relationship, error)

type Relevancy

type Relevancy struct {
	Id        int64     `form:"-"`
	ProductId int64     `orm:"null"` //编号
	Relevancy string    `orm:"null"` //标签
	Created   time.Time `orm:"null","auto_now_add;type(datetime)"`
	Updated   time.Time `orm:"null","auto_now_add;type(datetime)"`
}

func GetAllRelevancies

func GetAllRelevancies() (relevancies []*Relevancy, err error)

type RelevancyProduct

type RelevancyProduct struct {
	Relevancy `xorm:"extends"`
	Product   `xorm:"extends"`
}

func GetRelevancy

func GetRelevancy(prodid int64) ([]*RelevancyProduct, error)

根据成果id取得关联文件名称product code 根据关联文件名称product code,取得prod和proj

func GetRelevancybyName

func GetRelevancybyName(relevancy string) ([]*RelevancyProduct, error)

根据关联名称取得关联的成果id及成果code

type Result

type Result struct {
	Usernickname string `json:"name"`
	Productid    int64
	Total        int64 `json:"value"`
}

取出用户文章数目

func GetWxUserArticles

func GetWxUserArticles(pid int64) (results []*Result, err error)

type Role

type Role struct {
	Id         int64
	Rolename   string `json:"name",orm:"unique"` //这个拼音的简写
	Rolenumber string
	Status     string    `json:"role",orm:"default('0');size(2)"` //,form:"Status",valid:"Range('0','1','2','3','4')"`
	Createtime time.Time `orm:"type(datetime);auto_now_add" `
	Updated    time.Time `orm:"type(datetime);auto_now_add" `
}

角色表-20201225修改json status为role

func GetRoleByRoleId

func GetRoleByRoleId(roleid int64) (role Role)

取到一个角色数据,不是数组,所以table无法显示

func GetRoleByRolename

func GetRoleByRolename(name string) (role Role, err error)

由rolename取得角色

func GetRoleByUsername

func GetRoleByUsername(username string) (roles []*Role, count int64, err error)

func GetRolenameByUserId

func GetRolenameByUserId(id int64) (roles []*Role, err error)

由用户id取得所拥有的角色rolename

func GetRoles

func GetRoles() (roles []*Role, err error)

取出所有角色

type Select2

type Select2 struct {
	Id    string `json:"id"`
	Text  string `json:"text"`
	Value string `json:"value"`
}

type SelectMemberResult

type SelectMemberResult struct {
	Result []KeyValueItem `json:"results"`
}

type Share

type Share struct {
	// Base
	// gorm.Model
	Id        uint   `json:"id" gorm:"primary_key"`
	Uuid      string `json:"uuid" gorm:"type:char(36);index:idx_uuid"`
	CreatedAt time.Time
	UpdatedAt time.Time
	// DeletedAt *time.Time
	Name      string `json:"name" gorm:"type:varchar(255)"`
	ShareType string `json:"shareType" gorm:"type:varchar(45)"`
	Username  string `json:"username" gorm:"type:varchar(45)"`
	// UserUuid       string    `json:"userUuid" gorm:"type:char(36)"`
	UserId         int64     `json:"userid" gorm:"type:bigint(20) not null;default:0"`
	DownloadTimes  int64     `json:"downloadTimes" gorm:"type:bigint(20) not null;default:0"`
	Code           string    `json:"code" gorm:"type:varchar(45) not null"`
	ExpireInfinity bool      `json:"expireInfinity" gorm:"type:tinyint(1) not null;default:0"`
	ExpireTime     time.Time `json:"expireTime" gorm:"type:timestamp not null;default:'2018-01-01 00:00:00'"`
}

func CheckByUuidShare

func CheckByUuidShare(uuid string) (*Share, error)

find by uuid. if not found panic NotFound error

func CreateShare

func CreateShare(share *Share) (*Share, error)

func FindByUuidShare

func FindByUuidShare(uuid string) (*Share, error)

find by uuid. if not found return nil.

type Standard

type Standard struct {
	Id       int64
	Number   string //`orm:"unique"`
	Title    string
	Uid      int64
	Category string
	Content  string `orm:"sie(5000)"`
	Route    string
	// AttachmentId int64
	// Attachments     []*Attachment `orm:"reverse(many)"` // fk 的反向关系
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
	Views   int64
}

func GetAllStandards

func GetAllStandards() ([]*Standard, error)

func GetStandard

func GetStandard(id int64) (standard Standard, err error)

根据id取得规范

func SearchStandardsName

func SearchStandardsName(name string, isDesc bool) ([]*Standard, error)

由名字模糊搜索_作废

func SearchStandardsNamePage

func SearchStandardsNamePage(limit, offset int64, name string, isDesc bool) ([]*Standard, error)

由名字模糊搜索

func SearchStandardsNumber

func SearchStandardsNumber(number string, isDesc bool) ([]*Standard, error)

由编号模糊搜索_作废

func SearchStandardsNumberPage

func SearchStandardsNumberPage(limit, offset int64, number string, isDesc bool) ([]*Standard, error)

由编号模糊搜索

type Team

type Team struct {
	TeamId      int       `orm:"column(team_id);pk;auto;unique;" json:"team_id"`
	TeamName    string    `orm:"column(team_name);size(255)" json:"team_name"`
	MemberId    int       `orm:"column(member_id);type(int);" json:"member_id"`
	IsDelete    bool      `orm:"column(is_delete);default(0)" json:"is_delete"`
	CreateTime  time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	MemberCount int       `orm:"-" json:"member_count"`
	BookCount   int       `orm:"-" json:"book_count"`
	MemberName  string    `orm:"-" json:"member_name"`
}

团队.

func NewTeam

func NewTeam() *Team

func (*Team) Delete

func (t *Team) Delete(id int) (err error)

func (*Team) FindToPager

func (t *Team) FindToPager(pageIndex, pageSize int) (list []*Team, totalCount int, err error)

分页查询团队.

func (*Team) First

func (t *Team) First(id int, cols ...string) (*Team, error)

查询一个团队.

func (*Team) Include

func (t *Team) Include()

func (*Team) Save

func (t *Team) Save(cols ...string) (err error)

更新或添加一个团队.

func (*Team) TableEngine

func (t *Team) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Team) TableName

func (t *Team) TableName() string

TableName 获取对应数据库表名.

func (*Team) TableNameWithPrefix

func (t *Team) TableNameWithPrefix() string

type TeamMember

type TeamMember struct {
	TeamMemberId int `orm:"column(team_member_id);pk;auto;unique;" json:"team_member_id"`
	TeamId       int `orm:"column(team_id);type(int)" json:"team_id"`
	MemberId     int `orm:"column(member_id);type(int)" json:"member_id"`
	// RoleId 角色:0 创始人(创始人不能被移除) / 1 管理员/2 编辑者/3 观察者
	RoleId   conf.BookRole `orm:"column(role_id);type(int)" json:"role_id"`
	RoleName string        `orm:"-" json:"role_name"`
	Account  string        `orm:"-" json:"account"`
	RealName string        `orm:"-" json:"real_name"`
	Avatar   string        `orm:"-" json:"avatar"`
}

func NewTeamMember

func NewTeamMember() *TeamMember

func (*TeamMember) ChangeRoleId

func (m *TeamMember) ChangeRoleId(teamId int, memberId int, roleId conf.BookRole) (member *TeamMember, err error)

func (*TeamMember) Delete

func (m *TeamMember) Delete(id int) (err error)

删除一个团队用户.

func (*TeamMember) FindByBookIdAndMemberId

func (m *TeamMember) FindByBookIdAndMemberId(bookId, memberId int) (*TeamMember, error)

func (*TeamMember) FindFirst

func (m *TeamMember) FindFirst(teamId, memberId int) (*TeamMember, error)

查询团队中指定的用户.

func (*TeamMember) FindNotJoinMemberByAccount

func (m *TeamMember) FindNotJoinMemberByAccount(teamId int, account string, limit int) (*SelectMemberResult, error)

查询未加入团队的用户。

func (*TeamMember) FindToPager

func (m *TeamMember) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamMember, totalCount int, err error)

分页查询团队用户.

func (*TeamMember) First

func (m *TeamMember) First(id int, cols ...string) (*TeamMember, error)

func (*TeamMember) Include

func (m *TeamMember) Include() *TeamMember

查询关联数据.

func (*TeamMember) QueryTable

func (m *TeamMember) QueryTable() orm.QuerySeter

func (*TeamMember) Save

func (m *TeamMember) Save(cols ...string) (err error)

更新或插入团队用户.

func (*TeamMember) TableEngine

func (m *TeamMember) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*TeamMember) TableName

func (m *TeamMember) TableName() string

TableName 获取对应数据库表名.

func (*TeamMember) TableNameWithPrefix

func (m *TeamMember) TableNameWithPrefix() string

func (*TeamMember) TableUnique

func (m *TeamMember) TableUnique() [][]string

联合唯一键

type TeamRelationship

type TeamRelationship struct {
	TeamRelationshipId int       `orm:"column(team_relationship_id);pk;auto;unique;" json:"team_relationship_id"`
	BookId             int       `orm:"column(book_id)" json:"book_id"`
	TeamId             int       `orm:"column(team_id)" json:"team_id"`
	CreateTime         time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	TeamName           string    `orm:"-" json:"team_name"`
	MemberCount        int       `orm:"-" json:"member_count"`
	BookMemberId       int       `orm:"-" json:"book_member_id"`
	BookMemberName     string    `orm:"-" json:"book_member_name"`
	BookName           string    `orm:"-" json:"book_name"`
}

func NewTeamRelationship

func NewTeamRelationship() *TeamRelationship

func (*TeamRelationship) Delete

func (m *TeamRelationship) Delete(teamRelId int) (err error)

func (*TeamRelationship) DeleteByBookId

func (m *TeamRelationship) DeleteByBookId(bookId int, teamId int) error

删除指定项目的指定团队.

func (*TeamRelationship) FindByBookId

func (m *TeamRelationship) FindByBookId(bookId int, teamId int) (*TeamRelationship, error)

查找指定项目的指定团队.

func (*TeamRelationship) FindByBookToPager

func (m *TeamRelationship) FindByBookToPager(bookId, pageIndex, pageSize int) (list []*TeamRelationship, totalCount int, err error)

查询指定项目的团队.

func (*TeamRelationship) FindNotJoinBookByBookIdentify

func (m *TeamRelationship) FindNotJoinBookByBookIdentify(bookId int, teamName string, limit int) (*SelectMemberResult, error)

查找指定项目中未加入的团队.

func (*TeamRelationship) FindNotJoinBookByName

func (m *TeamRelationship) FindNotJoinBookByName(teamId int, bookName string, limit int) (*SelectMemberResult, error)

查询未加入团队的项目.

func (*TeamRelationship) FindToPager

func (m *TeamRelationship) FindToPager(teamId, pageIndex, pageSize int) (list []*TeamRelationship, totalCount int, err error)

分页查询团队项目.

func (*TeamRelationship) First

func (m *TeamRelationship) First(teamId int, cols ...string) (*TeamRelationship, error)

func (*TeamRelationship) Include

func (m *TeamRelationship) Include() (*TeamRelationship, error)

加载附加数据.

func (*TeamRelationship) QueryTable

func (m *TeamRelationship) QueryTable() orm.QuerySeter

func (*TeamRelationship) Save

func (m *TeamRelationship) Save(cols ...string) (err error)

保存团队项目.

func (*TeamRelationship) TableEngine

func (m *TeamRelationship) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*TeamRelationship) TableName

func (m *TeamRelationship) TableName() string

TableName 获取对应数据库表名.

func (*TeamRelationship) TableNameWithPrefix

func (m *TeamRelationship) TableNameWithPrefix() string

func (*TeamRelationship) TableUnique

func (m *TeamRelationship) TableUnique() [][]string

联合唯一键

type Template

type Template struct {
	TemplateId   int    `orm:"column(template_id);pk;auto;unique;" json:"template_id"`
	TemplateName string `orm:"column(template_name);size(500);" json:"template_name"`
	MemberId     int    `orm:"column(member_id);" json:"member_id"`
	BookId       int    `orm:"column(book_id);" json:"book_id"`
	BookName     string `orm:"-" json:"book_name"`
	//是否是全局模板:0 否/1 是; 全局模板在所有项目中都可以使用;否则只能在创建模板的项目中使用
	IsGlobal        int       `orm:"column(is_global);default(0)" json:"is_global"`
	TemplateContent string    `orm:"column(template_content);type(text);null" json:"template_content"`
	CreateTime      time.Time `orm:"column(create_time);type(datetime);auto_now_add" json:"create_time"`
	CreateName      string    `orm:"-" json:"create_name"`
	ModifyTime      time.Time `orm:"column(modify_time);type(datetime);auto_now" json:"modify_time"`
	ModifyAt        int       `orm:"column(modify_at);type(int)" json:"-"`
	ModifyName      string    `orm:"-" json:"modify_name"`
	Version         int64     `orm:"type(bigint);column(version)" json:"version"`
}

func NewTemplate

func NewTemplate() *Template

func (*Template) Delete

func (t *Template) Delete(templateId int, memberId int) error

删除一个模板

func (*Template) Find

func (t *Template) Find(templateId int) (*Template, error)

查询指定ID的模板

func (*Template) FindAllByBookId

func (t *Template) FindAllByBookId(bookId int) ([]*Template, error)

查询指定项目所有可用模板列表.

func (*Template) FindByBookId

func (t *Template) FindByBookId(bookId int) ([]*Template, error)

查询属于指定项目的模板.

func (*Template) Preload

func (t *Template) Preload() *Template

预加载一些数据

func (*Template) Save

func (t *Template) Save(cols ...string) (err error)

添加或更新模板

func (*Template) TableEngine

func (m *Template) TableEngine() string

TableEngine 获取数据使用的引擎.

func (*Template) TableName

func (m *Template) TableName() string

TableName 获取对应数据库表名.

func (*Template) TableNameWithPrefix

func (m *Template) TableNameWithPrefix() string

type TempleInputs

type TempleInputs struct {
	gorm.Model
	UserTempleID      uint
	InputAlias        string            `json:"inputalias" gorm:"column:input_alias"`
	InputValue        string            `json:"inputvalue" gorm:"column:input_value"` //默认值
	ResultType        string            `json:"resulttype" gorm:"column:result_type"`
	Units             string            `json:"units" gorm:"column:units"`
	Comment           string            `json:"comment"`
	RealMin           string            `json:"realmin"`
	RealMax           string            `json:"realmax"`
	HistoryInputValue HistoryInputValue //`gorm:"foreignkey:ID"` //带条件的预加载,条件是UserHistoryID
	SelectValue       []Select2         `json:"selectvalue"`
	TextArealValue    TextAreal         `json:"textarealvalue"`
}

模板-输入表

func GetTempleInputs

func GetTempleInputs(templeid uint) (templeinputs []TempleInputs, err error)

查出模板输入参数

func GetUserHistoryInputs

func GetUserHistoryInputs(usertempleid, userhistoryid uint) (templeinputs []TempleInputs, err error)

查出模板历史输入参数

type TempleOutputs

type TempleOutputs struct {
	gorm.Model
	UserTempleID       uint
	OutputAlias        string             `json:"outputalias" gorm:"column:output_alias"`
	OutputValue        string             `json:"outputvalue" gorm:"column:output_value"`
	ResultType         string             `json:"resulttype" gorm:"column:result_type"`
	Units              string             `json:"units" gorm:"column:units"`
	Comment            string             `json:"comment"`
	HistoryOutputValue HistoryOutputValue //`gorm:"foreignkey:ID"`

}

模板-输出表

func GetTempleOutputs

func GetTempleOutputs(templeid uint) (templeoutputs []TempleOutputs, err error)

查出模板输出参数

func GetUserHistoryOutputs

func GetUserHistoryOutputs(usertempleid, userhistoryid uint) (templeoutputs []TempleOutputs, err error)

查出模板历史输出参数

type TextAreal

type TextAreal struct {
	Value string `json:"value"`
}

type Todo

type Todo struct {
	Id        int64  `json:"todoid"`
	ProjectId int64  `json:"projectid"`
	Name      string `json:"todoname"`
	UserId    int64
	Completed bool      `json:"completed"`
	Created   time.Time `orm:"auto_now_add;type(date)"`
	Updated   time.Time `orm:"auto_now_add;type(date)"`
}

待办事件

type TodoUser

type TodoUser struct {
	Todo `xorm:"extends"`
	User `xorm:"extends"`
}

func GetTodoUser

func GetTodoUser(projectid int64, limit, offset int) ([]*TodoUser, error)

type Todolog

type Todolog struct {
	Id      int64
	TodoId  int64
	UserId  int64
	Action  string    //'Finish' : 'Restart'
	Created time.Time `orm:"auto_now_add;type(date)"`
}

操作记录

type User

type User struct {
	Id            int64
	Username      string `json:"name" orm:"unique"` //这个拼音的简写
	Nickname      string //中文名,注意这里,很多都要查询中文名才行`orm:"unique;size(32)" form:"Nickname" valid:"Required;MaxSize(20);MinSize(2)"`
	Password      string `orm:"size(50)" valid:"Required" form:"-"`
	Repassword    string `orm:"-" form:"Repassword" valid:"Required" form:"-"`
	Email         string `orm:"size(32)" form:"Email" valid:"Email"`
	Department    string //分院
	Secoffice     string //科室,这里应该用科室id,才能保证即时重名也不怕。否则,查看科室必须要上溯到分院才能避免科室名称重复问题
	Remark        string `orm:"null;size(200)" form:"Remark" valid:"MaxSize(200)"`
	Ip            string //ip地址
	Port          string
	Status        int       `orm:"default(1)" form:"Status" valid:"Range(1,2)"`
	Lastlogintime time.Time `orm:"type(datetime);auto_now_add" form:"-"`
	Createtime    time.Time `orm:"type(datetime);auto_now_add" `
	Updated       time.Time `orm:"type(datetime);auto_now_add" `
	Role          string    `json:"role" orm:"default('4')"` //这个不是角色,这个无意义
	Salt          string    `orm:"size(50)"`
}

用户表

func GetAllusers

func GetAllusers(page int64, page_size int64, sort string) (users []*User, count int64)

func GetProjectUser

func GetProjectUser(pid int64) (user User, err error)

func GetUname

func GetUname(user User) ([]*User, error)

func GetUserByIp

func GetUserByIp(ip string) (user User, err error)

根据ip查询用户

func GetUserByNickname

func GetUserByNickname(nickname string) (user User)

根据用户nickname取得用户

func GetUserByOpenID

func GetUserByOpenID(openid string) (user User, err error)

根据openid查user

func GetUserByUserId

func GetUserByUserId(userid int64) (user User)

取到一个用户数据,不是数组,所以table无法显示

func GetUserByUsername

func GetUserByUsername(username string) (user User, err error)

###*****这里特别注意,这个是用户名,是汉语拼音,不是Nickname!!!!

func GetUsers

func GetUsers() (users []*User, err error)

********************************************************** 取出所有用户

func GetUsersbySec

func GetUsersbySec(department, secoffice string) (users []*User, count int, err error)

根据分院和科室名称查所有用户,只有状态1的

func GetUsersbySecId

func GetUsersbySecId(secofficeid string) (users []*User, count int, err error)

根据科室id查所有用户

func GetUsersbySecOnly

func GetUsersbySecOnly(department string) (users []*User, count int, err error)

根据分院名称查所有用户——适用于没有科室的部门 查出所有人员,只有分院(部门)而没科室字段的人员,只有状态1的

func (*User) Valid

func (u *User) Valid(v *validation.Validation)

type UserAppreciation

type UserAppreciation struct {
	Id              int64
	Uid             int64
	AppreciationUrl string
	Createtime      time.Time `orm:"type(datetime);auto_now_add" `
}

用户和AppreciationUrl对应表,一个用户对应多个AppreciationUrl

type UserAppreciationUrl

type UserAppreciationUrl struct {
	User             `xorm:"extends"`
	UserAppreciation `xorm:"extends"`
}

func GetUserAppreciationUrl

func GetUserAppreciationUrl(uid int64) ([]*UserAppreciationUrl, error)

取出用户赞赏码

type UserAvatar

type UserAvatar struct {
	Id         int64
	Uid        int64
	AvatarUrl  string
	Createtime time.Time `orm:"type(datetime);auto_now_add" `
}

用户和AvatorUrl对应表,一个用户对应多个AvatorUrl

type UserAvatarUrl

type UserAvatarUrl struct {
	User       `xorm:"extends"`
	UserAvatar `xorm:"extends"`
}

func GetUserAvatorUrl

func GetUserAvatorUrl(uid int64) ([]*UserAvatarUrl, error)

取出用户头像

type UserCalExplain

type UserCalExplain struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserID       int64 `gorm:"column:user_id;foreignkey:UserId;"` // 外键 (属于), tag `index`是为该列创建索引
	CalExplainID uint  `json:"calexplainid" gorm:"column:cal_explain_id"`
}

用户添加计算书说明(前说明和后分析)explain

type UserCalFace

type UserCalFace struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserID    int64 `gorm:"column:user_id;foreignkey:UserId;"` // 外键 (属于), tag `index`是为该列创建索引
	CalFaceID uint  `json:"calfaceid" gorm:"column:cal_face_id"`
}

用户自定义计算书封面

type UserCart

type UserCart struct {
	// gorm.Model
	Id int64 `json:"id"`
	// Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `json:"updated"`
	// DeletedAt *time.Time
	UserId          int64  `json:"userid"`
	ProductId       int64  `json:"productid"`
	TopProjectId    int64  `json:"topprojectid"`
	Status          int    `json:"status"`
	UserNickname    string `json:"usernickname"`
	ProductTitle    string `json:"producttitle"`
	ProjectTitle    string `json:"projecttitle"`
	TopProjectTitle string `json:"topprojecttitle"`
}

购物车表

func GetApplyCart

func GetApplyCart(uid int64, limit, offset, status int, searchText string, isadmin bool) (usercarts []UserCart, err error)

查询某个用户申请下载的记录

func GetApprovalCart

func GetApprovalCart(uid int64, limit, offset, status int, searchText string, isadmin bool) (usercarts []UserCart, err error)

查询待自己审批的记录

type UserHistory

type UserHistory struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	UserID       int64 `json:"userid" gorm:"column:user_id;foreignkey:UserId;"` // 外键 (属于), tag `index`是为该列创建索引
	UserTempleID uint  `json:"tempid" gorm:"column:user_temple_id"`
	User         User  `gorm:"foreignkey:UserId"`
	UserTemple   UserTemple
	PdfUrl       string `json:"pdfurl"`
}

用户-历史计算记录表

func GetHistory

func GetHistory(historyid uint) (userhistory UserHistory, err error)

根据historyid查询历史计算

func GetUserHistory

func GetUserHistory(userid int64, usertempleid uint, limit, offset int) (userhistory []UserHistory, err error)

查询用户计算历史列表

func GetUserHistoryValue

func GetUserHistoryValue(userhistoryid uint) (userhistory UserHistory, err error)

查询历史计算数值_作废!!

type UserOpenID

type UserOpenID struct {
	Id     int64
	Uid    int64
	OpenID string
}

用户和openid对应表,一个用户对应多个openid

func GetOpenIDs

func GetOpenIDs() (openids []*UserOpenID, err error)

取出所有openid

type UserProject

type UserProject struct {
	Id        int64     `json:"id"`
	Code      string    `json:"code"`
	Title     string    `json:"title"`
	Label     string    `json:"label"`
	Principal string    `json:"principal"`
	Created   time.Time `json:"created"`
	Updated   time.Time `json:"updated"`
}

分页取得项目列表——作废,用下面那个

func GetProjectsPage(limit, offset int64, searchText string) (proj []*Project, err error) {
	o := orm.NewOrm()
	qs := o.QueryTable("Project")
	if searchText != "" {
		cond := orm.NewCondition()
		cond1 := cond.Or("Code__contains", searchText).Or("Title__contains", searchText).Or("Label__contains", searchText).Or("Principal__contains", searchText)
		cond2 := cond.AndCond(cond1).And("parent_id", 0)
		qs = qs.SetCond(cond2)
		_, err = qs.Limit(limit, offset).OrderBy("-created").All(&proj)
	} else {
		_, err = qs.Filter("parent_id", 0).Limit(limit, offset).OrderBy("-created").All(&proj)
	}
	return proj, err
}

func GetProjectsPage

func GetProjectsPage(limit, offset int64, searchText string) (project []*UserProject, err error)

type UserRole

type UserRole struct {
	Id     int64
	UserId int64
	RoleId int64 `xorm:"extends"`
}

func GetRoleByUserId

func GetRoleByUserId(id int64) (roles []*UserRole, err error)

由用户id取得所拥有的角色id

type UserStandard

type UserStandard struct {
	Id       int64
	Number   string //`orm:"unique"`
	Title    string
	Category string
	Content  string
	Route    string
	Created  time.Time
	Updated  time.Time
	Views    int64
	UserName string
}

gorm查询规范,join用户

func GetUserStandard

func GetUserStandard(limit, offset int, searchText string) (ustds []UserStandard, err error)

查询某个用户借阅记录

type UserTemple

type UserTemple struct {
	gorm.Model
	// ID     int    `gorm:"primary_key"`
	ClassID    int64  `gorm:"column:class_id;foreignkey:ProjectId;"`
	UserID     int64  `gorm:"column:user_id;foreignkey:UserId;"` // 外键 (属于), tag `index`是为该列创建索引
	TempTitle  string `json:"temptitle" gorm:"column:temp_title"`
	TempTitleB string `json:"temptitleb" gorm:"column:temp_title_b"` //简要名称,无日期,无版本号,无扩展名
	TempPath   string `json:"temppath" gorm:"column:temp_path"`
	// TempUrl   string `json:"tempurl" gorm:"column:temp_url"`
	Status      bool   `json:"status"`
	Version     string `json:"version"`
	User        User   `gorm:"foreignkey:UserId"`
	MathArticle MathArticle
}

用户-模板表

func GetMathTemple

func GetMathTemple(templeid uint) (usertemple UserTemple, err error)

查出某个模板

func GetMathTemples

func GetMathTemples(classid int64, limit, offset int) (usertemples []UserTemple, err error)

查出所有模板

type UserVideo

type UserVideo struct {
	// gorm.Model
	Id       int64  `json:"id"`
	Name     string `json:"name"`
	Url      string `json:"url"`
	CoverUrl string `json:"coverurl"`
	Content  string `json:"content"`
	// Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `json:"updated"`
	// DeletedAt *time.Time
	UserId       int64  `json:"userid"`
	ProjectId    int64  `json:"projectid"`
	TopProjectId int64  `json:"topprojectid"`
	UserNickname string `json:"usernickname"`
	ProductTitle string `json:"producttitle"`
}

查询返回的视频表

func GetUserVideo

func GetUserVideo(pid int64, limit, offset int, searchText string) (uservideos []UserVideo, err error)

查询所有视频

type Video

type Video struct {
	Id int64
	// Code         string `orm:"null"`                                              //编号
	Name     string `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique",
	Url      string `orm:"null"`                                              //关键字
	CoverUrl string `orm:"null"`
	UserId   int64  `orm:"null"`
	// Principal    string `orm:"null"`       //提供人 负责人id
	ProjectId int64 `orm:"null"` //侧栏id
	// TopProjectId int64  `orm:"default(0)"` //项目id
	Content string    `orm:"sie(5000)"` //内容
	Created time.Time `orm:"auto_now_add;type(datetime)"`
	Updated time.Time `orm:"auto_now;type(datetime)"`
}

视频表

func GetVideobyId

func GetVideobyId(id int64) (video Video, err error)

查询一个video

type WherePair

type WherePair struct {
	Query string
	Args  []interface{}
}

type Wiki

type Wiki struct {
	Id                int64
	Uid               int64
	Title             string
	Content           string `orm:"sie(5000)"`
	Attachment        string
	Created           time.Time `orm:"auto_now_add;type(datetime)"`
	Updated           time.Time `orm:"auto_now;type(datetime)"`
	Views             int64
	Author            string
	ReplyTime         time.Time
	ReplyCount        int64
	ReplyLastUserName string
}

func GetAllWikis

func GetAllWikis(isDesc bool) ([]*Wiki, error)

缺少排序,由项目名称获取项目下所有成果,如果没有项目名称,则获取所有成果

func GetWiki

func GetWiki(tid string) (*Wiki, error)

查看一个文章

func Getwikisbyuname

func Getwikisbyuname(uname string) ([]*Wiki, error)

由用户名取得文章

func ListWikisByOffsetAndLimit

func ListWikisByOffsetAndLimit(set, postsPerPage int) ([]*Wiki, error)

取出分页的wiki

func SearchWikis

func SearchWikis(tuming string, isDesc bool) ([]*Wiki, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL