Преглед на файлове

Merge remote-tracking branch 'origin/master' into master

zlisen преди 4 години
родител
ревизия
b499358f8e

+ 23
- 34
src/main/java/com/shigongli/controller/TaHouseController.java Целия файл

@@ -43,26 +43,26 @@ public class TaHouseController extends BaseController {
43 43
     @Autowired
44 44
     public ITaHouseService iTaHouseService;
45 45
 
46
-
47
-    /**
48
-     * 分页查询列表
49
-     * @param pageNum
50
-     * @param pageSize
51
-     * @return
52
-     */
53
-    @RequestMapping(value="/mp/taHouse",method= RequestMethod.GET)
54
-    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
55
-    public ResponseBean taHouseList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
57
-
58
-		    IPage<TaHouse> pg = new Page<>(pageNum, pageSize);
59
-            QueryWrapper<TaHouse> queryWrapper = new QueryWrapper<>();
60
-            queryWrapper.eq("status", StatusConstant.NORMAL);
61
-            queryWrapper.orderByDesc("create_date");
62
-
63
-            IPage<TaHouse> result = iTaHouseService.page(pg, queryWrapper);
64
-            return ResponseBean.success(result);
65
-    }
46
+//
47
+//    /**
48
+//     * 分页查询列表
49
+//     * @param pageNum
50
+//     * @param pageSize
51
+//     * @return
52
+//     */
53
+//    @RequestMapping(value="/mp/taHouse",method= RequestMethod.GET)
54
+//    @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
55
+//    public ResponseBean taHouseList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
56
+//									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
57
+//
58
+//		    IPage<TaHouse> pg = new Page<>(pageNum, pageSize);
59
+//            QueryWrapper<TaHouse> queryWrapper = new QueryWrapper<>();
60
+//            queryWrapper.eq("status", StatusConstant.NORMAL);
61
+//            queryWrapper.orderByDesc("create_date");
62
+//
63
+//            IPage<TaHouse> result = iTaHouseService.page(pg, queryWrapper);
64
+//            return ResponseBean.success(result);
65
+//    }
66 66
 
67 67
     /**
68 68
      * 分页查询列表
@@ -92,7 +92,7 @@ public class TaHouseController extends BaseController {
92 92
      * @param taHouse 实体对象
93 93
      * @return
94 94
      */
