12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- package sandbox
- import (
- "github.com/beego/beego/v2/client/orm"
- "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 `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)
- 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)
- 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"`
- }
|