liyuanyuan 9 meses atrás
pai
commit
8156f72208

+ 62 - 0
hjzx-mapper/src/main/resources/mapper/survey/ScoreRangeMapper.xml

@@ -0,0 +1,62 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="api.mapper.survey.ScoreRangeMapper">
6
+
7
+
8
+	<resultMap type="api.entity.view.survey.SatisfactionView" id="SatisfactionViewResult">
9
+		<result property="min"     column="min"      />
10
+		<result property="max"     column="max"      />
11
+		<result property="labelName"     column="labelName"      />
12
+		<result property="total"     column="total"      />
13
+		<result property="color"     column="color"      />
14
+
15
+	</resultMap>
16
+
17
+
18
+	<select id="selectLabelBySurveyIdTotalScore"   resultType="java.lang.String"    >
19
+
20
+
21
+		SELECT label_name  FROM `q_score_range`
22
+		   where min <![CDATA[<=]]> #{totalScore} and max>=#{totalScore}
23
+
24
+		  and survey_id=#{surveyid}
25
+
26
+
27
+	</select>
28
+
29
+
30
+	<select id="selectScoreRangeBySurveyId" parameterType="long"  resultMap="SatisfactionViewResult"    >
31
+
32
+
33
+		SELECT min,max,b.label_name labelName,  IFNULL(t.total,0) total,color
34
+
35
+		from q_score_range b left join (
36
+
37
+			SELECT a.label_name,count(1) total from q_answersheet a
38
+			where a.surveyid =#{surveyId}  and a.label_name is not NULL
39
+
40
+			GROUP BY a.label_name
41
+		) t  on t.label_name=b.label_name where   b.survey_id  = #{surveyId}
42
+
43
+
44
+	</select>
45
+
46
+	<select id="selectLabelColorBySurveyIdTotalScore"   resultType="java.util.Map"    >
47
+
48
+
49
+		SELECT label_name,color  FROM `q_score_range`
50
+		where min <![CDATA[<=]]> #{totalScore} and max>=#{totalScore}
51
+
52
+		  and survey_id=#{surveyid}
53
+
54
+
55
+	</select>
56
+
57
+
58
+
59
+
60
+
61
+
62
+</mapper>