|
@@ -72,7 +72,7 @@ public class CommunityTagController extends BaseController {
|
|
|
int pageNum = Convert.toInt(ServletUtils.getParameter("pageNum"), 1);
|
|
|
int pageSize = Convert.toInt(ServletUtils.getParameter("pageSize"), 10);
|
|
|
int offset = (pageNum - 1) * pageSize;
|
|
|
- Page<CommunityTag> page = new Page<>(offset, pageSize);
|
|
|
+ Page<CommunityTag> page = new Page<>(pageNum, pageSize);
|
|
|
communityTags = communityTagService.page(page, new QueryWrapper<CommunityTag>().and((wrapper) -> {
|
|
|
wrapper.ne("is_delete", 1)
|
|
|
.or()
|
|
@@ -233,7 +233,7 @@ public class CommunityTagController extends BaseController {
|
|
|
@GetMapping("/tagsTakeBlock")
|
|
|
@Transactional
|
|
|
//@Anonymous
|
|
|
- public AjaxResult tagsTakeBlock(Long userId) {
|
|
|
+ public AjaxResult tagsTakeBlock(String tagName,Long userId, boolean isToken) {
|
|
|
/* List<CommunityTagVo> communityTagVos = new ArrayList<>();
|
|
|
try {
|
|
|
Page<CommunityTag> page = new Page<>(1, 10);
|
|
@@ -283,6 +283,12 @@ public class CommunityTagController extends BaseController {
|
|
|
if (userId == null) {
|
|
|
userId = SecurityUtils.getUserId();
|
|
|
}
|
|
|
+
|
|
|
+ //tagName 为空的话全文搜索
|
|
|
+ if (tagName == null) {
|
|
|
+ tagName = "%%";
|
|
|
+ }
|
|
|
+
|
|
|
List<CommunityTag> communityTags = null;
|
|
|
try {
|
|
|
//获取拉黑标签ID
|
|
@@ -301,8 +307,23 @@ public class CommunityTagController extends BaseController {
|
|
|
.in("id", tagList)
|
|
|
.and((wrapper) -> {
|
|
|
wrapper.ne("is_delete", 1).or().isNull("is_delete");
|
|
|
- }));
|
|
|
+ })
|
|
|
+ .like("tag_name", tagName));
|
|
|
+
|
|
|
+ if (isToken) {
|
|
|
+ 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());
|