|
|
@@ -91,6 +91,10 @@
|
|
|
<result column="followStaffName" property="followStaffName"/>
|
|
|
<result column="lastFollowStaffName" property="lastFollowStaffName"/>
|
|
|
<result column="saleStatusName" property="saleStatusName"/>
|
|
|
+ <result column="next_follow_time" property="nextFollowTime" typeHandler="TimestampTypeHandler"/>
|
|
|
+
|
|
|
+ <result column="follow_staff" property="followStaff"/>
|
|
|
+ <result column="follow_staff_name" property="followStaffName"/>
|
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
@@ -176,13 +180,14 @@
|
|
|
AND tmc.cp_id = #{cpId}
|
|
|
</if>
|
|
|
<if test="searchText != null">
|
|
|
- AND (data_value like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
- OR dict_code like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
- OR remarks like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ AND (tmc.cus_code like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tmc.cus_name like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tmc.cus_phone like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tmc.address_full like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
+ OR tmc.remarks like concat('%', my_ex.likequery(#{searchText}) , '%')
|
|
|
)
|
|
|
</if>
|
|
|
|
|
|
-
|
|
|
</where>
|
|
|
</sql>
|
|
|
|
|
|
@@ -203,19 +208,18 @@
|
|
|
tmo.org_name AS "orgName",
|
|
|
tms.staff_name AS "staffName",
|
|
|
tms2.staff_name AS "reportStaffName",
|
|
|
- tdk.kind_name_i18n ->> 'zh_CN' AS "saleStatusName"
|
|
|
--- tms3.staff_name AS "followStaffName",
|
|
|
--- tms4.staff_name AS "lastFollowStaffName"
|
|
|
+ tdk.kind_name_i18n ->> 'zh_CN' AS "saleStatusName",
|
|
|
+ tcf.next_follow_time
|
|
|
FROM dkic_b.t_mst_customer tmc
|
|
|
+ LEFT JOIN ( select tccff.cus_id, max (tccff.next_follow_time)as next_follow_time from dkic_b.t_crm_cus_follow tccff group by tccff.cus_id ) tcf on tmc.cus_id = tcf.cus_id
|
|
|
LEFT JOIN dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tmc.cus_from
|
|
|
LEFT JOIN dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
|
|
|
LEFT JOIN dkic_b.t_mst_org tmo on tmo.org_id = tmc.org_id
|
|
|
LEFT JOIN dkic_b.t_mst_staff tms on tms.staff_id = tmc.staff_id
|
|
|
LEFT JOIN dkic_b.t_mst_staff tms2 on tms2.staff_id = tmc.report_staff
|
|
|
LEFT JOIN sys.t_data_kind tdk on tdk.kind_code = tmc.sale_status
|
|
|
--- LEFT JOIN dkic_b.t_mst_staff tms3 on tms3.staff_id = tmc.follow_staffs
|
|
|
--- LEFT JOIN dkic_b.t_mst_staff tms4 on tms4.staff_id = tmc.last_follow_staff
|
|
|
<include refid="Condition"/>
|
|
|
+ order by tmc.cus_id DESC
|
|
|
<if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
|
|
|
limit #{end} offset #{start}
|
|
|
</if>
|
|
|
@@ -249,6 +253,8 @@
|
|
|
tms.staff_name AS "staffName",
|
|
|
tms2.staff_name AS "reportStaffName",
|
|
|
tdk.kind_name_i18n ->> 'zh_CN' AS "saleStatusName"
|
|
|
+-- tccfs.follow_staff as follow_staff,
|
|
|
+-- tms1.staff_name as follow_staff_name
|
|
|
FROM dkic_b.t_mst_customer tmc
|
|
|
LEFT JOIN dkic_b.t_mst_dictionary_data tmd on tmd.data_id = tmc.cus_from
|
|
|
LEFT JOIN dkic_b.t_mst_sale_channel tmsc on tmsc.channel_id = tmc.channel_id
|
|
|
@@ -256,7 +262,9 @@
|
|
|
LEFT JOIN dkic_b.t_mst_staff tms on tms.staff_id = tmc.staff_id
|
|
|
LEFT JOIN dkic_b.t_mst_staff tms2 on tms2.staff_id = tmc.report_staff
|
|
|
LEFT JOIN sys.t_data_kind tdk on tdk.kind_code = tmc.sale_status
|
|
|
- WHERE cus_id = #{cusId}::uuid
|
|
|
+-- LEFT JOIN dkic_b.t_crm_cus_follow_staff tccfs on tccfs.follow_staff = any(tmc.follow_staffs)
|
|
|
+-- LEFT JOIN dkic_b.t_mst_staff tms1 on tms1.staff_id = tccfs.follow_staff
|
|
|
+ WHERE tmc.cus_id = #{cusId}::uuid
|
|
|
</select>
|
|
|
|
|
|
<!-- 根据主键锁定表t_mst_customer的一行数据 -->
|