|
@@ -2,6 +2,7 @@ package com.example.wholeestate.service.impl;
|
2
|
2
|
|
3
|
3
|
import com.alibaba.fastjson.JSONObject;
|
4
|
4
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
5
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
5
|
6
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
6
|
7
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
7
|
8
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -10,9 +11,9 @@ import com.example.wholeestate.common.resp.ResponseBean;
|
10
|
11
|
import com.example.wholeestate.common.uuid.IdGen;
|
11
|
12
|
import com.example.wholeestate.dao.CustomerMapper;
|
12
|
13
|
|
13
|
|
-import com.example.wholeestate.model.Building;
|
14
|
14
|
import com.example.wholeestate.model.Customer;
|
15
|
15
|
import com.example.wholeestate.service.ICustomerService;
|
|
16
|
+import org.apache.http.HttpStatus;
|
16
|
17
|
import org.springframework.beans.factory.annotation.Autowired;
|
17
|
18
|
import org.springframework.stereotype.Service;
|
18
|
19
|
|
|
@@ -93,4 +94,25 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
93
|
94
|
responseBean.addSuccess(customer);
|
94
|
95
|
return responseBean;
|
95
|
96
|
}
|
|
97
|
+
|
|
98
|
+ @Override
|
|
99
|
+ public ResponseBean updateCustomer(String parameter) {
|
|
100
|
+ ResponseBean responseBean = new ResponseBean();
|
|
101
|
+ Customer customer = JSONObject.parseObject(parameter, Customer.class);
|
|
102
|
+
|
|
103
|
+ UpdateWrapper<Customer> updateWrapper = new UpdateWrapper<>();
|
|
104
|
+ updateWrapper.set("customerName", customer.getCustomerName());
|
|
105
|
+ updateWrapper.set("name", customer.getName());
|
|
106
|
+ updateWrapper.set("phone", customer.getPhone());
|
|
107
|
+ updateWrapper.set("idNum", customer.getIdNum());
|
|
108
|
+ updateWrapper.set("remark", customer.getRemark());
|
|
109
|
+ updateWrapper.eq("customer_id", customer.getCustomerId());
|
|
110
|
+
|
|
111
|
+ int success = customerMapper.update(customer, updateWrapper);
|
|
112
|
+ if (success >= 0) {
|
|
113
|
+ responseBean.addError(HttpStatus.SC_INTERNAL_SERVER_ERROR, "更新用户信息失败");
|
|
114
|
+ }
|
|
115
|
+
|
|
116
|
+ return responseBean;
|
|
117
|
+ }
|
96
|
118
|
}
|