Bladeren bron

getCustomerById

胡轶钦 5 jaren geleden
bovenliggende
commit
041b9603c4

+ 12
- 0
src/main/java/com/huiju/estateagents/controller/TaRecommendCustomerController.java Bestand weergeven

@@ -189,6 +189,18 @@ public class TaRecommendCustomerController extends BaseController {
189 189
         return responseBean;
190 190
     }
191 191
 
192
+    @RequestMapping(value = "/customer/recommend/{id}")
193
+    public ResponseBean getCustomerById(String customerId) {
194
+        ResponseBean responseBean = new ResponseBean();
195
+        try {
196
+            responseBean.addSuccess(taRecommendCustomerService.getCustomerById(customerId));
197
+        }catch (Exception e){
198
+            e.printStackTrace();
199
+            responseBean.addError(e.getMessage());
200
+        }
201
+        return responseBean;
202
+    }
203
+
192 204
     @RequestMapping(value = "/customer/recommend/get/{id}")
193 205
     public ResponseBean getCutomerDetail(String id) {
194 206
         ResponseBean responseBean = new ResponseBean();

+ 2
- 0
src/main/java/com/huiju/estateagents/mapper/TaRecommendCustomerMapper.java Bestand weergeven

@@ -23,6 +23,8 @@ public interface TaRecommendCustomerMapper extends BaseMapper<TaRecommendCustome
23 23
 
24 24
     TaRecommendCustomer getCustomerDetail(@Param("customerId")String customerId);
25 25
 
26
+    TaRecommendCustomer getCustomerById(@Param("customerId")String customerId);
27
+
26 28
     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 29
 
28 30
 

+ 2
- 0
src/main/java/com/huiju/estateagents/service/ITaRecommendCustomerService.java Bestand weergeven

@@ -29,6 +29,8 @@ public interface ITaRecommendCustomerService extends IService<TaRecommendCustome
29 29
 
30 30
     TaRecommendCustomer getCustomerDetail(String customerId);
31 31
 
32
+    TaRecommendCustomer getCustomerById(String customerId);
33
+
32 34
     IPage<TaRecommendCustomer>getCustomersIRecommended(int pageNumber, int pageSize,String customerId,String building);
33 35
 
34 36
 

+ 8
- 2
src/main/java/com/huiju/estateagents/service/impl/TaRecommendCustomerServiceImpl.java Bestand weergeven

@@ -251,14 +251,20 @@ public class TaRecommendCustomerServiceImpl extends ServiceImpl<TaRecommendCusto
251 251
         return taRecommendCustomerMapper.getCustomerList(page,building,name,tel,consultName,consultTel);
252 252
     }
253 253
 
254
+    @Override
255
+    public TaRecommendCustomer getCustomerById(String customerId){
256
+        return taRecommendCustomerMapper.getCustomerById(customerId);
257
+    }
258
+
259
+
254 260
     @Override
255 261
     public TaRecommendCustomer getCustomerDetail(String customerId){
256 262
         String personId = taRecommendCustomerMapper.getCustomerPersonId(customerId);
257 263
         TaRecommendCustomer taRecommendCustomer = taRecommendCustomerMapper.getCustomerDetail(customerId);
258
-        if(!personId.equals("")&& null != personId){
264
+        if(!StringUtils.isEmpty(personId)){
259 265
             taRecommendCustomer.setVisitRecords(taPersonVisitRecordMapper.visitRecordByPersonId(personId));
260 266
         }
261
-        if(!taRecommendCustomer.getRealtyConsultant().equals("")&&null != taRecommendCustomer.getRealtyConsultant()){
267
+        if(!StringUtils.isEmpty(taRecommendCustomer.getRealtyConsultant())){
262 268
             TaPerson consultant =  taPersonMapper.getById(taRecommendCustomer.getRealtyConsultant());
263 269
             consultant.setProjects(taPersonMapper.getUserProjects(consultant.getPersonId()));
264 270
             taRecommendCustomer.setConsultant(consultant);

+ 9
- 0
src/main/resources/mapper/TaRecommendCustomerMapper.xml Bestand weergeven

@@ -58,4 +58,13 @@ FROM
58 58
         </if>
59 59
     </where>
60 60
     </select>
61
+    <select id="getCustomerById" resultType="com.huiju.estateagents.entity.TaRecommendCustomer">
62
+         SELECT
63
+	a.*,
64
+	b.name as consultantName
65
+FROM
66
+	ta_recommend_customer a
67
+	LEFT JOIN ta_person b ON a.realty_consultant = b.person_id
68
+	WHERE a.customer_id = #{customerId}
69
+    </select>
61 70
 </mapper>