diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java new file mode 100644 index 0000000..000e542 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/HomeController.java @@ -0,0 +1,39 @@ +package com.hxhq.business.controller; + +import com.hxhq.business.dto.study.StudyListDto; +import com.hxhq.business.enums.study.StudyTypeEnum; +import com.hxhq.business.form.study.StudySearchForm; +import com.hxhq.business.service.IStudyService; +import com.hxhq.common.core.web.controller.BaseController; +import com.hxhq.common.core.web.domain.AjaxResult; +import com.hxhq.common.core.web.page.TableDataInfo; +import com.hxhq.common.security.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + + +/** + * 首页Controller + * + * @author hxhq + * @date 2025-12-24 + */ +@RestController +@RequestMapping("/business/home") +public class HomeController extends BaseController +{ + @Autowired + private IStudyService studyService; + + /** + * 查询首页数量 + */ + @GetMapping("/count") + @RequiresPermissions("business:user:work") + public AjaxResult list() + { + return AjaxResult.success(studyService.queryHomeCount()); + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/home/HomeCountDto.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/home/HomeCountDto.java new file mode 100644 index 0000000..de99109 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/dto/home/HomeCountDto.java @@ -0,0 +1,67 @@ +package com.hxhq.business.dto.home; + +/** + * @author memory + */ +public class HomeCountDto { + /** + * 今日新增表单 + */ + private Integer formTodayCount; + /** + * 已提交表单 + */ + private Integer formYtjCount; + /** + * 待提交表单 + */ + private Integer formTbzCount; + /** + * 本周新增试验 + */ + private Integer studyFinishCount; + /** + * 已完成试验 + */ + private Integer studyWeekCount; + + public Integer getFormTodayCount() { + return formTodayCount; + } + + public void setFormTodayCount(Integer formTodayCount) { + this.formTodayCount = formTodayCount; + } + + public Integer getFormYtjCount() { + return formYtjCount; + } + + public void setFormYtjCount(Integer formYtjCount) { + this.formYtjCount = formYtjCount; + } + + public Integer getFormTbzCount() { + return formTbzCount; + } + + public void setFormTbzCount(Integer formTbzCount) { + this.formTbzCount = formTbzCount; + } + + public Integer getStudyFinishCount() { + return studyFinishCount; + } + + public void setStudyFinishCount(Integer studyFinishCount) { + this.studyFinishCount = studyFinishCount; + } + + public Integer getStudyWeekCount() { + return studyWeekCount; + } + + public void setStudyWeekCount(Integer studyWeekCount) { + this.studyWeekCount = studyWeekCount; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java index 014dfa2..37a24f2 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/StudyMapper.java @@ -3,6 +3,7 @@ package com.hxhq.business.mapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.hxhq.business.domain.Study; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.hxhq.business.dto.home.HomeCountDto; import com.hxhq.business.dto.study.StudyListDto; import org.apache.ibatis.annotations.Param; @@ -36,4 +37,18 @@ public interface StudyMapper extends BaseMapper * @return */ String queryNotFinishFormName(@Param("studyId") Long studyId); + + /** + * 获取首页统计的表单数量 + * @param userId + * @return + */ + HomeCountDto queryHomeFormCount(@Param("userId") Long userId); + + /** + * 获取首页的试验数量 + * @param userId + * @return + */ + HomeCountDto queryHomeStudyCount(@Param("userId") Long userId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java index 0bec73c..cfd6e84 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyService.java @@ -3,6 +3,7 @@ package com.hxhq.business.service; import java.util.List; import com.hxhq.business.domain.Study; import com.baomidou.mybatisplus.extension.service.IService; +import com.hxhq.business.dto.home.HomeCountDto; import com.hxhq.business.dto.study.StudyListDto; import com.hxhq.business.form.common.SignForm; import com.hxhq.business.form.study.StudySaveForm; @@ -108,4 +109,10 @@ public interface IStudyService extends IService */ void checkPassword(SignForm sign); + /** + * 获取首页统计数量 + * @return + */ + HomeCountDto queryHomeCount(); + } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java index 69668e6..9d479ec 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.domain.StudyJcgj; +import com.hxhq.business.dto.home.HomeCountDto; import com.hxhq.business.dto.study.StudyListDto; import com.hxhq.business.enums.study.StudyBorrowStatusEnum; import com.hxhq.business.enums.study.StudyStatusEnum; @@ -464,4 +465,14 @@ public class StudyServiceImpl extends ServiceImpl implements } } } + + @Override + public HomeCountDto queryHomeCount() { + HomeCountDto formCount = baseMapper.queryHomeFormCount(SecurityUtils.getUserId()); + HomeCountDto studyCount = baseMapper.queryHomeStudyCount(SecurityUtils.getUserId()); + + formCount.setStudyWeekCount(studyCount.getStudyWeekCount()); + formCount.setStudyFinishCount(studyCount.getStudyFinishCount()); + return formCount; + } } diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml index e084d94..a1dc3b6 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml @@ -28,4 +28,39 @@ del_flag='0' AND study_id=#{studyId} AND bdzt NOT IN (5,7,11) + + + + \ No newline at end of file