|
@@ -126,4 +126,73 @@
|
|
<select id="exportCustomerCompanyPage" resultType="com.dayou.vo.CustomerCompanyVO">
|
|
<select id="exportCustomerCompanyPage" resultType="com.dayou.vo.CustomerCompanyVO">
|
|
<include refid="customerCompanyQuerySql" />
|
|
<include refid="customerCompanyQuerySql" />
|
|
</select>
|
|
</select>
|
|
|
|
+
|
|
|
|
+ <!--分页查询企业客户来单列表-->
|
|
|
|
+ <select id="getCustomerCompanyOrderPage" resultType="com.dayou.vo.CustomerCompanyOrderVO">
|
|
|
|
+ SELECT *
|
|
|
|
+ FROM (SELECT assets.id AS id,
|
|
|
|
+ order_id AS orderId,
|
|
|
|
+ assets.name AS projectName,
|
|
|
|
+ 'ASSET_BUSINESS' AS businessType,
|
|
|
|
+ customer.name AS customerName,
|
|
|
|
+ subCustomer.name AS customerSubName,
|
|
|
|
+ linkman.name AS linkmanName,
|
|
|
|
+ user.name AS clientManager,
|
|
|
|
+ assets.created AS created
|
|
|
|
+ FROM assets
|
|
|
|
+ LEFT JOIN customer_company AS customer ON customer.id = assets.clientele_id
|
|
|
|
+ LEFT JOIN customer_company AS subCustomer ON subCustomer.id = assets.clientele_sub_id
|
|
|
|
+ LEFT JOIN customer_linkman AS linkman ON linkman.id = assets.clientele_contact_id
|
|
|
|
+ LEFT JOIN user ON user.id = assets.client_manager_id
|
|
|
|
+ WHERE assets.deleted = 0
|
|
|
|
+ AND assets.clientele_sub_id = #{dto.subCustomerId}
|
|
|
|
+ UNION ALL
|
|
|
|
+ SELECT major.id AS id,
|
|
|
|
+ order_id AS orderId,
|
|
|
|
+ major.name AS projectName,
|
|
|
|
+ 'MAJOR_BUSINESS' AS businessType,
|
|
|
|
+ customer.name AS customerName,
|
|
|
|
+ subCustomer.name AS customerSubName,
|
|
|
|
+ linkman.name AS linkmanName,
|
|
|
|
+ user.name AS clientManager,
|
|
|
|
+ major.created AS created
|
|
|
|
+ FROM major
|
|
|
|
+ LEFT JOIN customer_company AS customer ON customer.id = major.clientele_id
|
|
|
|
+ LEFT JOIN customer_company AS subCustomer ON subCustomer.id = major.clientele_sub_id
|
|
|
|
+ LEFT JOIN customer_linkman AS linkman ON linkman.id = major.clientele_contact_id
|
|
|
|
+ LEFT JOIN user ON user.id = major.client_manager_id
|
|
|
|
+ WHERE major.deleted = 0
|
|
|
|
+ AND major.clientele_sub_id = #{dto.subCustomerId}
|
|
|
|
+ UNION ALL
|
|
|
|
+ SELECT personal.id AS id,
|
|
|
|
+ order_id AS orderId,
|
|
|
|
+ personal.location AS projectName,
|
|
|
|
+ 'PERSONAL_BUSINESS' AS businessType,
|
|
|
|
+ customer.name AS customerName,
|
|
|
|
+ subCustomer.name AS customerSubName,
|
|
|
|
+ linkman.name AS linkmanName,
|
|
|
|
+ user.name AS clientManager,
|
|
|
|
+ personal.created AS created
|
|
|
|
+ FROM personal
|
|
|
|
+ LEFT JOIN customer_company AS customer ON customer.id = personal.clientele_id
|
|
|
|
+ LEFT JOIN customer_company AS subCustomer ON subCustomer.id = personal.clientele_sub_id
|
|
|
|
+ LEFT JOIN customer_linkman AS linkman ON linkman.id = personal.clientele_contact_id
|
|
|
|
+ LEFT JOIN user ON user.id = personal.client_manager_id
|
|
|
|
+ WHERE personal.deleted = 0
|
|
|
|
+ AND personal.clientele_sub_id = #{dto.subCustomerId}) AS custmerOrder
|
|
|
|
+ <where>
|
|
|
|
+ <if test="dto.orderId != null">
|
|
|
|
+ AND orderId = #{dto.orderId}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dto.projectName != null">
|
|
|
|
+ AND projectName LIKE CONCAT('%',#{dto.projectName},'%')
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dto.businessType != null">
|
|
|
|
+ AND businessType = #{dto.businessType}
|
|
|
|
+ </if>
|
|
|
|
+ <if test="dto.createdStartTime != null and dto.createdEndTime != null">
|
|
|
|
+ AND created BETWEEN #{dto.createdStartTime} AND #{dto.createdEndTime}
|
|
|
|
+ </if>
|
|
|
|
+ </where>
|
|
|
|
+ </select>
|
|
</mapper>
|
|
</mapper>
|