记得上下班打卡 | git大法好,push需谨慎

Commit db20e679 authored by 张国柄's avatar 张国柄

修改收藏删除接口:支持删除多个;

kylin build pom config;
parent 2fe3ce9c
...@@ -20,7 +20,7 @@ public interface IAdamCollectionService extends IService<AdamCollection> { ...@@ -20,7 +20,7 @@ public interface IAdamCollectionService extends IService<AdamCollection> {
AdamCollectBaseVo query(String uid, String type, String contentId); AdamCollectBaseVo query(String uid, String type, String contentId);
void del(String uid, String type, String contentId); void del(String uid, String type, String... contentIds);
boolean queryState(String uid, String type, String contentId); boolean queryState(String uid, String type, String contentId);
......
...@@ -56,13 +56,13 @@ public class AdamCollectionController { ...@@ -56,13 +56,13 @@ public class AdamCollectionController {
@ApiOperation(value = "删除收藏") @ApiOperation(value = "删除收藏")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "type", value = "收藏类型", allowableValues = "VIDEO,TICKET,SITE,ARTIST,BAND,BRAND,STYLE,GOODS,MUSIC,SONG"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "type", value = "收藏类型", allowableValues = "VIDEO,TICKET,SITE,ARTIST,BAND,BRAND,STYLE,GOODS,MUSIC,SONG"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentId", value = "内容ID[64]"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "contentIds", value = "内容ID[多个ID用','分隔]"),
}) })
@PostMapping("del") @PostMapping("del")
public ResponseDto<Object> del(@RequestParam String type, @RequestParam String contentId) { public ResponseDto<Object> del(@RequestParam String type, @RequestParam String contentIds) {
// TODO: 2021/4/28 数据校验 // TODO: 2021/4/28 数据校验
adamCollectionService.del(CurrentUtil.getCurrentUid(), type, contentId); adamCollectionService.del(CurrentUtil.getCurrentUid(), type, contentIds.split(","));
return ResponseDto.success(); return ResponseDto.success();
} }
......
...@@ -91,13 +91,13 @@ public class AdamCollectionServiceImpl extends ServiceImpl<AdamCollectionMapper, ...@@ -91,13 +91,13 @@ public class AdamCollectionServiceImpl extends ServiceImpl<AdamCollectionMapper,
} }
@Override @Override
public void del(String uid, String type, String contentId) { public void del(String uid, String type, String... contentIds) {
AdamCollectBaseVo delVo = AdamCollectBaseVo.getNew(); AdamCollectBaseVo delVo = AdamCollectBaseVo.getNew();
delVo.setState(2); delVo.setState(2);
delVo.setUpdatedAt(DateUtil.getNowTime()); delVo.setUpdatedAt(DateUtil.getNowTime());
mongoTemplate.getCollection(AdamCollectBaseVo.class.getSimpleName()).updateOne( mongoTemplate.getCollection(AdamCollectBaseVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("uid").is(uid).and("type").is(type) Query.query(Criteria.where("uid").is(uid).and("type").is(type)
.and("contentId").is(contentId).and("state").is(1)).getQueryObject(), .and("contentId").in(contentIds).and("state").is(1)).getQueryObject(),
new BasicDBObject("$set", mongoConverter.convertToMongoType(delVo))); new BasicDBObject("$set", mongoConverter.convertToMongoType(delVo)));
} }
......
...@@ -36,7 +36,14 @@ ...@@ -36,7 +36,14 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId> <artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project> </project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment