Browse Source

获取当前库存商品数量的Map方法

master
lzh 2 years ago
parent
commit
71f4a38009
  1. 3
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java
  2. 26
      yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java

3
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkMapper.java

@ -95,4 +95,7 @@ public interface GdInventoryOkMapper extends BaseMapper<GdInventoryOk> {
@Select("select IFNULL(sum(prodValue),0) from gd_inventory_ok where warehouseCode='199'") @Select("select IFNULL(sum(prodValue),0) from gd_inventory_ok where warehouseCode='199'")
double countVal199(); double countVal199();
@Select("select prodCode,IFNULL(sum(prodNum),0) pnum from gd_inventory_ok group by prodCode")
List<Map<String, String>> numberOfProduct();
} }

26
yxt_supervise/supervise-portal/supervise-portal-biz/src/main/java/com/yxt/supervise/portal/biz/gdinventory/GdInventoryOkService.java

@ -29,6 +29,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import cn.hutool.poi.excel.ExcelUtil; import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter; import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@ -36,6 +37,7 @@ import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -105,19 +107,19 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv
writer.setSheet(0); writer.setSheet(0);
writer.writeCellValue(0, 1, "编号:" + timestr); writer.writeCellValue(0, 1, "编号:" + timestr);
writer.writeCellValue(3, 1, datefmt1); writer.writeCellValue(3, 1, datefmt1);
if(prod112>0){ if (prod112 > 0) {
writer.writeCellValue(1, 3, 1); writer.writeCellValue(1, 3, 1);
}else { } else {
writer.writeCellValue(1, 3, 0); writer.writeCellValue(1, 3, 0);
} }
if(prod101>0){ if (prod101 > 0) {
writer.writeCellValue(1, 4, 1); writer.writeCellValue(1, 4, 1);
}else { } else {
writer.writeCellValue(1, 4, 0); writer.writeCellValue(1, 4, 0);
} }
if(prod199>0){ if (prod199 > 0) {
writer.writeCellValue(1, 5, 1); writer.writeCellValue(1, 5, 1);
}else { } else {
writer.writeCellValue(1, 5, 0); writer.writeCellValue(1, 5, 0);
} }
// writer.writeCellValue(1, 4, type1); // writer.writeCellValue(1, 4, type1);
@ -175,4 +177,16 @@ public class GdInventoryOkService extends ServiceImpl<GdInventoryOkMapper, GdInv
return rb.success().setData(url); return rb.success().setData(url);
} }
/**
* 当前库存商品数量
*
* @return 商品编号对应的库存数
*/
public Map<String, String> numberMapOfProduct() {
Map<String, String> map = new HashMap<>();
List<Map<String, String>> list = baseMapper.numberOfProduct();
list.forEach(m -> map.put(m.get("prodCode"), m.get("pnum")));
return map;
}
} }

Loading…
Cancel
Save