package com.ks.vip.service.remote;
|
|
import com.ks.vip.dao.UserLijinRecordDao;
|
import com.ks.vip.pojo.DO.UserLijinRecord;
|
import com.ks.vip.service.LijinRecordService;
|
import org.apache.dubbo.config.annotation.Service;
|
import org.springframework.data.domain.Sort;
|
|
import javax.annotation.Resource;
|
import java.util.Arrays;
|
import java.util.Collections;
|
import java.util.List;
|
|
@Service(version = "1.0")
|
public class LijinRecordServiceImpl implements LijinRecordService {
|
|
@Resource
|
private UserLijinRecordDao userLijinRecordDao;
|
|
@Override
|
public List<UserLijinRecord> listRecord(String uid, Integer type, int page, int pageSize) {
|
UserLijinRecordDao.DaoQuery daoQuery = new UserLijinRecordDao.DaoQuery();
|
daoQuery.uid = uid;
|
daoQuery.type = type;
|
daoQuery.start = (page - 1) * pageSize;
|
daoQuery.count = pageSize;
|
daoQuery.sortList = Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "createTime")});
|
return userLijinRecordDao.list(daoQuery);
|
}
|
|
@Override
|
public long countRecord(String uid, Integer type) {
|
UserLijinRecordDao.DaoQuery daoQuery = new UserLijinRecordDao.DaoQuery();
|
daoQuery.uid = uid;
|
daoQuery.type = type;
|
return userLijinRecordDao.count(daoQuery);
|
}
|
|
@Override
|
public UserLijinRecord getRecord(String uid, Integer type, String category, String identifyCode) {
|
|
UserLijinRecordDao.DaoQuery daoQuery = new UserLijinRecordDao.DaoQuery();
|
daoQuery.uid = uid;
|
daoQuery.type = type;
|
daoQuery.identifyCode = identifyCode;
|
daoQuery.category = category;
|
daoQuery.start = 0;
|
daoQuery.count = 1;
|
daoQuery.sortList = Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "createTime")});
|
List<UserLijinRecord> list = userLijinRecordDao.list(daoQuery);
|
if (list == null || list.size() == 0) {
|
return null;
|
}
|
return list.get(0);
|
}
|
}
|