he2802 2 years ago
parent
commit
9df9011336

+ 4 - 17
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -179,23 +179,10 @@
     </resultMap>
 
     <select id="selectListByBo" parameterType="com.zhongzheng.modules.bank.bo.QuestionQueryBo" resultMap="QuestionResultVo">
-       SELECT
+        SELECT
         q.*
         FROM
         question q
-        LEFT JOIN (SELECT
-        major_id,
-        type,
-        any_value ( education_type_id ) as  education_type_id,
-        any_value ( business_id ) as  business_id,
-        any_value ( project_id )as  project_id,
-        any_value ( subject_id ) as subject_id
-        FROM
-        question_business
-        where type = 1
-        GROUP BY
-        major_id,
-        type ) qb ON q.question_id = qb.major_id
         WHERE
         1 = 1 AND q.status !=-1
         <if test="status != null and status.size()!=0 ">
@@ -206,16 +193,16 @@
         </if>
 
         <if test="educationTypeId != null and educationTypeId != ''">
-            AND qb.education_type_id = #{educationTypeId}
+            AND (select count(*) from question_business qb  where qb.type = 1 and qb.major_id = q.question_id and qb.education_type_id = #{educationTypeId}) >0
         </if>
         <if test="subjectId != null and subjectId != ''">
-            AND qb.subject_id = #{subjectId}
+            AND (select count(*) from question_business qb  where qb.type = 1 and qb.major_id = q.question_id and qb.subject_id = #{subjectId}) >0
         </if>
         <if test="type != null and type != ''">
             AND q.type = #{type}
         </if>
         <if test="businessId != null and businessId != ''">
-            AND qb.business_id = #{businessId}
+            AND (select count(*) from question_business qb  where qb.type = 1 and qb.major_id = q.question_id and qb.business_id = #{businessId}) >0
         </if>
         <if test="publishStatus != null ">
             AND q.publish_status = #{publishStatus}