package handler import ( "cicv-data-closedloop/common/entity" "github.com/gin-gonic/gin" "net/http" ) type testStruct struct { Id int `db:"id"` Name string `db:"name"` } // Page 分页查询 func Page(c *gin.Context) { //// 获取请求参数 //param := c.Query("param") //c_log.GlobalLogger.Info("接受到请求参数:", param) //var tests []testStruct //// 查询数据库 //var testSql string //if err := c_db.MysqlDb.Select(&tests, testSql); err != nil { // c_log.GlobalLogger.Error("数据库查询报错:", err) // c.JSON(http.StatusInternalServerError, entity.DefaultFailHttpResult) // return //} //c_log.GlobalLogger.Info("数据库查询成功:", tests) c.JSON(http.StatusOK, entity.DefaultSuccessHttpResult) }