"(select count(1) from ecw_customer_followup l where l.offer_id = o.offer_id) as log_count, ",
"u.nickname as creator_name, ",
"u.nickname as business_manager_name, ",
// "(SELECT cc.`name` FROM ecw_customer_contacts cc WHERE ( o.relation = 1 AND cc.id = o.consignor_id ) OR ( o.relation = 2 AND cc.id = o.consignee_id)) AS relation_name ",
"cc.name as relation_name, ",
"cc.area_code as relation_area_code, ",
"cc.phone_new as relation_phone, ",
"if(#{lang} = 0, l.name_zh , l.name_en ) as channel_name, ",
"line.start_warehouse_id, ",
"line.dest_warehouse_id, ",
"if(#{lang} = 0, l.name_zh , l.name_en ) as channel_name, ",
"if(#{lang} = 0, l.name_zh , l.name_en ) as channel_name, ",
"if(#{lang} = 0, st.title_zh , st.title_en) as start_warehouse_name, ",
"if(#{lang} = 0, dst.title_zh , dst.title_en) as dest_warehouse_name, ",
"line.transport_type ",
"from ecw_offer o ",
"left join ecw_customer_contacts cc on (o.relation = 1 and cc.id = o.consignor_id) or (o.relation = 2 and cc.id = o.consignee_id) ",
"left join ecw_customer user on user.id = o.relation_id ",
"left join system_user u on u.id = o.follow_up_salesman_id ",
"left join ecw_region s on o.objective_id = s.id ",
"left join ecw_warehouse_line line on o.line_id = line.id ",
"left join ecw_warehouse st on line.start_warehouse_id = st.id ",
"left join ecw_warehouse dst on line.dest_warehouse_id = dst.id ",
"left join ecw_channel l on o.channel_id = l.channel_id ",
"where o.deleted = 0",
...
...
@@ -152,7 +142,6 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"AND o.relation_id = #{pageVO.customerId} ",
"</when>",
"<when test = 'pageVO.deptId != null'>",
"AND o.dept_id = #{pageVO.deptId} ",
"</when>",
...
...
@@ -254,11 +243,21 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"<script>",
"select count(1)",
"from ecw_offer o ",
"left join ecw_customer c on c.id = o.relation_id ",
"left join ecw_customer_contacts cc on (o.relation = 1 and cc.id = o.consignor_id) or (o.relation = 2 and cc.id = o.consignee_id) ",
"left join ecw_customer user on user.id = o.relation_id ",
"left join system_user u on u.id = o.follow_up_salesman_id ",
"left join ecw_region s on o.objective_id = s.id ",
"left join ecw_warehouse_line line on o.line_id = line.id ",
"left join ecw_warehouse st on line.start_warehouse_id = st.id ",
"left join ecw_warehouse dst on line.dest_warehouse_id = dst.id ",
"left join ecw_channel l on o.channel_id = l.channel_id ",
"where o.deleted = 0",
//startWarehouseIds
"<when test = 'pageVO.startWarehouseIds != null and pageVO.startWarehouseIds.size() > 0'>",
"<when test = 'pageVO.searchCustomer != null and pageVO.searchCustomer != \"\" '>",
"AND o.`relation_id` in(select cc.customer_id from ecw_customer_contacts cc where concat(cc.`name`, cc.phone_new) like concat('%',concat(#{pageVO.searchCustomer},'%')))",