Browse Source

Merge branch 'master' of http://www.sysuimars.com:3000/kelei12399/foster

 Conflicts:
	admin/src/main/java/com/flyer/foster/controller/app/AppFosterRecordController.java
kelei 6 tháng trước cách đây
mục cha
commit
f48b09af35

+ 10 - 8
admin/src/main/java/com/flyer/foster/controller/app/AppFosterRecordController.java

@@ -1,13 +1,12 @@
 package com.flyer.foster.controller.app;
 
-import com.flyer.foster.dto.app.FosterRecordAddDTO;
 import com.flyer.foster.entity.FosterRecord;
+import com.flyer.foster.entity.Garden;
 import com.flyer.foster.service.IFosterRecordService;
 import com.flyer.util.R;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import javax.validation.Valid;
 import java.util.List;
 
 /**
@@ -24,14 +23,17 @@ public class AppFosterRecordController {
     private IFosterRecordService iFosterRecordService;
 
     /**
-     * 根据id查询领养记录
-     *
+     * 领养记录列表
      * @return
      */
-    @GetMapping("/list/{appUserId}")
-    public R list(@PathVariable Integer appUserId) {
-        List<FosterRecord> res = iFosterRecordService.lambdaQuery().
-                eq(FosterRecord::getAppUserId, appUserId).list();
+    @GetMapping("/list/{gardenId}/")
+    public R list(@PathVariable Integer gardenId) {
+//        Integer appUserId = (Integer)StpAppUtil.getLoginId();
+        Integer appUserId = 4;
+        List<FosterRecord> res = service.lambdaQuery().
+                eq(FosterRecord::getAppUserId, appUserId)
+                .eq(FosterRecord::getGardenId, gardenId)
+                .list();
         return R.ok().result(res);
     }
 

+ 9 - 0
admin/src/main/java/com/flyer/foster/controller/app/AppTreeController.java

@@ -32,4 +32,13 @@ public class AppTreeController {
     public R getTreeByGardenId(@PathVariable Integer gardenId) {
         return R.ok().result(iTreeService.getTreeById(gardenId));
     }
+
+    /**
+     * 返回区域随机的一棵树
+     * @return
+     */
+    @GetMapping("/getRandomTree/{areaId}")
+    public R getRandomTree(@PathVariable Integer areaId){
+        return R.ok().result(iTreeService.lambdaQuery().eq(Tree::getAreaId, areaId).list());
+    }
 }

+ 5 - 0
admin/src/main/java/com/flyer/foster/entity/FosterRecord.java

@@ -39,6 +39,11 @@ public class FosterRecord implements Serializable {
     private Integer appUserId;
 
     /**
+     * gardenId
+     */
+    private Integer gardenId;
+
+    /**
      * 树id
      */
     private Integer treeId;