|
@@ -1,7 +1,7 @@
|
|
|
package handler
|
|
|
|
|
|
import (
|
|
|
- "cicv-data-closedloop/amd64/web_server/entity"
|
|
|
+ webServerEntity "cicv-data-closedloop/amd64/web_server/entity"
|
|
|
"cicv-data-closedloop/common/config/c_db"
|
|
|
"cicv-data-closedloop/common/config/c_log"
|
|
|
commonEntity "cicv-data-closedloop/common/entity"
|
|
@@ -13,7 +13,7 @@ import (
|
|
|
|
|
|
// 考试开始时间
|
|
|
func Begin(c *gin.Context) {
|
|
|
- param := new(entity.ExamPAO)
|
|
|
+ param := new(webServerEntity.ExamPao)
|
|
|
// 映射到结构体
|
|
|
if err := c.ShouldBindJSON(¶m); err != nil {
|
|
|
c_log.GlobalLogger.Error("项目启动接收请求参数报错:", err)
|
|
@@ -44,7 +44,7 @@ func Begin(c *gin.Context) {
|
|
|
|
|
|
// 考试结束时间
|
|
|
func End(c *gin.Context) {
|
|
|
- param := new(entity.ExamPAO)
|
|
|
+ param := new(webServerEntity.ExamPao)
|
|
|
// 映射到结构体
|
|
|
if err := c.ShouldBindJSON(¶m); err != nil {
|
|
|
c_log.GlobalLogger.Error("项目启动接收请求参数报错:", err)
|
|
@@ -55,7 +55,7 @@ func End(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
// 1 查询指定队伍的开始时间最新的考试是否有结束时间,如果有则不在处理,如果没有则更新
|
|
|
- var result entity.ExamPO
|
|
|
+ var result webServerEntity.ExamPo
|
|
|
selectSql, err := util.ReadFile(c_db.SqlFilesMap["exam-select-latest-by-team_name.sql"])
|
|
|
if err != nil {
|
|
|
c_log.GlobalLogger.Error("读取sql文件报错:", err)
|
|
@@ -101,3 +101,23 @@ func End(c *gin.Context) {
|
|
|
Msg: "插入数据成功。",
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+// Page 分页查询
|
|
|
+func Page(c *gin.Context) {
|
|
|
+ param := new(webServerEntity.ExamPagePao)
|
|
|
+ _ = c.ShouldBindJSON(¶m)
|
|
|
+ c_log.GlobalLogger.Info("参数为:", param)
|
|
|
+ var result []webServerEntity.ExamPo
|
|
|
+ if param.TeamName == "" {
|
|
|
+ if param.Topic == "" {
|
|
|
+ selectSql, _ := util.ReadFile(c_db.SqlFilesMap["exam-select-page.sql"])
|
|
|
+ _ = c_db.MysqlDb.Select(&result, selectSql, param.Page.CurrentPage*param.Page.Size, param.Page.Size)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ c.JSON(http.StatusOK, commonEntity.Response{
|
|
|
+ Code: 200,
|
|
|
+ Msg: "分页查询成功。",
|
|
|
+ Data: result,
|
|
|
+ })
|
|
|
+}
|