From 2edea640d0962a5fa3be0d85939814afb5f8b5d8 Mon Sep 17 00:00:00 2001 From: sunyugang Date: Tue, 15 Jul 2025 13:40:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E8=B0=83=E6=9F=A5=E9=97=AE?= =?UTF-8?q?=E5=8D=B7=E7=9A=84=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/dw/controller/DwIndexConfigController.java | 11 ++++++----- .../java/com/ruoyi/dw/mapper/DwIndexConfigMapper.java | 2 +- .../com/ruoyi/dw/service/IDwIndexConfigService.java | 2 +- .../dw/service/impl/DwIndexConfigServiceImpl.java | 4 ++-- .../main/resources/mapper/dw/DwIndexConfigMapper.xml | 9 +++++++-- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwIndexConfigController.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwIndexConfigController.java index af6601c..66d9cae 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwIndexConfigController.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/controller/DwIndexConfigController.java @@ -49,9 +49,10 @@ public class DwIndexConfigController extends BaseController * 根据毕业年份统计人数 * @return */ - @GetMapping("/getBynf") - public AjaxResult getBynf(){ - return AjaxResult.success(dwIndexConfigService.getBynf()); + @GetMapping("/getBynf/{year}") + public AjaxResult getBynf(@PathVariable int year){ + //todo: 还没有写完 + return AjaxResult.success(dwIndexConfigService.getBynf(year)); } /** @@ -143,8 +144,8 @@ public class DwIndexConfigController extends BaseController return AjaxResult.error("请先选择展示调查问题"); } String[] question_ids = dwIndexConfig.getQuestionId().split(","); - if (question_ids.length > 1 && dwIndexConfig.getIndexType() == 0){ - return AjaxResult.error("饼状图只能选择一个问题"); + if (question_ids.length > 1){ + return AjaxResult.error("只能选择一个问题"); } return toAjax(dwIndexConfigService.updateDwIndexConfig(dwIndexConfig)); } diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwIndexConfigMapper.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwIndexConfigMapper.java index 8b9a90c..31a74de 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwIndexConfigMapper.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/mapper/DwIndexConfigMapper.java @@ -78,7 +78,7 @@ public interface DwIndexConfigMapper * 毕业年份折线图统计 * @return */ - public List selectBynf(); + public List selectBynf(int year); /** * 根据生源地统计学生数量 diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwIndexConfigService.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwIndexConfigService.java index 85bdcfc..a02bfdc 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwIndexConfigService.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/IDwIndexConfigService.java @@ -74,7 +74,7 @@ public interface IDwIndexConfigService * 毕业年份折线图统计 * @return */ - public List getBynf(); + public List getBynf(int year); /** * 根据学生生源地统计 diff --git a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwIndexConfigServiceImpl.java b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwIndexConfigServiceImpl.java index d985d36..03679ee 100644 --- a/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwIndexConfigServiceImpl.java +++ b/ruoyi-dw/src/main/java/com/ruoyi/dw/service/impl/DwIndexConfigServiceImpl.java @@ -117,8 +117,8 @@ public class DwIndexConfigServiceImpl implements IDwIndexConfigService } @Override - public List getBynf() { - return dwIndexConfigMapper.selectBynf(); + public List getBynf(int year) { + return dwIndexConfigMapper.selectBynf(year); } @Override diff --git a/ruoyi-dw/src/main/resources/mapper/dw/DwIndexConfigMapper.xml b/ruoyi-dw/src/main/resources/mapper/dw/DwIndexConfigMapper.xml index 400bc51..153c3a7 100644 --- a/ruoyi-dw/src/main/resources/mapper/dw/DwIndexConfigMapper.xml +++ b/ruoyi-dw/src/main/resources/mapper/dw/DwIndexConfigMapper.xml @@ -99,8 +99,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" group by answer - + select bynf,count(0) as bubf_count + from cj_student + where sfqr = 1 + and cast(bynf as unsigned) + between YEAR(CURRENT_DATE) - #{year} + 1 and YEAR(CURRENT_DATE) + group by bynf order by bynf desc