feat: sql解析器替换、工单统一由‘我的流程’发起、流程定义支持自定义条件触发审批、资源隐藏编号、model支持物理删除等

This commit is contained in:
meilin.huang
2024-10-16 17:24:50 +08:00
parent 43edef412c
commit e135e4ce64
170 changed files with 397197 additions and 1251 deletions

View File

@@ -0,0 +1,75 @@
package sqlstmt
import (
"reflect"
"github.com/antlr4-go/antlr/v4"
)
type INode interface {
GetText() string
// GetStartIndex() int
// GetStopIndex() int
}
type Node struct {
// startIndex int
// stopIndex int
parser antlr.Parser
ruleContext antlr.RuleContext
}
func (n *Node) GetText() string {
if n == nil || n.ruleContext == nil || n.parser == nil {
return ""
}
return n.parser.GetTokenStream().GetTextFromRuleContext(n.ruleContext)
}
// func (n *Node) GetStartIndex() int {
// return n.startIndex
// }
// func (n *Node) GetStopIndex() int {
// return n.stopIndex
// }
func NewNode(parser antlr.Parser, ruleContext antlr.RuleContext) *Node {
return &Node{
parser: parser,
ruleContext: ruleContext,
}
}
// func NewNode(startIndex, stopIndex int) *Node {
// return &Node{
// startIndex: startIndex,
// stopIndex: stopIndex,
// }
// }
// func GetText(sqlstmts string, node INode) string {
// return sqlstmts[node.GetStartIndex() : node.GetStopIndex()+1]
// }
type Stmt interface {
INode
}
type SqlStmt struct {
*Node
}
type DmlStmt struct {
SqlStmt
}
type OtherReadStmt struct {
*Node
}
func IsSelectStmt(stmt Stmt) bool {
return reflect.TypeOf(stmt).AssignableTo(reflect.TypeOf(&SelectStmt{}))
}