fix
This commit is contained in:
parent
91b1555d95
commit
37b6a34b7a
@ -8,6 +8,7 @@ import com.lz.common.utils.R;
|
||||
import com.lz.common.utils.StringUtil;
|
||||
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;
|
||||
@ -15,12 +16,29 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.aop.Advisor;
|
||||
import org.springframework.aop.AfterReturningAdvice;
|
||||
import org.springframework.aop.framework.adapter.AdvisorAdapter;
|
||||
import org.springframework.aop.framework.adapter.AfterReturningAdviceInterceptor;
|
||||
import org.springframework.aop.framework.adapter.UnknownAdviceTypeException;
|
||||
import org.springframework.aop.support.DefaultPointcutAdvisor;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -55,7 +73,6 @@ public class IndicatorLibraryController {
|
||||
@PostMapping("/saveOrUpdate")
|
||||
@ApiOperation("保存/修改指标")
|
||||
public R save(@RequestBody IndicatorLibraryDto dto) {
|
||||
|
||||
IndicatorLibrary indicatorLibrary = new IndicatorLibrary();
|
||||
BeanUtil.copyProperties(dto,indicatorLibrary);
|
||||
boolean success = indicatorLibraryService.saveOrUpdate(indicatorLibrary);
|
||||
@ -93,7 +110,8 @@ public class IndicatorLibraryController {
|
||||
@PostMapping("/statistical")
|
||||
@ApiOperation("统计指标")
|
||||
public R statistical() {
|
||||
//indicatorLibraryService
|
||||
return R.ok();
|
||||
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryService.statisticalByIndicatorType();
|
||||
return R.ok().put("data",dtos);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,8 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.ToDoubleFunction;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -103,9 +105,15 @@ public class IndicatorLibraryServiceImpl extends ServiceImpl<IndicatorLibraryMap
|
||||
@Override
|
||||
public List<StatisticalIndicatorTypeDto> statisticalByIndicatorType() {
|
||||
List<StatisticalIndicatorTypeDto> dtos = indicatorLibraryMapper.statisticalByIndicatorType();
|
||||
for(StatisticalIndicatorTypeDto dto:dtos){
|
||||
|
||||
StatisticalIndicatorTypeDto dto = new StatisticalIndicatorTypeDto();
|
||||
dto.setName("全部分类");
|
||||
dto.setIndicatorType(null);
|
||||
if(CollectionUtils.isNotEmpty(dtos)){
|
||||
double sum = dtos.stream().mapToDouble(value -> value.getCount()).sum();
|
||||
dto.setCount(Double.valueOf(sum).intValue());
|
||||
}
|
||||
return null;
|
||||
//加入首位
|
||||
dtos.add(0,dto);
|
||||
return dtos;
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,8 +125,9 @@
|
||||
|
||||
<select id="statisticalByIndicatorType"
|
||||
resultType="com.lz.modules.performance.dto.StatisticalIndicatorTypeDto">
|
||||
SELECT indicator_type,count(indicator_type) count from lz_indicator_library where is_delete = 0 GROUP BY indicator_type
|
||||
|
||||
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>
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user