|
@@ -66,7 +66,7 @@ public class CommunityTagController extends BaseController {
|
|
|
@GetMapping()
|
|
|
@Transactional
|
|
|
//@Anonymous
|
|
|
- public AjaxResult tags(String tagName) {
|
|
|
+ public AjaxResult tags(String tagName, boolean isToken) {
|
|
|
List<CommunityTag> communityTags = null;
|
|
|
try {
|
|
|
int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
|
@@ -80,6 +80,23 @@ public class CommunityTagController extends BaseController {
|
|
|
})
|
|
|
.like("tag_name", tagName)
|
|
|
.orderByDesc("tag_hot")).getRecords();
|
|
|
+
|
|
|
+
|
|
|
+ if (isToken) {
|
|
|
+ Long userId = SecurityUtils.getLoginUser().getUserId();
|
|
|
+ for (CommunityTag communityTag : communityTags) {
|
|
|
+ CommunityUserTag userTag = communityUserTagMapper
|
|
|
+ .selectOne(new QueryWrapper<CommunityUserTag>()
|
|
|
+ .eq("tag_id", communityTag.getId())
|
|
|
+ .eq("user_id", userId)
|
|
|
+ .eq("is_delete", 0));
|
|
|
+
|
|
|
+ if (userTag != null){
|
|
|
+ communityTag.setIsLike(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
} catch (Exception e) {
|
|
|
System.out.println(e.getMessage());
|
|
|
throw new ProjectException();
|
|
@@ -88,6 +105,7 @@ public class CommunityTagController extends BaseController {
|
|
|
return AjaxResult.success(communityTags);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取我创建的标签
|
|
|
*/
|