|
|
package com.yoho.unions.channel.service.impl;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.yoho.service.model.response.PageResponseBO;
|
|
|
import com.yoho.service.model.union.request.ChannelUserBO;
|
|
|
import com.yoho.service.model.union.request.ChannelUserRequest;
|
|
|
import com.yoho.unions.channel.service.IChannelUserService;
|
|
|
import com.yoho.unions.dal.IChannelUserDAO;
|
|
|
import com.yoho.unions.dal.model.ChannelUser;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
* 范渠道用户管理
|
|
|
* Created by LiQZ on 2017/2/15.
|
...
|
...
|
@@ -15,6 +26,35 @@ public class ChannelUserServiceImpl implements IChannelUserService { |
|
|
@Autowired
|
|
|
private IChannelUserDAO channelUserDAO;
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<ChannelUserBO> list(ChannelUserRequest request) {
|
|
|
// 设置查询参数
|
|
|
Map<String, Object> condition = Maps.newHashMap();
|
|
|
// condition.put("status", request.getStatus());
|
|
|
|
|
|
// 统计数量
|
|
|
int count = channelUserDAO.selectCount(condition);
|
|
|
request.checkCurrentPage(count);
|
|
|
|
|
|
// 查询列表
|
|
|
List<ChannelUser> users = Collections.emptyList();
|
|
|
if (count > 0) {
|
|
|
users = channelUserDAO.selectPage(condition, request.getStart(), request.getSize());
|
|
|
}
|
|
|
|
|
|
List<ChannelUserBO> list = Lists.transform(users, input -> {
|
|
|
ChannelUserBO output = new ChannelUserBO();
|
|
|
BeanUtils.copyProperties(input, output);
|
|
|
return output;
|
|
|
});
|
|
|
|
|
|
// 设置返回参数
|
|
|
PageResponseBO<ChannelUserBO> page = new PageResponseBO<>();
|
|
|
page.setPage(request.getPage());
|
|
|
page.setPageSize(request.getSize());
|
|
|
page.setTotal(count);
|
|
|
page.setList(list);
|
|
|
|
|
|
return page;
|
|
|
}
|
|
|
} |
...
|
...
|
|