魏熙美 5 年之前
父節點
當前提交
941eae86d8

+ 6
- 0
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java 查看文件

@@ -123,6 +123,12 @@ public class TaRecommendCustomer implements Serializable {
123 123
     @TableField(exist = false)
124 124
     private Map<String, Object> consultants;
125 125
 
126
+    @TableField(exist = false)
127
+    private String consultantName;
128
+
129
+    @TableField(exist = false)
130
+    private String consultTel;
131
+
126 132
     private String verifyStatus;
127 133
 
128 134
     private String verifyRemark;

+ 3
- 0
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java 查看文件

@@ -1,5 +1,6 @@
1 1
 package com.huiju.estateagents.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.huiju.estateagents.entity.TaRecommendCustomer;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import org.apache.ibatis.annotations.Mapper;
@@ -22,5 +23,7 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
22 23
 
23 24
     TaRecommendCustomer getCustomerDetail(@Param("customerId")String customerId);
24 25
 
26
+    IPage<TaRecommendCustomer> getCustomerList(IPage<TaRecommendCustomer> page,@Param("building") String building, @Param("name") String name, @Param("tel") String tel, @Param("consultName") String consultName, @Param("consultTel") String consultTel);
27
+
25 28
 
26 29
 }

+ 1
- 15
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java 查看文件

@@ -247,22 +247,8 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
247 247
 
248 248
     @Override
249 249
     public IPage<TaRecommendCustomer> getCustomerList(int pageNumber, int pageSize,String building,String name,String tel,String consultName,String consultTel){
250
-        QueryWrapper<TaRecommendCustomer>queryWrapper = new QueryWrapper<>();
251
-        queryWrapper.eq(org.apache.commons.lang3.StringUtils.isNotBlank(building),"building_id",building);
252
-        queryWrapper.like(org.apache.commons.lang3.StringUtils.isNotBlank(name), "name",name);
253
-        queryWrapper.eq(org.apache.commons.lang3.StringUtils.isNotBlank(tel),"phone",tel);
254
-        if(org.apache.commons.lang3.StringUtils.isNotBlank(consultName)){
255
-            List<String> consultIds = taPersonMapper.getConsultantByName(consultName);
256
-            queryWrapper.in("realty_consultant",consultIds);
257
-        }
258
-        if(org.apache.commons.lang3.StringUtils.isNotBlank(consultTel)){
259
-            String consultId = taPersonMapper.getConsultantByTel(consultTel);
260
-            queryWrapper.eq("realty_consultant",consultId);
261
-        }
262
-
263
-        queryWrapper.gt("status", CommConstant.MESSAGE_UNREAD);
264 250
         IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
265
-        return taRecommendCustomerMapper.selectPage(page,queryWrapper);
251
+        return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel);
266 252
     }
267 253
 
268 254
     @Override

+ 28
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml 查看文件

@@ -30,4 +30,32 @@ FROM
30 30
 	LEFT JOIN ta_person_visit_record c ON b.person_id = c.person_id
31 31
 	where a.customer_id = #{customerId}
32 32
     </select>
33
+
34
+    <select id="getCustomerList" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
35
+        SELECT
36
+	a.*,
37
+	b.name as consultantName,
38
+    b.tel as consultTel
39
+FROM
40
+	ta_recommend_customer a
41
+	LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
42
+	<where>
43
+        a.status > 0
44
+        <if test="building != null and building !=''">
45
+            and a.building_id = #{building}
46
+        </if>
47
+        <if test="name != null and name !=''">
48
+            and a.name = #{name}
49
+        </if>
50
+        <if test="tel != null and tel!=''">
51
+            and a.phone = #{tel}
52
+        </if>
53
+        <if test="consultName != null and consultName !=''">
54
+            and b.name like CONCAT('%',#{consultName}, '%')
55
+        </if>
56
+        <if test="consultTel != null and consultTel !=''">
57
+            and b.tel = #{consultTel}
58
+        </if>
59
+    </where>
60
+    </select>
33 61
 </mapper>