소스 검색

[update] message:1.海报、悄悄话接口开发

kelei 6 달 전
부모
커밋
2247a2208e
36개의 변경된 파일854개의 추가작업 그리고 14개의 파일을 삭제
  1. 21 2
      admin/src/main/java/com/flyer/foster/controller/AreaController.java
  2. 2 2
      admin/src/main/java/com/flyer/foster/controller/GardenController.java
  3. 62 2
      admin/src/main/java/com/flyer/foster/controller/PosterLibController.java
  4. 62 2
      admin/src/main/java/com/flyer/foster/controller/TreeController.java
  5. 2 2
      admin/src/main/java/com/flyer/foster/controller/UserController.java
  6. 61 2
      admin/src/main/java/com/flyer/foster/controller/WhisperController.java
  7. 3 0
      admin/src/main/java/com/flyer/foster/dto/AreaQueryDTO.java
  8. 2 0
      admin/src/main/java/com/flyer/foster/dto/AreaUpdateDTO.java
  9. 2 0
      admin/src/main/java/com/flyer/foster/dto/GardenUpdateDTO.java
  10. 28 0
      admin/src/main/java/com/flyer/foster/dto/PosterLibAddDTO.java
  11. 26 0
      admin/src/main/java/com/flyer/foster/dto/PosterLibQueryDTO.java
  12. 62 0
      admin/src/main/java/com/flyer/foster/dto/PosterLibRespDTO.java
  13. 28 0
      admin/src/main/java/com/flyer/foster/dto/PosterLibUpdateDTO.java
  14. 2 0
      admin/src/main/java/com/flyer/foster/dto/RoleUpdateDTO.java
  15. 35 0
      admin/src/main/java/com/flyer/foster/dto/TreeAddDTO.java
  16. 75 0
      admin/src/main/java/com/flyer/foster/dto/TreeRespDTO.java
  17. 36 0
      admin/src/main/java/com/flyer/foster/dto/TreeUpdateDTO.java
  18. 22 0
      admin/src/main/java/com/flyer/foster/dto/WhisperAddDTO.java
  19. 21 0
      admin/src/main/java/com/flyer/foster/dto/WhisperQueryDTO.java
  20. 51 0
      admin/src/main/java/com/flyer/foster/dto/WhisperRespDTO.java
  21. 24 0
      admin/src/main/java/com/flyer/foster/dto/WhisperUpdateDTO.java
  22. 5 0
      admin/src/main/java/com/flyer/foster/entity/PosterLib.java
  23. 10 0
      admin/src/main/java/com/flyer/foster/mapper/IPosterLibMapper.java
  24. 18 0
      admin/src/main/java/com/flyer/foster/mapper/ITreeMapper.java
  25. 9 0
      admin/src/main/java/com/flyer/foster/mapper/IWhisperMapper.java
  26. 14 0
      admin/src/main/java/com/flyer/foster/service/IPosterLibService.java
  27. 19 0
      admin/src/main/java/com/flyer/foster/service/ITreeService.java
  28. 22 0
      admin/src/main/java/com/flyer/foster/service/IWhisperService.java
  29. 2 2
      admin/src/main/java/com/flyer/foster/service/impl/AreaServiceImpl.java
  30. 29 0
      admin/src/main/java/com/flyer/foster/service/impl/PosterLibServiceImpl.java
  31. 22 0
      admin/src/main/java/com/flyer/foster/service/impl/TreeServiceImpl.java
  32. 34 0
      admin/src/main/java/com/flyer/foster/service/impl/WhisperServiceImpl.java
  33. 6 0
      admin/src/main/resources/mapper/PosterLibMapper.xml
  34. 29 0
      admin/src/main/resources/mapper/TreeMapper.xml
  35. 6 0
      admin/src/main/resources/mapper/WhisperMapper.xml
  36. 2 0
      admin/src/main/resources/mysql/ddl/init-table.sql

+ 21 - 2
admin/src/main/java/com/flyer/foster/controller/AreaController.java

@@ -2,10 +2,12 @@ package com.flyer.foster.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.flyer.exception.BusinessException;
 import com.flyer.foster.dto.AreaAddDTO;
 import com.flyer.foster.dto.AreaQueryDTO;
 import com.flyer.foster.dto.AreaRespDTO;
 import com.flyer.foster.dto.AreaUpdateDTO;
