feat(character): 新增人设详情与标签筛选接口
This commit is contained in:
@@ -14,6 +14,7 @@ import jakarta.annotation.Resource;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -37,4 +38,19 @@ public class CharacterController {
|
|||||||
List<KeyboardCharacter> list = characterService.selectListWithRank();
|
List<KeyboardCharacter> list = characterService.selectListWithRank();
|
||||||
return ResultUtils.success(BeanUtil.copyToList(list, KeyboardCharacterRespVO.class));
|
return ResultUtils.success(BeanUtil.copyToList(list, KeyboardCharacterRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail")
|
||||||
|
@Operation(summary = "人设详情", description = "人设详情接口")
|
||||||
|
public BaseResponse<KeyboardCharacterRespVO> detail(@RequestParam("id") Long id) {
|
||||||
|
KeyboardCharacter character = characterService.getById(id);
|
||||||
|
return ResultUtils.success(BeanUtil.copyProperties(character ,KeyboardCharacterRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listByTag")
|
||||||
|
@Operation(summary = "按标签查询人设列表", description = "按标签查询人设列表接口")
|
||||||
|
public BaseResponse<List<KeyboardCharacterRespVO>> listByTag(@RequestParam("tagId") Long tagId) {
|
||||||
|
List<KeyboardCharacter> list = characterService.selectListByTag(tagId);
|
||||||
|
return ResultUtils.success(BeanUtil.copyToList(list, KeyboardCharacterRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,4 +14,6 @@ public interface KeyboardCharacterService extends IService<KeyboardCharacter>{
|
|||||||
|
|
||||||
|
|
||||||
List<KeyboardCharacter> selectListWithRank();
|
List<KeyboardCharacter> selectListWithRank();
|
||||||
|
|
||||||
|
List<KeyboardCharacter> selectListByTag(Long tagId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,4 +27,12 @@ public class KeyboardCharacterServiceImpl extends ServiceImpl<KeyboardCharacterM
|
|||||||
.eq(KeyboardCharacter::getDeleted, false)
|
.eq(KeyboardCharacter::getDeleted, false)
|
||||||
.orderByDesc(KeyboardCharacter::getRank));
|
.orderByDesc(KeyboardCharacter::getRank));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<KeyboardCharacter> selectListByTag(Long tagId) {
|
||||||
|
return keyboardCharacterMapper.selectList(new LambdaQueryWrapper<KeyboardCharacter>()
|
||||||
|
.eq(KeyboardCharacter::getDeleted, false)
|
||||||
|
.eq(KeyboardCharacter::getTag, tagId)
|
||||||
|
.orderByDesc(KeyboardCharacter::getRank));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user