mirror of
https://gitee.com/XM-GO/PandaX.git
synced 2026-04-23 02:48:34 +08:00
数据集
This commit is contained in:
@@ -31,11 +31,11 @@ func (r *RuleChainApi) RuleChainTest(rc *restfulx.ReqCtx) {
|
|||||||
|
|
||||||
// GetVisualRuleChainList WorkInfo列表数据
|
// GetVisualRuleChainList WorkInfo列表数据
|
||||||
func (p *RuleChainApi) GetVisualRuleChainList(rc *restfulx.ReqCtx) {
|
func (p *RuleChainApi) GetVisualRuleChainList(rc *restfulx.ReqCtx) {
|
||||||
|
data := entity.VisualRuleChain{}
|
||||||
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
pageNum := restfulx.QueryInt(rc, "pageNum", 1)
|
||||||
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
pageSize := restfulx.QueryInt(rc, "pageSize", 10)
|
||||||
ruleName := restfulx.QueryParam(rc, "ruleName")
|
data.RuleName = restfulx.QueryParam(rc, "ruleName")
|
||||||
status := restfulx.QueryParam(rc, "status")
|
data.Status = restfulx.QueryParam(rc, "status")
|
||||||
data := entity.VisualRuleChain{RuleName: ruleName, Status: status}
|
|
||||||
list, total := p.VisualRuleChainApp.FindListPage(pageNum, pageSize, data)
|
list, total := p.VisualRuleChainApp.FindListPage(pageNum, pageSize, data)
|
||||||
|
|
||||||
rc.ResData = model.ResultPage{
|
rc.ResData = model.ResultPage{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ package api
|
|||||||
// 生成人:panda
|
// 生成人:panda
|
||||||
// ==========================================================================
|
// ==========================================================================
|
||||||
import (
|
import (
|
||||||
|
"github.com/XM-GO/PandaKit/biz"
|
||||||
"github.com/XM-GO/PandaKit/model"
|
"github.com/XM-GO/PandaKit/model"
|
||||||
"github.com/XM-GO/PandaKit/restfulx"
|
"github.com/XM-GO/PandaKit/restfulx"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -35,6 +36,15 @@ func (p *VisualDataSetFieldApi) GetVisualDataSetFieldList(rc *restfulx.ReqCtx) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetVisualDataSetFieldListAll DataSetField列表数据
|
||||||
|
func (p *VisualDataSetFieldApi) GetVisualDataSetFieldListAll(rc *restfulx.ReqCtx) {
|
||||||
|
data := entity.VisualDataSetField{}
|
||||||
|
data.TableId = restfulx.QueryParam(rc, "tableId")
|
||||||
|
biz.NotEmpty(data.TableId, "tableId 必传")
|
||||||
|
|
||||||
|
rc.ResData = p.VisualDataSetFieldApp.FindList(data)
|
||||||
|
}
|
||||||
|
|
||||||
// GetVisualDataSetField 获取DataSetField
|
// GetVisualDataSetField 获取DataSetField
|
||||||
func (p *VisualDataSetFieldApi) GetVisualDataSetField(rc *restfulx.ReqCtx) {
|
func (p *VisualDataSetFieldApi) GetVisualDataSetField(rc *restfulx.ReqCtx) {
|
||||||
fieldId := restfulx.PathParam(rc, "fieldId")
|
fieldId := restfulx.PathParam(rc, "fieldId")
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import (
|
|||||||
"pandax/apps/visual/driver"
|
"pandax/apps/visual/driver"
|
||||||
"pandax/apps/visual/entity"
|
"pandax/apps/visual/entity"
|
||||||
"pandax/apps/visual/services"
|
"pandax/apps/visual/services"
|
||||||
|
"pandax/pkg/global"
|
||||||
"pandax/pkg/tool"
|
"pandax/pkg/tool"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -80,7 +81,14 @@ func (p *VisualDataSetTableApi) InsertVisualDataSetTable(rc *restfulx.ReqCtx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
one := p.VisualDataSourceApp.FindOne(data.DataSourceId)
|
one := p.VisualDataSourceApp.FindOne(data.DataSourceId)
|
||||||
|
if driver.TestConnection(one) != nil {
|
||||||
|
one.Status = "0"
|
||||||
|
one := p.VisualDataSourceApp.Update(*one)
|
||||||
|
global.Log.Errorf("数据源:%s不在线", one.SourceName)
|
||||||
|
return
|
||||||
|
}
|
||||||
instance := driver.NewDbInstance(one)
|
instance := driver.NewDbInstance(one)
|
||||||
|
|
||||||
sql := ""
|
sql := ""
|
||||||
if data.TableType == "db" {
|
if data.TableType == "db" {
|
||||||
sql = fmt.Sprintf(`select * from %s LIMIT 1`, info["table"])
|
sql = fmt.Sprintf(`select * from %s LIMIT 1`, info["table"])
|
||||||
|
|||||||
@@ -5,18 +5,22 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type VisualRuleChain struct {
|
type VisualRuleChainBase struct {
|
||||||
UserId string `gorm:"userId;type:varchar(64);comment:用户Id" json:"userId"`
|
UserId string `gorm:"userId;type:varchar(64);comment:用户Id" json:"userId"`
|
||||||
RuleId string `gorm:"primary_key;" json:"ruleId"`
|
RuleId string `gorm:"primary_key;" json:"ruleId"`
|
||||||
RuleName string `gorm:"ruleName;type:varchar(50);comment:名称" json:"ruleName"`
|
RuleName string `gorm:"ruleName;type:varchar(50);comment:名称" json:"ruleName"`
|
||||||
RuleDataJson string `gorm:"ruleDataJson;type:longtext;comment:Json数据" json:"ruleDataJson"`
|
RuleBase64 string `gorm:"ruleBase64;type:longtext;comment:Base64缩略图" json:"ruleBase64"` //缩略图 base64
|
||||||
RuleBase64 string `gorm:"ruleBase64;type:longtext;comment:Base64缩略图" json:"ruleBase64"` //缩略图 base64
|
RuleRemark string `gorm:"ruleRemark;type:varchar(256);comment:说明" json:"ruleRemark"`
|
||||||
RuleRemark string `gorm:"ruleRemark;type:varchar(256);comment:说明" json:"ruleRemark"`
|
Status string `gorm:"status;type:varchar(1);comment:状态" json:"status"`
|
||||||
Status string `gorm:"status;type:varchar(1);comment:状态" json:"status"`
|
Creator string `json:"creator"` //创建者
|
||||||
Creator string `json:"creator"` //创建者
|
|
||||||
model.BaseModel
|
model.BaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type VisualRuleChain struct {
|
||||||
|
VisualRuleChainBase
|
||||||
|
RuleDataJson string `gorm:"ruleDataJson;type:longtext;comment:Json数据" json:"ruleDataJson"`
|
||||||
|
}
|
||||||
|
|
||||||
func (VisualRuleChain) TableName() string {
|
func (VisualRuleChain) TableName() string {
|
||||||
return "visual_rule_chain"
|
return "visual_rule_chain"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,19 +22,23 @@ func (VisualScreenGroup) TableName() string {
|
|||||||
return "visual_screen_group"
|
return "visual_screen_group"
|
||||||
}
|
}
|
||||||
|
|
||||||
type VisualScreen struct {
|
type VisualScreenBase struct {
|
||||||
UserId int64 `gorm:"userId;type:int;comment:用户Id" json:"userId"`
|
UserId int64 `gorm:"userId;type:int;comment:用户Id" json:"userId"`
|
||||||
ScreenId string `gorm:"primary_key;" json:"screenId"`
|
ScreenId string `gorm:"primary_key;" json:"screenId"`
|
||||||
GroupId int64 `gorm:"screenGroup;type:int;comment:分组Id" json:"groupId"`
|
GroupId int64 `gorm:"screenGroup;type:int;comment:分组Id" json:"groupId"`
|
||||||
ScreenName string `gorm:"screenName;type:varchar(50);comment:名称" json:"screenName"`
|
ScreenName string `gorm:"screenName;type:varchar(50);comment:名称" json:"screenName"`
|
||||||
ScreenDataJson string `gorm:"screenDataJson;type:longtext;comment:Json数据" json:"screenDataJson"` //pg 使用类型 text
|
ScreenBase64 string `gorm:"screenBase64;type:longtext;comment:Base64缩略图" json:"screenBase64"` //缩略图 base64
|
||||||
ScreenBase64 string `gorm:"screenBase64;type:longtext;comment:Base64缩略图" json:"screenBase64"` //缩略图 base64
|
ScreenRemark string `gorm:"screenRemark;type:varchar(255);comment:说明" json:"screenRemark"`
|
||||||
ScreenRemark string `gorm:"screenRemark;type:varchar(255);comment:说明" json:"screenRemark"`
|
Status string `gorm:"status;type:varchar(1);comment:状态" json:"status"`
|
||||||
Status string `gorm:"status;type:varchar(1);comment:状态" json:"status"`
|
Creator string `json:"creator"` //创建者
|
||||||
Creator string `json:"creator"` //创建者
|
|
||||||
model.BaseModel
|
model.BaseModel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type VisualScreen struct {
|
||||||
|
VisualScreenBase
|
||||||
|
ScreenDataJson string `gorm:"screenDataJson;type:longtext;comment:Json数据" json:"screenDataJson"` //pg 使用类型 text
|
||||||
|
}
|
||||||
|
|
||||||
func (VisualScreen) TableName() string {
|
func (VisualScreen) TableName() string {
|
||||||
return "visual_screen"
|
return "visual_screen"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,13 @@ func InitVisualDataSetFieldRouter(container *restful.Container) {
|
|||||||
Writes(model.ResultPage{}).
|
Writes(model.ResultPage{}).
|
||||||
Returns(200, "OK", model.ResultPage{}))
|
Returns(200, "OK", model.ResultPage{}))
|
||||||
|
|
||||||
|
ws.Route(ws.GET("/list/all").To(func(request *restful.Request, response *restful.Response) {
|
||||||
|
restfulx.NewReqCtx(request, response).WithNeedCasbin(false).WithLog("获取DataSetField列表").Handle(s.GetVisualDataSetFieldListAll)
|
||||||
|
}).
|
||||||
|
Doc("获取DataSetField列表").
|
||||||
|
Param(ws.QueryParameter("tableId", "tableId").Required(true).DataType("string")).
|
||||||
|
Metadata(restfulspec.KeyOpenAPITags, tags))
|
||||||
|
|
||||||
ws.Route(ws.GET("/{fieldId}").To(func(request *restful.Request, response *restful.Response) {
|
ws.Route(ws.GET("/{fieldId}").To(func(request *restful.Request, response *restful.Response) {
|
||||||
restfulx.NewReqCtx(request, response).WithNeedCasbin(false).WithLog("获取DataSetField信息").Handle(s.GetVisualDataSetField)
|
restfulx.NewReqCtx(request, response).WithNeedCasbin(false).WithLog("获取DataSetField信息").Handle(s.GetVisualDataSetField)
|
||||||
}).
|
}).
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type (
|
|||||||
VisualRuleChainModel interface {
|
VisualRuleChainModel interface {
|
||||||
Insert(data entity.VisualRuleChain) *entity.VisualRuleChain
|
Insert(data entity.VisualRuleChain) *entity.VisualRuleChain
|
||||||
FindOne(id string) *entity.VisualRuleChain
|
FindOne(id string) *entity.VisualRuleChain
|
||||||
FindListPage(page, pageSize int, data entity.VisualRuleChain) (*[]entity.VisualRuleChain, int64)
|
FindListPage(page, pageSize int, data entity.VisualRuleChain) (*[]entity.VisualRuleChainBase, int64)
|
||||||
FindList(data entity.VisualRuleChain) *[]entity.VisualRuleChain
|
FindList(data entity.VisualRuleChain) *[]entity.VisualRuleChain
|
||||||
Update(data entity.VisualRuleChain) *entity.VisualRuleChain
|
Update(data entity.VisualRuleChain) *entity.VisualRuleChain
|
||||||
Delete(ids []string)
|
Delete(ids []string)
|
||||||
@@ -45,8 +45,8 @@ func (m *ruleChainModelImpl) FindOne(id string) *entity.VisualRuleChain {
|
|||||||
return resData
|
return resData
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ruleChainModelImpl) FindListPage(page, pageSize int, data entity.VisualRuleChain) (*[]entity.VisualRuleChain, int64) {
|
func (m *ruleChainModelImpl) FindListPage(page, pageSize int, data entity.VisualRuleChain) (*[]entity.VisualRuleChainBase, int64) {
|
||||||
list := make([]entity.VisualRuleChain, 0)
|
list := make([]entity.VisualRuleChainBase, 0)
|
||||||
var total int64 = 0
|
var total int64 = 0
|
||||||
offset := pageSize * (page - 1)
|
offset := pageSize * (page - 1)
|
||||||
db := global.Db.Table(m.table)
|
db := global.Db.Table(m.table)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ type (
|
|||||||
VisualScreenModel interface {
|
VisualScreenModel interface {
|
||||||
Insert(data entity.VisualScreen) *entity.VisualScreen
|
Insert(data entity.VisualScreen) *entity.VisualScreen
|
||||||
FindOne(screenId string) *entity.VisualScreen
|
FindOne(screenId string) *entity.VisualScreen
|
||||||
FindListPage(page, pageSize int, data entity.VisualScreen) (*[]entity.VisualScreen, int64)
|
FindListPage(page, pageSize int, data entity.VisualScreen) (*[]entity.VisualScreenBase, int64)
|
||||||
FindList(data entity.VisualScreen) *[]entity.VisualScreen
|
FindList(data entity.VisualScreen) *[]entity.VisualScreen
|
||||||
Update(data entity.VisualScreen) *entity.VisualScreen
|
Update(data entity.VisualScreen) *entity.VisualScreen
|
||||||
Delete(screenIds []string)
|
Delete(screenIds []string)
|
||||||
@@ -45,8 +45,8 @@ func (m *screenModelImpl) FindOne(screenId string) *entity.VisualScreen {
|
|||||||
return resData
|
return resData
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *screenModelImpl) FindListPage(page, pageSize int, data entity.VisualScreen) (*[]entity.VisualScreen, int64) {
|
func (m *screenModelImpl) FindListPage(page, pageSize int, data entity.VisualScreen) (*[]entity.VisualScreenBase, int64) {
|
||||||
list := make([]entity.VisualScreen, 0)
|
list := make([]entity.VisualScreenBase, 0)
|
||||||
var total int64 = 0
|
var total int64 = 0
|
||||||
offset := pageSize * (page - 1)
|
offset := pageSize * (page - 1)
|
||||||
db := global.Db.Table(m.table)
|
db := global.Db.Table(m.table)
|
||||||
|
|||||||
Reference in New Issue
Block a user