添加getContentsLikeNameAndFunc用户名信息
This commit is contained in:
parent
651c08bbef
commit
4e131e5118
|
|
@ -7,6 +7,7 @@ import com.gitlink.softbot.service.market.IMarketService;
|
|||
import com.gitlink.softbot.vo.GetAllBotCategory;
|
||||
import com.gitlink.softbot.vo.GetBotDetailResponse;
|
||||
import com.gitlink.softbot.vo.MarketBotPagesVO;
|
||||
import com.gitlink.softbot.vo.MarketBotPagesVO1;
|
||||
import org.springframework.web.bind.annotation.CrossOrigin;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
|
@ -96,13 +97,13 @@ public class MarketController {
|
|||
* @throws BotException
|
||||
*/
|
||||
@GetMapping("/getContentsLikeNameAndFunc")
|
||||
public Result<MarketBotPagesVO> getContentsLikeNameAndFunc(@RequestParam(value = "name",required = false) String keyword,
|
||||
@RequestParam(value= "func", required = false) String func,
|
||||
@RequestParam(value = "page_no",defaultValue = "1",required = false) Integer pageIndex,
|
||||
@RequestParam(value = "page_size",defaultValue = "12",required = false) Integer pageSize) throws BotException{
|
||||
MarketBotPagesVO marketBotPagesVO = marketService.getContentsLikeNameAndFunc(keyword,func,pageIndex,pageSize);
|
||||
Result<MarketBotPagesVO> result = new Result<>();
|
||||
return result.build(marketBotPagesVO).build(200).build("success!");
|
||||
public Result<MarketBotPagesVO1> getContentsLikeNameAndFunc(@RequestParam(value = "name",required = false) String keyword,
|
||||
@RequestParam(value= "func", required = false) String func,
|
||||
@RequestParam(value = "page_no",defaultValue = "1",required = false) Integer pageIndex,
|
||||
@RequestParam(value = "page_size",defaultValue = "12",required = false) Integer pageSize) throws BotException{
|
||||
MarketBotPagesVO1 marketBotPagesVO1 = marketService.getContentsLikeNameAndFunc(keyword,func,pageIndex,pageSize);
|
||||
Result<MarketBotPagesVO1> result = new Result<>();
|
||||
return result.build(marketBotPagesVO1).build(200).build("success!");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ public interface IMarketService {
|
|||
|
||||
GetAllBotCategory getAllBotCategory();
|
||||
|
||||
MarketBotPagesVO getContentsLikeNameAndFunc(String name,String fun,Integer pageNo,Integer pageSize);
|
||||
MarketBotPagesVO1 getContentsLikeNameAndFunc(String name,String fun,Integer pageNo,Integer pageSize);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
|
@ -256,7 +257,7 @@ public class MarketService implements IMarketService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public MarketBotPagesVO getContentsLikeNameAndFunc(String name, String fun, Integer pageNo, Integer pageSize) {
|
||||
public MarketBotPagesVO1 getContentsLikeNameAndFunc(String name, String fun, Integer pageNo, Integer pageSize) {
|
||||
LambdaQueryWrapper<MarketBot> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if(StringUtils.isNotBlank(fun)){
|
||||
lambdaQueryWrapper.and(wrapper->{
|
||||
|
|
@ -268,13 +269,25 @@ public class MarketService implements IMarketService {
|
|||
lambdaQueryWrapper.like(StringUtils.isNotBlank(name),MarketBot::getMarketName,name);
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(MarketBot::getInstallNum);
|
||||
|
||||
IPage<MarketBot> page = marketBotMapper.selectPage(new Page<MarketBot>(pageNo,pageSize),lambdaQueryWrapper);
|
||||
MarketBotPagesVO marketBotPagesVO = new MarketBotPagesVO();
|
||||
marketBotPagesVO.setBotList(page.getRecords());
|
||||
marketBotPagesVO.setTotal(page.getTotal());
|
||||
marketBotPagesVO.setPageIndex(pageNo);
|
||||
marketBotPagesVO.setPageSize(pageSize);
|
||||
return marketBotPagesVO;
|
||||
MarketBotPagesVO1 marketBotPagesVO1 = new MarketBotPagesVO1();
|
||||
List<MarketBotVO1> marketBotVO1s = new ArrayList<>();
|
||||
page.getRecords().forEach(MarketBot ->{
|
||||
Integer botId = MarketBot.getBotId();
|
||||
RegisterBot registerBot = registerMapper.selectOne(Wrappers.<RegisterBot>lambdaQuery()
|
||||
.eq(RegisterBot::getBotId,botId));
|
||||
MarketBotVO1 marketBotVO1 = new MarketBotVO1();
|
||||
BeanUtils.copyProperties(MarketBot,marketBotVO1);
|
||||
BeanUtils.copyProperties(registerBot,marketBotVO1);
|
||||
marketBotVO1.setDeveloperName(api.getUserNameByUid(registerBot.getDeveloperId().toString()));
|
||||
marketBotVO1s.add(marketBotVO1);
|
||||
});
|
||||
marketBotPagesVO1.setBotList(marketBotVO1s);
|
||||
marketBotPagesVO1.setTotal(page.getTotal());
|
||||
marketBotPagesVO1.setPageIndex(pageNo);
|
||||
marketBotPagesVO1.setPageSize(pageSize);
|
||||
return marketBotPagesVO1;
|
||||
}
|
||||
|
||||
private LimitVO getLimitFromLimitEvents(List<BotLimitEvent> botLimitEvents){
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.gitlink.softbot.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import com.gitlink.softbot.entity.db.MarketBot;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class MarketBotPagesVO1 implements Serializable {
|
||||
private int pageIndex;
|
||||
private int pageSize;
|
||||
private long total;
|
||||
private List<MarketBotVO1> botList;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.gitlink.softbot.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonNaming;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class MarketBotVO1 implements Serializable {
|
||||
|
||||
private Integer botId;
|
||||
|
||||
private String marketName;
|
||||
|
||||
private String marketDesc;
|
||||
|
||||
private String firstFunc;
|
||||
|
||||
private String secondFunc;
|
||||
|
||||
private Date marketTime;
|
||||
|
||||
private String logo;
|
||||
|
||||
private Integer installNum;
|
||||
|
||||
private String category;
|
||||
|
||||
private String marketIntro;
|
||||
|
||||
private String webhook;
|
||||
|
||||
private Integer developerId;
|
||||
|
||||
private String developerLogin;
|
||||
|
||||
private String developerName;
|
||||
}
|
||||
Loading…
Reference in New Issue