增加下载台码功能
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package cn.ysk.cashier.service.impl.shopimpl;
|
||||
|
||||
import cn.ysk.cashier.pojo.TbDeviceStock;
|
||||
import cn.ysk.cashier.repository.shop.TbDeviceStockRepository;
|
||||
import cn.ysk.cashier.service.shop.TbDeviceStockService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class TbDeviceStockServiceImpl implements TbDeviceStockService {
|
||||
|
||||
private final TbDeviceStockRepository deviceStockRepository;
|
||||
|
||||
@Override
|
||||
public TbDeviceStock findLastRecord() {
|
||||
List<TbDeviceStock> list = deviceStockRepository.findAll(PageRequest.of(0, 1, Sort.by(Sort.Direction.DESC, "id"))).getContent();
|
||||
if (list.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveBatch(List<TbDeviceStock> list) {
|
||||
deviceStockRepository.saveAll(list);
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,11 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
return tbShopTableMapper.toDto(tbShopTableRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TbShopTable> queryListByShopId(Integer shopId) {
|
||||
return tbShopTableRepository.findByShopId(shopId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public TbShopTableDto findById(Integer id) {
|
||||
@@ -167,4 +172,4 @@ public class TbShopTableServiceImpl implements TbShopTableService {
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.ysk.cashier.service.shop;
|
||||
|
||||
import cn.ysk.cashier.pojo.TbDeviceStock;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author GYJ
|
||||
*/
|
||||
public interface TbDeviceStockService {
|
||||
TbDeviceStock findLastRecord();
|
||||
|
||||
void saveBatch(List<TbDeviceStock> list);
|
||||
}
|
||||
@@ -49,6 +49,13 @@ public interface TbShopTableService {
|
||||
*/
|
||||
List<TbShopTableDto> queryAll(TbShopTableQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 根据shopId查询台桌列表
|
||||
* @param shopId 店铺id
|
||||
* @return 台桌列表
|
||||
*/
|
||||
List<TbShopTable> queryListByShopId(Integer shopId);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
* @param id ID
|
||||
@@ -85,4 +92,4 @@ public interface TbShopTableService {
|
||||
* @throws IOException /
|
||||
*/
|
||||
void download(List<TbShopTableDto> all, HttpServletResponse response) throws IOException;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user