记得上下班打卡 | git大法好,push需谨慎

Commit 19f1d596 authored by 张国柄's avatar 张国柄

~API:附加数据:标签数据+AR标签数据获取;

parent 52c28c34
...@@ -19,9 +19,10 @@ public interface IGoblinStoreMgtExtraService { ...@@ -19,9 +19,10 @@ public interface IGoblinStoreMgtExtraService {
* *
* @param keyword 标签名称匹配关键字 * @param keyword 标签名称匹配关键字
* @param belong 标签所属[0-普通标签|1-专属标签] * @param belong 标签所属[0-普通标签|1-专属标签]
* @param typeRange 查询标签类型范围,belong=1时有效,多个以,分隔[1-音乐人|2-艺术家|3-品牌方|4-厂牌|5-AR]
* @return List<GoblinSelfTagVo> * @return List<GoblinSelfTagVo>
*/ */
List<GoblinSelfTagVo> listTagVo(String keyword, String belong); List<GoblinSelfTagVo> listTagVo(String keyword, String belong, String... typeRange);
/** /**
* 服务支持列表 * 服务支持列表
......
...@@ -69,12 +69,14 @@ public class GoblinStoreMgtExtraController { ...@@ -69,12 +69,14 @@ public class GoblinStoreMgtExtraController {
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(type = "form", required = false, dataType = "String", name = "keyword", value = "标签关键字"), @ApiImplicitParam(type = "form", required = false, dataType = "String", name = "keyword", value = "标签关键字"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "belong", value = "标签所属[0-普通标签|1-专属标签]", allowableValues = "0,1"), @ApiImplicitParam(type = "form", required = true, dataType = "String", name = "belong", value = "标签所属[0-普通标签|1-专属标签]", allowableValues = "0,1"),
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "range", value = "查询标签类型范围,belong=1时有效,多个以,分隔[1-音乐人|2-艺术家|3-品牌方|4-厂牌|5-AR]", example = "1,2,3,4,5"),
}) })
@GetMapping("tags") @GetMapping("tags")
public ResponseDto<List<GoblinSelfTagVo>> tagList(@RequestParam(required = false) String keyword, public ResponseDto<List<GoblinSelfTagVo>> tagList(@RequestParam(required = false) String keyword,
@NotBlank(message = "标签所属参数无效") @NotBlank(message = "标签所属参数无效")
@Pattern(regexp = "\\b(0|1)\\b", message = "标签所属[0-普通标签|1-专属标签]") @Pattern(regexp = "\\b(0|1)\\b", message = "标签所属[0-普通标签|1-专属标签]")
@RequestParam String belong) { @RequestParam String belong,
return ResponseDto.success(goblinStoreMgtExtraService.listTagVo(keyword, belong)); @RequestParam(defaultValue = "1,2,3,4") String range) {
return ResponseDto.success(goblinStoreMgtExtraService.listTagVo(keyword, belong, range.split(",")));
} }
} }
...@@ -32,8 +32,8 @@ public class GoblinStoreMgtExtraServiceImpl implements IGoblinStoreMgtExtraServi ...@@ -32,8 +32,8 @@ public class GoblinStoreMgtExtraServiceImpl implements IGoblinStoreMgtExtraServi
} }
@Override @Override
public List<GoblinSelfTagVo> listTagVo(String keyword, String belong) { public List<GoblinSelfTagVo> listTagVo(String keyword, String belong, String... typeRange) {
return goblinMongoUtils.getSelfTagVos(belong, keyword); return goblinMongoUtils.getSelfTagVos(keyword, belong, typeRange);
} }
@Override @Override
......
...@@ -94,11 +94,14 @@ public class GoblinMongoUtils { ...@@ -94,11 +94,14 @@ public class GoblinMongoUtils {
/* ---------------------------------------- 标签数据源 ---------------------------------------- */ /* ---------------------------------------- 标签数据源 ---------------------------------------- */
public List<GoblinSelfTagVo> getSelfTagVos(String belong, String keyword) { public List<GoblinSelfTagVo> getSelfTagVos(String keyword, String belong, Object[] typeRange) {
Criteria criteria = Criteria.where("delFlg").is("0").and("tagBelong").is(belong); Criteria criteria = Criteria.where("delFlg").is("0").and("tagBelong").is(belong);
if (StringUtils.isNotBlank(keyword)) { if (StringUtils.isNotBlank(keyword)) {
criteria.and("tagName").regex("^.*" + keyword + ".*$"); criteria.and("tagName").regex("^.*" + keyword + ".*$");
} }
if (belong.equals("1")) {
criteria.and("tagType").in(typeRange);
}
return mongoTemplate.find(Query.query(criteria).skip(0).limit(20), GoblinSelfTagVo.class, GoblinSelfTagVo.class.getSimpleName()); return mongoTemplate.find(Query.query(criteria).skip(0).limit(20), GoblinSelfTagVo.class, GoblinSelfTagVo.class.getSimpleName());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment