根据模板id查询指标信息带上指标评分细则信息;解决选择指标接口查询报错
parent
96ee468856
commit
9dad212d54
|
|
@ -56,9 +56,9 @@ public class AssessTemplateController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "列表")
|
@Operation(summary = "列表")
|
||||||
@PostMapping("/list")
|
@PostMapping("/listByType/{templateFreq}")
|
||||||
public R<List<AssessTemplate>> list() {
|
public R<List<AssessTemplate>> listByType(@Schema(name = "templateFreq") @PathVariable("templateFreq") Integer templateFreq) {
|
||||||
return R.ok(service.lambdaQuery().list());
|
return R.ok(service.listByType(templateFreq));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "分页")
|
@Operation(summary = "分页")
|
||||||
|
|
@ -67,6 +67,12 @@ public class AssessTemplateController {
|
||||||
return R.ok(service.pageQuery(page));
|
return R.ok(service.pageQuery(page));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(summary = "根据模板id查询模板详情")
|
||||||
|
@GetMapping("/detail/{id}")
|
||||||
|
public R<AssessTemplate> detail(@Schema(name = "id") @PathVariable("id") Long id) {
|
||||||
|
return R.ok(service.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "根据模板id查询关联的指标")
|
@Operation(summary = "根据模板id查询关联的指标")
|
||||||
@GetMapping("/queryIndicators/{id}")
|
@GetMapping("/queryIndicators/{id}")
|
||||||
public R<List<AssessIndicator>> queryIndicators(@Schema(name = "id") @PathVariable("id") Long id) {
|
public R<List<AssessIndicator>> queryIndicators(@Schema(name = "id") @PathVariable("id") Long id) {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public interface AssessIndicatorMapper extends BaseMapper<AssessIndicator> {
|
||||||
and t1.category_id = #{obj.menuId}
|
and t1.category_id = #{obj.menuId}
|
||||||
</if>
|
</if>
|
||||||
<if test="obj.name != null and obj.name != ''">
|
<if test="obj.name != null and obj.name != ''">
|
||||||
and t1.indicator_name like concat('%', #{obj.name}, '%')
|
and t1.indicator_name like concat('%', #{obj.name}::text, '%')
|
||||||
</if>
|
</if>
|
||||||
order by t2.order_index,t1.order_index
|
order by t2.order_index,t1.order_index
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ public class AssessIndicatorService extends ServiceImpl<AssessIndicatorMapper, A
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillRating(List<AssessIndicator> records) {
|
public void fillRating(List<AssessIndicator> records) {
|
||||||
List<Long> ids = records.stream().map(AssessIndicator::getId).collect(Collectors.toList());
|
List<Long> ids = records.stream().map(AssessIndicator::getId).collect(Collectors.toList());
|
||||||
List<AssessIndicatorRating> relList = indicatorRatingService.queryRatingList(ids);
|
List<AssessIndicatorRating> relList = indicatorRatingService.queryRatingList(ids);
|
||||||
Map<Long, List<AssessIndicatorRating>> map = relList.stream().collect(Collectors.groupingBy(AssessIndicatorRating::getIndicatorId));
|
Map<Long, List<AssessIndicatorRating>> map = relList.stream().collect(Collectors.groupingBy(AssessIndicatorRating::getIndicatorId));
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
package com.gunshi.project.xyt.service;
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
|
@ -33,6 +35,8 @@ public class AssessTemplateService extends ServiceImpl<AssessTemplateMapper, Ass
|
||||||
@Autowired
|
@Autowired
|
||||||
private AssessTemplateIndicatorRelService relService;
|
private AssessTemplateIndicatorRelService relService;
|
||||||
|
|
||||||
|
@Autowired AssessIndicatorService indicatorService;
|
||||||
|
|
||||||
public AssessTemplate saveData(AssessTemplate dto) {
|
public AssessTemplate saveData(AssessTemplate dto) {
|
||||||
dto.setId(IdWorker.getId());
|
dto.setId(IdWorker.getId());
|
||||||
dto.setStatus(0);
|
dto.setStatus(0);
|
||||||
|
|
@ -85,7 +89,16 @@ public class AssessTemplateService extends ServiceImpl<AssessTemplateMapper, Ass
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<AssessIndicator> queryIndicators(Long id) {
|
public List<AssessIndicator> queryIndicators(Long id) {
|
||||||
return this.baseMapper.queryIndicators(id);
|
List<AssessIndicator> list = this.baseMapper.queryIndicators(id);
|
||||||
|
if(CollectionUtils.isEmpty(list)){
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
indicatorService.fillRating(list);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AssessTemplate> listByType(Integer templateFreq) {
|
||||||
|
return this.list(new QueryWrapper<AssessTemplate>().eq("template_freq",templateFreq));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue