|
@@ -8,6 +8,7 @@ import cn.com.ty.lift.enterprise.custom.service.PropertyCompanyService;
|
|
|
import cn.com.xwy.boot.web.dto.RestResponse;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.additional.query.impl.QueryChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -50,7 +51,10 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
return "维保电梯大于0,无法删除";
|
|
|
} else {
|
|
|
//如果维保电梯小于等于0
|
|
|
- if (this.removeById(id)) {
|
|
|
+ PropertyCompany one = this.getOne(new QueryWrapper<PropertyCompany>().eq("id", id));
|
|
|
+ if (null != one) {
|
|
|
+ one.setStatus(0);
|
|
|
+ this.updateById(one);
|
|
|
this.deleteForContact(id);
|
|
|
return "删除成功";
|
|
|
} else {
|
|
@@ -60,7 +64,9 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
}
|
|
|
|
|
|
public int deleteForContact(Long id) {
|
|
|
- return contactMapper.delete(new QueryWrapper<PropertyContact>().eq("pp_company_id", id));
|
|
|
+ PropertyContact propertyContact = new PropertyContact();
|
|
|
+ propertyContact.setStatus(0);
|
|
|
+ return contactMapper.update(propertyContact, new QueryWrapper<PropertyContact>().eq("pp_company_id", id));
|
|
|
}
|
|
|
|
|
|
private int getMaintenanceLiftNum() {
|
|
@@ -84,7 +90,7 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
Page<PropertyCompany> page = new Page<>(pageNum, pageSize);
|
|
|
List<Map<String, Object>> records = this.pageMaps(page, new QueryWrapper<PropertyCompany>()
|
|
|
.select("id", "code", "name", "address", "telephone")
|
|
|
- .eq("mt_company_id",mtCompanyId)).getRecords();
|
|
|
+ .eq("mt_company_id", mtCompanyId)).getRecords();
|
|
|
records.forEach(record -> {
|
|
|
record.put("maintenanceLiftNum", this.getMaintenanceLiftNum());
|
|
|
});
|
|
@@ -92,11 +98,11 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
|
|
|
}
|
|
|
|
|
|
|
|
|
- public RestResponse propertyCompaniesFromRowName(Long mtCompanyId,Integer pageNum, Integer pageSize, String rowName, Object rowValue) {
|
|
|
+ public RestResponse propertyCompaniesFromRowName(Long mtCompanyId, Integer pageNum, Integer pageSize, String rowName, Object rowValue) {
|
|
|
Page<PropertyCompany> page = new Page<>(pageNum, pageSize);
|
|
|
List<Map<String, Object>> records = this.pageMaps(page, new QueryWrapper<PropertyCompany>()
|
|
|
.select("id", "code", "name", "address", "telephone").like(rowName, rowValue)
|
|
|
- .eq("mt_company_id",mtCompanyId))
|
|
|
+ .eq("mt_company_id", mtCompanyId))
|
|
|
.getRecords();
|
|
|
records.forEach(record -> {
|
|
|
record.put("maintenanceLiftNum", this.getMaintenanceLiftNum());
|