|
@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<result property="corporateLogo" column="corporate_logo" />
|
|
|
<result property="customerSource" column="customer_source" />
|
|
|
<result property="cityCode" column="city_code" />
|
|
|
+ <result property="areaCode" column="area_code" />
|
|
|
<result property="attributedPersonnel" column="attributed_personnel" />
|
|
|
<result property="detailedAddress" column="detailed_address" />
|
|
|
<result property="industryType" column="industry_type" />
|
|
@@ -35,7 +36,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</resultMap>
|
|
|
|
|
|
<sql id="selectCustomerInfoVo">
|
|
|
- select id, corporate_name, business_type, corporate_logo, customer_source, city_code, attributed_personnel, detailed_address, industry_type, corporate_phone, corporate_contacts, phone, customer_star, enterprise_tax_number, invoice_title, bank_of_deposit, bank_account, finance_phone, fax_number, applet_address, applet_logo, applet_qr_code, applet_introduce, shelf_status, create_time, update_time, status from customer_info
|
|
|
+ select id, corporate_name, business_type, corporate_logo, customer_source, city_code,area_code, attributed_personnel, detailed_address, industry_type, corporate_phone, corporate_contacts, phone, customer_star, enterprise_tax_number, invoice_title, bank_of_deposit, bank_account, finance_phone, fax_number, applet_address, applet_logo, applet_qr_code, applet_introduce, shelf_status, create_time, update_time, status from customer_info
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectCustomerInfoList" parameterType="CustomerInfo" resultMap="CustomerInfoResult">
|
|
@@ -46,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
<if test="corporateLogo != null "> and corporate_logo = #{corporateLogo}</if>
|
|
|
<if test="customerSource != null "> and customer_source = #{customerSource}</if>
|
|
|
<if test="cityCode != null and cityCode != ''"> and city_code = #{cityCode}</if>
|
|
|
+ <if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
|
|
|
<if test="attributedPersonnel != null "> and attributed_personnel = #{attributedPersonnel}</if>
|
|
|
<if test="detailedAddress != null and detailedAddress != ''"> and detailed_address = #{detailedAddress}</if>
|
|
|
<if test="industryType != null "> and industry_type = #{industryType}</if>
|
|
@@ -73,6 +75,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
f1.file_url as corporateLogoFileUrl,
|
|
|
ci.customer_source,
|
|
|
ci.city_code,
|
|
|
+ ci.area_code,
|
|
|
ci.attributed_personnel,
|
|
|
ci.detailed_address,
|
|
|
ci.industry_type,
|
|
@@ -115,57 +118,74 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
ci.applet_introduce,
|
|
|
ci.create_time,
|
|
|
ci.update_time,
|
|
|
+ (select COUNT(1) from collection_info coi where coi.customer_id = ci.id) as collectionCount,
|
|
|
+ (SELECT COUNT(1) from collection_info coi where coi.user_id = #{userId} and customer_id = ci.id) as collectionStatus,
|
|
|
ci.status
|
|
|
from customer_info ci
|
|
|
LEFT JOIN file_info f1 on f1.file_id = ci.corporate_logo
|
|
|
LEFT JOIN file_info f2 on f2.file_id = ci.applet_logo
|
|
|
LEFT JOIN file_info f3 on f3.file_id = ci.applet_qr_code
|
|
|
- WHERE ci.industry_type = #{productId}
|
|
|
+ <where>
|
|
|
+ 1=1
|
|
|
+ <choose>
|
|
|
+ <when test="customerInfoDto.customerName != null and customerInfoDto.customerName != ''">
|
|
|
+ and ci.corporate_name like concat('%', #{customerInfoDto.customerName}, '%')
|
|
|
+ </when>
|
|
|
+ <when test="customerInfoDto.id == 0">
|
|
|
+ ORDER BY collectionCount DESC
|
|
|
+ </when>
|
|
|
+ <when test="customerInfoDto.pid != null and customerInfoDto.pid != ''">
|
|
|
+ AND ci.industry_type = #{customerInfoDto.pid}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND ci.industry_type IN ( SELECT id FROM product_type_info WHERE pid = #{customerInfoDto.id} )
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="getCustomerListByCollectionCount" resultType="com.miaxis.customer.vo.ExhibitionCustomerInfoVo">
|
|
|
+ <select id="getCollectionList" resultType="com.miaxis.collection.vo.CollectionCustomerVo">
|
|
|
SELECT
|
|
|
- ci.id,
|
|
|
- (select COUNT(1) from collection_info coi where coi.customer_id = ci.id) as collectionCount,
|
|
|
+ coi.id,
|
|
|
+ ci.id as customerId,
|
|
|
ci.corporate_name,
|
|
|
- f1.file_url as corporateLogoFileUrl,
|
|
|
ci.applet_address,
|
|
|
+ f1.file_url as corporateLogoFileUrl,
|
|
|
f2.file_url as appletLogoFileUrl,
|
|
|
f3.file_url as appletQrCodeFileUrl,
|
|
|
ci.applet_introduce,
|
|
|
- ci.create_time,
|
|
|
- ci.update_time,
|
|
|
+ coi.create_time,
|
|
|
ci.status
|
|
|
- FROM `customer_info` ci
|
|
|
- LEFT JOIN file_info f1 on f1.file_id = ci.corporate_logo
|
|
|
- LEFT JOIN file_info f2 on f2.file_id = ci.applet_logo
|
|
|
- LEFT JOIN file_info f3 on f3.file_id = ci.applet_qr_code
|
|
|
- ORDER BY collectionCount DESC
|
|
|
+ FROM `user_info` ui
|
|
|
+ LEFT JOIN collection_info coi ON coi.user_id = ui.id
|
|
|
+ LEFT JOIN customer_info ci ON coi.customer_id = ci.id
|
|
|
+ LEFT JOIN file_info f1 ON f1.file_id = ci.corporate_logo
|
|
|
+ LEFT JOIN file_info f2 ON f2.file_id = ci.applet_logo
|
|
|
+ LEFT JOIN file_info f3 ON f3.file_id = ci.applet_qr_code
|
|
|
+ WHERE ui.id = #{id}
|
|
|
+
|
|
|
</select>
|
|
|
|
|
|
|
|
|
- <select id="getCollectionList" resultType="com.miaxis.collection.vo.CollectionCustomerVo">
|
|
|
+ <!--getCustomerDetailsById-->
|
|
|
+ <select id="getCustomerDetailsById" resultType="com.miaxis.customer.vo.BrowseRecordCustomerInfoVo">
|
|
|
SELECT
|
|
|
- coi.id,
|
|
|
- ci.id as customerId,
|
|
|
+ ci.id,
|
|
|
ci.corporate_name,
|
|
|
ci.applet_address,
|
|
|
f1.file_url as corporateLogoFileUrl,
|
|
|
f2.file_url as appletLogoFileUrl,
|
|
|
f3.file_url as appletQrCodeFileUrl,
|
|
|
ci.applet_introduce,
|
|
|
- coi.create_time,
|
|
|
ci.status
|
|
|
FROM `customer_info` ci
|
|
|
LEFT JOIN file_info f1 on f1.file_id = ci.corporate_logo
|
|
|
LEFT JOIN file_info f2 on f2.file_id = ci.applet_logo
|
|
|
LEFT JOIN file_info f3 on f3.file_id = ci.applet_qr_code
|
|
|
- LEFT JOIN collection_info coi ON coi.customer_id = ci.id
|
|
|
- WHERE ci.id IN ( select coi.customer_id from collection_info coi where coi.user_id = #{id})
|
|
|
+ WHERE ci.id = #{id}
|
|
|
|
|
|
</select>
|
|
|
|
|
|
-
|
|
|
</mapper>
|