xuhy
4 天以前 f90b70b4448c8930c752111504b857b5fb76e8e3
bug修改
5个文件已修改
81 ■■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TQaProduceReportMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/TQaProduceReportService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TQaProduceReportServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TQaProduceReportMapper.xml 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TQaProduceReportController.java
@@ -30,6 +30,7 @@
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -113,6 +114,30 @@
    }
    /**
     * 获取中试、生产验证分析报告;辅料;产品报告管理评定列表
     */
    //@PreAuthorize("@ss.hasPermi('system:qaProduceReport:evaluateList')")
    @ApiOperation(value = "获取中试、生产验证分析报告;辅料;产品报告管理评定数量统计",  response = TQaProduceReportQuery.class)
    @PostMapping(value = "/api/t-qa-produce-report/evaluateCount")
    public R<Map<String,Integer>> evaluateCount(@RequestBody String param) {
        TQaProduceReportQuery query = JSON.parseObject(param, TQaProduceReportQuery.class);
        Long userId = tokenService.getLoginUser().getUserId();
        Integer roleType = tokenService.getLoginUser().getUser().getRoleType();
        if(roleType != 1){
            // 查询用户所在项目组
            List<TProjectTeamStaff> projectTeamStaffs = projectTeamStaffService.list(Wrappers.lambdaQuery(TProjectTeamStaff.class)
                    .eq(TProjectTeamStaff::getUserId, userId));
            if(projectTeamStaffs.size() > 0){
                // 查询项目组id
                List<String> teamIds = projectTeamStaffs.stream().map(TProjectTeamStaff::getTeamId).distinct().collect(Collectors.toList());
                query.setTeamIds(teamIds);
            }
        }
        Map<String,Integer> map = qaProduceReportService.evaluateCount(query);
        return R.ok(map);
    }
    /**
     * 添加中试、生产验证分析报告;辅料;产品报告管理管理
     */
    //@PreAuthorize("@ss.hasPermi('system:qaProduceReport:add')")
ruoyi-system/src/main/java/com/ruoyi/system/mapper/TQaProduceReportMapper.java
@@ -8,6 +8,7 @@
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -33,4 +34,11 @@
     * @return
     */
    List<TQaProduceReportVO> evaluateList(@Param("query") TQaProduceReportQuery query, @Param("pageInfo")PageInfo<TQaProduceReportVO> pageInfo);
    /**
     * 获取数量统计
     * @param query
     * @return
     */
    Map<String, Integer> evaluateCount(@Param("query")TQaProduceReportQuery query);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/TQaProduceReportService.java
@@ -6,6 +6,8 @@
import com.ruoyi.system.query.TQaProduceReportQuery;
import com.ruoyi.system.vo.TQaProduceReportVO;
import java.util.Map;
/**
 * <p>
 * 中试、生产验证分析报告;辅料;产品报告 服务类
@@ -28,4 +30,11 @@
     * @return
     */
    PageInfo<TQaProduceReportVO> evaluateList(TQaProduceReportQuery query);
    /**
     * 获取中试、生产验证分析报告;辅料;产品报告管理数量统计
     * @param query
     * @return
     */
    Map<String, Integer> evaluateCount(TQaProduceReportQuery query);
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TQaProduceReportServiceImpl.java
@@ -10,6 +10,7 @@
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * <p>
@@ -36,4 +37,10 @@
        pageInfo.setRecords(list);
        return pageInfo;
    }
    @Override
    public Map<String, Integer> evaluateCount(TQaProduceReportQuery query) {
        Map<String, Integer> map = this.baseMapper.evaluateCount(query);
        return map;
    }
}
ruoyi-system/src/main/resources/mapper/system/TQaProduceReportMapper.xml
@@ -100,5 +100,37 @@
        </where>
        ORDER BY tqpr.create_time DESC
    </select>
    <select id="evaluateCount" resultType="java.util.Map">
        select
        COUNT(tqpr.id) as totalCount,
        SUM(CASE WHEN tqpr.status = 2 THEN 1 ELSE 0 END) AS toEvaluatedCount,
        SUM(CASE WHEN tqpr.status = 3 THEN 1 ELSE 0 END) AS evaluatedCount
        from t_qa_produce_report tqpr
        left join t_project_team tpt on tpt.id = tqpr.team_id
        <where>
            <if test="query.reportTitle != null and query.reportTitle != ''">
                and tqpr.report_title like concat('%', #{query.reportTitle}, '%')
            </if>
            <if test="query.reportCode != null and query.reportCode != ''">
                and tqpr.report_code like concat('%', #{query.reportCode}, '%')
            </if>
            <if test="query.teamName != null and query.teamName != ''">
                and tpt.team_name like concat('%', #{query.teamName}, '%')
            </if>
            <if test="query.reportType != null">
                and tqpr.report_type = #{query.reportType}
            </if>
            <if test="query.status != null">
                and tqpr.status = #{query.status}
            </if>
            <if test="query.teamIds != null and query.teamIds.size() > 0">
                and tqpr.team_id in
                <foreach collection="query.teamIds" item="teamId" open="(" separator="," close=")">
                    #{teamId}
                </foreach>
            </if>
            AND tqpr.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
    </select>
</mapper>