Browse Source

修复分类bug

赵冬冬 4 years ago
parent
commit
34db170630
1 changed files with 35 additions and 34 deletions
  1. 35 34
      forest-admin/admin-server/src/main/resources/dao/BigCompanyDao.xml

+ 35 - 34
forest-admin/admin-server/src/main/resources/dao/BigCompanyDao.xml

@@ -2,28 +2,28 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.hwrj.cloud.admin.dao.BigCompanyDao">
     <select id="bigCompanyInfo" resultType="java.util.Map">
-<!--        SELECT-->
-<!--            a.id,-->
-<!--            a.comp_name AS name,-->
-<!--            a.comp_con_person as compConPerson,-->
-<!--            a.comp_con_num as compConNum,-->
-<!--            concat(a.province_id,a.city_id,a.county_id) as address,-->
-<!--            a.longitude as lng,-->
-<!--            a.latitude as latitude,-->
-<!--            a.company_type as companyType-->
-<!--        FROM-->
-<!--            ums_company_info a-->
-<!--        WHERE-->
-<!--            a.comp_status =0-->
-<!--            <if test="key != null and key != ''">-->
-<!--                and a.comp_name like concat('%',#{key},'%')-->
-<!--            </if>-->
-<!--            <if test="catId != null">-->
-<!--                and a.id in (-->
-<!--                select p.ums_company_info_id from pms_product p LEFT JOIN pms_product_category pc on p.product_category_id = pc.id  where pc.parent_id = #{catId} GROUP BY p.ums_company_info_id-->
+        <!--        SELECT-->
+        <!--            a.id,-->
+        <!--            a.comp_name AS name,-->
+        <!--            a.comp_con_person as compConPerson,-->
+        <!--            a.comp_con_num as compConNum,-->
+        <!--            concat(a.province_id,a.city_id,a.county_id) as address,-->
+        <!--            a.longitude as lng,-->
+        <!--            a.latitude as latitude,-->
+        <!--            a.company_type as companyType-->
+        <!--        FROM-->
+        <!--            ums_company_info a-->
+        <!--        WHERE-->
+        <!--            a.comp_status =0-->
+        <!--            <if test="key != null and key != ''">-->
+        <!--                and a.comp_name like concat('%',#{key},'%')-->
+        <!--            </if>-->
+        <!--            <if test="catId != null">-->
+        <!--                and a.id in (-->
+        <!--                select p.ums_company_info_id from pms_product p LEFT JOIN pms_product_category pc on p.product_category_id = pc.id  where pc.parent_id = #{catId} GROUP BY p.ums_company_info_id-->
 
-<!--                )-->
-<!--            </if>-->
+        <!--                )-->
+        <!--            </if>-->
 
         SELECT
         a.id,
@@ -38,15 +38,16 @@
         ums_company_info a
         WHERE
         a.comp_status = 0
-                    <if test="key != null and key != ''">
-                        and a.comp_name like concat('%',#{key},'%')
-                    </if>
-                    <if test="catId != null">
-                        and a.id in (
-                        select p.ums_company_info_id from pms_product p LEFT JOIN pms_product_category pc on p.product_category_id = pc.id  where pc.parent_id = #{catId} GROUP BY p.ums_company_info_id
+        <if test="key != null and key != ''">
+            and a.comp_name like concat('%',#{key},'%')
+        </if>
+        <if test="catId != null">
+            and a.id in (
+            select p.comp_id from pms_product p LEFT JOIN pms_product_category pc on p.product_category_id =
+            pc.id where pc.parent_id = #{catId} GROUP BY p.comp_id
 
-                        )
-                    </if>
+            )
+        </if>
         UNION ALL
         SELECT
         CONCAT( b.id, '9999' ) AS id,
@@ -61,12 +62,12 @@
         ums_company_info_ext b
         WHERE
         b.delete_status = 0
-        <if test = "key != null and key != ''" >
-        AND b.comp_name LIKE concat( '%', #{key},'%')
+        <if test="key != null and key != ''">
+            AND b.comp_name LIKE concat( '%', #{key},'%')
+        </if>
+        <if test="catId != null">
+            and b.product_category_id = #{catId}
         </if>
-          <if test = "catId != null" >
-           and b.product_category_id = #{catId}
-          </if>
 
     </select>
     <select id="getCat" resultType="java.lang.String">