123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!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-->
- <!-- )-->
- <!-- </if>-->
- 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.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>
- 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 id="getCat" resultType="java.lang.String">
- SELECT
- CONCAT(
- a.id,
- '---',
- a. NAME,
- '---',
- IFNULL(SUM(d.numm), 0)
- ) AS cat
- FROM
- pms_product_category a
- LEFT JOIN (
- SELECT
- b.comp_name,
- b.comp_id,
- c.parent_id,
- CASE IFNULL(b.comp_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
- WHERE
- b.product_category_id IS NOT NULL
- GROUP BY
- c.parent_id,
- b.comp_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
- GROUP BY
- a.id
- </select>
- </mapper>
|