Parcourir la source

goods 加入缩略图
评论加入批量显示、删除功能
如果更新生产环境, 需要更新数据库

wuweihao il y a 3 ans
Parent
commit
52e10a9074

+ 2 - 2
gis_domain/src/main/java/com/gis/domain/dto/GoodsDto.java

@@ -28,8 +28,8 @@ public class GoodsDto {
     @ApiModelProperty(value = "类型: 图片:img, 模型:model", required = true)
     private String type;
 
-//    @ApiModelProperty(value = "文件地址", required = true)
-//    private String filePath;
+    @ApiModelProperty(value = "文件地址(大图)")
+    private String filePath;
 
 //    @ApiModelProperty(value = "文件名称", required = true)
 //    private String fileName;

+ 3 - 3
gis_domain/src/main/java/com/gis/domain/po/GoodsEntity.java

@@ -26,9 +26,9 @@ public class GoodsEntity extends BaseEntity {
     @ApiModelProperty(value = "缩略图url")
     private String thumb;
 
-//    @ApiModelProperty(value = "文件地址")
-//    private String filePath;
-//
+    @ApiModelProperty(value = "文件地址(或大图)")
+    private String filePath;
+
 //    @ApiModelProperty(value = "文件名")
 //    private String fileName;
 

+ 4 - 0
gis_mapper/src/main/java/com/gis/mapper/CommentMapper.java

@@ -4,6 +4,7 @@ package com.gis.mapper;
 import com.gis.domain.po.CommentEntity;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 import org.springframework.stereotype.Component;
 
 import java.time.LocalDate;
@@ -16,4 +17,7 @@ public interface CommentMapper extends IBaseMapper<CommentEntity, Long> {
 
     @Select("select COUNT(id) from tb_comment where is_delete = 0 AND  DATE_FORMAT( create_time, '%Y%m%d' ) = DATE_FORMAT(#{date} , '%Y%m%d' ) ")
     Integer countFindByDate(LocalDate now);
+
+    @Update("UPDATE tb_comment set display=#{display}, update_time=NOW() WHERE is_delete=0 and id in (${ids})")
+    void setDisplays(String ids, Integer display);
 }

+ 2 - 0
gis_service/src/main/java/com/gis/service/CommentService.java

@@ -18,4 +18,6 @@ public interface CommentService extends IBaseService<CommentEntity, Long> {
     Result<PageInfo<CommentEntity>> search(PageDateDto param, Integer display);
 
     Integer countFindByDate(LocalDate now);
+
+    Result displays(String ids, Integer display);
 }

+ 6 - 0
gis_service/src/main/java/com/gis/service/impl/CommentServiceImpl.java

@@ -61,4 +61,10 @@ public class CommentServiceImpl extends IBaseServiceImpl<CommentEntity, Long> im
     public Integer countFindByDate(LocalDate now) {
         return entityMapper.countFindByDate(now);
     }
+
+    @Override
+    public Result displays(String ids, Integer display) {
+        entityMapper.setDisplays(ids, display);
+        return Result.success();
+    }
 }

+ 21 - 15
gis_web/src/main/java/com/gis/web/controller/CommentController.java

@@ -22,7 +22,7 @@ import javax.validation.Valid;
  * Created by owen on 2020/5/8 0008 9:54
  */
 @Slf4j
-@Api(tags = "留言管理")
+@Api(tags = "v0.1-留言管理")
 @RestController
 @RequestMapping("manage/comment")
 public class CommentController extends BaseController {
@@ -52,26 +52,32 @@ public class CommentController extends BaseController {
 
 
     @WebControllerLog(description = "留言管理-删除留言", addDb = true)
-    @ApiOperation("删除")
+    @ApiOperation(value = "删除(支持批量)", notes = "ids多个以逗号隔开")
     @GetMapping("removes/{ids}")
-    public Result detail(@PathVariable String ids) {
+    public Result removes(@PathVariable String ids) {
         commentService.deleteByIds(ids);
 
         return Result.success();
     }
 
-    @ApiOperation("是否显示")
-    @GetMapping("display/{id}/{display}")
-    public Result display(@PathVariable Long id, @PathVariable Integer display) {
-        CommentEntity entity = commentService.findById(id);
-        if (entity == null) {
-            log.error("对象id不存在 : {}", id);
-            return Result.failure("对象id不存在");
-        }
-
-        entity.setDisplay(display);
-        commentService.update(entity);
-        return Result.success();
+//    @ApiOperation("是否显示")
+//    @GetMapping("display/{id}/{display}")
+//    public Result display(@PathVariable Long id, @PathVariable Integer display) {
+//        CommentEntity entity = commentService.findById(id);
+//        if (entity == null) {
+//            log.error("对象id不存在 : {}", id);
+//            return Result.failure("对象id不存在");
+//        }
+//
+//        entity.setDisplay(display);
+//        commentService.update(entity);
+//        return Result.success();
+//    }
+
+    @ApiOperation(value = "v0.1-是否显示(支持批量)", notes = "ids多个以逗号隔开")
+    @GetMapping("displays/{ids}/{display}")
+    public Result displays(@PathVariable String ids, @PathVariable Integer display) {
+        return commentService.displays(ids, display);
     }
 
 

+ 2 - 2
gis_web/src/main/java/com/gis/web/controller/GoodsController.java

@@ -17,7 +17,7 @@ import javax.validation.Valid;
 /**
  * Created by owen on 2021/5/14 0008 9:54
  */
-@Api(tags = "品信息-臧品详情")
+@Api(tags = "v0.1-藏品信息-臧品详情")
 @RestController
 @RequestMapping("manage/goods")
 public class GoodsController extends BaseController {
@@ -34,7 +34,7 @@ public class GoodsController extends BaseController {
     }
 
     @WebControllerLog(description = "文物管理-新增/修改", addDb = true)
-    @ApiOperation("新增/修改")
+    @ApiOperation("v0.1-新增/修改")
     @PostMapping("save")
     public Result save(@Valid @RequestBody GoodsDto param) {
         return goodsService.saveEntity(param);