This commit is contained in:
DirectionOfMind 2021-01-19 16:18:37 +08:00
parent 9b91874ff2
commit b81cc49401
5 changed files with 13 additions and 10 deletions

View File

@ -109,10 +109,10 @@ public class IndicatorLibraryController {
return R.ok();
}
@PostMapping("/statistical")
@GetMapping("/statistical")
@ApiOperation("统计指标")
public R statistical() {
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryService.statisticalByIndicatorType();
public R statistical(@RequestParam("indicatorType") @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) {
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryService.statisticalByIndicatorType(indicatorType);
return R.ok().put("data",dtos);
}
}

View File

@ -42,7 +42,7 @@ public interface IndicatorLibraryMapper extends BaseMapper<IndicatorLibrary> {
void updateIndicatorLibrarysMove(@Param("ids")List<Long> ids,@Param("indicatorType")Long indicatorType);
List<StatisticalIndicatorTypeDto> statisticalByIndicatorType();
List<StatisticalIndicatorTypeDto> statisticalByIndicatorType(Long indicatorType);
int deleteIndicatorLibrarysByIndicatorType(@Param("indicatorType") Integer indicatorType);
}

View File

@ -41,7 +41,7 @@ public interface IndicatorLibraryService extends IService<IndicatorLibrary> {
void updateIndicatorLibrarysMove(IndicatorLibraryMoveDto dto);
List<StatisticalIndicatorTypeDto> statisticalByIndicatorType();
List<StatisticalIndicatorTypeDto> statisticalByIndicatorType(Long indicatorType);
int deleteIndicatorLibrarysIndicatorType(Integer indicatorType);

View File

@ -103,8 +103,8 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMap
}
@Override
public List<StatisticalIndicatorTypeDto> statisticalByIndicatorType() {
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryMapper.statisticalByIndicatorType();
public List<StatisticalIndicatorTypeDto> statisticalByIndicatorType(Long indicatorType) {
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryMapper.statisticalByIndicatorType(indicatorType);
StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto();
dto.setName("全部分类");
dto.setIndicatorType(null);

View File

@ -125,9 +125,12 @@
<select id="statisticalByIndicatorType"
resultType="com.lz.modules.performance.dto.StatisticalIndicatorTypeDto">
SELECT t.id indicatorType,t.name,IFNULL(l.count,0) count from lz_indicator_type t
LEFT JOIN (SELECT name,indicator_type,count(indicator_type) count from lz_indicator_library where is_delete = 0 GROUP BY indicator_type) l
on t.is_delete = 0 and t.id = l.indicator_type
SELECT t.name,l.indicator_type,count(l.indicator_type) count from lz_indicator_type t RIGHT JOIN lz_indicator_library l
on t.id = l.indicator_type where t.is_delete = 0 and l.is_delete=0
<if test="indicatorType!=null">
and l.indicator_type=#{indicatorType}
</if>
GROUP BY indicator_type
</select>