Browse Source

奖学金名单查询

dzx 1 year ago
parent
commit
dfac967872

+ 14 - 0
src/main/java/com/xjrsoft/module/student/controller/BaseStudentScholarshipApplicantController.java

@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.toolkit.MPJWrappers;
 import com.xjrsoft.common.model.result.RT;
 import com.xjrsoft.common.page.ConventPage;
@@ -12,11 +13,14 @@ import com.xjrsoft.common.page.PageOutput;
 import com.xjrsoft.common.utils.VoToColumnUtil;
 import com.xjrsoft.module.base.entity.BaseSemester;
 import com.xjrsoft.module.student.dto.AddBaseStudentScholarshipApplicantDto;
+import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
 import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantPageDto;
 import com.xjrsoft.module.student.dto.UpdateBaseStudentScholarshipApplicantDto;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipCategory;
 import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
+import com.xjrsoft.module.student.service.IBaseStudentScholarshipCategoryService;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantPageVo;
 import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantVo;
 import io.swagger.annotations.Api;
@@ -48,6 +52,7 @@ public class BaseStudentScholarshipApplicantController {
 
 
     private final IBaseStudentScholarshipApplicantService baseStudentScholarshipApplicantService;
+    private final IBaseStudentScholarshipCategoryService baseStudentScholarshipCategoryService;
 
     @GetMapping(value = "/page")
     @ApiOperation(value="奖学金申请列表(分页)")
@@ -71,6 +76,15 @@ public class BaseStudentScholarshipApplicantController {
         return RT.ok(pageOutput);
     }
 
+    @GetMapping(value = "/scholarship-page")
+    @ApiOperation(value="奖学金名称表(分页)")
+    @SaCheckPermission("basestudentscholarshipapplicant:detail")
+    public RT<PageOutput<BaseStudentScholarshipApplicantCategoryPageVo>> scholarshiPage(@Valid BaseStudentScholarshipApplicantCategoryPageDto dto){
+        IPage<BaseStudentScholarshipApplicantCategoryPageVo> page = baseStudentScholarshipApplicantService.getScholarshiPage(new Page<>(dto.getLimit(), dto.getSize()), dto);
+        PageOutput<BaseStudentScholarshipApplicantCategoryPageVo> pageOutput = ConventPage.getPageOutput(page, BaseStudentScholarshipApplicantCategoryPageVo.class);
+        return RT.ok(pageOutput);
+    }
+
     @GetMapping(value = "/info")
     @ApiOperation(value="根据id查询奖学金申请信息")
     @SaCheckPermission("basestudentscholarshipapplicant:detail")

+ 18 - 0
src/main/java/com/xjrsoft/module/student/dto/BaseStudentScholarshipApplicantCategoryPageDto.java

@@ -0,0 +1,18 @@
+package com.xjrsoft.module.student.dto;
+
+import com.xjrsoft.common.page.PageInput;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+
+/**
+* @title: 奖学金申请分页查询入参
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class BaseStudentScholarshipApplicantCategoryPageDto extends PageInput {
+
+}

+ 10 - 2
src/main/java/com/xjrsoft/module/student/mapper/BaseStudentScholarshipApplicantMapper.java

@@ -1,8 +1,10 @@
 package com.xjrsoft.module.student.mapper;
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseMapper;
+import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -13,5 +15,11 @@ import org.apache.ibatis.annotations.Mapper;
 */
 @Mapper
 public interface BaseStudentScholarshipApplicantMapper extends MPJBaseMapper<BaseStudentScholarshipApplicant> {
-
+    /**
+     * app分页查询
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto);
 }

+ 12 - 3
src/main/java/com/xjrsoft/module/student/service/IBaseStudentScholarshipApplicantService.java

@@ -1,10 +1,10 @@
 package com.xjrsoft.module.student.service;
 
-import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseService;
+import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
-import lombok.Data;
-import java.util.List;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
 
 /**
 * @title: 奖学金申请
@@ -14,4 +14,13 @@ import java.util.List;
 */
 
 public interface IBaseStudentScholarshipApplicantService extends MPJBaseService<BaseStudentScholarshipApplicant> {
+
+    /**
+     * app分页查询
+     * @param page
+     * @param dto
+     * @return
+     */
+    Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto);
+
 }

+ 9 - 6
src/main/java/com/xjrsoft/module/student/service/impl/BaseStudentScholarshipApplicantServiceImpl.java

@@ -1,17 +1,14 @@
 package com.xjrsoft.module.student.service.impl;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.yulichang.base.MPJBaseServiceImpl;
+import com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantCategoryPageDto;
 import com.xjrsoft.module.student.entity.BaseStudentScholarshipApplicant;
 import com.xjrsoft.module.student.mapper.BaseStudentScholarshipApplicantMapper;
 import com.xjrsoft.module.student.service.IBaseStudentScholarshipApplicantService;
+import com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 
 /**
 * @title: 奖学金申请
@@ -22,4 +19,10 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 @Service
 @AllArgsConstructor
 public class BaseStudentScholarshipApplicantServiceImpl extends MPJBaseServiceImpl<BaseStudentScholarshipApplicantMapper, BaseStudentScholarshipApplicant> implements IBaseStudentScholarshipApplicantService {
+    private final BaseStudentScholarshipApplicantMapper baseStudentScholarshipApplicantMapper;
+    @Override
+    public Page<BaseStudentScholarshipApplicantCategoryPageVo> getScholarshiPage(Page<BaseStudentScholarshipApplicantCategoryPageDto> page, BaseStudentScholarshipApplicantCategoryPageDto dto) {
+        Page<BaseStudentScholarshipApplicantCategoryPageVo> result = baseStudentScholarshipApplicantMapper.getScholarshiPage(page, dto);
+        return result;
+    }
 }

+ 41 - 0
src/main/java/com/xjrsoft/module/student/vo/BaseStudentScholarshipApplicantCategoryPageVo.java

@@ -0,0 +1,41 @@
+package com.xjrsoft.module.student.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+* @title: 奖学金类别分页列表出参
+* @Author dzx
+* @Date: 2023-11-23
+* @Version 1.0
+*/
+@Data
+public class BaseStudentScholarshipApplicantCategoryPageVo {
+
+    /**
+    * 主键编号
+    */
+    @ApiModelProperty("主键编号")
+    private Long id;
+    /**
+     * 主键编号
+     */
+    @ApiModelProperty("奖金名称")
+    private String name;
+    /**
+    * 上报金额
+    */
+    @ApiModelProperty("上报金额")
+    private Double reportAmount;
+    /**
+    * 发放金额
+    */
+    @ApiModelProperty("发放金额")
+    private Double grantAmount;
+    /**
+    * 申请人数
+    */
+    @ApiModelProperty("申请人数")
+    private Integer applicantUserCount;
+
+}

+ 26 - 0
src/main/resources/mapper/student/BaseStudentScholarshipApplicantMapper.xml

@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.xjrsoft.module.student.mapper.BaseStudentScholarshipApplicantMapper">
+    <select id="getScholarshiPage" parameterType="com.xjrsoft.module.student.dto.BaseStudentScholarshipApplicantPageDto" resultType="com.xjrsoft.module.student.vo.BaseStudentScholarshipApplicantCategoryPageVo">
+        SELECT t.id, t.name,(
+            SELECT SUM(t2.amount) FROM base_student_scholarship_applicant t1
+                                           INNER JOIN base_student_scholarship_level t2 ON t1.scholarship_level = t2.level
+            WHERE t1.base_student_scholarship_category_id = t.id
+              AND t1.release_status = 0
+        ) AS report_amount,
+               (
+                   SELECT SUM(t2.amount) FROM base_student_scholarship_applicant t1
+                                                  INNER JOIN base_student_scholarship_level t2 ON t1.scholarship_level = t2.level
+                   WHERE t1.base_student_scholarship_category_id = t.id
+                     AND t1.release_status = 1
+               ) AS grant_amount,(
+                   SELECT COUNT(*) FROM base_student_scholarship_applicant
+                   WHERE base_student_scholarship_category_id = t.id
+               ) AS applicant_user_count FROM base_student_scholarship_category t
+        WHERE delete_mark = 0
+    </select>
+
+
+</mapper>