You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

103 lines
3.3 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

/**
* @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)"`<br/>`json:"system_id" xorm:"not null comment('数据提供系统编码') VARCHAR(36)"`<br/>`json:"datasource_id" xorm:"not null comment('数据源编码') VARCHAR(36)"`<br/>`json:"org_id" xorm:"not null comment('数据机构ID【输入参数】') VARCHAR(36)"`<br/>`json:"data_id" xorm:"not null comment('数据ID【输入参数】') VARCHAR(36)"`<br/>`json:"data_content" xorm:"default 'NULL' comment('数据内容【Json格式输入参数】') VARCHAR"`<br/>`json:"file_uri" xorm:"default 'NULL' comment('文件地址【文件交换】') VARCHAR(500)"`<br/>`json:"error_info" xorm:"default 'NULL' comment('错误信息说明') VARCHAR(5000)"`<br/>`json:"create_time" xorm:"default 'NULL' created comment('建立时间') DATETIME"`<br/>`json:"change_time" xorm:"default 'NULL' updated comment('最近修改时间') DATETIME"`<br/>`json:"delete_time" xorm:"default 'NULL' deleted comment('删除时间') DATETIME"`<br/>`json:"enable_flag" xorm:"not null default 1 comment('启用标志【默认11启用-1禁用】') INT(11)"`<br/>`json:"delete_flag" xorm:"not null default -1 comment('删除标志【默认-11删除-1正常】') INT(11)"`
// @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
}