From 37328ea082d92acecbf14a9c954f9ac33514646e Mon Sep 17 00:00:00 2001 From: Cool <747682928@qq.com> Date: Wed, 27 Mar 2024 16:03:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/controller/CenterController.java | 51 +++++++++++++++++-- 1 file changed, 47 insertions(+), 4 deletions(-) diff --git a/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/modules/controller/CenterController.java b/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/modules/controller/CenterController.java index ea51ecd3..e2a7d88f 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/modules/controller/CenterController.java +++ b/jeecg-module-system/jeecg-system-start/src/main/java/org/jeecg/modules/controller/CenterController.java @@ -1,19 +1,23 @@ package org.jeecg.modules.controller; +import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.common.constant.CacheConstant; +import org.jeecg.modules.entity.Cet_4; +import org.jeecg.modules.entity.Cet_6; import org.jeecg.modules.service.CenterService; +import org.jeecg.modules.service.ICet_4Service; +import org.jeecg.modules.service.ICet_6Service; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.Cacheable; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.Date; @RestController @RequestMapping("/cet") @@ -21,6 +25,10 @@ import javax.annotation.Resource; public class CenterController { @Resource private CenterService centerService; + @Autowired + ICet_4Service cet4Service; + @Autowired + ICet_6Service cet6Service; /** * 统计四级表和六级表中存在得学院和年级 @@ -31,6 +39,41 @@ public class CenterController { return centerService.getGradeAndCollege(); } + @PostMapping("/getRateByBatch") + public Result getRateByBatch(@RequestParam("batch") Date batch, @RequestParam("level") String level) { + + //四六级分开查询 + if (level.equals("cet4")) { + Cet_4 cet = new Cet_4(); + cet.setBatch(batch); + return cet4Service.getRate(cet); + } else if (level.equals("cet6")) { + Cet_6 cet = new Cet_6(); + cet.setBatch(batch); + return cet6Service.getRate(cet); + } else { + return null; + } + } + //根据batch/college是否为空判断两种查询方式 + + @PostMapping("/getRateByCollege") + public Result getRateByCollege(@RequestParam("college") String college, @RequestParam("level") String level) { + + if (level.equals("cet4")) { + Cet_4 cet = new Cet_4(); + cet.setCollege(college); + + return cet4Service.getRate(cet); + } else if (level.equals("cet6")) { + Cet_6 cet = new Cet_6(); + cet.setCollege(college); + + return cet6Service.getRate(cet); + } else { + return null; + } + } /** * 依据学院和年级获取四级和六级通过数据 */