test_data/api/test.data/report.list.go
2024-08-30 16:27:39 +08:00

204 lines
6.5 KiB
Go

package test_data
import (
"github.com/gin-gonic/gin"
"testData/global"
"testData/model"
"testData/model/response"
test_data "testData/repository/test.data"
"testData/request"
"testData/utils"
)
type IReportListService interface {
}
type ReportListService struct{}
func InitReportService() *ReportListService {
global.PostGreSQL.AutoMigrate(&model.Report{}, &model.FinalReport{}, &model.ReportSites{}, &model.BinFail{},
&model.WaferList{}, &model.WaferStock{}, &model.ABList{}, &model.ABListStock{}, &model.BPList{}, &model.BPListStock{},
&model.TRList{}, &model.TRListStock{}, &model.CPList{}, &model.CPListStock{}, &model.FTList{}, &model.FTListStock{})
return &ReportListService{}
}
// @Tags 数据分析平台-生产
// @Summary 晶圆记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.WaferList true "查询参数"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/wafer [post]
func (S *ReportListService) WaferList(c *gin.Context) {
r := request.WaferList{}
_ = c.ShouldBind(&r)
if msg, ok := utils.ValidateInfo2CN(r); !ok {
response.FailWithMessage(msg, c)
return
}
waferList, total := test_data.WaferList(&r)
response.OkWithData(gin.H{"wafer_list": waferList, "total": total}, c)
}
// @Tags 数据分析平台-生产
// @Summary 封装记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.ABList true "查询参数"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/ab [post]
func (S *ReportListService) ABList(c *gin.Context) {
r := request.ABList{}
_ = c.ShouldBind(&r)
if msg, ok := utils.ValidateInfo2CN(r); !ok {
response.FailWithMessage(msg, c)
return
}
list, total := test_data.ABList(&r)
response.OkWithData(gin.H{"list": list, "total": total}, c)
}
// @Tags 数据分析平台-生产
// @Summary 导出AB记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/ab/export [post]
func (S *ReportListService) ExportABList(c *gin.Context) {
response.OkWithData(test_data.ExportABList(), c)
}
// @Tags 数据分析平台-生产
// @Summary BP记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.BPList true "查询参数"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/bp [post]
func (S *ReportListService) BPList(c *gin.Context) {
r := request.BPList{}
_ = c.ShouldBind(&r)
if msg, ok := utils.ValidateInfo2CN(r); !ok {
response.FailWithMessage(msg, c)
return
}
list, total := test_data.BPList(&r)
response.OkWithData(gin.H{"list": list, "total": total}, c)
}
// @Tags 数据分析平台-生产
// @Summary 导出BP记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/bp/export [post]
func (S *ReportListService) ExportBPList(c *gin.Context) {
response.OkWithData(test_data.ExportBPList(), c)
}
// @Tags 数据分析平台-生产
// @Summary 导出晶圆记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/wafer/export [post]
func (S *ReportListService) ExportWaferList(c *gin.Context) {
response.OkWithData(test_data.ExportWaferList(), c)
}
// @Tags 数据分析平台-生产
// @Summary CP记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.CPList true "查询参数"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/cp [post]
func (S *ReportListService) CPList(c *gin.Context) {
r := request.CPList{}
_ = c.ShouldBind(&r)
if msg, ok := utils.ValidateInfo2CN(r); !ok {
response.FailWithMessage(msg, c)
return
}
list, total := test_data.CPList(&r)
response.OkWithData(gin.H{"list": list, "total": total}, c)
}
// @Tags 数据分析平台-生产
// @Summary 导出CP记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/cp/export [post]
func (S *ReportListService) ExportCPList(c *gin.Context) {
response.OkWithData(test_data.ExportCPList(), c)
}
// @Tags 数据分析平台-生产
// @Summary FT记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.FTList true "查询参数"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/ft [post]
func (S *ReportListService) FTList(c *gin.Context) {
r := request.FTList{}
_ = c.ShouldBind(&r)
if msg, ok := utils.ValidateInfo2CN(r); !ok {
response.FailWithMessage(msg, c)
return
}
list, total := test_data.FTList(&r)
response.OkWithData(gin.H{"list": list, "total": total}, c)
}
// @Tags 数据分析平台-生产
// @Summary 导出FT记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/ft/export [post]
func (S *ReportListService) ExportFTList(c *gin.Context) {
response.OkWithData(test_data.ExportFTList(), c)
}
// @Tags 数据分析平台-生产
// @Summary TR记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Param data body request.TRList true "查询参数"
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/tr [post]
func (S *ReportListService) TRList(c *gin.Context) {
r := request.TRList{}
_ = c.ShouldBind(&r)
if msg, ok := utils.ValidateInfo2CN(r); !ok {
response.FailWithMessage(msg, c)
return
}
list, total := test_data.TRList(&r)
response.OkWithData(gin.H{"list": list, "total": total}, c)
}
// @Tags 数据分析平台-生产
// @Summary 导出TR记录
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
// @Success 200 {string} string "{"success":true,"data":{},"msg":"操作成功"}"
// @Router /testData/report/tr/export [post]
func (S *ReportListService) ExportTRList(c *gin.Context) {
response.OkWithData(test_data.ExportTRList(), c)
}