|
@@ -3,10 +3,15 @@ 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")
|
|
@@ -24,26 +29,26 @@ public class PropertyCompanyController {
|
|
|
/**
|
|
|
* @description id顺序+分页客户列表
|
|
|
* @date 2019/11/27 11:33
|
|
|
- * @param [mtCompanyId, pageNum, pageSize]
|
|
|
+ * @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.propertyCompanyListResponse(mtCompanyId, pageNum, pageSize), "查询成功");
|
|
|
+ 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获取客户详细信息
|
|
|
* @date 2019/11/27 11:36
|
|
|
- * @param [id]
|
|
|
+ * @param [客户id]
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse propertyCompany(@PathVariable Long id) {
|
|
|
PropertyCompany byId = propertyCompanyService.getById(id);
|
|
|
if (byId != null) {
|
|
|
- return RestResponse.ok(byId,"查询成功");
|
|
|
+ return RestResponse.ok(byId, "1", "查询成功");
|
|
|
} else {
|
|
|
- return RestResponse.ok(null, "无数据");
|
|
|
+ return RestResponse.ok(null, "0", "无数据");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -51,60 +56,67 @@ public class PropertyCompanyController {
|
|
|
/**
|
|
|
* @description 根据客户名称分页获取客户列表
|
|
|
* @date 2019/11/27 11:37
|
|
|
- * @param [name, mtCompanyId, current, size]
|
|
|
+ * @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);
|
|
|
+ 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 [address, mtCompanyId, current, size]
|
|
|
+ * @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);
|
|
|
+ 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")
|
|
|
/**
|
|
|
* @description 根据客户电话分页获取客户列表
|
|
|
* @date 2019/11/27 11:39
|
|
|
- * @param [phone, mtCompanyId, current, size]
|
|
|
+ * @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);
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@PostMapping("/add")
|
|
|
/**
|
|
|
* @description 新增客户
|
|
|
* @date 2019/11/27 11:45
|
|
|
- * @param [propertyCompany]
|
|
|
+ * @param [客户]
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse add(@RequestBody PropertyCompany propertyCompany) {
|
|
|
//service层判断了是否有相同名称的name
|
|
|
propertyCompany.setCreateDate(LocalDateTime.now());
|
|
|
- return RestResponse.ok(null, propertyCompanyService.savePropertyCompany(propertyCompany));
|
|
|
+ return propertyCompanyService.savePropertyCompany(propertyCompany);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/update")
|
|
|
/**
|
|
|
* @description 更新客户信息
|
|
|
* @date 2019/11/27 11:45
|
|
|
- * @param [propertyCompany]
|
|
|
+ * @param [客户]
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
public RestResponse update(@RequestBody PropertyCompany propertyCompany) {
|
|
|
if (propertyCompanyService.updateById(propertyCompany)) {
|
|
|
- return RestResponse.ok(null, "更新成功");
|
|
|
+ return RestResponse.ok(null, "1", "更新成功");
|
|
|
} else {
|
|
|
- return RestResponse.ok(null, "更新失败");
|
|
|
+ return RestResponse.ok(null, "0", "更新失败");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -115,7 +127,7 @@ public class PropertyCompanyController {
|
|
|
* @param [id]
|
|
|
* @return cn.com.xwy.boot.web.dto.RestResponse
|
|
|
*/
|
|
|
- public RestResponse delete(@PathVariable Long id) {
|
|
|
+ public RestResponse delete(@PathVariable("id") Long propertyCompanyId) {
|
|
|
|
|
|
//判断维保电梯台数是否为0
|
|
|
//判断维保电梯台数是否为0
|
|
@@ -130,26 +142,26 @@ public class PropertyCompanyController {
|
|
|
//判断维保电梯台数是否为0
|
|
|
//也就是客户公司创建的所有项目的总电梯的在保电梯是否为0
|
|
|
|
|
|
- return RestResponse.ok(null, propertyCompanyService.delete(id));
|
|
|
+ return RestResponse.ok(null, propertyCompanyService.delete(propertyCompanyId));
|
|
|
}
|
|
|
|
|
|
@GetMapping("/list/current")
|
|
|
public RestResponse currentProject(@RequestParam Long propertyCompanyId) {
|
|
|
- //分页查询正在服务的项目列表
|
|
|
- //分页查询正在服务的项目列表
|
|
|
- //分页查询正在服务的项目列表
|
|
|
- //分页查询正在服务的项目列表
|
|
|
- //分页查询正在服务的项目列表
|
|
|
+ //分页查询正在服务的项目列表
|
|
|
+ //分页查询正在服务的项目列表
|
|
|
+ //分页查询正在服务的项目列表
|
|
|
+ //分页查询正在服务的项目列表
|
|
|
+ //分页查询正在服务的项目列表
|
|
|
return RestResponse.ok(null, "待实现");
|
|
|
}
|
|
|
|
|
|
@GetMapping("/list/previous")
|
|
|
public RestResponse previousProject(@RequestParam Long propertyCompanyId) {
|
|
|
- //分页查询曾经服务的项目列表
|
|
|
- //分页查询曾经服务的项目列表
|
|
|
- //分页查询曾经服务的项目列表
|
|
|
- //分页查询曾经服务的项目列表
|
|
|
- //分页查询曾经服务的项目列表
|
|
|
+ //分页查询曾经服务的项目列表
|
|
|
+ //分页查询曾经服务的项目列表
|
|
|
+ //分页查询曾经服务的项目列表
|
|
|
+ //分页查询曾经服务的项目列表
|
|
|
+ //分页查询曾经服务的项目列表
|
|
|
return RestResponse.ok(null, "待实现");
|
|
|
}
|
|
|
}
|