95
-    @RequestMapping(value="/mp/taHouse",method= RequestMethod.POST)
95
+    @RequestMapping(value="/ma/taHouse",method= RequestMethod.POST)
96 96
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
97 97
     public ResponseBean taHouseAdd(@ApiParam("保存内容") @RequestBody TaHouse taHouse) throws Exception{
98 98
 
@@ -107,7 +107,7 @@ public class TaHouseController extends BaseController {
107 107
      * 根据id删除对象
108 108
      * @param id  实体ID
109 109
      */
110
-    @RequestMapping(value="/mp/taHouse/{id}", method= RequestMethod.DELETE)
110
+    @RequestMapping(value="/ma/taHouse/{id}", method= RequestMethod.DELETE)
111 111
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
112 112
     public ResponseBean taHouseDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
113 113
         TaHouse taHouse = iTaHouseService.getById(id);
@@ -126,7 +126,7 @@ public class TaHouseController extends BaseController {
126 126
      * @param taHouse 实体对象
127 127
      * @return
128 128
      */
129
-    @RequestMapping(value="/mp/taHouse/{id}",method= RequestMethod.PUT)
129
+    @RequestMapping(value="/ma/taHouse/{id}",method= RequestMethod.PUT)
130 130
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
131 131
     public ResponseBean taHouseUpdate(@ApiParam("对象ID") @PathVariable String id,
132 132
                                         @ApiParam("更新内容") @RequestBody TaHouse taHouse) throws Exception{
@@ -138,17 +138,6 @@ public class TaHouseController extends BaseController {
138 138
         }
139 139
     }
140 140
 
141
-    /**
142
-     * 根据id查询对象
143
-     * @param id  实体ID
144
-     */
145
-    @RequestMapping(value="/mp/taHouse/{id}",method= RequestMethod.GET)
146
-    @ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
147
-    public ResponseBean taHouseGet(@ApiParam("对象ID") @PathVariable String id) throws Exception{
148
-        return ResponseBean.success(iTaHouseService.getById(id));
149
-    }
150
-
151
-
152 141
     /**
153 142
      * 查询当前房源
154 143
      * @param id  实体ID

+ 5
- 7
src/main/java/com/shigongli/controller/TaHouseSurroundController.java Целия файл

@@ -46,16 +46,14 @@ public class TaHouseSurroundController extends BaseController {
46 46
      * @param pageSize
47 47
      * @return
48 48
      */
49
-    @RequestMapping(value="/taHouseSurround",method= RequestMethod.GET)
49
+    @RequestMapping(value="/ma/taHouseSurround",method= RequestMethod.GET)
50 50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
51
-    public ResponseBean taHouseSurroundList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
52
-									 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
51
+    public ResponseBean taHouseSurroundList(@ApiParam("页码") @RequestParam(value ="pageNum", defaultValue = "1") Integer pageNum,
52
+                                            @ApiParam("单页数据量") @RequestParam(value ="pageSize", defaultValue = "10") Integer pageSize,
53
+                                            @ApiParam("房源ID") @RequestParam(value ="houseId", required = false) String houseId) throws Exception{
53 54
 
54 55
 		    IPage<TaHouseSurround> pg = new Page<>(pageNum, pageSize);
55
-            QueryWrapper<TaHouseSurround> queryWrapper = new QueryWrapper<>();
56
-            queryWrapper.orderByDesc("create_date");
57
-
58
-            IPage<TaHouseSurround> result = iTaHouseSurroundService.page(pg, queryWrapper);
56
+            IPage<TaHouseSurround> result = iTaHouseSurroundService.getListByHouseOrNot(pg, houseId);
59 57
             return ResponseBean.success(result);
60 58
     }
61 59
 

+ 3
- 0
src/main/java/com/shigongli/mapper/TaHouseSurroundMapper.java Целия файл

@@ -1,8 +1,10 @@
1 1
 package com.shigongli.mapper;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.shigongli.entity.TaHouseSurround;
4 5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6 8
 
7 9
 /**
8 10
  * <p>
@@ -15,4 +17,5 @@ import org.apache.ibatis.annotations.Mapper;
15 17
 @Mapper
16 18
 public interface TaHouseSurroundMapper extends BaseMapper<TaHouseSurround> {
17 19
 
20
+    IPage<TaHouseSurround> getListByHouseOrNot(IPage<TaHouseSurround> pg, @Param("houseId") String houseId);
18 21
 }

+ 2
- 0
src/main/java/com/shigongli/service/ITaHouseSurroundService.java Целия файл

@@ -1,5 +1,6 @@
1 1
 package com.shigongli.service;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.shigongli.entity.TaHouseSurround;
4 5
 import com.baomidou.mybatisplus.extension.service.IService;
5 6
 
@@ -13,4 +14,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
13 14
  */
14 15
 public interface ITaHouseSurroundService extends IService<TaHouseSurround> {
15 16
 
17
+    IPage<TaHouseSurround> getListByHouseOrNot(IPage<TaHouseSurround> pg, String houseId);
16 18
 }

+ 8
- 0
src/main/java/com/shigongli/service/impl/TaHouseSurroundServiceImpl.java Целия файл

@@ -1,9 +1,11 @@
1 1
 package com.shigongli.service.impl;
2 2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3 4
 import com.shigongli.entity.TaHouseSurround;
4 5
 import com.shigongli.mapper.TaHouseSurroundMapper;
5 6
 import com.shigongli.service.ITaHouseSurroundService;
6 7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
+import org.springframework.beans.factory.annotation.Autowired;
7 9
 import org.springframework.stereotype.Service;
8 10
 
9 11
 /**
@@ -16,5 +18,11 @@ import org.springframework.stereotype.Service;
16 18
  */
17 19
 @Service
18 20
 public class TaHouseSurroundServiceImpl extends ServiceImpl<TaHouseSurroundMapper, TaHouseSurround> implements ITaHouseSurroundService {
21
+    @Autowired
22
+    TaHouseSurroundMapper taHouseSurroundMapper;
19 23
 
24
+    @Override
25
+    public IPage<TaHouseSurround> getListByHouseOrNot(IPage<TaHouseSurround> pg, String houseId) {
26
+        return taHouseSurroundMapper.getListByHouseOrNot(pg, houseId);
27
+    }
20 28
 }

+ 15
- 0
src/main/resources/mapper/TaHouseSurroundMapper.xml Целия файл

@@ -2,4 +2,19 @@
2 2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 3
 <mapper namespace="com.shigongli.mapper.TaHouseSurroundMapper">
4 4
 
5
+    <select id="getListByHouseOrNot" resultType="com.shigongli.entity.TaHouseSurround">
6
+        SELECT
7
+            t.*,
8
+            s.image
9
+        FROM
10
+            ta_house_surround t
11
+        INNER JOIN ta_meta_image s ON t.image_id = s.image_id
12
+        WHERE
13
+            t.`status` = 1
14
+        <if test="null != houseId and '' != houseId">
15
+            AND t.house_id = #{houseId}
16
+        </if>
17
+        ORDER BY
18
+            t.create_date DESC;
19
+    </select>
5 20
 </mapper>