1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package seal
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- //Attachment 用印附件结构体
- type Attachment struct {
- Id int `orm:"column(id);pk"`
- SealId int `description:"用印ID"`
- FileUrl string `description:"文件附件地址"`
- ModifyTime time.Time `description:"最近一次修改时间"`
- CreateTime time.Time `description:"添加时间"`
- }
- func (a *Attachment) TableName() string {
- return "seal_attachment"
- }
- //GetAttachmentBySealId 根据用印id获取合同附件信息
- func GetAttachmentBySealId(sealId int) ( list []*Attachment, err error) {
- o := orm.NewOrm()
- sql := `select * from seal_attachment where seal_id = ? `
- _, err = o.Raw(sql, sealId).QueryRows(&list)
- return
- }
- //DelAttachmentBySealId 删除用印相关的合同附件信息
- func DelAttachmentBySealId(sealId int) (err error) {
- o := orm.NewOrm()
- sql := `delete from seal_attachment where seal_id = ? `
- _, err = o.Raw(sql, sealId).Exec()
- return
- }
- //AddAttachments 用印附件添加
- func AddAttachments(list []*Attachment) (err error) {
- o := orm.NewOrm()
- _, err = o.InsertMulti(1, list)
- return
- }
|