Commit d7c3399f authored by 王国存's avatar 王国存

Merge branch 'master' into 'test'

问卷管理-绩效汇总列表优化

See merge request !4
parents 6aa70a2a 3aeff8e0
......@@ -374,24 +374,26 @@ public class QuestionnaireCtrl {
map.put("msg", "");
Map<String, Object> data = new HashMap();
//列表排序
String sorting = "";
if(performanceSummary.getSorting().equals("desc")){
sorting = "tr.create_time desc";
}else{
sorting = "basicIndicators,guideIndicators,rewardIndicators desc";
}
performanceSummary.setSorting(sorting);
int totalScore = 0;
//查询空间的不同指标的分数
List<PerformanceSummary> performanceSummaryList = questionnaireService.selectPerformanceSummaryList(performanceSummary);
if(performanceSummaryList.size() > 0){
for(PerformanceSummary total : performanceSummaryList){
//基础指标最高30分,引导指标最高50分,奖励指标最高10分
if(total.getGuideIndicators() > 50){
total.setGuideIndicators(50);
}
if(total.getRewardIndicators() > 30){
total.setRewardIndicators(30);
}
//计算各个空间指标的总分
totalScore = total.getBasicIndicators() + total.getGuideIndicators() + total.getRewardIndicators();
total.setTotalScore(totalScore);
}
data.put("performanceSummaryList",performanceSummaryList);
data.put("totalScore",totalScore);
}
map.put("data",data);
......
......@@ -123,41 +123,36 @@
<select id="selectPerformanceSummaryList" resultType="com.tiptimes.model.PerformanceSummary">
SELECT
ta.value as optinName,
CASE WHEN tr.process_status = 2 THEN '0'
WHEN tr.process_status = 3 THEN '30'
ELSE '0'
END as basicIndicators,
CASE WHEN tr.process_status = 2 THEN '0' WHEN tr.process_status = 3 THEN '30' ELSE '0' END as basicIndicators,
(
SELECT
COUNT(ta.score) as score
FROM
t_questions AS tq
LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1'
LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` in('2','5','6','8','9','12','13','14','15','16')
LEFT JOIN t_record AS tr on tr.id = ta.record_id
WHERE o.`status` = 1 and tq.`status` = 1
CASE WHEN COUNT(ta.score) > 50 THEN 50 WHEN COUNT(ta.score) THEN COUNT(ta.score) ELSE '0' END as score
FROM t_questions AS tq
LEFT JOIN t_answer AS ta ON ta.`group` = tq.id
LEFT JOIN t_record AS tr ON tr.id = ta.record_id
WHERE tq.`status` = 1 AND ta.`group` in('2','5','6','8','9','12','13','14','15','16')
) as guideIndicators,
(
SELECT
COUNT(ta.score) as score
FROM
t_questions AS tq
LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1'
LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` = '1'
LEFT JOIN t_record AS tr on tr.id = ta.record_id and ta.`group` BETWEEN 17 and 21
WHERE o.`status` = 1 and tq.`status` = 1
CASE WHEN COUNT(ta.score) > 10 THEN 10 WHEN COUNT(ta.score) THEN COUNT(ta.score) ELSE '0' END as score
FROM t_questions AS tq
LEFT JOIN t_answer AS ta ON ta.`group` = tq.id
LEFT JOIN t_record AS tr ON tr.id = ta.record_id and ta.`group` BETWEEN 17 and 21
WHERE tq.`status` = 1
) as rewardIndicators
FROM
t_questions AS tq
FROM t_questions AS tq
LEFT JOIN t_options AS o ON o.question_id = tq.id AND o.id = '1'
LEFT JOIN t_answer AS ta ON ta.options_id = o.id AND ta.`group` = '1'
LEFT JOIN t_record AS tr on tr.id = ta.record_id and ta.`group` BETWEEN 1 and 11
LEFT JOIN t_record AS tr ON tr.id = ta.record_id and ta.`group` BETWEEN 1 and 11
WHERE o.`status` = 1 and tq.`status` = 1
<if test=" optinName!= null and optinName !=''">
AND ta.value LIKE CONCAT('%', #{optinName}, '%')
</if>
ORDER BY ta.value ${sorting}
ORDER BY
<if test="sorting != null and sorting != ''">
${sorting}
</if>
</select>
<!--绩效汇总导出-->
......
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