1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- package company
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type CompanyHistoryRemark struct {
- HistoryId int `orm:"column(history_id);pk" comment:"备注id"`
- CompanyId int `comment:"客户ID"`
- ProductId int `comment:"产品id"`
- Content string `comment:"备注内容"`
- SysAdminId int `comment:"创建人ID"`
- SysAdminName string `comment:"创建人姓名"`
- CreateTime time.Time `comment:"创建时间"`
- ModifyTime time.Time `comment:"更新时间"`
- TableName string `comment:"表名"`
- TableId int `comment:"表ID"`
- UserId int `comment:"用户ID"`
- Mobile string `comment:"手机号"`
- Email string `comment:"邮箱"`
- RealName string `comment:"用户实际名称"`
- ShowTime time.Time `comment:"对外展示的创建时间"`
- }
- // CompanyHistoryRemarkReq 新增历史备注请求
- type CompanyHistoryRemarkReq struct {
- CompanyId int `description:"客户id"`
- Content string `description:"备注内容"`
- }
- // 新增
- func AddCompanyHistoryRemark(remark *CompanyHistoryRemark) (err error) {
- o := orm.NewOrm()
- _, err = o.Insert(remark)
- return
- }
- type CompanyHistoryRemarkResp struct {
- CompanyId int `comment:"客户ID"`
- Content string `comment:"备注内容"`
- SysAdminName string `comment:"创建人姓名"`
- RemarkType string `comment:"备注类型"`
- CreateTime string `comment:"对外展示的创建时间"`
- }
- type CompanyHistoryRemarkListResp struct {
- List []*CompanyHistoryRemarkResp
- }
- // GetCompanyHistoryRemarkList 获取备注列表
- func GetCompanyHistoryRemarkList(CompanyId, ProductId string) (items []*CompanyHistoryRemark, err error) {
- o := orm.NewOrm()
- sql := "SELECT * FROM company_history_remark WHERE company_id=? AND product_id=? ORDER BY show_time DESC "
- _, err = o.Raw(sql, CompanyId, ProductId).QueryRows(&items)
- return
- }
- // DelCompanyHistoryRemark 删除客户历史备注
- func DelCompanyHistoryRemark(tableName string, tableId int) (err error) {
- o := orm.NewOrm()
- sql := `DELETE FROM company_history_remark WHERE table_name = ? AND table_id = ? `
- _, err = o.Raw(sql, tableName, tableId).Exec()
- return
- }
|