Browse Source

Merge branch 'wanghaicheng' of lift-manager/lift-server into develop

wanghaicheng 5 years ago
parent
commit
3e01f343e8

+ 4 - 5
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/controller/PropertyCompanyController.java

@@ -8,12 +8,10 @@ import cn.com.xwy.boot.web.dto.RestResponse;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 @RestController
 @RequestMapping("/property-company")
@@ -26,8 +24,6 @@ import java.util.Map;
  */
 public class PropertyCompanyController {
     private final PropertyCompanyServiceImpl propertyCompanyService;
-    private final PropertyContactServiceImpl propertyContactService;
-    private final RestTemplate restTemplate;
 
     @GetMapping("/{id}")
     /**
@@ -64,7 +60,10 @@ public class PropertyCompanyController {
      */
     public RestResponse add(@RequestBody PropertyCompany propertyCompany) {
         //service层判断了是否有相同名称的name//如果数据库客户名不重复,就删除里面判断name是否重复的逻辑
-        return propertyCompanyService.savePropertyCompany(propertyCompany);
+        if (propertyCompanyService.save(propertyCompany)) {
+            return RestResponse.ok(null,"1","新增成功");
+        }
+        return RestResponse.ok(null,"0","新增失败");
     }
 
     @PostMapping("/update")

+ 0 - 11
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCompanyServiceImpl.java

@@ -31,17 +31,6 @@ import java.util.Map;
 public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMapper, PropertyCompany> implements PropertyCompanyService {
     private final PropertyContactMapper contactMapper;
 
-    public RestResponse savePropertyCompany(PropertyCompany propertyCompany) {
-        if (null != this.getOne(new QueryWrapper<PropertyCompany>().eq("name", propertyCompany.getName()))) {
-            return RestResponse.ok(null, "0", "客户已存在");
-        }
-        if (this.save(propertyCompany)) {
-            return RestResponse.ok(propertyCompany.getId().toString(), "1", "新增客户成功");
-        } else {
-            return RestResponse.ok(null, "0", "新增客户失败");
-        }
-    }
-
     public RestResponse delete(Long id) {
         //维保电梯大于0
         if (this.getMaintenanceLiftNum(1L) > 0) {