Browse Source

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

zlisen 4 years ago
parent
commit
b499358f8e

+ 23
- 34
src/main/java/com/shigongli/controller/TaHouseController.java View File

43
     @Autowired
43
     @Autowired
44
     public ITaHouseService iTaHouseService;
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
      * @param taHouse 实体对象
92
      * @param taHouse 实体对象
93
      * @return
93
      * @return
94
      */
94
      */
95
-    @RequestMapping(value="/mp/taHouse",method= RequestMethod.POST)
95
+    @RequestMapping(value="/ma/taHouse",method= RequestMethod.POST)
96
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
96
     @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
97
     public ResponseBean taHouseAdd(@ApiParam("保存内容") @RequestBody TaHouse taHouse) throws Exception{
97
     public ResponseBean taHouseAdd(@ApiParam("保存内容") @RequestBody TaHouse taHouse) throws Exception{
98
 
98
 
107
      * 根据id删除对象
107
      * 根据id删除对象
108
      * @param id  实体ID
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
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
111
     @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
112
     public ResponseBean taHouseDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
112
     public ResponseBean taHouseDelete(@ApiParam("对象ID") @PathVariable String id) throws Exception{
113
         TaHouse taHouse = iTaHouseService.getById(id);
113
         TaHouse taHouse = iTaHouseService.getById(id);
126
      * @param taHouse 实体对象
126
      * @param taHouse 实体对象
127
      * @return
127
      * @return
128
      */
128
      */
129
-    @RequestMapping(value="/mp/taHouse/{id}",method= RequestMethod.PUT)
129
+    @RequestMapping(value="/ma/taHouse/{id}",method= RequestMethod.PUT)
130
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
130
     @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
131
     public ResponseBean taHouseUpdate(@ApiParam("对象ID") @PathVariable String id,
131
     public ResponseBean taHouseUpdate(@ApiParam("对象ID") @PathVariable String id,
132
                                         @ApiParam("更新内容") @RequestBody TaHouse taHouse) throws Exception{
132
                                         @ApiParam("更新内容") @RequestBody TaHouse taHouse) throws Exception{
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
      * @param id  实体ID
143
      * @param id  实体ID

+ 5
- 7
src/main/java/com/shigongli/controller/TaHouseSurroundController.java View File

46
      * @param pageSize
46
      * @param pageSize
47
      * @return
47
      * @return
48
      */
48
      */
49
-    @RequestMapping(value="/taHouseSurround",method= RequestMethod.GET)
49
+    @RequestMapping(value="/ma/taHouseSurround",method= RequestMethod.GET)
50
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
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
 		    IPage<TaHouseSurround> pg = new Page<>(pageNum, pageSize);
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
             return ResponseBean.success(result);
57
             return ResponseBean.success(result);
60
     }
58
     }
61
 
59
 

+ 3
- 0
src/main/java/com/shigongli/mapper/TaHouseSurroundMapper.java View File

1
 package com.shigongli.mapper;
1
 package com.shigongli.mapper;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaHouseSurround;
4
 import com.shigongli.entity.TaHouseSurround;
4
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5
 import org.apache.ibatis.annotations.Mapper;
6
 import org.apache.ibatis.annotations.Mapper;
7
+import org.apache.ibatis.annotations.Param;
6
 
8
 
7
 /**
9
 /**
8
  * <p>
10
  * <p>
15
 @Mapper
17
 @Mapper
16
 public interface TaHouseSurroundMapper extends BaseMapper<TaHouseSurround> {
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 View File

1
 package com.shigongli.service;
1
 package com.shigongli.service;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaHouseSurround;
4
 import com.shigongli.entity.TaHouseSurround;
4
 import com.baomidou.mybatisplus.extension.service.IService;
5
 import com.baomidou.mybatisplus.extension.service.IService;
5
 
6
 
13
  */
14
  */
14
 public interface ITaHouseSurroundService extends IService<TaHouseSurround> {
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 View File

1
 package com.shigongli.service.impl;
1
 package com.shigongli.service.impl;
2
 
2
 
3
+import com.baomidou.mybatisplus.core.metadata.IPage;
3
 import com.shigongli.entity.TaHouseSurround;
4
 import com.shigongli.entity.TaHouseSurround;
4
 import com.shigongli.mapper.TaHouseSurroundMapper;
5
 import com.shigongli.mapper.TaHouseSurroundMapper;
5
 import com.shigongli.service.ITaHouseSurroundService;
6
 import com.shigongli.service.ITaHouseSurroundService;
6
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
7
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
8
+import org.springframework.beans.factory.annotation.Autowired;
7
 import org.springframework.stereotype.Service;
9
 import org.springframework.stereotype.Service;
8
 
10
 
9
 /**
11
 /**
16
  */
18
  */
17
 @Service
19
 @Service
18
 public class TaHouseSurroundServiceImpl extends ServiceImpl<TaHouseSurroundMapper, TaHouseSurround> implements ITaHouseSurroundService {
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 View File

2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
2
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
 <mapper namespace="com.shigongli.mapper.TaHouseSurroundMapper">
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
 </mapper>
20
 </mapper>