Selaa lähdekoodia

customerListFix

胡轶钦 5 vuotta sitten
vanhempi
commit
0410b90b98

+ 6
- 0
src/main/java/com/huiju/estateagents/entity/TaRecommendCustomer.java Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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
- 21
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Näytä tiedosto

@@ -247,28 +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
-        if(building.equals("") && null != building){
252
-            queryWrapper.eq("building_id",building);
253
-        }
254
-        if(name.equals("") && null != name){
255
-            queryWrapper.like("name",name);
256
-        }
257
-        if(tel.equals("") && null != tel){
258
-            queryWrapper.eq("phone",tel);
259
-        }
260
-        if(consultName.equals("") && null != consultName){
261
-            List<String> consultIds = taPersonMapper.getConsultantByName(consultName);
262
-            queryWrapper.in("realty_consultant",consultIds);
263
-        }
264
-        if(consultTel.equals("") && null != consultTel){
265
-            String consultId = taPersonMapper.getConsultantByTel(consultTel);
266
-            queryWrapper.eq("realty_consultant",consultId);
267
-        }
268
-
269
-        queryWrapper.gt("status", CommConstant.MESSAGE_UNREAD);
270 250
         IPage<TaRecommendCustomer>page = new Page<>(pageNumber,pageSize);
271
-        return taRecommendCustomerMapper.selectPage(page,queryWrapper);
251
+        return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel);
272 252
     }
273 253
 
274 254
     @Override

+ 28
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml Näytä tiedosto

@@ -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>