fix
This commit is contained in:
parent
0e43d5b9dc
commit
1ed80a054e
@ -7,15 +7,14 @@ import com.google.common.collect.Maps;
|
||||
import com.lz.common.utils.PageUtils;
|
||||
import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
import com.lz.modules.flow.entity.FlowStart;
|
||||
import com.lz.modules.performance.dto.IndicatorLibraryDto;
|
||||
import com.lz.modules.performance.dto.IndicatorLibraryMoveDto;
|
||||
import com.lz.modules.performance.dto.StatisticalIndicatorTypeDto;
|
||||
import com.lz.modules.performance.entity.IndicatorLibrary;
|
||||
import com.lz.modules.performance.req.IndicatorLibraryReq;
|
||||
import com.lz.modules.performance.service.IndicatorLibraryService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -111,6 +110,7 @@ public class IndicatorLibraryController {
|
||||
|
||||
@GetMapping("/statistical")
|
||||
@ApiOperation("统计指标")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "成功", response = StatisticalIndicatorTypeDto.class)})
|
||||
public R statistical(@RequestParam(name = "indicatorType",required = false) @ApiParam(value = "指标分类id",name = "indicatorType") Long indicatorType) {
|
||||
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryService.statisticalByIndicatorType(indicatorType);
|
||||
return R.ok().put("data",dtos);
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.lz.modules.performance.dto;
|
||||
|
||||
import com.lz.modules.performance.entity.IndicatorType;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@ -9,11 +11,18 @@ import lombok.Data;
|
||||
* @Date: 2021/1/13 17:20
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("统计响应实体")
|
||||
public class StatisticalIndicatorTypeDto {
|
||||
|
||||
@ApiModelProperty(value = "名称",name = "name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "类型",name = "indicatorType")
|
||||
private Integer indicatorType;
|
||||
|
||||
@ApiModelProperty(value = "个数",name = "count")
|
||||
private int count;
|
||||
|
||||
@ApiModelProperty(value = "是否可以删除 0:可以 1:不可以",name = "delete")
|
||||
private int delete;
|
||||
}
|
||||
|
||||
@ -108,6 +108,7 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMap
|
||||
StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto();
|
||||
dto.setName("未分类指标");
|
||||
dto.setIndicatorType(0);
|
||||
dto.setDelete(1);
|
||||
int count = indicatorLibraryMapper.countIndicatorLibrarysByIndicatorType(0);
|
||||
dto.setCount(count);
|
||||
if(count>0){
|
||||
@ -117,6 +118,7 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMap
|
||||
dto = new StatisticalIndicatorTypeDto();
|
||||
dto.setName("全部分类");
|
||||
dto.setIndicatorType(null);
|
||||
dto.setDelete(1);
|
||||
if(CollectionUtils.isNotEmpty(dtos)){
|
||||
double sum = dtos.stream().mapToDouble(value -> value.getCount()).sum();
|
||||
dto.setCount(Double.valueOf(sum).intValue());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user