|
@@ -5,6 +5,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.shigongli.common.BaseController;
|
7
|
7
|
import com.shigongli.common.ResponseBean;
|
|
8
|
+import com.shigongli.constants.StatusConstant;
|
|
9
|
+import com.shigongli.entity.TaPerson;
|
|
10
|
+import com.shigongli.entity.TaShopKeeper;
|
|
11
|
+import com.shigongli.service.ITaHouseService;
|
|
12
|
+import com.shigongli.service.ITaShopKeeperService;
|
8
|
13
|
import io.swagger.annotations.Api;
|
9
|
14
|
import io.swagger.annotations.ApiOperation;
|
10
|
15
|
import io.swagger.annotations.ApiParam;
|
|
@@ -20,6 +25,7 @@ import com.shigongli.service.ITaHouseSurroundService;
|
20
|
25
|
import com.shigongli.entity.TaHouseSurround;
|
21
|
26
|
import org.springframework.web.bind.annotation.RestController;
|
22
|
27
|
|
|
28
|
+import javax.servlet.http.HttpServletRequest;
|
23
|
29
|
import java.util.List;
|
24
|
30
|
|
25
|
31
|
/**
|
|
@@ -41,6 +47,9 @@ public class TaHouseSurroundController extends BaseController {
|
41
|
47
|
@Autowired
|
42
|
48
|
public ITaHouseSurroundService iTaHouseSurroundService;
|
43
|
49
|
|
|
50
|
+ @Autowired
|
|
51
|
+ ITaHouseService iTaHouseService;
|
|
52
|
+
|
44
|
53
|
|
45
|
54
|
/**
|
46
|
55
|
* 分页查询房源周边, 不传房源则代表所有周边
|
|
@@ -79,14 +88,23 @@ public class TaHouseSurroundController extends BaseController {
|
79
|
88
|
* 根据id删除对象
|
80
|
89
|
* @param id 实体ID
|
81
|
90
|
*/
|
82
|
|
- @RequestMapping(value="/taHouseSurround/{id}", method= RequestMethod.DELETE)
|
|
91
|
+ @RequestMapping(value="/ma/taHouseSurround/{id}", method= RequestMethod.DELETE)
|
83
|
92
|
@ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
84
|
|
- public ResponseBean taHouseSurroundDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
85
|
|
- if(iTaHouseSurroundService.removeById(id)){
|
86
|
|
- return ResponseBean.success("success");
|
87
|
|
- }else {
|
88
|
|
- return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
93
|
+ public ResponseBean taHouseSurroundDelete(@ApiParam("对象ID") @PathVariable String id,
|
|
94
|
+ HttpServletRequest request) throws Exception{
|
|
95
|
+ TaPerson taPerson = getPerson(request);
|
|
96
|
+ TaHouseSurround taHouseSurround = iTaHouseSurroundService.getById(id);
|
|
97
|
+ if (null == taHouseSurround || StatusConstant.DELETE.equals(taHouseSurround.getStatus())) {
|
|
98
|
+ return ResponseBean.error("删除数据不存在, 请重试", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
89
|
99
|
}
|
|
100
|
+
|
|
101
|
+ if (!iTaHouseService.isOwner(taPerson.getPersonId(), taHouseSurround.getHouseId())) {
|
|
102
|
+ return ResponseBean.error("您无权进行当前操作", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
103
|
+ }
|
|
104
|
+
|
|
105
|
+ taHouseSurround.setStatus(StatusConstant.DELETE);
|
|
106
|
+
|
|
107
|
+ return taHouseSurroundUpdate(id, taHouseSurround);
|
90
|
108
|
}
|
91
|
109
|
|
92
|
110
|
/**
|
|
@@ -97,8 +115,8 @@ public class TaHouseSurroundController extends BaseController {
|
97
|
115
|
*/
|
98
|
116
|
@RequestMapping(value="/taHouseSurround/{id}",method= RequestMethod.PUT)
|
99
|
117
|
@ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
100
|
|
- public ResponseBean taHouseSurroundUpdate(@ApiParam("对象ID") @PathVariable Integer id,
|
101
|
|
- @ApiParam("更新内容") @RequestBody TaHouseSurround taHouseSurround) throws Exception{
|
|
118
|
+ public ResponseBean taHouseSurroundUpdate(@ApiParam("对象ID") @PathVariable String id,
|
|
119
|
+ @ApiParam("更新内容") @RequestBody TaHouseSurround taHouseSurround) throws Exception{
|
102
|
120
|
|
103
|
121
|
if (iTaHouseSurroundService.updateById(taHouseSurround)){
|
104
|
122
|
return ResponseBean.success(iTaHouseSurroundService.getById(id));
|