Documentation ¶
Overview ¶
成果类型
部门结构,价值,ip地址段,日历
Index ¶
- func AddAchievementTopic(pid int64, uname, title, choose, content, mark string) (id int64, err error)
- func AddAdminCalendar(title, content, color string, allday, public bool, start, end time.Time) (id int64, err error)
- func AddAdminCarousel(title, url string) (id int64, err error)
- func AddAdminCategory(pid int64, title, code string, grade int) (id int64, err error)
- func AddAdminDepart(pid int64, title, code string) (id int64, err error)
- func AddAdminIpsegment(title, startip, endip string, iprole int) (id int64, err error)
- func AddAdminMerit(pid int64, title string, mark int) (id int64, err error)
- func AddAdminSynchIp(pid int64, username, synchip, port string) (id int64, err error)
- func AddAttachment(filename string, filesize, downloads, productid int64) (id int64, err error)
- func AddCatalog(name, tnumber string) (id int64, err error)
- func AddCatalogContent(cid int64, content string, level int) (id int64, err error)
- func AddCatalogLink(cid int64, link string) (id int64, err error)
- func AddMerit(mid, userid int64, title, content string, active bool) (id int64, err error)
- func AddSecofficeMerit(sid, mid int64) error
- func AddUser(u *User) (int64, error)
- func AddUserOpenID(userid int64, openid string) (id int64, err error)
- func AddUserRole(uid, rid int64) error
- func CheckUname(user User) error
- func DelUserById(Id int64) (int64, error)
- func DeletCatalog(id int64) error
- func DeleteAchievcategory(id int64) error
- func DeleteAdminCalendar(cid int64) error
- func DeleteAdminCategory(cid int64) error
- func DeleteAdminDepart(cid int64) error
- func DeleteAdminIpsegment(cid int64) error
- func DeleteAdminMerit(id int64) error
- func DeleteAdminSynchIp(cid int64) error
- func DeleteAttachment(cid int64) error
- func DeleteMerit(id int64) error
- func DeleteRole(Id int64) (int64, error)
- func DeleteSecofficeMerit(sid, mid int64) error
- func DeleteUserRole(uid, rid int64) error
- func DropAdminCalendar(cid int64, start, end time.Time) error
- func GetAttachmentsCount(id int64) (cnt int64, err error)
- func GetDB() *gorm.DB
- func GetUserMeritMark(uid, mid int64, state int, active bool) (mark int, err error)
- func Getprojuserspecialty(Id int64, ProjectNumber, DesignStage, Section string, t1, t2 time.Time) (value1, value2 float64, err error)
- func Getprojuserspecialty1(Uname string, ProjectNumber, DesignStage, Section string, t1, t2 time.Time) (value1 float64, err error)
- func Getspecialty(ProjectNumber, DesignStage, Section, Category string, t1, t2 time.Time) (value float64, err error)
- func Getuserlist(page int64, page_size int64, sort string) (users []orm.Params, count int64)
- func Getuserspecialty(Id int64, Category string, t1, t2 time.Time) (value float64, err error)
- func InsertUser()
- func ModifyCatalog(cid int64, fieldname, value string) error
- func ModifyCatalogContent(id, cid int64, fieldname, value string, level int) error
- func ModifyCatalogLink(id, cid int64, fieldname, value string) error
- func ModifyCatalogState(cid int64, state int) error
- func ResizeAdminCalendar(cid int64, end time.Time) error
- func Round(f float64, n int) float64
- func SaveAchievcategory(category AdminAchievcategory) (cid int64, err error)
- func SaveCatalog(catalog Catalog) (cid int64, err error, news string)
- func SaveRole(role Role) (rid int64, err error)
- func SaveUser(user User) (uid int64, err error)
- func UpdateAchievcategory(cid int64, ratio1 AdminAchievcategory) error
- func UpdateAdminCalendar(cid int64, title, content, color string, allday, public bool, ...) error
- func UpdateAdminCategory(cid int64, title, code string, grade int) error
- func UpdateAdminDepart(cid int64, title, code string) error
- func UpdateAdminIpsegment(cid int64, title, startip, endip string, iprole int) error
- func UpdateAdminMerit(id int64, title string, mark int) error
- func UpdateAdminSynchIp(cid int64, username, synchip, port string) error
- func UpdateAttachment(cid int64, filename string, filesize, downloads int64) (err error)
- func UpdateAttachmentTime(cid int64) (err error)
- func UpdateMerit(id int64, fieldname, value string) error
- func UpdateRole(role Role) (err error)
- func UpdateUser(cid int64, fieldname, value string) error
- func UpdateUserlastlogintime(username string) error
- func ValidateUser(user User) error
- type AchievementTopic
- type AdminAchievcategory
- type AdminCalenda
- type AdminCalendar
- type AdminCarousel
- type AdminCategory
- type AdminDepartMerit
- type AdminDepartment
- func GetAdminDepart(pid int64) (departs []*AdminDepartment, err error)
- func GetAdminDepartName(title string) (AdminDepartment, error)
- func GetAdminDepartTitle(title string) (categories []*AdminDepartment, err error)
- func GetAdminDepartbyId(id int64) (category AdminDepartment, err error)
- func GetAdminDepartbyidtitle(id int64, title string) (*AdminDepartment, error)
- type AdminIpsegment
- type AdminMerit
- type AdminMeritMark
- type AdminSynchIp
- type Attachment
- type Catalog
- func GetAllCatalogs(cid string) (catalogs []*Catalog, err error)
- func GetCatalog(id int64) (*Catalog, error)
- func GetProjectAchievement(projectnumber, designstage, section string) (catalogs []*Catalog, err error)
- func Getcatalog2byuserid(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func GetcatalogChecked(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func GetcatalogCompleted(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func GetcatalogDesignd(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func GetcatalogExamined(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func GetcatalogMyself(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func GetcatalogRunning(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func Getcatalogbyuserid(id, category string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func Getparticipatebyuserid(id string, t1, t2 time.Time) (catalogs []*Catalog, err error)
- func Rm_duplicate(list []*Catalog) []*Catalog
- type CatalogContent
- type CatalogLink
- type Employeeachievement
- type Merit
- type MeritTopic
- type MeritTopicUser
- type MeritTopicUser2
- type MyMeritTopic
- type Post
- type Profile
- type Role
- type Secofficeachievement
- type Specialty
- type Tag
- type User
- func GetAllusers(page int64, page_size int64, sort string) (users []*User, count int64)
- func GetMeritsbySecId(secofficeid string) (users []*User, count int, err error)
- func GetUname(user User) ([]*User, error)
- func GetUserByIp(ip string) (user User, err error)
- func GetUserByNickname(nickname string) (user User)
- func GetUserByOpenID(openid string) (user User, err error)
- func GetUserByUserId(userid int64) (user User)
- func GetUserByUsername(username string) (user User, err error)
- func GetUsers() (users []*User, err error)
- func GetUsersbySec(department, secoffice string) (users []*User, count int, err error)
- func GetUsersbySecId(secofficeid string) (users []*User, count int, err error)
- func GetUsersbySecOnly(department string) (users []*User, count int, err error)
- type UserMerit
- type UserMeritTopic
- type UserMeritTopic2
- type UserMeritTopics
- type UserOpenID
- type UserRole
- type Users
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddAchievementTopic ¶
func AddAchievementTopic(pid int64, uname, title, choose, content, mark string) (id int64, err error)
用户添加价值
func AddAdminCalendar ¶
func AddAdminCalendar(title, content, color string, allday, public bool, start, end time.Time) (id int64, err error)
********日历******** 添加
func AddAdminCategory ¶
添加
func AddAdminIpsegment ¶
****************IP****************** 添加ip地址段
func AddAdminMerit ¶
*********价值******************** 添加价值
func AddAdminSynchIp ¶
****项目同步ip**** 添加AdminSynchIp
func AddAttachment ¶
添加附件到成果id下 如果附件名称已经存在,则不再追加写入数据库 应该用ReadOrCreate尝试从数据库读取,不存在的话就创建一个
func AddCatalogContent ¶
添加设计说明
func AddSecofficeMerit ¶
将secofficeid和meritid存入对应数据库 如果存在,
func AddUserOpenID ¶
后台手工操作添加微信小程序openid和用户名
func CheckUname ¶
func DelUserById ¶
func DeletCatalog ¶
func DeleteAchievcategory ¶
func DeleteRole ¶
func DeleteSecofficeMerit ¶
func DeleteUserRole ¶
func GetDB ¶
获取gorm db对象,其他包需要执行数据库查询的时候,只要通过tools.getDB()获取db对象即可。 不用担心协程并发使用同样的db对象会共用同一个连接, db对象在调用他的方法的时候会从数据库连接池中获取新的连接 注意:使用连接池技术后,千万不要使用完db后调用db.Close关闭数据库连接, 这样会导致整个数据库连接池关闭,导致连接池没有可用的连接
func GetUserMeritMark ¶
查询某个用户userid的价值分值
func Getprojuserspecialty ¶
func Getprojuserspecialty(Id int64, ProjectNumber, DesignStage, Section string, t1, t2 time.Time) (value1, value2 float64, err error)
查出一个项目(阶段、专业)时间段内总分值和某个用户的总分值
func Getprojuserspecialty1 ¶
func Getprojuserspecialty1(Uname string, ProjectNumber, DesignStage, Section string, t1, t2 time.Time) (value1 float64, err error)
查出一个项目(阶段、专业)时间段内某个用户的总分值
func Getspecialty ¶
func Getspecialty(ProjectNumber, DesignStage, Section, Category string, t1, t2 time.Time) (value float64, err error)
查出一个项目(阶段、专业)时间段内某个类型的总分值
func Getuserlist ¶
get user list
func Getuserspecialty ¶
查出一个人时间段内某个类型的总分值
func ModifyCatalogContent ¶
修改content
func ModifyCatalogLink ¶
修改links
func SaveAchievcategory ¶
func SaveAchievcategory(category AdminAchievcategory) (cid int64, err error)
func UpdateAchievcategory ¶
func UpdateAchievcategory(cid int64, ratio1 AdminAchievcategory) error
func UpdateAdminCalendar ¶
func UpdateAdminCalendar(cid int64, title, content, color string, allday, public bool, start, end time.Time) error
修改
func UpdateAdminCategory ¶
修改
func UpdateAdminIpsegment ¶
修改Ip地址段
func UpdateAdminSynchIp ¶
修改
func UpdateAttachment ¶
修改_这个意义不大,对于附件的修改,一般是追加或删除
func UpdateAttachmentTime ¶
修改附件的日期和changesurl修改记录地址
func UpdateRole ¶
func ValidateUser ¶
Types ¶
type AchievementTopic ¶
type AchievementTopic struct { Id int64 `form:"-"` ParentId int64 `orm:"null"` UserId int64 `orm:"null"` Title string `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique", Choose string `orm:"null"` Content string `orm:"null"` Mark string `orm:"null"` //设置分数 Created time.Time `orm:"auto_now_add;type(datetime)"` Updated time.Time `orm:"auto_now_add;type(datetime)"` }
func GetAchievementTopic ¶
func GetAchievementTopic(pid, uid int64) (topics []*AchievementTopic, numbers, marks int, err error)
根据父级价值id和用户id取得所有价值——返回数量和分值 这个是拷贝jsonmodel的,这里没有用
type AdminAchievcategory ¶
type AdminAchievcategory struct { Id int64 Category string //成果类型及单位 Rationum float64 //折标系数 Ismaterial bool //是否是实物工作量 // Data 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)"` }
func GetAchcatebycate ¶
func GetAchcatebycate(category string) (ratio AdminAchievcategory, err error)
根据成果类型,查系数等特性
func GetAchievcategories ¶
func GetAchievcategories() (categories []*AdminAchievcategory, err error)
func GetAchievcategory ¶
func GetAchievcategory(tid string) (*AdminAchievcategory, error)
type AdminCalenda ¶
type AdminCalenda struct { Id int64 `form:"-"` Title string `form:"title;text;title:",valid:"MinSize(1);MaxSize(100)"` //orm:"unique", // contains filtered or unexported fields }
日历
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)
取所有——要修改为支持时间段的,比如某个月份
type AdminCarousel ¶
type AdminCarousel struct { Id int64 `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 AdminDepartMerit ¶
type AdminDepartMerit struct { Id int64 `json:"id",form:"-"` SecofficeId int64 `orm:"null"` MeritId int64 `orm:"null"` }
func GetMeritsbySec ¶
func GetMeritsbySec(department, secoffice string) (meritcates []*AdminDepartMerit, err error)
根据分院和科室名称查所有价值
func GetMeritsbySecOnly ¶
func GetMeritsbySecOnly(department string) (meritcates []*AdminDepartMerit, err error)
根据分院名称查所有价值——适用于没有科室的部门 查出所有价值,只有分院(部门)而没科室字段的价值
func GetSecofficeMerit ¶
func GetSecofficeMerit(id int64) (meritcates []*AdminDepartMerit, err error)
由科室id取得所有价值分类 根据分院名称查所有价值——适用于没有科室的部门 查出所有价值,只有分院(部门)而没科室字段的价值
type AdminDepartment ¶
type AdminDepartment struct { Id int64 `json:"id",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 AdminMerit ¶
type AdminMerit struct { Id int64 `form:"-"` ParentId int64 `orm:"null"` Title string `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)"` //orm:"unique", // Mark string `orm:"null"` //设置分数 // List string `orm:"null"` //选择项 // ListMark string `orm:"null"` Created time.Time `orm:"auto_now_add;type(datetime)"` Updated time.Time `orm:"auto_now_add;type(datetime)"` }
价值分类
func GetAdminMeritbyId ¶
func GetAdminMeritbyId(id int64) (*AdminMerit, error)
由id取得价值 要么本身能查到分值,要么要子价值查出分值
func GetAdminMeritbyPid ¶
func GetAdminMeritbyPid(pid int64) ([]*AdminMerit, error)
由父级id(项目管理类)得到所有价值
func GetMeritIdbyTitles ¶
func GetMeritIdbyTitles(title_1, title_2, title_3 string) (merit AdminMerit, err error)
根据价值分类3级,得到meritid
type AdminMeritMark ¶
type AdminMeritMark struct { Id int64 `form:"-"` MeritId int64 `orm:"null"` Mark int `orm:"null"` Created time.Time `orm:"auto_now_add;type(datetime)"` Updated time.Time `orm:"auto_now_add;type(datetime)"` }
价值分值
func GetAdminMeritMarkbyId ¶
func GetAdminMeritMarkbyId(meritid int64) (*AdminMeritMark, error)
由id取得价值分值
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 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 GetAttachmentTitle ¶
func GetAttachmentTitle(title string) (cate Attachment, err error)
根据名字title查询到附件
func GetAttachments ¶
func GetAttachments(id int64) (attachments []*Attachment, err error)
根据成果id取得所有附件
type Catalog ¶
type Catalog 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编写者提交,等待校核确认;3,校核确认,等待审查确认;4,审查确认 }
func GetAllCatalogs ¶
func GetCatalog ¶
func GetProjectAchievement ¶
func GetProjectAchievement(projectnumber, designstage, section string) (catalogs []*Catalog, err error)
根据项目编号、项目名称和项目阶段、专业,查出所有成果
func Getcatalog2byuserid ¶
由用户Id取得所有成果按时间顺序排列 不返回重复的值
func GetcatalogChecked ¶
别人传来,自己处于校核位置的展示 author!=登录名,状态为3,校核名=登录名
func GetcatalogCompleted ¶
已经完成 制图、设计、校核、审查中含有登录名字,状态为5
func GetcatalogDesignd ¶
别人传来,自己处于设计位置的展示 author!=登录名,状态为2,设计名=登录名
func GetcatalogExamined ¶
别人传来,自己处于审查位置的展示 author!=登录名,状态为4,审查名=登录名
func GetcatalogMyself ¶
我发起,待提交 由用户名(不是nickname)和时间段取得自己发起的成果 不返回重复的值 author=登录的人名,登录名所处制图-状态为1;设计-状态为2;校核-状态为3;审查-无
func GetcatalogRunning ¶
自己发起,已经提交 author=登录人名,状态>登录名字所处位置,且状态<5 设计和制图同一人会重复
func Getcatalogbyuserid ¶
由用户Id取得所有编制、设计、校核详细catalog,按成果类型排列
func Getparticipatebyuserid ¶
由用户Id取得所有成果_得到参与的项目和阶段——去重 不返回重复的值
func Rm_duplicate ¶
struct去重——根据指定字段 ProjectNumber string //项目编号 ProjectName string //项目名称 Section专业 DesignStage string //阶段
type CatalogContent ¶
type CatalogContent struct { Id int64 CatalogId int64 Content string Level int Created time.Time `orm:"auto_now_add;type(datetime)"` Updated time.Time `orm:"auto_now_add;type(datetime)"` }
设计说明表
func GetCatalogContents ¶
func GetCatalogContents(cid int64) (contents []*CatalogContent, err error)
根据成果id查出设计说明校审记录表
type CatalogLink ¶
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 ¶
func GetCatalogLinks(cid int64) (links []*CatalogLink, err error)
根据成果id查出附件链接表
type Employeeachievement ¶
type Employeeachievement struct { Id string //员工Id Name string //员工姓名nickname Drawn float64 //编制、绘制 Designd float64 //设计 Checked float64 //校核 Examined float64 //审查 Verified float64 //核定 Approved float64 //批准 Sigma float64 //合计 //增加实物工作量合计 MaterialSigma float64 //实物工作量合计 }
员工的编制、设计……分值——全部改成float浮点型小数
func Getemployeevalue ¶
func Getemployeevalue(uname string, t1, t2 time.Time) (employeevalue, employeerealvalue []Employeeachievement, err error)
由用户姓名取得所有编制、设计、校核分值
type Merit ¶
type Merit struct { // gorm.Model Id int64 `json:"id"` Title string `json:"title"` ParentId int64 `json:"parentid"` Mark int `json:"mark"` }
价值表带mark分值
type MeritTopic ¶
type MeritTopic struct { Id int64 `json:"id"` MeritId int64 `orm:"null"` UserId int64 `orm:"null"` Title string `form:"title;text;title:",valid:"MinSize(1);MaxSize(20)" json:"title"` //orm:"unique", // Choose string `orm:"null"` Content string `orm:"null" json:"content"` State int `json:"state"` //1编写状态,未提交;2编写者提交,等待审核确认;3,已经审核确认 Active bool `default(true) json:"active"` // Mark string `orm:"null"` //设置分数 Created time.Time `orm:"auto_now_add;type(datetime)"` Updated time.Time `orm:"auto_now_add;type(datetime)"` }
func GetMerit ¶
func GetMerit(mid, uid int64, state int) (merits []*MeritTopic, err error)
根据价值id和用户id取得状态=state的价值
func GetMeritTopics2 ¶
func GetMeritTopics2(uid int64, state int) (topics []*MeritTopic, err error)
测试gorm返回嵌套结构体,必须是建表的数据结构,不能自定义数据结构。建表的数据struct必须有foreignKey
type MeritTopicUser ¶
type MeritTopicUser struct { AdminMeritMark `xorm:"extends"` MeritTopic `xorm:"extends"` User `xorm:"extends"` }
测试用
func GetMeritTopicUser ¶
func GetMeritTopicUser(uid int64, state int) ([]*MeritTopicUser, error)
测试xorm的join查询,返回结构体无法嵌套
type MeritTopicUser2 ¶
type MeritTopicUser2 struct { AdminMeritMark AdminMeritMark MeritTopic MeritTopic `json:"merittopic"` User User `json:"user"` }
测试gorm自定义嵌套结构体,无效果
type MyMeritTopic ¶
type MyMeritTopic struct { Id int64 `json:"id"` MeritCate string `json:"meritcate"` //价值分类——项目管理类 MeritTitle string `json:"merittitle"` //价值-专业负责人 UserNickName string `json:"usernickname"` TopicTitle string `json:"topictitle"` Choose string `json:"choose"` //大型、中型 Content string `json:"content"` Active bool `json:"active"` State int `json:"state"` //1编写状态,未提交;2编写者提交,等待审核确认;3,已经审核确认 Mark int `json:"mark"` // Created time.Time `orm:"index","auto_now_add;type(datetime)"` Updated time.Time `json:"updated"` }
func GetMyselfMeritTopic ¶
func GetMyselfMeritTopic(uid int64, state int, active bool) (merittopics []*MyMeritTopic, err error)
取得用户id状态为state的所有价值,代替下面那个 GetMeritTopics区别是-没有进行汇总
type Post ¶
type Post struct { Id int64 Title string Users *Users `orm:"rel(fk)"` //设置一对多关系 Tags []*Tag `orm:"rel(m2m)"` }
Post 和 User 是 ManyToOne 关系,也就是 ForeignKey 为 User
type Profile ¶
func Getprofile ¶
type Role ¶
type Role struct { Id int64 `PK` 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" ` }
角色表
func GetRoleByUsername ¶
type Secofficeachievement ¶
type Secofficeachievement struct { Id int64 //科室Id Name string //科室 Employee []Employeeachievement }
分院里各个科室人员结构
type User ¶
type User struct { Id int64 `PK` Username string `json:"name",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:"-"` 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(2)" 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"` }
用户表
func GetAllusers ¶
func GetMeritsbySecId ¶
根据科室id查所有价值
func GetUserByUsername ¶
###*****这里特别注意,这个是用户名,是汉语拼音,不是Nickname!!!!
func GetUsersbySec ¶
根据分院和科室名称查所有用户,只有状态1的
func GetUsersbySecId ¶
根据科室id查所有用户
func GetUsersbySecOnly ¶
根据分院名称查所有用户——适用于没有科室的部门 查出所有人员,只有分院(部门)而没科室字段的人员,只有状态1的
func (*User) Valid ¶
func (u *User) Valid(v *validation.Validation)
type UserMerit ¶
type UserMerit struct { // gorm.Model Id int64 `json:"id"` Title string `json:"title"` Mark int `json:"mark"` }
价值表带mark分值
func GetAdminMerit ¶
根据父级id取到所有的价值结构
type UserMeritTopic ¶
type UserMeritTopic struct { // gorm.Model Id int64 `json:"id"` MeritCate string `json:"meritcate"` //价值分类——项目管理类 MeritTitle string `json:"merittitle"` //价值-专业负责人 Choose string `json:"choose"` //大型、中型 TopicTitle string `json:"topictitle"` //价值内容名称 Mark int `json:"mark"` Content string `json:"content"` Updated time.Time `json:"updated"` State int `json:"state"` Active bool `json:"active"` User User }
价值表带mark分值
func GetMeritTopic ¶
func GetMeritTopic(mid, uid int64, state int) (usermerittopics []*UserMeritTopic, err error)
根据用户id和价值分类2级,取得所有这个用户的价值
type UserMeritTopic2 ¶
type UserMeritTopic2 struct { // gorm.Model Id int64 `json:"id"` Title string `json:"title"` Title1 string `json:"title1"` //价值分类名称 Title2 string `json:"title2"` //价值分类名称 Title3 string `json:"title3"` //价值分类名称 TopicTitle string `json:"topictitle"` //价值内容名称 Mark int `json:"mark"` Content string `json:"content"` User User }
测试 价值表带mark分值
func GetMeritTopic2 ¶
func GetMeritTopic2(mid, uid int64, state int) (usermerittopics []*UserMeritTopic2, err error)
测试子查询,希望查询出树状结构表的父子孙 最后用join查询重命名来解决了。
type UserMeritTopics ¶
type UserMeritTopics struct { Marks int `json:"marks"` Number int `json:"number"` Nickname string `json:"nickname"` Department string `json:"department"` UserId int64 `json:"userid"` User User `gorm:"foreignKey:UserId"` }
统计用户价值表带mark分值
func GetMeritTopics ¶
func GetMeritTopics(uid int64, state int, active bool) (usermerittopics []*UserMeritTopics, err error)
根据用户id,取得所有这个用户的价值分值汇总和价值数量汇总 和GetMyselfMeritTopic区别是进行了汇总
type UserOpenID ¶
用户和openid对应表,一个用户对应多个openid