+import com.flyer.foster.entity.Area;
 import com.flyer.foster.service.IAreaService;
 import com.flyer.util.R;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -29,8 +31,8 @@ public class AreaController {
     /**
      * 区域列表-分页
      *
-     * @param current 当前页,默认1
-     * @param size    当前页显示条数,默认10
+     * @param current 当前页
+     * @param size    当前页显示条数
      * @return
      */
     @GetMapping("/list/{current}/{size}")
@@ -39,12 +41,29 @@ public class AreaController {
         return R.ok().result(iAreaService.getPageList(page, queryDTO));
     }
 
+    /**
+     * 根据区域id获取区域详情
+     *
+     * @param areaId
+     * @return
+     */
     @GetMapping("/{areaId}")
     public R getById(@PathVariable Integer areaId) {
         return R.ok().result(iAreaService.getById(areaId));
     }
 
     /**
+     * 区域列表
+     *
+     * @param areaQueryDTO 查询对象
+     * @return
+     */
+    @GetMapping("/list")
+    public R getByGardenId(@Valid AreaQueryDTO areaQueryDTO) {
+        return R.ok().result(iAreaService.lambdaQuery().eq(Area::getGardenId, areaQueryDTO.getGardenId()).list());
+    }
+
+    /**
      * 新增区域
      *
      * @param addDTOList

+ 2 - 2
admin/src/main/java/com/flyer/foster/controller/GardenController.java

@@ -27,8 +27,8 @@ public class GardenController {
     /**
      * 果园列表-分页
      *
-     * @param current 当前页,默认1
-     * @param size    当前页显示条数,默认10
+     * @param current 当前页
+     * @param size    当前页显示条数
      * @return
      */
     @GetMapping("/list/{current}/{size}")

+ 62 - 2
admin/src/main/java/com/flyer/foster/controller/PosterLibController.java

@@ -1,7 +1,18 @@
 package com.flyer.foster.controller;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.flyer.foster.dto.*;
+import com.flyer.foster.entity.PosterLib;
+import com.flyer.foster.service.IPosterLibService;
+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;
 
 /**
  * 海报库
@@ -12,5 +23,54 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/poster-lib")
 public class PosterLibController {
+    @Autowired
+    private IPosterLibService iPosterLibService;
+
+    /**
+     * 海报列表-分页
+     *
+     * @param current 当前页
+     * @param size    当前页显示条数
+     * @return
+     */
+    @GetMapping("/list/{current}/{size}")
+    public R getPageList(@PathVariable Integer current, @PathVariable Integer size, PosterLibQueryDTO queryDTO) {
+        return R.ok().result(iPosterLibService.getPageList(new Page<>(current, size), queryDTO));
+    }
+
+    /**
+     * 新增海报
+     *
+     * @return
+     */
+    @PostMapping("")
+    public R addPosterLib(@Valid @RequestBody PosterLibAddDTO addDTO) {
+        PosterLib posterLib = new PosterLib();
+        BeanUtil.copyProperties(addDTO, posterLib);
+        return R.ok().result(iPosterLibService.save(posterLib));
+    }
+
+    /**
+     * 修改海报
+     */
+    @PutMapping("")
+    public R updatePosterLib(@Valid @RequestBody PosterLibUpdateDTO updateDTO) {
+        return R.ok().result(
+                iPosterLibService.lambdaUpdate()
+                        .set(StrUtil.isNotBlank(updateDTO.getName()), PosterLib::getName, updateDTO.getName())
+                        .set(StrUtil.isNotBlank(updateDTO.getUrl()), PosterLib::getUrl, updateDTO.getUrl())
+                        .eq(PosterLib::getId, updateDTO.getId())
+                        .update());
+    }
 
+    /**
+     * 批量删除
+     *
+     * @param idList
+     * @return
+     */
+    @PostMapping("/delete")
+    public R deletePosterLib(@RequestBody List<Integer> idList) {
+        return R.ok().result(iPosterLibService.deleteByIdList(idList));
+    }
 }

