32 changed files with 5104 additions and 93 deletions
@ -0,0 +1,202 @@ |
|||
package datacenter |
|||
|
|||
import ( |
|||
"appPlatform/overall/publicmethod" |
|||
"encoding/json" |
|||
"fmt" |
|||
"net/url" |
|||
"strings" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
/* |
|||
* |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-04-18 15:37:05 |
|||
@ 功能: 通用地址 |
|||
@ 参数 |
|||
|
|||
# |
|||
|
|||
@ 返回值 |
|||
|
|||
# |
|||
|
|||
@ 方法原型 |
|||
|
|||
# |
|||
*/ |
|||
func (a *ApiMethod) GaindataCenter(c *gin.Context) { |
|||
var requestData DataInfo |
|||
c.ShouldBindJSON(&requestData) |
|||
if requestData.Url == "" { |
|||
publicmethod.Result(1, requestData, c, "未知访问地址") |
|||
return |
|||
} |
|||
// publicmethod.Result(1, requestData, c, "未知访问地址")
|
|||
// return
|
|||
if requestData.Where != "" { |
|||
if requestData.Method == "GET" { |
|||
var whereAry []string |
|||
whyOne := strings.Split(requestData.Where, "&") |
|||
if len(whyOne) > 0 { |
|||
for _, v := range whyOne { |
|||
whyTwo := strings.Split(v, "=") |
|||
if len(whyTwo) == 2 { |
|||
whereAry = append(whereAry, fmt.Sprintf("%v=%v", whyTwo[0], url.QueryEscape(whyTwo[1]))) |
|||
} else { |
|||
whereAry = append(whereAry, v) |
|||
} |
|||
} |
|||
} |
|||
getUrl := requestData.Url |
|||
if len(whereAry) > 0 { |
|||
getUrl = fmt.Sprintf("%v?%v", requestData.Url, strings.Join(whereAry, "&")) |
|||
} |
|||
|
|||
// getUrl = url.QueryEscape(getUrl)
|
|||
// fmt.Printf("%T--------->%v\n", getUrl, getUrl)
|
|||
getData := publicmethod.CurlGet(getUrl) |
|||
var sendMap map[string]interface{} |
|||
json.Unmarshal(getData, &sendMap) |
|||
// fmt.Printf("%T--------->%v--------->%v\n", sendMap, sendMap, getUrl)
|
|||
// publicmethod.Result(0, sendMap, c)
|
|||
shenData := publicmethod.MapOut[string]() |
|||
if code, ok := sendMap["code"]; ok { |
|||
|
|||
if codeIn, ok := code.(float64); ok { |
|||
if codeIn == 200 { |
|||
shenData["code"] = 0 |
|||
} else { |
|||
shenData["code"] = codeIn |
|||
} |
|||
} |
|||
|
|||
} |
|||
if msg, ok := sendMap["msg"]; ok { |
|||
shenData["msg"] = msg |
|||
} |
|||
if data, ok := sendMap["data"]; ok { |
|||
shenData["data"] = data |
|||
} |
|||
publicmethod.ResultInterface(sendMap, c) |
|||
return |
|||
} else { |
|||
getData := publicmethod.CurlPostJosn(requestData.Url, []byte(requestData.Where)) |
|||
var sendMap map[string]interface{} |
|||
json.Unmarshal(getData, &sendMap) |
|||
publicmethod.ResultInterface(sendMap, c) |
|||
return |
|||
} |
|||
} else { |
|||
if requestData.Method == "GET" { |
|||
getUrl := fmt.Sprintf("%v", requestData.Url) |
|||
getData := publicmethod.CurlGet(getUrl) |
|||
var sendMap map[string]interface{} |
|||
json.Unmarshal(getData, &sendMap) |
|||
// publicmethod.Result(0, sendMap, c)
|
|||
shenData := publicmethod.MapOut[string]() |
|||
if code, ok := sendMap["code"]; ok { |
|||
if codeIn, ok := code.(float64); ok { |
|||
if codeIn == 200 { |
|||
shenData["code"] = 0 |
|||
} else { |
|||
shenData["code"] = codeIn |
|||
} |
|||
} |
|||
|
|||
} |
|||
if msg, ok := sendMap["msg"]; ok { |
|||
shenData["msg"] = msg |
|||
} |
|||
if data, ok := sendMap["data"]; ok { |
|||
shenData["data"] = data |
|||
} |
|||
publicmethod.ResultInterface(sendMap, c) |
|||
return |
|||
} else { |
|||
getData := publicmethod.CurlPostJosn(requestData.Url, []byte("")) |
|||
var sendMap map[string]interface{} |
|||
json.Unmarshal(getData, &sendMap) |
|||
shenData := publicmethod.MapOut[string]() |
|||
if code, ok := sendMap["code"]; ok { |
|||
if codeIn, ok := code.(float64); ok { |
|||
if codeIn == 200 { |
|||
shenData["code"] = 0 |
|||
} else { |
|||
shenData["code"] = codeIn |
|||
} |
|||
} |
|||
|
|||
} |
|||
if msg, ok := sendMap["msg"]; ok { |
|||
shenData["msg"] = msg |
|||
} |
|||
publicmethod.ResultInterface(sendMap, c) |
|||
return |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* |
|||
* |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-04-19 14:05:46 |
|||
@ 功能: 数据中台POST提交数据 |
|||
@ 参数 |
|||
|
|||
# |
|||
|
|||
@ 返回值 |
|||
|
|||
# |
|||
|
|||
@ 方法原型 |
|||
|
|||
# |
|||
*/ |
|||
func (a *ApiMethod) PostSaveData(c *gin.Context) { |
|||
var requestData DataInfoPost |
|||
c.ShouldBindJSON(&requestData) |
|||
if requestData.Url == "" { |
|||
publicmethod.Result(1, requestData, c, "未知访问地址") |
|||
return |
|||
} |
|||
dataJson, err := json.Marshal(requestData.DataInfo) |
|||
shenData := publicmethod.MapOut[string]() |
|||
if err != nil { |
|||
shenData["code"] = 10001 |
|||
shenData["msg"] = err |
|||
publicmethod.ResultInterface(shenData, c) |
|||
return |
|||
} |
|||
callBackBtye := publicmethod.CurlPostJosn(requestData.Url, dataJson) |
|||
var sendMap map[string]interface{} |
|||
err = json.Unmarshal(callBackBtye, &sendMap) |
|||
if err != nil { |
|||
shenData["code"] = 10001 |
|||
shenData["msg"] = err |
|||
publicmethod.ResultInterface(shenData, c) |
|||
return |
|||
} |
|||
if code, ok := sendMap["code"]; ok { |
|||
|
|||
if codeIn, ok := code.(float64); ok { |
|||
if codeIn == 200 { |
|||
shenData["code"] = 0 |
|||
} else { |
|||
shenData["code"] = codeIn |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
if msg, ok := sendMap["msg"]; ok { |
|||
shenData["msg"] = msg |
|||
} |
|||
if data, ok := sendMap["data"]; ok { |
|||
shenData["data"] = data |
|||
} |
|||
publicmethod.ResultInterface(shenData, c) |
|||
} |
|||
@ -0,0 +1,49 @@ |
|||
package datacenter |
|||
|
|||
import ( |
|||
"appPlatform/overall/publicmethod" |
|||
"sync" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 协程设置
|
|||
var syncSeting = sync.WaitGroup{} |
|||
|
|||
type ApiMethod struct{} |
|||
|
|||
/* |
|||
* |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-04-18 15:28:20 |
|||
@ 功能: 数据中台入口 |
|||
@ 参数 |
|||
|
|||
# |
|||
|
|||
@ 返回值 |
|||
|
|||
# |
|||
|
|||
@ 方法原型 |
|||
|
|||
# |
|||
*/ |
|||
func (a *ApiMethod) Index(c *gin.Context) { |
|||
outputCont := publicmethod.MapOut[string]() |
|||
outputCont["index"] = "数据中台入口" |
|||
publicmethod.Result(0, outputCont, c) |
|||
} |
|||
|
|||
// 接收参数
|
|||
type DataInfo struct { |
|||
Url string `json:"url"` |
|||
Method string `json:"methodType"` |
|||
Where string `json:"where"` |
|||
} |
|||
|
|||
// 接收POST请求
|
|||
type DataInfoPost struct { |
|||
Url string `json:"url"` |
|||
DataInfo interface{} `json:"dataInfo"` |
|||
} |
|||
@ -0,0 +1,186 @@ |
|||
package taskmanagement |
|||
|
|||
import "appPlatform/overall/publicmethod" |
|||
|
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2024-04-09 10:56:48 |
|||
@ 功能: 工作流结构主体 |
|||
*/ |
|||
type FlowMainBody struct { |
|||
TableId string `json:"tableId"` //工作流识别吗
|
|||
WorkFlowDef WorkFlowDefInfo `json:"workFlowDef"` //工作流主体属性
|
|||
DirectorMaxLevel int `json:"directorMaxLevel"` //审批主管最大层级
|
|||
FlowPermission []FlowPermissionInfo `json:"flowPermission"` //流程发起人
|
|||
NodeConfig NodePublicInfo `json:"nodeConfig"` //节点信息内容
|
|||
} |
|||
|
|||
//工作流主体属性
|
|||
type WorkFlowDefInfo struct { |
|||
FormKey string `json:"formKey"` //关联操作ID
|
|||
publicmethod.PublicName //姓名
|
|||
} |
|||
|
|||
//流程节点
|
|||
type NodePublicInfo struct { |
|||
NodePublicInfoES |
|||
Settype int `json:"settype"` // 审批人设置 1:指定成员; 2:主管;3:行政岗位; 4:发起人自选; 5:发起人自己;6:连续多级主管;7:指定前置审批为本节点设置审批人;8:表单字段;9:权限矩阵
|
|||
SelectMode int `json:"selectMode"` //审批人数 1选一个人 2选多个人
|
|||
SelectRange int `json:"selectRange"` //选择范围 1.全公司 2指定成员 3指定角色
|
|||
DirectorLevel int `json:"directorLevel"` //审批终点 最高层主管数
|
|||
ExamineMode int `json:"examineMode"` //多人审批时采用的审批方式 1:依次审批; 2:会签;3:非会签
|
|||
NoHanderAction int `json:"noHanderAction"` //审批人为空时 1自动审批通过/不允许发起 2转交给审核管理员
|
|||
ExamineEndDirectorLevel int `json:"examineEndDirectorLevel"` //审批终点 第n层主管
|
|||
SendBackNode string `json:"sendBackNode"` //退回哪个节点
|
|||
CustomNode string `json:"customNode"` //指定前置审批为本节点设置审批人
|
|||
|
|||
ConditionNodes []NodePublicInfoES `json:"conditionNodes"` //判断条件,当节点是路由时有效
|
|||
Executionaddress string `json:"executionaddress"` //第三方执行地址
|
|||
|
|||
ChildNode *NodePublicInfo `json:"childNode"` //子节点
|
|||
Matrix MatrixInfo `json:"matrix"` //
|
|||
} |
|||
|
|||
type NodePublicInfoES struct { |
|||
NodeNumber string `json:"nodeNumber"` //节点识别符
|
|||
NodeName string `json:"nodeName"` //节点名称
|
|||
Types int `json:"type"` //0:发起人;1:审批;2:抄送;3:执行人;4:条件;5:路由
|
|||
FromNode string `json:"fromNode"` //来源节点
|
|||
GotoNode []string `json:"gotoNode"` //流向节点
|
|||
PriorityLevel int `json:"priorityLevel"` // 条件优先级
|
|||
Attribute int `json:"attribute"` //属性 1:申请人为基线;2:目标人为基线
|
|||
Errors bool `json:"error"` //当前审批是否通过校验
|
|||
CcSelfSelectFlag int `json:"ccSelfSelectFlag"` //允许发起人自选抄送人(0:不允许;1:允许)
|
|||
NodeUserList []NodeUserListInfo `json:"nodeUserList"` //操作人
|
|||
ConditionList []ConditionListInfo `json:"conditionList"` //判断条件主体
|
|||
ChildNode *NodePublicInfo `json:"childNode"` //子节点
|
|||
} |
|||
|
|||
//节点执行人
|
|||
type NodeUserListInfo struct { |
|||
FlowPermissionInfo |
|||
publicmethod.CommonId[string] |
|||
publicmethod.PublicName |
|||
Options []OptionsInfo `json:"options"` //可选项(用于关联表单使用)
|
|||
IsCheckbox bool `json:"isCheckbox"` //结果值多选
|
|||
} |
|||
|
|||
//人员;角色;行政组织;职务通用结构体
|
|||
type FlowPermissionInfo struct { |
|||
Types int `json:"type"` //1:人员;2:角色;3:行政组织;4:职务
|
|||
TargetId string `json:"targetId"` //相关内容识别符
|
|||
publicmethod.PublicName //相关内容名称
|
|||
Icon string `json:"icon"` //头像
|
|||
IconToBase64 string `json:"iconToBase64"` //头像Base64
|
|||
} |
|||
|
|||
//矩阵信息
|
|||
type MatrixInfo struct { |
|||
MatrixId int64 `json:"matrixid"` |
|||
FactorId int64 `json:"factorid"` |
|||
OutcomeId int64 `json:"outcomeid"` |
|||
MatrixName string `json:"matrixName"` |
|||
FactorName string `json:"factorName"` |
|||
OutcomeName string `json:"outcomeName"` |
|||
} |
|||
|
|||
//判断条件主体
|
|||
type ConditionListInfo struct { |
|||
publicmethod.CommonId[int] //条件顺序
|
|||
publicmethod.PublicName //条件名称
|
|||
Factorid string `json:"factorid"` //条件识别字段
|
|||
Types int `json:"type"` //条件类型:1:人员、行政组织、角色;2:自定义字段;3:关联表单字段;
|
|||
Isok bool `json:"isok"` //页面渲染使用
|
|||
IsCheckbox bool `json:"isCheckbox"` //结果值多选
|
|||
Options []OptionsInfo `json:"options"` //可选项(用于关联表单使用)
|
|||
Oneanswer string `json:"oneanswer"` //可选项锚定值(用于关联表单使用)
|
|||
Answers []string `json:"answers"` //可选项锚定值(用于关联表单使用)
|
|||
CustomFields []CustomFieldsInfo `json:"customFields"` //自定义字段条件主体
|
|||
NodeUserList []FlowPermissionInfo `json:"nodeUserList"` //人员、行政组织、角色为条件主体
|
|||
} |
|||
|
|||
//可选项(用于关联表单使用)
|
|||
type OptionsInfo struct { |
|||
Label string `json:"label"` //名称
|
|||
Value string `json:"value"` //值
|
|||
} |
|||
|
|||
//自定义字段条件主体
|
|||
type CustomFieldsInfo struct { |
|||
Wordfield string `json:"wordfield"` //判断字段
|
|||
OptType string `json:"optType"` //判定方法(1:小于;2:大于;3:小于等于;4:等于;5:大于等于;6:介于两数之间;7:包含;8:不包含)
|
|||
LeftVal string `json:"leftval"` //左侧值
|
|||
LeftOptType string `json:"leftoptType"` //OptType值为6时;左侧判定方法
|
|||
RightOptType string `json:"rightoptType"` //OptType值为6时;右侧判定方法
|
|||
RightVal string `json:"rightval"` //OptType值为6时;右侧值
|
|||
} |
|||
|
|||
//输出工作流相关操作
|
|||
type SendFlowInfo struct { |
|||
Step int `json:"Step"` //当前执行第几步
|
|||
NodeKey string `json:"nodeKey"` //当前节点标识
|
|||
NextStep int `json:"nextStep"` //下一步执行第几步
|
|||
FlowList []RunFlow `json:"flowList"` //流程主体
|
|||
} |
|||
|
|||
/** |
|||
@ 作者: 秦东 |
|||
@ 时间: 2023-11-01 09:12:18 |
|||
@ 功能: 流程执行体 |
|||
*/ |
|||
type RunFlow struct { |
|||
Step int `json:"step"` //步骤
|
|||
Types int `json:"type"` //0:发起节点;1:审批节点;2:抄送;3:执行节点
|
|||
NodeKey string `json:"nodeKey"` //节点识别符
|
|||
NodeName string `json:"nodeName"` //节点名称
|
|||
Status int `json:"status"` //1:未到达;2:已审批;3:已驳回;4:再次审批
|
|||
FromNode string `json:"fromnode"` //来至哪个节点
|
|||
ArriveNode string `json:"arrivenode"` //到哪个节点
|
|||
GoBackNode string `json:"gobacknode"` //驳回返回节点
|
|||
ExamineMode int `json:"examinemode"` //多人审批时采用的审批方式。0:无操作 1依次审批 2会签 3:非会签
|
|||
NoHanderAction int `json:"nohanderaction"` //审批人为空时 1自动审批通过/不允许发起 2转交给审核管理员
|
|||
CustomNode string `json:"customNode"` //由哪个节点指定本节点审批人
|
|||
JudgeList bool `json:"judgelist"` //是否可自己选中操作人
|
|||
Operator []OperatorList `json:"operator"` //操作人
|
|||
PendPers []OperatorList `json:"pendpers"` //操作人ssss
|
|||
RunType int `json:"runtype"` //运行时选择 0:禁闭;1:发起人自选,2:发起人自己,3:有选中得节点指定,4:抄送节点
|
|||
RunScope int `json:"runscope"` //运行时选择范围 0:不可选,1:本公司;2:本部门;当RunType = 4时:1:自选;非1:不可自选
|
|||
// Operational bool `json:"operational"` //是否可提交审批意见
|
|||
} |
|||
|
|||
//操作人
|
|||
type OperatorList struct { |
|||
Id string `json:"id"` //操作人ID
|
|||
Types int `json:"type"` //1:人员;2:角色;3:行政组织
|
|||
Name string `json:"name"` //操作人姓名
|
|||
Number string `json:"number"` //操作人工号
|
|||
Icon string `json:"icon"` //操作人头像
|
|||
IconBase64 string `json:"iconbase64"` //操作人头像
|
|||
Wechat string `json:"wechat"` //微信Openid
|
|||
DepartmentId int64 `json:"departmentid"` //分厂Id
|
|||
DepartmentName string `json:"departmentname"` //分厂名称
|
|||
PostId int64 `json:"postid"` //职务Id
|
|||
PostName string `json:"postname"` //职务名称
|
|||
Tema int64 `json:"tema"` //班组Id
|
|||
TemaName string `json:"temaname"` //班组名称
|
|||
LogList []LogList `json:"log"` //操作记录
|
|||
NoEdit bool `json:"noedit"` //不可删除
|
|||
Tel string `json:"tel"` //电话
|
|||
CompanyName string `json:"companyName"` //公司
|
|||
} |
|||
|
|||
// 节点操作人操作记录
|
|||
type LogList struct { |
|||
State int `json:"state"` //状态 1、未操作;2、通过;3、驳回;4、已查看
|
|||
TimeVal string `json:"time"` |
|||
Cause string `json:"cause"` //审批意见
|
|||
Enclosure []EnclosureFormat `json:"enclosure"` //附件
|
|||
UID string `json:"uid"` //当前执行识别符
|
|||
} |
|||
|
|||
// 附件格式
|
|||
type EnclosureFormat struct { |
|||
FileName string `json:"filename"` //附件名称
|
|||
FilePath string `json:"filepath"` //附件地址
|
|||
Type int `json:"type"` //附件类型
|
|||
} |
|||
@ -0,0 +1,30 @@ |
|||
package taskmanagement |
|||
|
|||
import "appPlatform/overall/publicmethod" |
|||
|
|||
// 启动流程
|
|||
type StartWorkFlow struct { |
|||
publicmethod.PublicId |
|||
FlowList []RunFlow `json:"flowList"` //流程主体
|
|||
State int `json:"state"` //状态状态:1、草稿;2:驳回;3:审批中;4:归档;5:删除
|
|||
} |
|||
|
|||
// 流程执行
|
|||
type RunWorkFlow struct { |
|||
Step int //执行哪一步
|
|||
NextStep int //下一步
|
|||
TotalSteps int //总步数
|
|||
FlowList []RunFlow //流程
|
|||
Participant []string //参与人
|
|||
NewFlowList []RunFlow //流程
|
|||
Uuid int64 //
|
|||
RunUid int64 //执行Uid
|
|||
IsRun bool //是否结束执行
|
|||
Msg string //执行说明
|
|||
} |
|||
type SubmitAppResults struct { |
|||
publicmethod.PublicId |
|||
AgreeOrRefuse int `json:"agreeOrRefuse"` //1:同意;2:驳回
|
|||
Suggest string `json:"suggest"` //审批意见
|
|||
FlowList []RunFlow `json:"flowlist"` //执行流程
|
|||
} |
|||
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -0,0 +1,21 @@ |
|||
package datacenterrouter |
|||
|
|||
import ( |
|||
"appPlatform/api/version1" |
|||
|
|||
"github.com/gin-gonic/gin" |
|||
) |
|||
|
|||
// 权限矩阵PC端
|
|||
func (a *ApiRouter) RouterGroupPc(router *gin.RouterGroup) { |
|||
apiRouter := router.Group("dataCenter") |
|||
//var methodBinding = version1.AppApiEntry.CustomerFormApi
|
|||
dataApi := version1.AppApiEntry.DataCenterApi |
|||
{ |
|||
apiRouter.GET("", dataApi.Index) //入口
|
|||
apiRouter.POST("", dataApi.Index) //入口
|
|||
|
|||
apiRouter.POST("gaindataCenter", dataApi.GaindataCenter) //通用地址
|
|||
apiRouter.POST("postSaveData", dataApi.PostSaveData) //数据中台POST提交数据
|
|||
} |
|||
} |
|||
@ -0,0 +1,4 @@ |
|||
package datacenterrouter |
|||
|
|||
//公共路由
|
|||
type ApiRouter struct{} |
|||
@ -0,0 +1,76 @@ |
|||
package customerForm |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 工作流执行主体
|
|||
// 字典类型
|
|||
type RunWorkflow struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
FlowKey int64 `json:"flowKey" gorm:"column:flow_key;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` |
|||
Version string `json:"version" gorm:"column:version;type:varchar(255);default:'';comment:使用得版本"` |
|||
Status int `json:"status" gorm:"column:status;type:int(1) unsigned;default:1;not null;comment:状态:1、草稿;2:驳回;3:通过;4:归档;5:删除"` |
|||
FlowCont string `json:"flowcont" gorm:"column:flow_cont;type:longtext;comment:流程执行体"` |
|||
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` |
|||
CurrentStep int `json:"currentStep" gorm:"column:current_step;type:int(4) unsigned;default:1;not null;comment:当前节点"` |
|||
NextStep int `json:"nextStep" gorm:"column:next_step;type:int(4) unsigned;default:0;not null;comment:下一个节点。0:代表没有下一个节点。流程结束"` |
|||
NextExecutor string `json:"nextExecutor" gorm:"column:next_executor;type:mediumtext;default:'';comment:下一步执行人"` |
|||
Participants string `json:"participants" gorm:"column:participants;type:longtext;comment:参与人"` |
|||
StartTime int64 `json:"startTime" gorm:"column:start_time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
UpdateTime int64 `json:"update_time" gorm:"column:update_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
VersionCont string `json:"versionCont" gorm:"column:version_cont;type:longtext;comment:版本流程内容"` |
|||
RunKey int64 `json:"runKey" gorm:"column:runKey;type:bigint(20) unsigned;default:0;not null;comment:当前执行识别符"` |
|||
} |
|||
|
|||
func (RunWorkflow *RunWorkflow) TableName() string { |
|||
return "runWorkflow" |
|||
} |
|||
|
|||
// 写入内容
|
|||
func (cont *RunWorkflow) WriteCont() (err error) { |
|||
err = overall.CONSTANT_DB_CustomerForm.Create(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *RunWorkflow) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *RunWorkflow) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *RunWorkflow) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_CustomerForm.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *RunWorkflow) ContMap(whereMap interface{}, field ...string) (countAry []RunWorkflow, err error) { |
|||
gormDb := overall.CONSTANT_DB_CustomerForm.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *RunWorkflow) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_CustomerForm.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
@ -0,0 +1,67 @@ |
|||
package modelAppPlatform |
|||
|
|||
import ( |
|||
"appPlatform/overall" |
|||
"strings" |
|||
) |
|||
|
|||
// 自定义表单消息推送规则
|
|||
type MsgRule struct { |
|||
Id int64 `json:"id" gorm:"primaryKey;column:id;type:bigint(20) unsigned;not null;comment:Id;index"` |
|||
FlowKey int64 `json:"flowKey" gorm:"column:formKey;type:bigint(20) unsigned;default:0;not null;comment:工作流主体"` |
|||
Creater int64 `json:"creater" gorm:"column:creater;type:bigint(20) unsigned;default:0;not null;comment:流程发起人"` |
|||
RuleCont string `json:"ruleCont" gorm:"column:ruleCont;type:mediumtext;default:'';comment:规则字符串"` |
|||
StartTime int64 `json:"time" gorm:"column:time;type:bigint(20) unsigned;default:0;not null;comment:创建时间"` |
|||
UpdateTime int64 `json:"editTime" gorm:"column:edit_time;type:bigint(20) unsigned;default:0;not null;comment:编辑时间"` |
|||
} |
|||
|
|||
func (MsgRule *MsgRule) TableName() string { |
|||
return "msgrule" |
|||
} |
|||
|
|||
// 写入内容
|
|||
func (cont *MsgRule) WriteCont() (err error) { |
|||
err = overall.CONSTANT_DB_AppPlatform.Create(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 编辑内容
|
|||
func (cont *MsgRule) EiteCont(whereMap interface{}, saveData interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Updates(saveData).Error |
|||
return |
|||
} |
|||
|
|||
// 获取内容
|
|||
func (cont *MsgRule) GetCont(whereMap interface{}, field ...string) (err error) { |
|||
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
gormDb = gormDb.Where(whereMap) |
|||
err = gormDb.First(&cont).Error |
|||
return |
|||
} |
|||
|
|||
// 根据条件获取总数
|
|||
func (cont *MsgRule) CountCont(whereMap interface{}) (countId int64) { |
|||
overall.CONSTANT_DB_AppPlatform.Model(&cont).Where(whereMap).Count(&countId) |
|||
return |
|||
} |
|||
|
|||
// 读取全部信息
|
|||
func (cont *MsgRule) ContMap(whereMap interface{}, field ...string) (countAry []MsgRule, err error) { |
|||
gormDb := overall.CONSTANT_DB_AppPlatform.Model(&cont) |
|||
if len(field) > 0 { |
|||
fieldStr := strings.Join(field, ",") |
|||
gormDb = gormDb.Select(fieldStr) |
|||
} |
|||
err = gormDb.Where(whereMap).Find(&countAry).Error |
|||
return |
|||
} |
|||
|
|||
// 删除内容
|
|||
func (cont *MsgRule) DelCont(whereMap interface{}) (err error) { |
|||
err = overall.CONSTANT_DB_AppPlatform.Where(whereMap).Delete(&cont).Error |
|||
return |
|||
} |
|||
Loading…
Reference in new issue