Просмотр исходного кода

问卷调查导出新增分部和提交时间

zouxuan 4 лет назад
Родитель
Сommit
eb18bbb90f

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -356,4 +356,11 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
     List<Map<Integer, String>> getStudentSubjectMapList(@Param("studentIds") List<Integer> studentIds);
 
     List<IndexBaseMonthData> groupOrganId(@Param("organIds") List<Integer> organIds, @Param("userIds") List<Integer> userIds);
+
+    /**
+     * 获取学员分部
+     * @param userIdList
+     * @return
+     */
+    List<Map<Integer, String>> queryStudentOrganNameMap(@Param("userIdList") List<Integer> userIdList);
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/QuestionnaireUserResultServiceImpl.java

@@ -42,6 +42,8 @@ public class QuestionnaireUserResultServiceImpl extends BaseServiceImpl<Long, Qu
 	private SysUserFeignService sysUserFeignService;
 	@Autowired
 	private TeacherDao teacherDao;
+	@Autowired
+	private StudentDao studentDao;
 
 	@Override
 	public BaseDAO<Long, QuestionnaireUserResult> getDAO() {
@@ -104,15 +106,22 @@ public class QuestionnaireUserResultServiceImpl extends BaseServiceImpl<Long, Qu
 				nameList = MapUtil.convertMybatisMap(questionnaireUserResultDao.queryUserName(activeType));
 			}
 			Map<Integer, String> phoneList = MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(StringUtils.join(userIdList,",")));
+
+			Map<Integer, String> organNameMap = MapUtil.convertMybatisMap(studentDao.queryStudentOrganNameMap(userIdList));
 			for (Integer userId : userIdList) {
 				List<QuestionnaireUserResult> userResultList = userIdMap.get(userId);
 				if(userResultList != null && userResultList.size() > 0){
+					QuestionnaireUserResult result1 = userResultList.get(0);
 					Map<String,Object> jsonObject = new LinkedHashMap<>();
 					body.add("cooperationId");
+					body.add("organName");
+					body.add("createTime");
 					body.add("userId");
 					body.add("userName");
 					body.add("phone");
 					jsonObject.put("cooperationId",cooperationId);
+					jsonObject.put("organName",organNameMap.get(userId));
+					jsonObject.put("createTime",result1.getCreateTime());
 					jsonObject.put("userId",userId);
 					jsonObject.put("userName",nameList.get(userId));
 					jsonObject.put("phone",phoneList.get(userId));

+ 6 - 5
mec-biz/src/main/resources/config/mybatis/QuestionnaireUserResultMapper.xml

@@ -28,19 +28,20 @@
 	
 	<!-- 全查询 -->
 	<select id="findAll" resultMap="QuestionnaireUserResult">
-		SELECT * FROM questionnaire_user_result
+		SELECT qur.* FROM questionnaire_user_result qur
+		LEFT JOIN sys_user su ON su.id_ = qur.user_id_
 		<where>
 			<if test="userId != null">
-				AND user_id_ = #{userId}
+				AND qur.user_id_ = #{userId}
 			</if>
 			<if test="activeId != null">
-				AND active_id_ = #{activeId}
+				AND qur.active_id_ = #{activeId}
 			</if>
 			<if test="activeType != null and activeType != ''">
-				AND active_type_ = #{activeType}
+				AND qur.active_type_ = #{activeType}
 			</if>
 		</where>
-		ORDER BY user_id_,id_
+		ORDER BY su.organ_id_,qur.create_time_,qur.user_id_,qur.id_
 	</select>
 	
 	<!-- 向数据库增加一条记录 -->

+ 8 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -1207,6 +1207,14 @@
         </if>
         GROUP BY su.organ_id_
     </select>
+    <select id="queryStudentOrganNameMap" resultType="java.util.Map">
+        SELECT su.id_ 'key',o.name_ 'value' FROM sys_user su
+        LEFT JOIN organization o ON o.id_ = su.organ_id_
+        WHERE su.organ_id_ IS NOT NULL AND su.id_ IN
+        <foreach collection="userIdList" item="userId" open="(" close=")" separator=",">
+            #{userId}
+        </foreach>
+    </select>
 
     <update id="updateGrade"><![CDATA[
         UPDATE student SET current_grade_num_=current_grade_num_+1

+ 2 - 0
mec-web/src/main/java/com/ym/mec/web/controller/QuestionnaireUserResultController.java

@@ -60,6 +60,8 @@ public class QuestionnaireUserResultController extends BaseController {
         if(questionList != null && questionList.size() > 0){
             List<String> column = new ArrayList<>();
             column.add("活动编号");
+            column.add("分部");
+            column.add("提交时间");
             column.add("学员编号");
             column.add("学员姓名");
             column.add("手机号");