|  | @@ -2,32 +2,98 @@
 | 
											
												
													
														|  |  <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 |  |  <!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">
 |  |  <mapper namespace="com.hwrj.cloud.admin.dao.BigCompanyDao">
 | 
											
												
													
														|  |      <select id="bigCompanyInfo" resultType="java.util.Map">
 |  |      <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-->
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +<!--                )-->
 | 
											
												
													
														|  | 
 |  | +<!--            </if>-->
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          SELECT
 |  |          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
 |  | 
 | 
											
												
													
														|  | 
 |  | +        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
 |  |          FROM
 | 
											
												
													
														|  | -            ums_company_info a
 |  | 
 | 
											
												
													
														|  | 
 |  | +        ums_company_info a
 | 
											
												
													
														|  |          WHERE
 |  |          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
 |  | 
 | 
											
												
													
														|  | 
 |  | +        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>
 | 
											
												
													
														|  | 
 |  | +        UNION ALL
 | 
											
												
													
														|  | 
 |  | +        SELECT
 | 
											
												
													
														|  | 
 |  | +        CONCAT( b.id, '9999' ) AS id,
 | 
											
												
													
														|  | 
 |  | +        b.comp_name AS NAME,
 | 
											
												
													
														|  | 
 |  | +        b.comp_con_person AS compConPerson,
 | 
											
												
													
														|  | 
 |  | +        NULL AS compConNum,
 | 
											
												
													
														|  | 
 |  | +        concat( b.province_id, b.city_id, b.county_id ) AS address,
 | 
											
												
													
														|  | 
 |  | +        b.longitude AS lng,
 | 
											
												
													
														|  | 
 |  | +        b.latitude AS latitude,
 | 
											
												
													
														|  | 
 |  | +        b.company_type AS companyType
 | 
											
												
													
														|  | 
 |  | +        FROM
 | 
											
												
													
														|  | 
 |  | +        ums_company_info_ext b
 | 
											
												
													
														|  | 
 |  | +        WHERE
 | 
											
												
													
														|  | 
 |  | +        b.delete_status = 0
 | 
											
												
													
														|  | 
 |  | +        <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>
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |      </select>
 |  |      </select>
 | 
											
												
													
														|  |      <select id="getCat" resultType="java.lang.String">
 |  |      <select id="getCat" resultType="java.lang.String">
 | 
											
												
													
														|  | -        SELECT
 |  | 
 | 
											
												
													
														|  | 
 |  | +--         SELECT
 | 
											
												
													
														|  | 
 |  | +--             CONCAT(a.id,'---',a.name,'---',IFNULL(SUM(d.numm),0)) as cat
 | 
											
												
													
														|  | 
 |  | +--         FROM
 | 
											
												
													
														|  | 
 |  | +--             pms_product_category a
 | 
											
												
													
														|  | 
 |  | +--             LEFT JOIN (
 | 
											
												
													
														|  | 
 |  | +--             SELECT
 | 
											
												
													
														|  | 
 |  | +--                 b.ums_company_info,
 | 
											
												
													
														|  | 
 |  | +--                 b.ums_company_info_id,
 | 
											
												
													
														|  | 
 |  | +--                 c.parent_id,
 | 
											
												
													
														|  | 
 |  | +--             CASE IFNULL(b.ums_company_info_id,-1)
 | 
											
												
													
														|  | 
 |  | +--             WHEN  -1 THEN
 | 
											
												
													
														|  | 
 |  | +--                 0
 | 
											
												
													
														|  | 
 |  | +--             ELSE
 | 
											
												
													
														|  | 
 |  | +--                 1
 | 
											
												
													
														|  | 
 |  | +--         END as numm
 | 
											
												
													
														|  | 
 |  | +--
 | 
											
												
													
														|  | 
 |  | +--             FROM
 | 
											
												
													
														|  | 
 |  | +--                 pms_product b
 | 
											
												
													
														|  | 
 |  | +--                 LEFT JOIN pms_product_category c ON b.product_category_id = c.id GROUP BY c.id,b.ums_company_info_id
 | 
											
												
													
														|  | 
 |  | +--             ) d ON a.id = d.parent_id
 | 
											
												
													
														|  | 
 |  | +--         GROUP BY
 | 
											
												
													
														|  | 
 |  | +--             a.id
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            SELECT
 | 
											
												
													
														|  |              CONCAT(a.id,'---',a.name,'---',IFNULL(SUM(d.numm),0)) as cat
 |  |              CONCAT(a.id,'---',a.name,'---',IFNULL(SUM(d.numm),0)) as cat
 | 
											
												
													
														|  |          FROM
 |  |          FROM
 | 
											
												
													
														|  |              pms_product_category a
 |  |              pms_product_category a
 | 
											
										
											
												
													
														|  | @@ -45,9 +111,19 @@
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |              FROM
 |  |              FROM
 | 
											
												
													
														|  |                  pms_product b
 |  |                  pms_product b
 | 
											
												
													
														|  | -                LEFT JOIN pms_product_category c ON b.product_category_id = c.id GROUP BY c.id,b.ums_company_info_id
 |  | 
 | 
											
												
													
														|  | 
 |  | +                LEFT JOIN pms_product_category c ON b.product_category_id = c.id 								GROUP BY c.id,b.ums_company_info_id
 | 
											
												
													
														|  | 
 |  | +								union all
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +								SELECT
 | 
											
												
													
														|  | 
 |  | +									xxx.comp_name AS ums_company_info,
 | 
											
												
													
														|  | 
 |  | +									xxx.id AS ums_company_info_id,
 | 
											
												
													
														|  | 
 |  | +									xxx.product_category_id AS parent_id,
 | 
											
												
													
														|  | 
 |  | +									1 AS numm
 | 
											
												
													
														|  | 
 |  | +								FROM
 | 
											
												
													
														|  | 
 |  | +									ums_company_info_ext xxx
 | 
											
												
													
														|  |              ) d ON a.id = d.parent_id
 |  |              ) d ON a.id = d.parent_id
 | 
											
												
													
														|  |          GROUP BY
 |  |          GROUP BY
 | 
											
												
													
														|  |              a.id
 |  |              a.id
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      </select>
 |  |      </select>
 | 
											
												
													
														|  |  </mapper>
 |  |  </mapper>
 |