feat: 移动端收藏状态

This commit is contained in:
fit2cloud-chenyw
2021-12-09 12:47:07 +08:00
parent e1e770d61b
commit 142ff835ca
5 changed files with 29 additions and 6 deletions

View File

@@ -32,7 +32,12 @@ public interface StoreApi {
@ApiOperation("移除收藏")
@PostMapping("/remove/{storeId}")
void remove(@PathVariable("storeId") String storeId);
@PostMapping("/remove/{panelId}")
void remove(@PathVariable("panelId") String panelId);
@ApiOperation("收藏状态")
@PostMapping("/status/{id}")
Boolean hasStar(@PathVariable("id") String id);
}

View File

@@ -29,4 +29,9 @@ public class StoreServer implements StoreApi {
public void remove(String panelId) {
storeService.removeByPanelId(panelId);
}
@Override
public Boolean hasStar(String id) {
return storeService.count(id) > 0L;
}
}

View File

@@ -53,4 +53,11 @@ public class StoreService {
return extPanelStoreMapper.query(example);
}
public Long count(String panelId) {
PanelStoreExample example = new PanelStoreExample();
example.createCriteria().andUserIdEqualTo(AuthUtils.getUser().getUserId()).andPanelGroupIdEqualTo(panelId);
return panelStoreMapper.countByExample(example);
}
}