|
1 | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
2 | | -<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 2 | +<!DOCTYPE mapper |
| 3 | + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
3 | 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
4 | 5 | <mapper namespace="questionAnswerV1ServiceDaoImpl"> |
5 | 6 |
|
| 7 | + |
6 | 8 | <!-- 保存问卷投票信息 add by wuxw 2018-07-03 --> |
7 | 9 | <insert id="saveQuestionAnswerInfo" parameterType="Map"> |
8 | | - insert into question_answer(qa_name, qa_type, start_time, remark, end_time, community_id, content, qa_id, state, |
9 | | - obj_type, obj_id) |
10 | | - values (#{qaName}, #{qaType}, #{startTime}, #{remark}, #{endTime}, #{communityId}, #{content}, #{qaId}, |
11 | | - #{state}, #{objType}, #{objId}) |
| 10 | + insert into question_answer( |
| 11 | + qa_name,qa_type,start_time,remark,end_time,community_id,content,qa_id,state |
| 12 | + ) values ( |
| 13 | + #{qaName},#{qaType},#{startTime},#{remark},#{endTime},#{communityId},#{content},#{qaId},#{state} |
| 14 | + ) |
12 | 15 | </insert> |
13 | 16 |
|
| 17 | + |
14 | 18 | <!-- 查询问卷投票信息 add by wuxw 2018-07-03 --> |
15 | 19 | <select id="getQuestionAnswerInfo" parameterType="Map" resultType="Map"> |
16 | 20 | select t.qa_name,t.qa_name qaName,t.qa_type,t.qa_type qaType,t.start_time,t.start_time |
17 | 21 | startTime,t.remark,t.status_cd,t.status_cd statusCd,t.end_time,t.end_time endTime,t.community_id,t.community_id |
18 | | - communityId,t.content,t.qa_id,t.qa_id qaId,t.create_time createTime,t.state,t.obj_type,t.obj_type objType, |
19 | | - t.obj_id,t.obj_id objId, count(uqa1.user_qa_id) voteCount,td.name qaTypeName |
| 22 | + communityId,t.content,t.qa_id,t.qa_id qaId,t.create_time createTime,t.state,count(uqa1.user_qa_id) voteCount |
20 | 23 | from question_answer t |
21 | 24 | left join user_question_answer uqa1 on t.qa_id = uqa1.qa_id and uqa1.status_cd = '0' |
22 | | - left join t_dict td on t.qa_type = td.status_cd and td.table_name = 'question_answer' and td.table_columns = |
23 | | - 'qa_type' |
24 | 25 | where 1 =1 |
25 | 26 | <if test="qaName !=null and qaName != ''"> |
26 | 27 | and t.qa_name= #{qaName} |
|
52 | 53 | <if test="state !=null and state != ''"> |
53 | 54 | and t.state= #{state} |
54 | 55 | </if> |
55 | | - <if test="objType !=null and objType != ''"> |
56 | | - and t.obj_type= #{objType} |
57 | | - </if> |
58 | | - <if test="objId !=null and objId != ''"> |
59 | | - and t.obj_id= #{objId} |
60 | | - </if> |
61 | | - group by |
62 | | - t.qa_name,t.qa_type,t.start_time,t.remark,t.status_cd,t.end_time,t.community_id,t.content,t.qa_id,t.create_time,t.state |
| 56 | + group by t.qa_name,t.qa_type,t.start_time,t.remark,t.status_cd,t.end_time,t.community_id,t.content,t.qa_id,t.create_time,t.state |
63 | 57 | order by t.create_time desc |
64 | 58 | <if test="page != -1 and page != null "> |
65 | 59 | limit #{page}, #{row} |
66 | 60 | </if> |
| 61 | + |
67 | 62 | </select> |
68 | 63 |
|
| 64 | + |
69 | 65 | <!-- 修改问卷投票信息 add by wuxw 2018-07-03 --> |
70 | 66 | <update id="updateQuestionAnswerInfo" parameterType="Map"> |
71 | 67 | update question_answer t set t.status_cd = #{statusCd} |
|
93 | 89 | <if test="content !=null and content != ''"> |
94 | 90 | , t.content= #{content} |
95 | 91 | </if> |
96 | | - <if test="objType !=null and objType != ''"> |
97 | | - , t.obj_type= #{objType} |
98 | | - </if> |
99 | | - <if test="objId !=null and objId != ''"> |
100 | | - , t.obj_id= #{objId} |
101 | | - </if> |
102 | 92 | where 1=1 |
103 | 93 | <if test="qaId !=null and qaId != ''"> |
104 | 94 | and t.qa_id= #{qaId} |
105 | 95 | </if> |
106 | 96 | <if test="communityId !=null and communityId != ''"> |
107 | 97 | and t.community_id= #{communityId} |
108 | 98 | </if> |
| 99 | + |
109 | 100 | </update> |
110 | 101 |
|
111 | 102 | <!-- 查询问卷投票数量 add by wuxw 2018-07-03 --> |
|
143 | 134 | <if test="state !=null and state != ''"> |
144 | 135 | and t.state= #{state} |
145 | 136 | </if> |
146 | | - <if test="objType !=null and objType != ''"> |
147 | | - and t.obj_type= #{objType} |
148 | | - </if> |
149 | | - <if test="objId !=null and objId != ''"> |
150 | | - and t.obj_id= #{objId} |
151 | | - </if> |
| 137 | + |
| 138 | + |
152 | 139 | </select> |
153 | 140 |
|
| 141 | + |
154 | 142 | <select id="queryVotedCountAndScore" parameterType="Map" resultType="Map"> |
155 | 143 | select qa_id qaId, count(1) votedCount,SUM(t.score) score |
156 | 144 | from user_question_answer t |
|
0 commit comments