|
@@ -1,12 +1,15 @@
|
1
|
1
|
package com.huiju.estateagents.controller;
|
2
|
2
|
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
3
|
4
|
import com.huiju.estateagents.base.BaseController;
|
4
|
5
|
import com.huiju.estateagents.base.ResponseBean;
|
5
|
6
|
import com.huiju.estateagents.common.CommConstant;
|
6
|
7
|
import com.huiju.estateagents.entity.TaBuildingRoom;
|
7
|
8
|
import com.huiju.estateagents.entity.TaHousingResources;
|
|
9
|
+import com.huiju.estateagents.entity.TaPreselectionRecord;
|
8
|
10
|
import com.huiju.estateagents.service.ITaBuildingRoomService;
|
9
|
11
|
import com.huiju.estateagents.service.ITaHousingResourcesService;
|
|
12
|
+import com.huiju.estateagents.service.ITaPreselectionRecordService;
|
10
|
13
|
import io.swagger.annotations.ApiOperation;
|
11
|
14
|
import org.slf4j.Logger;
|
12
|
15
|
import org.slf4j.LoggerFactory;
|
|
@@ -37,6 +40,9 @@ public class TaHousingResourcesController extends BaseController {
|
37
|
40
|
@Autowired
|
38
|
41
|
private ITaBuildingRoomService taBuildingRoomService;
|
39
|
42
|
|
|
43
|
+ @Autowired
|
|
44
|
+ private ITaPreselectionRecordService taPreselectionRecordService;
|
|
45
|
+
|
40
|
46
|
/**
|
41
|
47
|
* 分页查询列表
|
42
|
48
|
*
|
|
@@ -99,10 +105,18 @@ public class TaHousingResourcesController extends BaseController {
|
99
|
105
|
*/
|
100
|
106
|
@ResponseBody
|
101
|
107
|
@RequestMapping(value = "/admin/houseDelete/{id}", method = RequestMethod.DELETE)
|
102
|
|
- public ResponseBean taHousingResourcesDelete(@PathVariable Integer id) {
|
|
108
|
+ public ResponseBean taHousingResourcesDelete(@PathVariable Integer id,HttpServletRequest request) {
|
103
|
109
|
ResponseBean responseBean = new ResponseBean();
|
104
|
110
|
try {
|
105
|
|
- //校验是否有预选记录 todo
|
|
111
|
+ //校验是否有预选记录
|
|
112
|
+ QueryWrapper<TaPreselectionRecord> queryWrapper = new QueryWrapper<>();
|
|
113
|
+ queryWrapper.eq("status", CommConstant.STATUS_NORMAL);
|
|
114
|
+ queryWrapper.eq("org_id", getOrgId(request));
|
|
115
|
+ queryWrapper.eq("house_id", id);
|
|
116
|
+ List<TaPreselectionRecord> taPreselectionRecords = taPreselectionRecordService.list(queryWrapper);
|
|
117
|
+ if (taPreselectionRecords.size() > 0){
|
|
118
|
+ return ResponseBean.error("存在预选房源不能删除!",ResponseBean.ERROR_UNAVAILABLE);
|
|
119
|
+ }
|
106
|
120
|
TaHousingResources taHousingResources = new TaHousingResources();
|
107
|
121
|
taHousingResources.setHouseId(id);
|
108
|
122
|
taHousingResources.setStatus(CommConstant.STATUS_DELETE);
|