wanghaicheng 5 년 전
부모
커밋
0d131b77eb

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

@@ -3,15 +3,11 @@ package cn.com.ty.lift.enterprise.custom.controller;
 import cn.com.ty.lift.enterprise.custom.dao.entity.PropertyCompany;
 import cn.com.ty.lift.enterprise.custom.service.impl.PropertyCompanyServiceImpl;
 import cn.com.xwy.boot.web.dto.RestResponse;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.AllArgsConstructor;
 import org.springframework.web.bind.annotation.*;
 
 import java.time.LocalDateTime;
 import java.util.HashMap;
-import java.util.Map;
 
 @RestController
 @RequestMapping("/property-company")
@@ -25,17 +21,6 @@ import java.util.Map;
 public class PropertyCompanyController {
     private final PropertyCompanyServiceImpl propertyCompanyService;
 
-    @GetMapping("/list")
-    /**
-     * @description id顺序+分页客户列表
-     * @date 2019/11/27 11:33
-     * @param [维保公司id, 页码, 页大小]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse propertyCompanies(@RequestParam Long mtCompanyId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
-        return RestResponse.ok(propertyCompanyService.propertyCompanies(mtCompanyId, pageNum, pageSize), "1", "查询成功");
-    }
-
     @GetMapping("/{id}")
     /**
      * @description 根据id获取客户详细信息
@@ -52,42 +37,14 @@ public class PropertyCompanyController {
         }
     }
 
-    @GetMapping("/list/name")
-    /**
-     * @description 根据客户名称分页获取客户列表
-     * @date 2019/11/27 11:37
-     * @param [客户名称, 维保公司id, 页码, 页大小]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse propertyCompaniesFromName(@RequestParam String name, @RequestParam Long mtCompanyId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
-        return propertyCompanyService.propertyCompaniesFromRowName(mtCompanyId, pageNum, pageSize, "name", name);
-    }
-
-    @GetMapping("/list/address")
-    /**
-     * @description 根据客户地址分页获取客户列表
-     * @date 2019/11/27 11:38
-     * @param [客户地址, 维保公司id, 页码, 页大小]
-     * @return cn.com.xwy.boot.web.dto.RestResponse
-     */
-    public RestResponse propertyCompaniesFromAddress(@RequestParam String address, @RequestParam Long mtCompanyId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
-        return propertyCompanyService.propertyCompaniesFromRowName(mtCompanyId, pageNum, pageSize, "address", address);
-    }
-
-    @GetMapping("/list/phone")
+    @PostMapping("/list/condition")
     /**
-     * @description 根据客户电话分页获取客户列表
-     * @date 2019/11/27 11:39
-     * @param [客户手机, 维保公司id, 页码, 页大小]
+     * @description 根据条件查询客户列表
+     * @date 2019/12/3 8:51
+     * @param [客户名称或客户地址或客户联系方式,页码,页大小,维保公司id]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse propertyCompaniesFromPhone(@RequestParam String phone, @RequestParam Long mtCompanyId, @RequestParam Integer pageNum, @RequestParam Integer pageSize) {
-        return propertyCompanyService.propertyCompaniesFromRowName(mtCompanyId, pageNum, pageSize, "telephone", phone);
-    }
-
-    @PostMapping("/list/condition")
     public RestResponse propertyCompaniesForCondition(@RequestBody HashMap map) {
-//        IPage<PropertyCompany> iPage = propertyCompanyService.page(page, new QueryWrapper<PropertyCompany>().eq("mt_company_id", mtCompanyId).allEq(conditions, false));
         return propertyCompanyService.propertyCompaniesForCondition(map);
     }
 

+ 3 - 1
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCertificateServiceImpl.java

@@ -5,6 +5,7 @@ import cn.com.ty.lift.enterprise.custom.dao.mapper.PropertyCertificateMapper;
 import cn.com.ty.lift.enterprise.custom.service.PropertyCertificateService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * <p>
@@ -15,6 +16,7 @@ import org.springframework.stereotype.Service;
  * @since 2019-11-11
  */
 @Service
+@Transactional
 public class PropertyCertificateServiceImpl extends ServiceImpl<PropertyCertificateMapper, PropertyCertificate> implements PropertyCertificateService {
 
-}
+}

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

@@ -26,8 +26,8 @@ import java.util.Map;
  * @author wang-hai-cheng
  * @since 2019-11-11
  */
-@Transactional
 @Service
+@Transactional
 @AllArgsConstructor
 public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMapper, PropertyCompany> implements PropertyCompanyService {
     private final PropertyContactMapper contactMapper;
@@ -50,7 +50,7 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
             //就不删除
             return "维保电梯大于0,无法删除";
         } else {
-            //如果维保电梯小于等于0
+            //如果维保电梯小于等于0,逻辑删除
             PropertyCompany one = this.getOne(new QueryWrapper<PropertyCompany>().eq("id", id));
             if (null != one) {
                 one.setStatus(0);
@@ -124,22 +124,16 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         String name = (String) map.get("name");
         String address = (String) map.get("address");
         String telephone = (String) map.get("telephone");
+        boolean nameFlag = name != null;
+        boolean addressFlag = address != null;
+        boolean telephoneFlag = telephone != null;
 
-        Integer pageNum = (Integer) map.get("pageNum");
-        Integer pageSize = (Integer) map.get("pageSize");
-        Object mtCompanyId = map.get("mtCompanyId");
-
-//        HashMap<String, Object> conditions = new HashMap<>();
-//        conditions.put("name", name);
-//        conditions.put("address", address);
-//        conditions.put("telephone", telephone);
-
-        Page<PropertyCompany> page = new Page<>(pageNum, pageSize);
+        Page<PropertyCompany> page = new Page<>((Integer) map.get("pageNum"), (Integer) map.get("pageSize"));
         IPage<Map<String, Object>> records = this
                 .pageMaps(page, new QueryWrapper<PropertyCompany>()
                         .select("id", "code", "name", "address", "telephone")
-                        .eq("mt_company_id", mtCompanyId)
-                        .like(false, "name", name).like(false, "address", address).like(false, "telephone", telephone));
+                        .eq("mt_company_id", map.get("mtCompanyId"))
+                        .like(nameFlag, "name", name).like(addressFlag, "address", address).like(telephoneFlag, "telephone", telephone));
         if (!records.getRecords().isEmpty()) {
             records.getRecords().forEach(record -> {
                 record.put("maintenanceLiftNum", this.getMaintenanceLiftNum());
@@ -148,19 +142,5 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         } else {
             return RestResponse.ok(null, "9", "无数据");
         }
-
-
-//        if (name == null & address == null & telephone == null) {
-//            IPage<PropertyCompany> iPage = this.page(page, new QueryWrapper<PropertyCompany>()
-//                    .select("id", "code", "name", "address", "telephone")
-//                    .eq("mt_company_id", mtCompanyId));
-//        } else if (name != null & address == null & telephone == null) {
-//            IPage<PropertyCompany> iPage = this
-//                    .page(page, new QueryWrapper<PropertyCompany>()
-//                            .select("id", "code", "name", "address", "telephone")
-//                            .eq("mt_company_id", mtCompanyId)
-//                            .like("name", name));
-//        }
-
     }
 }

+ 2 - 2
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyContactServiceImpl.java

@@ -15,8 +15,8 @@ import org.springframework.transaction.annotation.Transactional;
  * @author wang-hai-cheng
  * @since 2019-11-11
  */
-@Transactional
 @Service
+@Transactional
 public class PropertyContactServiceImpl extends ServiceImpl<PropertyContactMapper, PropertyContact> implements PropertyContactService {
 
-}
+}