12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package semantic_analysis
- import (
- "eta_gn/eta_api/global"
- "fmt"
- "strings"
- )
- type SaCompareDoc struct {
- SaCompareDocId int `gorm:"primaryKey;column:sa_compare_doc_id;type:int(10) unsigned;not null"` // 比对文档Id
- CompareId int `gorm:"index:idx_compare_id;column:compare_id;type:int(10) unsigned;not null;default:0"` // 比对Id
- DocId int `gorm:"column:doc_id;type:int(10) unsigned;not null;default:0"` // 文档Id
- }
- var SaCompareDocColumns = struct {
- SaCompareDocId string
- CompareId string
- DocId string
- }{
- SaCompareDocId: "sa_compare_doc_id",
- CompareId: "compare_id",
- DocId: "doc_id",
- }
- func (m *SaCompareDoc) TableName() string {
- return "sa_compare_doc"
- }
- func (m *SaCompareDoc) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*SaCompareDoc, err error) {
- fields := strings.Join(fieldArr, ",")
- if len(fieldArr) == 0 {
- fields = `*`
- }
- order := ``
- if orderRule != "" {
- order = ` ORDER BY ` + orderRule
- }
- sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
- err = global.DEFAULT_DmSQL.Raw(sql, pars...).Find(&items).Error
- return
- }
- // SaCompareDocSection 比对文档段落信息
- type SaCompareDocSection struct {
- DocId int `description:"文档ID"`
- Title string `description:"文档标题"`
- Theme string `description:"文档主题"`
- ClassifyName string `description:"分类名称"`
- SectionId int `description:"段落ID"`
- Content string `description:"段落内容"`
- Sort int `description:"段落排序"`
- }
|