+ 62 - 2
admin/src/main/java/com/flyer/foster/controller/TreeController.java

@@ -1,7 +1,19 @@
 package com.flyer.foster.controller;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.flyer.foster.dto.AreaAddDTO;
+import com.flyer.foster.dto.PosterLibUpdateDTO;
+import com.flyer.foster.dto.TreeAddDTO;
+import com.flyer.foster.dto.TreeUpdateDTO;
+import com.flyer.foster.entity.PosterLib;
+import com.flyer.foster.entity.Tree;
+import com.flyer.foster.service.IAreaService;
+import com.flyer.foster.service.ITreeService;
+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;
 
 /**
  * 树
@@ -12,5 +24,53 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/tree")
 public class TreeController {
+    @Autowired
+    private ITreeService iTreeService;
+
+    /**
+     * 新增果树
+     *
+     * @param addDTO
+     * @return
+     */
+    @PostMapping("")
+    public R addTree(@Valid @RequestBody TreeAddDTO addDTO) {
+        return R.ok().result(iTreeService.addTree(addDTO));
+    }
+
+    /**
+     * 修改树
+     */
+    @PutMapping("")
+    public R updatePosterLib(@Valid @RequestBody TreeUpdateDTO updateDTO) {
+        return R.ok().result(
+                iTreeService.lambdaUpdate()
+                        .set(Tree::getWkt, updateDTO.getWkt())
+                        .set(Tree::getGardenId, updateDTO.getGardenId())
+                        .set(Tree::getAreaId, updateDTO.getAreaId())
+                        .eq(Tree::getId, updateDTO.getId())
+                        .update());
+    }
+
+    /**
+     * 根据gardenId获取详情
+     *
+     * @param gardenId
+     * @return
+     */
+    @GetMapping("/{gardenId}")
+    public R getTreeById(@PathVariable Integer gardenId) {
+        return R.ok().result(iTreeService.getTreeById(gardenId));
+    }
 
+    /**
+     * 删除树
+     *
+     * @param idList id集合
+     * @return
+     */
+    @PostMapping("/delete")
+    public R deleteTree(@RequestBody List<Integer> idList) {
+        return R.ok().result(iTreeService.deleteByIdList(idList));
+    }
 }

+ 2 - 2
admin/src/main/java/com/flyer/foster/controller/UserController.java

@@ -92,8 +92,8 @@ public class UserController {
     /**
      * 用户列表-分页
      *
-     * @param current 当前页,默认1
-     * @param size    当前页显示条数,默认10
+     * @param current 当前页
+     * @param size    当前页显示条数
      * @return
      */
     @GetMapping("/list/{current}/{size}")

+ 61 - 2
admin/src/main/java/com/flyer/foster/controller/WhisperController.java

@@ -1,7 +1,18 @@
 package com.flyer.foster.controller;
 
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.flyer.foster.dto.*;
+import com.flyer.foster.entity.PosterLib;
+import com.flyer.foster.entity.Whisper;
+import com.flyer.foster.service.IPosterLibService;
+import com.flyer.foster.service.IWhisperService;
+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;
 
 /**
  * 悄悄话
@@ -12,5 +23,53 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/whisper")
 public class WhisperController {
+    @Autowired
+    private IWhisperService iWhisperService;
+
+    /**
+     * 悄悄话列表-分页
+     *
+     * @param current 当前页
+     * @param size    当前页显示条数
+     * @return
+     */
+    @GetMapping("/list/{current}/{size}")
+    public R getPageList(@PathVariable Integer current, @PathVariable Integer size, WhisperQueryDTO queryDTO) {
+        return R.ok().result(iWhisperService.getPageList(new Page<>(current, size), queryDTO));
+    }
+
+    /**
+     * 新增海报
+     *
+     * @return
+     */
+    @PostMapping("")
+    public R addPosterLib(@Valid @RequestBody WhisperAddDTO addDTO) {
+        Whisper whisper = new Whisper();
+        BeanUtil.copyProperties(addDTO, whisper);
+        return R.ok().result(iWhisperService.save(whisper));
+    }
+
+    /**
+     * 修改海报
+     */
+    @PutMapping("")
+    public R updatePosterLib(@Valid @RequestBody WhisperUpdateDTO updateDTO) {
+        return R.ok().result(
+                iWhisperService.lambdaUpdate()
+                        .set(Whisper::getContent, updateDTO.getContent())
+                        .eq(Whisper::getId, updateDTO.getId())
+                        .update());
+    }
 
+    /**
+     * 批量删除
+     *
+     * @param idList
+     * @return
+     */
+    @PostMapping("/delete")
+    public R deletePosterLib(@RequestBody List<Integer> idList) {
+        return R.ok().result(iWhisperService.deleteByIdList(idList));
+    }
 }

