Browse Source

20240324

master
qiezi 10 months ago
parent
commit
841d0bcd97
  1. 12
      src/main/java/com/gaotao/modules/pallet/entity/CatchPallet.java
  2. 7
      src/main/java/com/gaotao/modules/pallet/service/impl/CatchPalletServiceImpl.java

12
src/main/java/com/gaotao/modules/pallet/entity/CatchPallet.java

@ -24,21 +24,21 @@ public class CatchPallet {
@ExcelIgnore @ExcelIgnore
private String site; private String site;
@ExcelProperty(value = "Pallet Label",index = 1)
@ExcelProperty(value = "Pallet Label",index = 0)
private String palletNo; private String palletNo;
@ExcelProperty(value = "SN",index = 2)
@ExcelProperty(value = "SN",index = 1)
private String sn; private String sn;
@ExcelProperty(value = "SKU",index = 3)
@ExcelProperty(value = "SKU",index = 2)
private String sku; private String sku;
@ExcelProperty(value = "Part No",index = 3)
private String erpPartNo;
@ExcelProperty(value = "Part Description",index = 4) @ExcelProperty(value = "Part Description",index = 4)
private String partDesc; private String partDesc;
@ExcelIgnore
private String erpPartNo;
@ExcelIgnore @ExcelIgnore
private String createBy; private String createBy;

7
src/main/java/com/gaotao/modules/pallet/service/impl/CatchPalletServiceImpl.java

@ -1,6 +1,7 @@
package com.gaotao.modules.pallet.service.impl; package com.gaotao.modules.pallet.service.impl;
import cn.idev.excel.FastExcel; import cn.idev.excel.FastExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -33,7 +34,9 @@ public class CatchPalletServiceImpl extends ServiceImpl<CatchPalletMapper, Catch
public void export(HttpServletResponse response, CatchPallet pallet) { public void export(HttpServletResponse response, CatchPallet pallet) {
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
List<CatchPallet> list = list(new QueryWrapper<>(pallet));
LambdaQueryWrapper<CatchPallet> queryWrapper = new LambdaQueryWrapper<>(pallet);
queryWrapper.orderByDesc(CatchPallet::getId);
List<CatchPallet> list = list(queryWrapper);
if (list.isEmpty()) { if (list.isEmpty()) {
throw new RuntimeException("not find any Pallet Label"); throw new RuntimeException("not find any Pallet Label");
} }
@ -61,7 +64,7 @@ public class CatchPalletServiceImpl extends ServiceImpl<CatchPalletMapper, Catch
.eq(Pallet::getPalletNo, pallet.getPalletNo().trim()) .eq(Pallet::getPalletNo, pallet.getPalletNo().trim())
.list(); .list();
if (list.isEmpty()){ if (list.isEmpty()){
throw new RuntimeException("no Pallet Label found "+pallet.getPalletNo().trim());
throw new RuntimeException("no Pallet Label found \""+pallet.getPalletNo().trim()+"\"");
} }
int count = lambdaQuery() int count = lambdaQuery()

Loading…
Cancel
Save