123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package sandbox
- import (
- "eta_gn/eta_task/global"
- "time"
- )
- // Sandbox 沙盘推演主表
- //type Sandbox struct {
- // SandboxId int `orm:"column(sandbox_id);pk" description:"沙盘id"`
- // Name string `description:"沙盘名称"`
- // ChartPermissionId int `description:"品种id"`
- // ChartPermissionName string `description:"品种名称"`
- // CurrVersion int `description:"当前版本"`
- // Code string `description:"沙盘code"`
- // Content string `description:"沙盘数据"`
- // PicUrl string `description:"沙盘图片地址"`
- // OpUserId int `description:"最近一次编辑操作的用户id"`
- // OpUserName string `description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
- // IsDelete int8 `description:"是否删除,0:未删除,1:已删除"`
- // ModifyTime time.Time `description:"修改时间"`
- // CreateTime time.Time `description:"创建时间"`
- // SandboxClassifyId int `description:"分类id"`
- // Sort int `description:"排序"`
- //}
- type Sandbox struct {
- SandboxId int `gorm:"column:sandbox_id;primaryKey"` //`orm:"column(sandbox_id);pk" description:"沙盘id"`
- Name string `description:"沙盘名称"`
- Code string `description:"沙盘code"`
- Content string `description:"沙盘数据"`
- MindmapData string `description:"思维导图数据"`
- PicUrl string `description:"沙盘图片地址"`
- SysUserId int `description:"作者id"`
- SysUserName string `description:"作者名称"`
- IsDelete int8 `description:"是否删除,0:未删除,1:已删除"`
- ModifyTime time.Time `description:"修改时间"`
- CreateTime time.Time `description:"创建时间"`
- SandboxClassifyId int `description:"分类id"`
- Sort int `description:"排序"`
- Style int `description:"风格"`
- }
- func GetSandboxListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*Sandbox, err error) {
- //o := orm.NewOrmUsingDB("data")
- //sql := ` SELECT * FROM sandbox WHERE 1=1 `
- //if condition != "" {
- // sql += condition
- //}
- //sql += " ORDER BY create_time DESC LIMIT ?,? "
- //_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
- sql := ` SELECT * FROM sandbox WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- sql += " ORDER BY create_time DESC LIMIT ?,? "
- pars = append(pars, startSize, pageSize)
- err = global.DmSQL["data"].Raw(sql, pars...).Find(&item).Error
- return
- }
- func GetSandboxListCountByCondition(condition string, pars []interface{}) (count int, err error) {
- //o := orm.NewOrmUsingDB("data")
- //sql := ` SELECT COUNT(1) AS count FROM sandbox WHERE 1=1 `
- //if condition != "" {
- // sql += condition
- //}
- //err = o.Raw(sql, pars).QueryRow(&count)
- sql := ` SELECT COUNT(1) AS count FROM sandbox WHERE 1=1 `
- if condition != "" {
- sql += condition
- }
- err = global.DmSQL["data"].Raw(sql, pars...).Scan(&count).Error
- return
- }
- // ContentDataStruct 沙盘内容结构体
- type ContentDataStruct struct {
- Cells []struct {
- Data *NodeData `json:"data,omitempty"`
- } `json:"cells"`
- }
- type NodeData struct {
- LinkData []*LinkData `json:"linkData"`
- LinkFold bool `json:"linkFold"`
- }
- type LinkData struct {
- RId string `json:"RId"`
- Id int `json:"Id"`
- Name string `json:"Name"`
- Type int `json:"Type"`
- Editing bool `json:"editing"`
- DatabaseType int `json:"databaseType"`
- DetailParams DetailParams `json:"detailParams"`
- }
- type DetailParams struct {
- Code string `json:"code"`
- Id int `json:"id"`
- ClassifyId int `json:"classifyId"`
- }
|