修改直播间返回参数

This commit is contained in:
xuwenbo
2020-08-31 11:11:25 +08:00
parent 610cce7aa7
commit 4a5b00e8aa
6 changed files with 30 additions and 13 deletions

View File

@ -6,9 +6,9 @@ spring:
druid:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: jdbc:log4jdbc:mysql://localhost:3306/yshop3?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
username: yshop3
password:
url: jdbc:log4jdbc:mysql://localhost:3306/yshopb2c?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&zeroDateTimeBehavior=convertToNull
username: root
password: xxcs@!2019
# 初始化配置
initial-size: 3

View File

@ -15,6 +15,7 @@ import co.yixiang.modules.wechat.domain.YxWechatLive;
import co.yixiang.modules.wechat.service.YxWechatLiveService;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveDto;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveQueryCriteria;
import co.yixiang.modules.wechat.vo.WechatLiveVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
@ -44,7 +45,7 @@ public class WechatLiveController {
@GetMapping("yxWechatLive")
@ApiOperation("查询所有直播间")
public ApiResult<Map<String,Object>> getYxWechatLives(YxWechatLiveQueryCriteria criteria, Pageable pageable){
public ApiResult<WechatLiveVo> getYxWechatLives(YxWechatLiveQueryCriteria criteria, Pageable pageable){
return ApiResult.ok(yxWechatLiveService.queryAll(criteria,pageable));
}

View File

@ -5,9 +5,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://localhost:3306/yshop3?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: yshop3
password:
url: jdbc:mysql://localhost:3306/yshopb2c?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root
password: xxcs@!2019
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -12,6 +12,7 @@ import co.yixiang.common.service.BaseService;
import co.yixiang.modules.wechat.domain.YxWechatLive;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveDto;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveQueryCriteria;
import co.yixiang.modules.wechat.vo.WechatLiveVo;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
@ -40,7 +41,7 @@ public interface YxWechatLiveService extends BaseService<YxWechatLive>{
* @param pageable 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable);
WechatLiveVo queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable);
/**
* 查询所有数据不分页

View File

@ -25,6 +25,7 @@ import co.yixiang.modules.wechat.service.dto.YxWechatLiveDto;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveGoodsDto;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveQueryCriteria;
import co.yixiang.modules.wechat.service.mapper.YxWechatLiveMapper;
import co.yixiang.modules.wechat.vo.WechatLiveVo;
import co.yixiang.tools.config.WxMaConfiguration;
import co.yixiang.utils.FileUtil;
import co.yixiang.utils.OrderUtil;
@ -88,10 +89,10 @@ public class YxWechatLiveServiceImpl extends BaseServiceImpl<YxWechatLiveMapper,
}
@Override
//@Cacheable
public Map<String, Object> queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable) {
public WechatLiveVo queryAll(YxWechatLiveQueryCriteria criteria, Pageable pageable) {
getPage(pageable);
PageInfo<YxWechatLive> page = new PageInfo<>(queryAll(criteria));
Map<String, Object> map = new LinkedHashMap<>(2);
WechatLiveVo wechatLiveVo = new WechatLiveVo();
// List<WxMaLiveResult.RoomInfo> liveInfos = wxMaLiveService.getLiveInfos();
List<YxWechatLiveDto> liveDtos = generator.convert(page.getList(), YxWechatLiveDto.class);
//获取所有商品
@ -104,9 +105,9 @@ public class YxWechatLiveServiceImpl extends BaseServiceImpl<YxWechatLiveMapper,
}
i.setId(i.getRoomid());
});
map.put("content",liveDtos);
map.put("totalElements", page.getTotal());
return map;
wechatLiveVo.setContent(liveDtos);
wechatLiveVo.setTotalElements(page.getTotal());
return wechatLiveVo;
}
@Override
public boolean saveLive(YxWechatLive resources){

View File

@ -0,0 +1,14 @@
package co.yixiang.modules.wechat.vo;
import co.yixiang.modules.wechat.service.dto.YxWechatLiveDto;
import lombok.Data;
import java.util.List;
@Data
public class WechatLiveVo {
private List<YxWechatLiveDto> content;
private Long totalElements;
}