12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package knowledge
- import (
- "eta_gn/eta_api/global"
- "eta_gn/eta_api/utils"
- "fmt"
- "time"
- )
- type KnowledgeImportFail struct {
- Id int `gorm:"column:id;primaryKey;autoIncrement" description:"主键ID"`
- ResourceType int `gorm:"column:resource_type;"`
- Title string `gorm:"column:title;"`
- Content string `gorm:"column:content"`
- SourceFrom string `gorm:"column:source_from"`
- Tag string `gorm:"column:tag"`
- ClassifyFirst string `gorm:"column:classify_first;"`
- ClassifySecond string `gorm:"column:classify_second;"`
- ClassifyThird string `gorm:"column:classify_third;"`
- StartTime string `gorm:"column:start_time"`
- EndTime string `gorm:"column:end_time"`
- StartDate string `gorm:"column:start_date"`
- EndDate string `gorm:"column:end_date"`
- Remark string `gorm:"column:remark" description:"备注"`
- SysUserId string `gorm:"column:sys_user_id" description:"系统用户ID"`
- CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
- }
- func (m *KnowledgeImportFail) TableName() string {
- return "knowledge_import_fail"
- }
- func (m *KnowledgeImportFail) Add(item *KnowledgeImportFail) (err error) {
- err = global.DmSQL["rddp"].Create(item).Error
- return
- }
- func (m *KnowledgeImportFail) MultiAdd(items []*KnowledgeImportFail) (err error) {
- err = global.DmSQL["rddp"].CreateInBatches(items, utils.MultiAddNum).Error
- return err
- }
- func (m *KnowledgeImportFail) Delete(userId, resourceType int) (err error) {
- sql := fmt.Sprintf(`delete from %s where sys_user_id=? and resource_type=?`, m.TableName())
- err = global.DmSQL["rddp"].Exec(sql, userId, resourceType).Error
- return err
- }
- func (m *KnowledgeImportFail) GetListBySysUserId(sysUserId, resourceType int) (items []*KnowledgeImportFail, err error) {
- sql := fmt.Sprintf(` SELECT * FROM %s WHERE sys_user_id=? and resource_type=? `, m.TableName())
- err = global.DmSQL["rddp"].Raw(sql, sysUserId, resourceType).Find(&items).Error
- return
- }
|