|
@@ -10,6 +10,7 @@ import com.flyer.foster.pojo.StpAppUtil;
|
|
|
import com.flyer.foster.service.IFosterRecordService;
|
|
|
import com.flyer.foster.service.ITreeService;
|
|
|
import com.flyer.util.R;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@@ -42,6 +43,29 @@ public class AppTreeController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 修改树
|
|
|
+ */
|
|
|
+ @PutMapping("")
|
|
|
+ public R update(@RequestBody TreeUpdateDTO updateDTO) {
|
|
|
+ return R.ok().result(
|
|
|
+ iTreeService.lambdaUpdate()
|
|
|
+ .set(Tree::getName, updateDTO.getGardenId())
|
|
|
+ .eq(Tree::getId, updateDTO.getId())
|
|
|
+ .update());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * get tree
|
|
|
+ */
|
|
|
+ @GetMapping("/{treeId}")
|
|
|
+ public R get(@PathVariable Integer treeId) {
|
|
|
+ Tree tree = iTreeService.lambdaQuery().eq(Tree::getName ,treeId).one();
|
|
|
+ TreeRespDTO dto = new TreeRespDTO();
|
|
|
+ BeanUtils.copyProperties(tree, dto);
|
|
|
+ return R.ok().result(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 返回区域随机的一棵树
|
|
|
*
|
|
|
* @return
|