+ 3 - 0
admin/src/main/java/com/flyer/foster/dto/AreaQueryDTO.java

@@ -2,6 +2,8 @@ package com.flyer.foster.dto;
 
 import lombok.Data;
 
+import javax.validation.constraints.NotNull;
+
 /**
  * AreaSearchDTO
  *
@@ -15,6 +17,7 @@ public class AreaQueryDTO {
     /**
      * 果园id
      */
+    @NotNull(message = "果园id不能为空")
     private Integer gardenId;
 
     /**

+ 2 - 0
admin/src/main/java/com/flyer/foster/dto/AreaUpdateDTO.java

@@ -3,6 +3,7 @@ package com.flyer.foster.dto;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 
 /**
  * AreaSearchDTO
@@ -12,6 +13,7 @@ import javax.validation.constraints.NotBlank;
  */
 @Data
 public class AreaUpdateDTO {
+    @NotNull(message = "id不能为空")
     private Integer id;
 
     /**

+ 2 - 0
admin/src/main/java/com/flyer/foster/dto/GardenUpdateDTO.java

@@ -3,6 +3,7 @@ package com.flyer.foster.dto;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
 
 /**
  * AreaSearchDTO
@@ -12,6 +13,7 @@ import javax.validation.constraints.NotBlank;
  */
 @Data
 public class GardenUpdateDTO {
+    @NotNull(message = "id不能为空")
     private Integer id;
 
     /**

+ 28 - 0
admin/src/main/java/com/flyer/foster/dto/PosterLibAddDTO.java

@@ -0,0 +1,28 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class PosterLibAddDTO {
+    private Integer id;
+
+    /**
+     * 海报名称
+     */
+    @NotBlank(message = "海报名称不能为空")
+    private String name;
+
+    /**
+     * 海报url
+     */
+    @NotBlank(message = "海报url不能为空")
+    private String url;
+}

+ 26 - 0
admin/src/main/java/com/flyer/foster/dto/PosterLibQueryDTO.java

@@ -0,0 +1,26 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class PosterLibQueryDTO {
+    private Integer id;
+
+    /**
+     * 海报名称
+     */
+    private String name;
+
+    /**
+     * 海报url
+     */
+    private String url;
+}

+ 62 - 0
admin/src/main/java/com/flyer/foster/dto/PosterLibRespDTO.java

@@ -0,0 +1,62 @@
+package com.flyer.foster.dto;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.Version;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.time.LocalDateTime;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class PosterLibRespDTO {
+    private Integer id;
+
+    /**
+     * 海报名称
+     */
+    private String name;
+
+    /**
+     * 海报url
+     */
+    private String url;
+
+    /**
+     * 状态-{0.不可用 1.可用}
+     */
+    private Integer status;
+
+    /**
+     * 租户号
+     */
+    private Integer tenantId;
+
+
+    /**
+     * 创建人
+     */
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新人
+     */
+    private String updatedBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedTime;
+}

+ 28 - 0
admin/src/main/java/com/flyer/foster/dto/PosterLibUpdateDTO.java

@@ -0,0 +1,28 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class PosterLibUpdateDTO {
+    @NotNull(message = "id不能为空")
+    private Integer id;
+
+    /**
+     * 海报名称
+     */
+    private String name;
+
+    /**
+     * 海报url
+     */
+    private String url;
+}

+ 2 - 0
admin/src/main/java/com/flyer/foster/dto/RoleUpdateDTO.java

@@ -2,6 +2,7 @@ package com.flyer.foster.dto;
 
 import lombok.Data;
 
+import javax.validation.constraints.NotNull;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -13,6 +14,7 @@ import java.util.List;
  */
 @Data
 public class RoleUpdateDTO {
+    @NotNull(message = "id不能为空")
     private Integer roleId;
 
     private String roleName;

+ 35 - 0
admin/src/main/java/com/flyer/foster/dto/TreeAddDTO.java

@@ -0,0 +1,35 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * TreeAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/9/10:54
+ */
+@Data
+public class TreeAddDTO {
+    private Integer id;
+
+    /**
+     * 果园id
+     */
+    @NotNull(message = "果园id不能为空")
+    private Integer gardenId;
+
+    /**
+     * 区域id
+     */
+    @NotNull(message = "区域id不能为空")
+    private Integer areaId;
+
+    /**
+     * 坐标
+     */
+    @NotBlank(message = "坐标不能为空")
+    private String wkt;
+}

+ 75 - 0
admin/src/main/java/com/flyer/foster/dto/TreeRespDTO.java

@@ -0,0 +1,75 @@
+package com.flyer.foster.dto;
+
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.Version;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * TreeRespDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/13:46
+ */
+@Data
+public class TreeRespDTO {
+    private Integer id;
+
+    /**
+     * 果园id
+     */
+    private Integer gardenId;
+
+    /**
+     * 果园名称
+     */
+    private String gardenName;
+
+    /**
+     * 区域id
+     */
+    private Integer areaId;
+
+    /**
+     * 区域名称
+     */
+    private String areaName;
+
+    /**
+     * 坐标
+     */
+    private String wkt;
+
+    /**
+     * 状态-{0.不可用 1.可用}
+     */
+    private Integer status;
+
+    /**
+     * 状态中文
+     */
+    private String statusName;
+
+    /**
+     * 创建人
+     */
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新人
+     */
+    private String updatedBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedTime;
+}

+ 36 - 0
admin/src/main/java/com/flyer/foster/dto/TreeUpdateDTO.java

@@ -0,0 +1,36 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * TreeAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/9/10:54
+ */
+@Data
+public class TreeUpdateDTO {
+    @NotNull(message = "id不能为空")
+    private Integer id;
+
+    /**
+     * 果园id
+     */
+    @NotNull(message = "果园id不能为空")
+    private Integer gardenId;
+
+    /**
+     * 区域id
+     */
+    @NotNull(message = "区域id不能为空")
+    private Integer areaId;
+
+    /**
+     * 坐标
+     */
+    @NotBlank(message = "坐标不能为空")
+    private String wkt;
+}

+ 22 - 0
admin/src/main/java/com/flyer/foster/dto/WhisperAddDTO.java

@@ -0,0 +1,22 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class WhisperAddDTO {
+    private Integer id;
+
+    /**
+     * 文案内容
+     */
+    @NotBlank(message = "内容不能为空")
+    private String content;
+}

+ 21 - 0
admin/src/main/java/com/flyer/foster/dto/WhisperQueryDTO.java

@@ -0,0 +1,21 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class WhisperQueryDTO {
+    private Integer id;
+
+    /**
+     * 文案内容
+     */
+    private String content;
+}

+ 51 - 0
admin/src/main/java/com/flyer/foster/dto/WhisperRespDTO.java

@@ -0,0 +1,51 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class WhisperRespDTO {
+    private Integer id;
+
+    /**
+     * 文案内容
+     */
+    private String content;
+
+    /**
+     * 状态-{0.不可用 1.可用}
+     */
+    private Integer status;
+
+    /**
+     * 租户号
+     */
+    private Integer tenantId;
+
+    /**
+     * 创建人
+     */
+    private String createdBy;
+
+    /**
+     * 创建时间
+     */
+    private LocalDateTime createdTime;
+
+    /**
+     * 更新人
+     */
+    private String updatedBy;
+
+    /**
+     * 更新时间
+     */
+    private LocalDateTime updatedTime;
+}

+ 24 - 0
admin/src/main/java/com/flyer/foster/dto/WhisperUpdateDTO.java

@@ -0,0 +1,24 @@
+package com.flyer.foster.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * PosterLibAddDTO
+ *
+ * @author kelei
+ * @since 2024/5/10/10:41
+ */
+@Data
+public class WhisperUpdateDTO {
+    @NotNull(message = "id不能为空")
+    private Integer id;
+
+    /**
+     * 文案内容
+     */
+    @NotBlank(message = "内容不能为空")
+    private String content;
+}

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

@@ -34,6 +34,11 @@ public class PosterLib implements Serializable {
     private Integer id;
 
     /**
+     * 海报名称
+     */
+    private String name;
+
+    /**
      * 海报url
      */
     private String url;

+ 10 - 0
admin/src/main/java/com/flyer/foster/mapper/IPosterLibMapper.java

@@ -2,6 +2,9 @@ package com.flyer.foster.mapper;
 
 import com.flyer.foster.entity.PosterLib;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,11 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface IPosterLibMapper extends BaseMapper<PosterLib> {
 
+    /**
+     * 物理删除
+     *
+     * @param idList
+     * @return
+     */
+    boolean deleteByIdList(@Param("idList") List<Integer> idList);
 }

+ 18 - 0
admin/src/main/java/com/flyer/foster/mapper/ITreeMapper.java

@@ -1,7 +1,11 @@
 package com.flyer.foster.mapper;
 
+import com.flyer.foster.dto.TreeRespDTO;
 import com.flyer.foster.entity.Tree;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +17,18 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface ITreeMapper extends BaseMapper<Tree> {
 
+    /**
+     * 物理删除
+     *
+     * @param idList
+     * @return
+     */
+    boolean deleteByIdList(@Param("idList") List<Integer> idList);
+
+    /**
+     * 根据gardenId获取详情
+     * @param gardenId
+     * @return
+     */
+    List<TreeRespDTO> getTreeById(@Param("gardenId") Integer gardenId);
 }

+ 9 - 0
admin/src/main/java/com/flyer/foster/mapper/IWhisperMapper.java

@@ -2,6 +2,9 @@ package com.flyer.foster.mapper;
 
 import com.flyer.foster.entity.Whisper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -13,4 +16,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface IWhisperMapper extends BaseMapper<Whisper> {
 
+    /**
+     * 物理删除
+     * @param idList
+     * @return
+     */
+    boolean deleteByIdList(@Param("idList") List<Integer> idList);
 }

+ 14 - 0
admin/src/main/java/com/flyer/foster/service/IPosterLibService.java

@@ -1,8 +1,15 @@
 package com.flyer.foster.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.flyer.foster.dto.AreaQueryDTO;
+import com.flyer.foster.dto.PosterLibAddDTO;
+import com.flyer.foster.dto.PosterLibQueryDTO;
+import com.flyer.foster.dto.PosterLibRespDTO;
 import com.flyer.foster.entity.PosterLib;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 海报库 服务类
@@ -12,5 +19,12 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2024-05-09
  */
 public interface IPosterLibService extends IService<PosterLib> {
+    /**
+     * 物理删除
+     * @param idList
+     * @return
+     */
+    boolean deleteByIdList(List<Integer> idList);
 
+    IPage<PosterLibRespDTO> getPageList(IPage<PosterLib> page, PosterLibQueryDTO queryDTO);
 }

+ 19 - 0
admin/src/main/java/com/flyer/foster/service/ITreeService.java

@@ -1,8 +1,12 @@
 package com.flyer.foster.service;
 
+import com.flyer.foster.dto.TreeAddDTO;
+import com.flyer.foster.dto.TreeRespDTO;
 import com.flyer.foster.entity.Tree;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 树 服务类
@@ -13,4 +17,19 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ITreeService extends IService<Tree> {
 
+    /**
+     * 新增树
+     * @param addDTO
+     * @return
+     */
+    Integer addTree(TreeAddDTO addDTO);
+
+    /**
+     * 物理删除
+     * @param idList
+     * @return
+     */
+    boolean deleteByIdList(List<Integer> idList);
+
+    List<TreeRespDTO> getTreeById(Integer gardenId);
 }

+ 22 - 0
admin/src/main/java/com/flyer/foster/service/IWhisperService.java

@@ -1,8 +1,15 @@
 package com.flyer.foster.service;
 
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.flyer.foster.dto.PosterLibQueryDTO;
+import com.flyer.foster.dto.WhisperQueryDTO;
+import com.flyer.foster.dto.WhisperRespDTO;
 import com.flyer.foster.entity.Whisper;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * <p>
  * 悄悄话 服务类
@@ -12,5 +19,20 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @since 2024-05-09
  */
 public interface IWhisperService extends IService<Whisper> {
+    /**
+     * 物理删除
+     *
+     * @param idList
+     * @return
+     */
+    boolean deleteByIdList(List<Integer> idList);
 
+    /**
+     * 悄悄话列表-分页
+     *
+     * @param page
+     * @param queryDTO
+     * @return
+     */
+    IPage<WhisperRespDTO> getPageList(IPage<Whisper> page, WhisperQueryDTO queryDTO);
 }

+ 2 - 2
admin/src/main/java/com/flyer/foster/service/impl/AreaServiceImpl.java

@@ -39,9 +39,9 @@ public class AreaServiceImpl extends ServiceImpl<IAreaMapper, Area> implements I
         for (AreaAddDTO addDTO : addDTOList) {
             BeanUtil.copyProperties(addDTO, area);
             if (area.getId() == null) {
-                return this.save(area);
+                this.save(area);
             } else {
-                return this.lambdaUpdate()
+                this.lambdaUpdate()
                         .set(Area::getName, addDTO.getName())
                         .set(Area::getGardenId, addDTO.getGardenId())
                         .set(Area::getWkt, addDTO.getWkt())

+ 29 - 0
admin/src/main/java/com/flyer/foster/service/impl/PosterLibServiceImpl.java

@@ -1,11 +1,19 @@
 package com.flyer.foster.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.flyer.foster.dto.PosterLibQueryDTO;
+import com.flyer.foster.dto.PosterLibRespDTO;
 import com.flyer.foster.entity.PosterLib;
 import com.flyer.foster.mapper.IPosterLibMapper;
 import com.flyer.foster.service.IPosterLibService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * <p>
  * 海报库 服务实现类
@@ -17,4 +25,25 @@ import org.springframework.stereotype.Service;
 @Service
 public class PosterLibServiceImpl extends ServiceImpl<IPosterLibMapper, PosterLib> implements IPosterLibService {
 
+    @Override
+    public boolean deleteByIdList(List<Integer> idList) {
+        return baseMapper.deleteByIdList(idList);
+    }
+
+    @Override
+    public IPage<PosterLibRespDTO> getPageList(IPage<PosterLib> page, PosterLibQueryDTO queryDTO) {
+        IPage<PosterLibRespDTO> pageResult = new Page<>(page.getCurrent(), page.getSize());
+
+        IPage<PosterLib> pageInfo = this.lambdaQuery().page(page);
+        List<PosterLibRespDTO> list = new ArrayList<>();
+        PosterLibRespDTO posterLibRespDTO;
+        for (PosterLib posterLib : pageInfo.getRecords()) {
+            posterLibRespDTO = new PosterLibRespDTO();
+            BeanUtil.copyProperties(posterLib, posterLibRespDTO);
+            list.add(posterLibRespDTO);
+        }
+        pageResult.setRecords(list);
+        pageResult.setTotal(pageInfo.getTotal());
+        return pageResult;
+    }
 }

+ 22 - 0
admin/src/main/java/com/flyer/foster/service/impl/TreeServiceImpl.java

@@ -1,11 +1,16 @@
 package com.flyer.foster.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import com.flyer.foster.dto.TreeAddDTO;
+import com.flyer.foster.dto.TreeRespDTO;
 import com.flyer.foster.entity.Tree;
 import com.flyer.foster.mapper.ITreeMapper;
 import com.flyer.foster.service.ITreeService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * <p>
  * 树 服务实现类
@@ -17,4 +22,21 @@ import org.springframework.stereotype.Service;
 @Service
 public class TreeServiceImpl extends ServiceImpl<ITreeMapper, Tree> implements ITreeService {
 
+    @Override
+    public Integer addTree(TreeAddDTO addDTO) {
+        Tree tree = new Tree();
+        BeanUtil.copyProperties(addDTO, tree);
+        this.save(tree);
+        return tree.getId();
+    }
+
+    @Override
+    public boolean deleteByIdList(List<Integer> idList) {
+        return baseMapper.deleteByIdList(idList);
+    }
+
+    @Override
+    public List<TreeRespDTO> getTreeById(Integer gardenId) {
+        return baseMapper.getTreeById(gardenId);
+    }
 }

+ 34 - 0
admin/src/main/java/com/flyer/foster/service/impl/WhisperServiceImpl.java

@@ -1,11 +1,22 @@
 package com.flyer.foster.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.flyer.foster.dto.PosterLibRespDTO;
+import com.flyer.foster.dto.WhisperQueryDTO;
+import com.flyer.foster.dto.WhisperRespDTO;
+import com.flyer.foster.entity.PosterLib;
 import com.flyer.foster.entity.Whisper;
 import com.flyer.foster.mapper.IWhisperMapper;
 import com.flyer.foster.service.IWhisperService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * <p>
  * 悄悄话 服务实现类
@@ -17,4 +28,27 @@ import org.springframework.stereotype.Service;
 @Service
 public class WhisperServiceImpl extends ServiceImpl<IWhisperMapper, Whisper> implements IWhisperService {
 
+    @Override
+    public boolean deleteByIdList(List<Integer> idList) {
+        return baseMapper.deleteByIdList(idList);
+    }
+
+    @Override
+    public IPage<WhisperRespDTO> getPageList(IPage<Whisper> page, WhisperQueryDTO queryDTO) {
+        IPage<WhisperRespDTO> pageResult = new Page<>(page.getCurrent(), page.getSize());
+
+        IPage<Whisper> pageInfo = this.lambdaQuery()
+                .like(StrUtil.isNotBlank(queryDTO.getContent()), Whisper::getContent, queryDTO.getContent())
+                .page(page);
+        List<WhisperRespDTO> list = new ArrayList<>();
+        WhisperRespDTO whisperRespDTO;
+        for (Whisper posterLib : pageInfo.getRecords()) {
+            whisperRespDTO = new WhisperRespDTO();
+            BeanUtil.copyProperties(posterLib, whisperRespDTO);
+            list.add(whisperRespDTO);
+        }
+        pageResult.setRecords(list);
+        pageResult.setTotal(pageInfo.getTotal());
+        return pageResult;
+    }
 }

+ 6 - 0
admin/src/main/resources/mapper/PosterLibMapper.xml

@@ -2,4 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.flyer.foster.mapper.IPosterLibMapper">
 
+    <delete id="deleteByIdList">
+        delete from tb_poster_lib where id in
+        <foreach collection="idList" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

+ 29 - 0
admin/src/main/resources/mapper/TreeMapper.xml

@@ -2,4 +2,33 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.flyer.foster.mapper.ITreeMapper">
 
+    <delete id="deleteByIdList">
+        delete from tb_tree where id in
+        <foreach collection="idList" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="getTreeById" resultType="com.flyer.foster.dto.TreeRespDTO">
+        select a.id,
+               a.garden_id                                         as gardenId,
+               b.name                                              as gardenName,
+               a.area_id                                           as areaId,
+               c.name                                              as areaName,
+               a.wkt,
+               a.status,
+               case a.status when 0 then '禁用' when 1 then '启用' end as statusName,
+               a.created_by                                        as createdBy,
+               a.created_time                                      as createdTime,
+               a.updated_by                                        as updatedBy,
+               a.updated_time                                      as updatedTime
+        from tb_tree a
+                 left join tb_garden b on a.garden_id = b.id
+                 left join tb_area c on a.area_id = c.id
+        <where>
+            <if test="gardenId!=null">
+                and a.garden_id = #{gardenId}
+            </if>
+        </where>
+    </select>
 </mapper>

+ 6 - 0
admin/src/main/resources/mapper/WhisperMapper.xml

@@ -2,4 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.flyer.foster.mapper.IWhisperMapper">
 
+    <delete id="deleteByIdList">
+        delete from tb_whisper where id in
+        <foreach collection="idList" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

+ 2 - 0
admin/src/main/resources/mysql/ddl/init-table.sql

@@ -282,3 +282,5 @@ create table tb_whisper
 )
     comment '悄悄话';
 
+alter table tb_poster_lib
+    add column name varchar(32) not null comment '海报名称' after id;