From 8d143cdfe6f73ce02b64c26b3caf1e8ea7e06f76 Mon Sep 17 00:00:00 2001 From: zhangheng <3226558941@qq.com> Date: Thu, 6 Jun 2024 16:21:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=91=E5=AE=A4=E9=97=AE=E5=8D=B7=E6=95=B0?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../questioninfo/QuestionInfoController.java | 5 ++- .../dto/department/DepartmentCount.java | 37 +++++++++++++++++++ .../questioninfo/QuestionInfoMapper.java | 7 ++-- .../questioninfo/IQuestionInfoService.java | 6 ++- .../impl/QuestionInfoServiceImpl.java | 13 ++++--- .../questioninfo/QuestionInfoMapper.xml | 2 + 6 files changed, 57 insertions(+), 13 deletions(-) create mode 100644 postdischarge-manage/src/main/java/com/xinelu/manage/dto/department/DepartmentCount.java diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/questioninfo/QuestionInfoController.java b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/questioninfo/QuestionInfoController.java index 6fc11f5a..a083a3d7 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/controller/questioninfo/QuestionInfoController.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/controller/questioninfo/QuestionInfoController.java @@ -7,6 +7,7 @@ import com.xinelu.common.core.page.TableDataInfo; import com.xinelu.common.enums.BusinessType; import com.xinelu.common.utils.poi.ExcelUtil; import com.xinelu.manage.domain.questioninfo.QuestionInfo; +import com.xinelu.manage.dto.department.DepartmentCount; import com.xinelu.manage.service.questioninfo.IQuestionInfoService; import com.xinelu.manage.vo.questionInfo.QuestionVO; import org.apache.commons.lang3.StringUtils; @@ -113,7 +114,7 @@ public class QuestionInfoController extends BaseController { * 科室问卷数量 */ @GetMapping("/departmentQuestionCount") - public AjaxResult departmentQuestionCount(String departmentName, String questionnaireStatus, String questionType) { - return questionInfoService.departmentQuestionCount(departmentName, questionnaireStatus, questionType); + public AjaxResult departmentQuestionCount(DepartmentCount departmentCount) { + return AjaxResult.success(questionInfoService.departmentQuestionCount(departmentCount)); } } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/dto/department/DepartmentCount.java b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/department/DepartmentCount.java new file mode 100644 index 00000000..2a15d50c --- /dev/null +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/dto/department/DepartmentCount.java @@ -0,0 +1,37 @@ +package com.xinelu.manage.dto.department; + +import com.xinelu.common.core.domain.BaseEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 科室数量DTO + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class DepartmentCount extends BaseEntity { + /** + * 科室名称 + */ + private String departmentName; + + /** + * 问卷发布状态 + */ + private String questionnaireStatus; + + /** + * 问卷类型 + */ + private String questionType; + + /** + * 机构信息 + */ + private Long agencyId; + + /** + * 科室信息 + */ + private Long departmentId; +} \ No newline at end of file diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/questioninfo/QuestionInfoMapper.java b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/questioninfo/QuestionInfoMapper.java index 64d2e8ac..d78c5e94 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/questioninfo/QuestionInfoMapper.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/mapper/questioninfo/QuestionInfoMapper.java @@ -1,8 +1,8 @@ package com.xinelu.manage.mapper.questioninfo; import com.xinelu.manage.domain.questioninfo.QuestionInfo; +import com.xinelu.manage.dto.department.DepartmentCount; import com.xinelu.manage.vo.department.DepartmentVO; -import org.apache.ibatis.annotations.Param; import java.util.List; @@ -65,9 +65,8 @@ public interface QuestionInfoMapper { /** * 科室路径数量 * - * @param departmentName 科室名称 - * @param questionnaireStatus 问卷状态 + * @param departmentCount 科室信息 * @return DepartmentVO */ - List departmentQuestionByDepartmentName(@Param("departmentName") String departmentName, @Param("questionnaireStatus") String questionnaireStatus, @Param("questionType") String questionType); + List departmentQuestionByDepartmentName(DepartmentCount departmentCount); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/IQuestionInfoService.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/IQuestionInfoService.java index 3ff59349..bf170f4f 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/IQuestionInfoService.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/IQuestionInfoService.java @@ -2,6 +2,8 @@ package com.xinelu.manage.service.questioninfo; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.manage.domain.questioninfo.QuestionInfo; +import com.xinelu.manage.dto.department.DepartmentCount; +import com.xinelu.manage.vo.department.DepartmentVO; import com.xinelu.manage.vo.questionInfo.QuestionVO; import java.util.List; @@ -72,8 +74,8 @@ public interface IQuestionInfoService { /** * 科室问卷数量 * - * @param departmentName 科室名称 + * @param departmentCount 科室信息 * @return AjaxResult */ - AjaxResult departmentQuestionCount(String departmentName, String questionnaireStatus,String questionType); + List departmentQuestionCount(DepartmentCount departmentCount); } diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/impl/QuestionInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/impl/QuestionInfoServiceImpl.java index f26742ae..2807adf1 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/impl/QuestionInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/questioninfo/impl/QuestionInfoServiceImpl.java @@ -1,5 +1,6 @@ package com.xinelu.manage.service.questioninfo.impl; +import com.xinelu.common.annotation.DataScope; import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.utils.SecurityUtils; import com.xinelu.common.utils.bean.BeanUtils; @@ -7,6 +8,7 @@ import com.xinelu.common.utils.uuid.IdUtils; import com.xinelu.manage.domain.questioninfo.QuestionInfo; import com.xinelu.manage.domain.questionsubject.QuestionSubject; import com.xinelu.manage.domain.questionsubjectoption.QuestionSubjectOption; +import com.xinelu.manage.dto.department.DepartmentCount; import com.xinelu.manage.mapper.questioninfo.QuestionInfoMapper; import com.xinelu.manage.mapper.questionsubject.QuestionSubjectMapper; import com.xinelu.manage.mapper.questionsubjectoption.QuestionSubjectOptionMapper; @@ -310,19 +312,20 @@ public class QuestionInfoServiceImpl implements IQuestionInfoService { /** * 科室问卷数量 * - * @param departmentName 科室名称 + * @param departmentCount 科室名称 * @return AjaxResult */ + @DataScope(agencyAlias = "dt", deptAlias = "qi") @Override - public AjaxResult departmentQuestionCount(String departmentName, String questionnaireStatus, String questionType) { + public List departmentQuestionCount(DepartmentCount departmentCount) { DepartmentVO departmentVO = new DepartmentVO(); List department = new ArrayList<>(); departmentVO.setDepartmentName("全部"); departmentVO.setCountNum(0); - List departmentVOS = questionInfoMapper.departmentQuestionByDepartmentName(departmentName, questionnaireStatus, questionType); + List departmentVOS = questionInfoMapper.departmentQuestionByDepartmentName(departmentCount); if (CollectionUtils.isNotEmpty(departmentVOS)) { Integer result = departmentVOS.stream().mapToInt(DepartmentVO::getCountNum).sum(); - if (StringUtils.isBlank(questionnaireStatus)) { + if (StringUtils.isBlank(departmentCount.getQuestionnaireStatus())) { result = departmentVOS.get(0).getTotalNumber(); } departmentVO.setCountNum(result); @@ -331,6 +334,6 @@ public class QuestionInfoServiceImpl implements IQuestionInfoService { } else { department.add(departmentVO); } - return AjaxResult.success(department); + return department; } } diff --git a/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml b/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml index 03d57afd..83685db1 100644 --- a/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml +++ b/postdischarge-manage/src/main/resources/mapper/manage/questioninfo/QuestionInfoMapper.xml @@ -275,6 +275,8 @@ and qi.question_type = #{questionType} + + ${params.dataScope} GROUP BY dt.id