main
elf 2 months ago
parent 7a09571fdc
commit e49bb1f0dd

@ -44,3 +44,24 @@ func DownloadOrders(c *gin.Context) {
f := service.OrderService.GenerateOrdersExcel(req) f := service.OrderService.GenerateOrdersExcel(req)
excel.Download(f, "订单列表.xlsx", c) excel.Download(f, "订单列表.xlsx", c)
} }
func GetInfos(c *gin.Context) (result.Data, error) {
var req request.StudentInsureInfoQueryRequest
err := c.ShouldBindQuery(&req)
if err != nil {
return nil, e.NewError("参数错误")
}
records, total := service.StudentInsureService.GetInfos(req)
data := result.Data{
"records": records,
"total": total,
}
return data, nil
}
func DownloadInfos(c *gin.Context) {
var req request.StudentInsureInfoQueryRequest
_ = c.ShouldBindQuery(&req)
f := service.StudentInsureService.GenerateInfosExcel(req)
excel.Download(f, "学生投保信息.xlsx", c)
}

@ -1,6 +1,7 @@
package manage package manage
type StudentInsureInfoQueryRequest struct { type StudentInsureInfoQueryRequest struct {
PageQueryRequest
SchoolName string `json:"schoolName" form:"schoolName"` SchoolName string `json:"schoolName" form:"schoolName"`
StudentName string `json:"studentName" form:"studentName"` StudentName string `json:"studentName" form:"studentName"`
StudentIdentityNo string `json:"studentIdentityNo" form:"studentIdentityNo"` StudentIdentityNo string `json:"studentIdentityNo" form:"studentIdentityNo"`

@ -21,5 +21,7 @@ func adminRouteInit(r *gin.Engine) {
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-orders", result.Json(manage.GetOrders)) authGroup.Match([]string{"GET", "OPTIONS"}, "/get-orders", result.Json(manage.GetOrders))
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-order", result.Json(manage.GetOrder)) authGroup.Match([]string{"GET", "OPTIONS"}, "/get-order", result.Json(manage.GetOrder))
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-orders", manage.DownloadOrders) authGroup.Match([]string{"GET", "OPTIONS"}, "/download-orders", manage.DownloadOrders)
authGroup.Match([]string{"GET", "OPTIONS"}, "/get-infos", result.Json(manage.GetInfos))
authGroup.Match([]string{"GET", "OPTIONS"}, "/download-infos", manage.DownloadInfos)
} }
} }

@ -38,7 +38,7 @@ func (s *studentInsureService) Save(r request.StudentInsureInfoRequest) (*model.
return &info, nil return &info, nil
} }
func (s *studentInsureService) GetInfos(req manage.OrderQueryRequest) ([]model.StudentInsureInfo, int64) { func (s *studentInsureService) GetInfos(req manage.StudentInsureInfoQueryRequest) ([]model.StudentInsureInfo, int64) {
records := make([]model.StudentInsureInfo, req.PageSize) records := make([]model.StudentInsureInfo, req.PageSize)
offset := (req.Page - 1) * req.PageSize offset := (req.Page - 1) * req.PageSize
var total int64 var total int64
@ -83,7 +83,7 @@ func (s *studentInsureService) buildQuery(req manage.StudentInsureInfoQueryReque
return tx return tx
} }
func (s *studentInsureService) GenerateOrdersExcel(req manage.StudentInsureInfoQueryRequest) *excelize.File { func (s *studentInsureService) GenerateInfosExcel(req manage.StudentInsureInfoQueryRequest) *excelize.File {
pageSize := 200 pageSize := 200
lastID := 0 lastID := 0

Loading…
Cancel
Save