he2802 2 жил өмнө
parent
commit
a36e06d644

+ 41 - 10
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionMapper.xml

@@ -183,17 +183,48 @@
         q.*
         FROM
         question q
-        LEFT JOIN (SELECT
-        major_id,
-        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
+        WHERE
+        1 = 1 AND q.status !=-1
+        <if test="status != null and status.size()!=0 ">
+            AND q.status in
+            <foreach collection="status" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+
+        <if test="educationTypeId != null and educationTypeId != ''">
+            AND (select count(*) from question_business qb where qb.type = 1 and q.question_id = qb.major_id and  qb.education_type_id = #{educationTypeId}) >0
+        </if>
+        <if test="subjectId != null and subjectId != ''">
+            AND (select count(*) from question_business qb where qb.type = 1 and q.question_id = qb.major_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 (select count(*) from question_business qb where qb.type = 1 and q.question_id = qb.major_id and  qb.business_id = #{businessId}) >0
+        </if>
+        <if test="publishStatus != null ">
+            AND q.publish_status = #{publishStatus}
+        </if>
+        <if test="prefixName != null and prefixName != ''">
+            AND q.prefix_name like concat('%', #{prefixName}, '%')
+        </if>
+        <if test="key != null and key != ''">
+            AND (q.content like concat('%', #{key}, '%') or q.prefix_name like concat('%', #{key}, '%') or q.code like concat('%', #{key}, '%'))
+        </if>
+        <if test="pageSizeSelf != null and pageSizeSelf != ''">
+            LIMIT #{currIndex} , #{pageSizeSelf}
+        </if>
+        ORDER BY q.question_id DESC
+    </select>
+
+    <select id="selectListByBo_COUNT" resultType="Long">
+        SELECT
+        COUNT( DISTINCT q.question_id )
         FROM
-        question_business
-        where type = 1
-        GROUP BY
-        major_id) qb ON q.question_id = qb.major_id
+        question q
+        LEFT JOIN question_business qb ON q.question_id = qb.major_id AND qb.type = 1
         WHERE
         1 = 1 AND q.status !=-1
         <if test="status != null and status.size()!=0 ">