Commit 209a7e09 authored by 盖献康's avatar 盖献康

Merge branch 'dev' of...

Merge branch 'dev' of ssh://gitlab.91isoft.com:10022/wangfei/vehicle-quality-review into gaixiankang
parents 63aa92b4 e8cfa4ca
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "首页数量统计")
public class QuantityStatisticsVO {
@ApiModelProperty("支持标准数量")
private Long standardQuantity;
@ApiModelProperty("测试用例数量")
private Long numberUseCases;
@ApiModelProperty("任务数量")
private Long numberTasks;
@ApiModelProperty("检验报告数量")
private Long numberReports;
@ApiModelProperty("检验员数量")
private Long numberInspectors;
@ApiModelProperty("车企数量")
private Long numberCompanies;
@ApiModelProperty("整车样品数量")
private Long numberVehicleSamples;
@ApiModelProperty("零部件样品数量")
private Long numberComponentSamples;
@ApiModelProperty("测试方法数量")
private Long numberMethods;
@ApiModelProperty("场景数量")
private Long numberScenes;
}
package com.ruoyi.domain.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(value = "首页标准类别统计")
public class StandardCategoryStatisticsVO {
@ApiModelProperty("类别数量")
private Long value;
@ApiModelProperty("类别名称")
private String name;
}
package com.ruoyi.mapper;
import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface StatisticsHomeMapper {
// 数量统计
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome);
// 标准类别统计
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics();
}
package com.ruoyi.service;
import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
import java.util.List;
public interface StatisticsHomeService {
// 数量统计
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome);
// 标准类别统计
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics();
}
package com.ruoyi.service.impl;
import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
import com.ruoyi.mapper.StatisticsHomeMapper;
import com.ruoyi.service.StatisticsHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class StatisticsHomeServiceImpl implements StatisticsHomeService {
@Autowired
private StatisticsHomeMapper statisticsHomeMapper;
@Override
public QuantityStatisticsVO selectQuantityStatistics(QuantityStatisticsVO quantityStatisticsHome){
return statisticsHomeMapper.selectQuantityStatistics(quantityStatisticsHome);
}
@Override
public List<StandardCategoryStatisticsVO> selectStandardCategoryStatistics(){
return statisticsHomeMapper.selectStandardCategoryStatistics();
}
}
package com.ruoyi.web;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.domain.vo.QuantityStatisticsVO;
import com.ruoyi.domain.vo.StandardCategoryStatisticsVO;
import com.ruoyi.service.StatisticsHomeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@Api(tags = {"首页统计"})
@RestController
@RequestMapping("/home/statistics")
public class StatisticsHomeController {
@Autowired
private StatisticsHomeService statisticsHomeService;
@ApiOperation("首页数量统计")
@PostMapping("/quantityStatistics")
public R<QuantityStatisticsVO> selectQuantityStatistics(@Validated @RequestBody QuantityStatisticsVO quantityStatisticsHome){
return R.ok(statisticsHomeService.selectQuantityStatistics(quantityStatisticsHome));
}
@ApiOperation("首页标准分类占比")
@PostMapping("/standardCategory")
public R<List<StandardCategoryStatisticsVO>> selectStandardCategoryStatistics(){
return R.ok(statisticsHomeService.selectStandardCategoryStatistics());
}
}
<?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.ruoyi.mapper.StatisticsHomeMapper">
<select id="selectQuantityStatistics" resultType="com.ruoyi.domain.vo.QuantityStatisticsVO" parameterType="com.ruoyi.domain.vo.QuantityStatisticsVO">
SELECT
( SELECT count( id ) FROM t_standard ) AS standardQuantity,
( SELECT count( id ) FROM t_test_usecase ) AS numberUseCases,
( SELECT count( id ) FROM t_task ) AS numberTasks,
( SELECT count( id ) FROM t_automobile_enterprise WHERE deleted = 0 ) AS numberCompanies,
(
SELECT
count( su.user_id )
FROM
sys_user su
LEFT JOIN sys_user_role sur ON sur.user_id = su.user_id
WHERE
sur.role_id = 106
) AS numberInspectors,
( SELECT count( id ) FROM t_sample WHERE flag = '0' AND deleted = 0 ) AS numberVehicleSamples,
( SELECT count( id ) FROM t_sample WHERE flag = '1' AND deleted = 0 ) AS numberComponentSamples,
( SELECT count( id ) FROM t_test_scenario ) AS numberScenes,
( SELECT count( id ) FROM t_test_type ) AS numberMethods,
( SELECT count( id ) FROM t_task WHERE vehicle_information_url IS NOT NULL ) AS numberReports
</select>
<select id="selectStandardCategoryStatistics" resultType="com.ruoyi.domain.vo.StandardCategoryStatisticsVO">
SELECT
count( id ) AS value,
standard_type AS name
FROM
t_standard
GROUP BY
standard_type
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment