|
|
@@ -1,6 +1,9 @@
|
|
|
package com.model.service.impl;
|
|
|
|
|
|
+import com.github.pagehelper.PageHelper;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
import com.model.entity.Client;
|
|
|
+import com.model.entity.Dispatch;
|
|
|
import com.model.mapper.ClientMapper;
|
|
|
import com.model.result.CommRes;
|
|
|
import com.model.service.ClientService;
|
|
|
@@ -40,4 +43,86 @@ public class ClientServiceImpl implements ClientService {
|
|
|
}
|
|
|
return CommRes.success(clients);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 添加客户信息
|
|
|
+ * @Param: Client
|
|
|
+ * @return: CommRes
|
|
|
+ * @Author: XiaoChen
|
|
|
+ * @Date: 2023/4/24
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommRes addClient(Client client) {
|
|
|
+ try {
|
|
|
+ Client client1 = clientMapper.getClient(client);
|
|
|
+ if (client1 != null){
|
|
|
+ return CommRes.fail("客户已存在");
|
|
|
+ }
|
|
|
+ clientMapper.addClient(client);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return CommRes.success(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 删除客户信息
|
|
|
+ * @Param:
|
|
|
+ * @return:
|
|
|
+ * @Author: XiaoChen
|
|
|
+ * @Date: 2023/4/24
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommRes delClient(Client client) {
|
|
|
+ try {
|
|
|
+ Client client1 = clientMapper.getClients(client);
|
|
|
+ if (client1 == null){
|
|
|
+ return CommRes.fail("未找到该客户信息");
|
|
|
+ }
|
|
|
+ clientMapper.delClient(client);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return CommRes.success(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 修改客户信息
|
|
|
+ * @Param: client
|
|
|
+ * @return: CommRes
|
|
|
+ * @Author: XiaoChen
|
|
|
+ * @Date: 2023/4/24
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommRes updClient(Client client) {
|
|
|
+ try {
|
|
|
+ Client client1 = clientMapper.getClient(client);
|
|
|
+ if (client1 == null){
|
|
|
+ return CommRes.fail("未找到该客户信息");
|
|
|
+ }
|
|
|
+ clientMapper.updClient(client);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return CommRes.success(null);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @Description: 查询客户表列表
|
|
|
+ * @Param: client
|
|
|
+ * @return: CommRes
|
|
|
+ * @Author: XiaoChen
|
|
|
+ * @Date: 2023/4/24
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public CommRes getClientList(Client client) {
|
|
|
+ PageInfo<Client> pageInfo = null ;
|
|
|
+ try {
|
|
|
+ PageHelper.startPage(client.getPage(),client.getLimit());
|
|
|
+ pageInfo = new PageInfo<>(clientMapper.getClientList(client));
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return CommRes.success(pageInfo);
|
|
|
+ }
|
|
|
}
|