张延森 3 vuotta sitten
vanhempi
commit
5b1ababc53

+ 3
- 2
src/main/java/com/yunzhi/shigongli/controller/TaResourceController.java Näytä tiedosto

@@ -47,10 +47,11 @@ public class TaResourceController extends BaseController {
47 47
     @ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
48 48
     public ResponseBean getList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
49 49
                                 @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize,
50
-                                @ApiParam("定位") @RequestParam(value ="location", required = false) String location) throws Exception{
50
+                                @ApiParam("定位") @RequestParam(value ="location", required = false) String location,
51
+                                @ApiParam("分类") @RequestParam(value ="typeId", required = false) String typeId) throws Exception{
51 52
 
52 53
 		    IPage<ResourceListVO> pg = new Page<>(pageNum, pageSize);
53
-            IPage<ResourceListVO> result = iTaResourceService.getWxPagedBy(pg, getCurrentPerson(), location);
54
+            IPage<ResourceListVO> result = iTaResourceService.getWxPagedBy(pg, getCurrentPerson(), location, typeId);
54 55
             return ResponseBean.success(result);
55 56
     }
56 57
 

+ 1
- 1
src/main/java/com/yunzhi/shigongli/mapper/TaResourceMapper.java Näytä tiedosto

@@ -22,5 +22,5 @@ public interface TaResourceMapper extends BaseMapper<TaResource> {
22 22
 
23 23
     int updateQuota(@Param("quota") String save_num,  @Param("targetType") String targetType, @Param("targetId")  String targetId, @Param("num") int num);
24 24
 
25
-    IPage<ResourceListVO> getWxPagedBy(IPage<ResourceListVO> pg, @Param("personId") String personId, @Param("location") String location);
25
+    IPage<ResourceListVO> getWxPagedBy(IPage<ResourceListVO> pg, @Param("personId") String personId, @Param("location") String location, @Param("typeId") String typeId);
26 26
 }

+ 1
- 1
src/main/java/com/yunzhi/shigongli/service/ITaResourceService.java Näytä tiedosto

@@ -25,5 +25,5 @@ public interface ITaResourceService extends IBaseService<TaResource> {
25 25
 
26 26
     void updateSave(TaSave taSave, int num);
27 27
 
28
-    IPage<ResourceListVO> getWxPagedBy(IPage<ResourceListVO> pg, TaPerson taPerson, String location);
28
+    IPage<ResourceListVO> getWxPagedBy(IPage<ResourceListVO> pg, TaPerson taPerso, String location, String typeId);
29 29
 }

+ 2
- 2
src/main/java/com/yunzhi/shigongli/service/impl/TaResourceServiceImpl.java Näytä tiedosto

@@ -93,12 +93,12 @@ public class TaResourceServiceImpl extends BaseServiceImpl<TaResourceMapper, TaR
93 93
     }
94 94
 
95 95
     @Override
96
-    public IPage<ResourceListVO> getWxPagedBy(IPage<ResourceListVO> pg, TaPerson taPerson, String location) {
96
+    public IPage<ResourceListVO> getWxPagedBy(IPage<ResourceListVO> pg, TaPerson taPerson, String location, String typeId) {
97 97
         if (StringUtils.isEmpty(location)) {
98 98
             // 南京新街口
99 99
             location = "116.367742,39.940667";
100 100
         }
101 101
 
102
-        return baseMapper.getWxPagedBy(pg, taPerson.getPersonId(), location);
102
+        return baseMapper.getWxPagedBy(pg, taPerson.getPersonId(), location, typeId);
103 103
     }
104 104
 }

+ 5
- 0
src/main/resources/mapper/TaTargetQuotaMapper.xml Näytä tiedosto

@@ -32,6 +32,11 @@
32 32
             ) AS is_saved
33 33
         FROM
34 34
             ta_resource t
35
+        <if test="typeId != null and typeId != ''">
36
+            INNER JOIN ta_target_type s ON s.target_type = t.target_type
37
+                AND s.target_id = t.target_id
38
+                AND s.type_id = #{typeId}
39
+        </if>
35 40
         ORDER BY
36 41
             IFNULL( t.weight, 0 ) DESC,
37 42
             fn_distance ( #{location}, CONCAT( t.lng, ',', t.lat ) ) DESC