1.fix tag display condition 2.enable badge for user info

main
Gary 9 months ago
parent fd551ec9a0
commit 848490215e

@ -53,7 +53,7 @@ public class SearchController {
@GetMapping("/category") @GetMapping("/category")
@GlobalInterceptor @GlobalInterceptor
public Result<List<SearchCategoryDTO>> getCategory() { public Result<List<SearchCategoryDTO>> getCategory() {
List<Tag> tags = tagService.getLevel1Tags(); List<Tag> tags = tagService.getCategoryTags();
List<SearchCategoryDTO> searchCategoryDTOs = tags.stream().map(this::getSearchCategoryDTO) List<SearchCategoryDTO> searchCategoryDTOs = tags.stream().map(this::getSearchCategoryDTO)
.collect(Collectors.toList()); .collect(Collectors.toList());
return Result.success(searchCategoryDTOs); return Result.success(searchCategoryDTOs);

@ -19,14 +19,14 @@ public interface TagDao extends JpaRepository<Tag, String>, JpaSpecificationExec
@Query(value = "select * from tb_tag_info where parent_id='' order by rand() limit ?1 ", nativeQuery = true) @Query(value = "select * from tb_tag_info where parent_id='' order by rand() limit ?1 ", nativeQuery = true)
List<Tag> random(int limit); List<Tag> random(int limit);
@Query(value = "select * from tb_tag_info where parent_id=(select id from tb_tag_info where name_ch='语言' and level=1 limit 1) ", nativeQuery = true) @Query(value = "select * from tb_tag_info where state=1 and parent_id=(select id from tb_tag_info where name_ch='语言' and level=1 limit 1) ", nativeQuery = true)
List<Tag> getLanguageList(); List<Tag> getLanguageList();
@Query(value = "select * from tb_tag_info where level=1 and not name_ch='语言' ", nativeQuery = true) @Query(value = "select * from tb_tag_info where state=1 and is_show=1 and not name_ch='语言' ", nativeQuery = true)
List<Tag> getStyleList(); List<Tag> getStyleList();
@Query(value = "select * from tb_tag_info where level=1", nativeQuery = true) @Query(value = "select * from tb_tag_info where state=1 and is_show=1", nativeQuery = true)
List<Tag> getLevel1Tags(); List<Tag> getCategoryTags();
@Query(value = "select journal_id,name_ch from tb_journal_tag,tb_tag_info where journal_id in ?1 and tb_journal_tag.tag_id =tb_tag_info.id ;", nativeQuery = true) @Query(value = "select journal_id,name_ch from tb_journal_tag,tb_tag_info where journal_id in ?1 and tb_journal_tag.tag_id =tb_tag_info.id ;", nativeQuery = true)
List<Object[]> getJounralId2TagPairs(List<String> journalIds); List<Object[]> getJounralId2TagPairs(List<String> journalIds);

@ -56,6 +56,11 @@ public class Tag implements Serializable {
*/ */
private Integer state; private Integer state;
/**
*
*/
private Integer isShow;
/** /**
* *
*/ */

@ -24,8 +24,8 @@ public class TagService {
return tagDao.getStyleList(); return tagDao.getStyleList();
} }
public List<Tag> getLevel1Tags() { public List<Tag> getCategoryTags() {
return tagDao.getLevel1Tags(); return tagDao.getCategoryTags();
} }
public Map<String, List<String>> getTagMap(List<String> journalIds) { public Map<String, List<String>> getTagMap(List<String> journalIds) {

@ -1,6 +1,7 @@
package com.luoo.user.controller; package com.luoo.user.controller;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -273,6 +274,9 @@ public class MyController extends BaseController {
private UserRespDTO getUserRespDTO(UserInfo user, boolean withCount, Set<String> bothFollowSet) { private UserRespDTO getUserRespDTO(UserInfo user, boolean withCount, Set<String> bothFollowSet) {
UserRespDTO userRespDTO = new UserRespDTO(); UserRespDTO userRespDTO = new UserRespDTO();
BeanUtils.copyProperties(user, userRespDTO); BeanUtils.copyProperties(user, userRespDTO);
if(!StringTools.isEmpty(user.getBadges())) {
userRespDTO.setBadgeList(Arrays.stream(user.getBadges().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
}
if (null != userRespDTO.getAvatar()) { if (null != userRespDTO.getAvatar()) {
userRespDTO.setAvatar(Constants.RESOURCE_PREFIX + userRespDTO.getAvatar()); userRespDTO.setAvatar(Constants.RESOURCE_PREFIX + userRespDTO.getAvatar());
} }

@ -17,8 +17,8 @@ public class UserRespDTO {
private String avatar; private String avatar;
@ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”") @ApiModelProperty(value = "个性签名,首次注册登录,默认为“无签名”")
private String signature; private String signature;
@ApiModelProperty(value = "用户标识,如“贡献者”,“音乐人”") @ApiModelProperty(value = "用户标识,1为贡献者 2为音乐人")
private List<String> badge; private List<Integer> badgeList;
@ApiModelProperty(value = "关注数") @ApiModelProperty(value = "关注数")
private int followCount; private int followCount;
@ApiModelProperty(value = "粉丝数") @ApiModelProperty(value = "粉丝数")

@ -134,4 +134,6 @@ public class UserInfo implements Serializable {
* 0: 1: * 0: 1:
*/ */
private int onlineStatus; private int onlineStatus;
private String badges;
} }

Loading…
Cancel
Save