|
|
/**
|
|
|
* @Title:
|
|
|
* @Description:
|
|
|
* @Author: Yuki Wong(iyuki0430@msn.com)
|
|
|
* @Update:
|
|
|
* @Date: 2020/7/20 11:50
|
|
|
* @File: DataerrorOpenAPI.go
|
|
|
* @Software: GoLand
|
|
|
**/
|
|
|
package DataerrorOpenAPI
|
|
|
|
|
|
import (
|
|
|
"dsSupport/MyModel/DataError/DataerrorService"
|
|
|
"dsSupport/MyModel/MySwagger"
|
|
|
"fmt"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"net/http"
|
|
|
)
|
|
|
|
|
|
// 获取数据异常表 godoc
|
|
|
// @Summary 获取数据异常列表
|
|
|
// @Description json:"id" xorm:"not null pk comment('ID') VARCHAR(36)"
|
|
|
// @Description json:"`system_id`" xorm:"not null comment('数据提供系统编码') VARCHAR(36)"
|
|
|
// @Description json:"`datasource_id`" xorm:"not null comment('数据源编码') VARCHAR(36)"
|
|
|
// @Description json:"`org_id`" xorm:"not null comment('数据机构ID【输入参数】') VARCHAR(36)"
|
|
|
// @Description json:"data_id" xorm:"not null comment('数据ID【输入参数】') VARCHAR(36)"
|
|
|
// @Description json:"data_content" xorm:"default 'NULL' comment('数据内容【Json格式输入参数】') VARCHAR"
|
|
|
// @Description json:"file_uri" xorm:"default 'NULL' comment('文件地址【文件交换】') VARCHAR(500)"
|
|
|
// @Description json:"error_info" xorm:"default 'NULL' comment('错误信息说明') VARCHAR(5000)"
|
|
|
// @Description json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME"
|
|
|
// @Description json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME"
|
|
|
// @Description json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME"
|
|
|
// @Description json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认1,1:启用,-1:禁用】') INT(11)"
|
|
|
// @Description json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-1,1:删除,-1:正常】') INT(11)"
|
|
|
// @Description json:"page" example:"1"
|
|
|
// @Tags dataerror
|
|
|
// @ID readDataerror
|
|
|
// @Accept json
|
|
|
// @Produce json
|
|
|
// @Param input body MySwagger.DataerrorSwag true "数据异常"
|
|
|
// @Success 200 {object} MySwagger.Result
|
|
|
// @Failure 400 {object} MySwagger.Result
|
|
|
// @Router /v1/openapi/dataerror/ReadDataerror [post]
|
|
|
func ReadDataerror(c *gin.Context) {
|
|
|
var raw MySwagger.DataerrorSwag
|
|
|
|
|
|
//input.AuthToken = c.Request.Header["Authorization"][0]
|
|
|
|
|
|
if err := c.ShouldBindJSON(&raw); err != nil {
|
|
|
c.JSON(http.StatusBadRequest, MySwagger.Result{Success: false, Message: "接入系统数据JSON格式错误"})
|
|
|
fmt.Println(err)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
success, message, count, data, _ := DataerrorService.GetDataerrorResults(raw)
|
|
|
|
|
|
if success {
|
|
|
c.JSON(http.StatusOK, MySwagger.Result{
|
|
|
Success: true,
|
|
|
Fail: false,
|
|
|
Message: message,
|
|
|
Total: count,
|
|
|
Data: data,
|
|
|
})
|
|
|
|
|
|
return
|
|
|
} else {
|
|
|
c.JSON(http.StatusOK, MySwagger.Result{
|
|
|
Success: false,
|
|
|
Fail: true,
|
|
|
Message: message,
|
|
|
})
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
// 删除数据异常 godoc
|
|
|
// @Summary 删除数据异常
|
|
|
// @Description `*`json:"id" xorm:"not null pk comment('ID') VARCHAR(36)"
|
|
|
// @Tags dataerror
|
|
|
// @ID deleteDataerror
|
|
|
// @Accept json
|
|
|
// @Produce json
|
|
|
// @Param id path string true "数据异常ID"
|
|
|
// @Success 200 {object} MySwagger.Result
|
|
|
// @Failure 400 {object} MySwagger.Result
|
|
|
// @Router /v1/openapi/dataerror/DeleteDataerror/{id} [post]
|
|
|
func DeleteDataerror(c *gin.Context) {
|
|
|
ID := c.Param("id")
|
|
|
|
|
|
success, message, _ := DataerrorService.RemoveDataerror(ID)
|
|
|
|
|
|
if success {
|
|
|
c.JSON(http.StatusOK, MySwagger.Result{
|
|
|
Success: true,
|
|
|
Fail: false,
|
|
|
Message: message,
|
|
|
})
|
|
|
|
|
|
return
|
|
|
} else {
|
|
|
c.JSON(http.StatusOK, MySwagger.Result{
|
|
|
Success: false,
|
|
|
Fail: true,
|
|
|
Message: message,
|
|
|
})
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
return
|
|
|
}
|