123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package seal
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type SealOperationRecord struct {
- Id int `orm:"column(id);pk"`
- SealId int `orm:"column(seal_id)";description:"用印ID"`
- Operation string `description:"操作类型,add:新增,edit:编辑,apply:发起审批,cancel:撤回审批,reject:拒绝审批,approval:审批操作,invalid:作废;长度36位"`
- OpUserId int `description:"操作人id"`
- OpUserName string `description:"操作人名称"`
- Remark string `description:"备注,长度255位"`
- ApprovalRecordId int `orm:"column(approval_record_id)";description:"审批流id"`
- ApprovalRemark string `description:"审批备注"`
- CreateTime time.Time `description:"日志添加时间"`
- }
- type SealOperationRecordList struct {
- SealOperationRecord
- CreateTimeStr string `description:"日志添加时间标准格式"`
- }
- // GetSealOperationListBySealId 根据用印ID获取所有操作日志
- func GetSealOperationListBySealId(sealId int) (list []*SealOperationRecordList, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM seal_operation_record WHERE seal_id = ? ORDER BY id DESC`
- _, err = o.Raw(sql, sealId).QueryRows(&list)
- return
- }
- // AddContractOperationRecord 添加用印操作日志
- func AddSealOperationRecord(sealId, opUserId, approvalRecordId int, operation, opUserName, remark, approvalRemark string) (err error) {
- o := orm.NewOrm()
- item := &SealOperationRecord{
- SealId: sealId,
- Operation: operation,
- OpUserId: opUserId,
- OpUserName: opUserName,
- Remark: remark,
- ApprovalRecordId: approvalRecordId,
- ApprovalRemark: approvalRemark,
- CreateTime: time.Now(),
- }
- _, err = o.Insert(item)
- return
- }
|