优化商品导出功能
This commit is contained in:
@@ -10,7 +10,10 @@ import com.jsh.erp.service.depotItem.DepotItemService;
|
|||||||
import com.jsh.erp.service.material.MaterialService;
|
import com.jsh.erp.service.material.MaterialService;
|
||||||
import com.jsh.erp.service.redis.RedisService;
|
import com.jsh.erp.service.redis.RedisService;
|
||||||
import com.jsh.erp.service.unit.UnitService;
|
import com.jsh.erp.service.unit.UnitService;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.BaseResponseInfo;
|
||||||
|
import com.jsh.erp.utils.ErpInfo;
|
||||||
|
import com.jsh.erp.utils.ExcelUtils;
|
||||||
|
import com.jsh.erp.utils.StringUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@@ -53,18 +56,6 @@ public class MaterialController {
|
|||||||
@Resource
|
@Resource
|
||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private RedisService redisService;
|
|
||||||
|
|
||||||
@Value("${server.tomcat.basedir}")
|
|
||||||
private String basedir;
|
|
||||||
|
|
||||||
@Value("${template.path}")
|
|
||||||
private String templatePath;
|
|
||||||
|
|
||||||
@Value("${export.mode}")
|
|
||||||
private Integer exportMode;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查商品是否存在
|
* 检查商品是否存在
|
||||||
* @param id
|
* @param id
|
||||||
@@ -363,54 +354,9 @@ public class MaterialController {
|
|||||||
@RequestParam(value = "mpList", required = false) String mpList,
|
@RequestParam(value = "mpList", required = false) String mpList,
|
||||||
HttpServletRequest request, HttpServletResponse response) {
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
try {
|
try {
|
||||||
String[] mpArr = new String[]{};
|
materialService.exportExcel(StringUtil.toNull(categoryId), StringUtil.toNull(materialParam), StringUtil.toNull(color), StringUtil.toNull(weight),
|
||||||
if(StringUtil.isNotEmpty(mpList)){
|
StringUtil.toNull(expiryNum), StringUtil.toNull(enabled), StringUtil.toNull(enableSerialNumber),
|
||||||
mpArr= mpList.split(",");
|
StringUtil.toNull(enableBatchNumber), StringUtil.toNull(remark), mpList, response);
|
||||||
}
|
|
||||||
List<MaterialVo4Unit> dataList = materialService.exportExcel(StringUtil.toNull(materialParam), StringUtil.toNull(color),
|
|
||||||
StringUtil.toNull(weight), StringUtil.toNull(expiryNum), StringUtil.toNull(enabled), StringUtil.toNull(enableSerialNumber),
|
|
||||||
StringUtil.toNull(enableBatchNumber), StringUtil.toNull(remark), StringUtil.toNull(categoryId));
|
|
||||||
if(exportMode == 0) {
|
|
||||||
String[] names = {"条码", "名称", "规格", "型号", "颜色", "类别", "扩展信息", "单位", "基础重量", "保质期", "采购价", "零售价", "销售价", "最低售价", "备注", "状态", "序列号", "批号"};
|
|
||||||
String title = "商品信息";
|
|
||||||
List<String[]> objects = new ArrayList<>();
|
|
||||||
if (null != dataList) {
|
|
||||||
for (MaterialVo4Unit m : dataList) {
|
|
||||||
String[] objs = new String[100];
|
|
||||||
objs[0] = m.getmBarCode();
|
|
||||||
objs[1] = m.getName();
|
|
||||||
objs[2] = m.getStandard();
|
|
||||||
objs[3] = m.getModel();
|
|
||||||
objs[4] = m.getColor();
|
|
||||||
objs[5] = m.getCategoryName();
|
|
||||||
objs[6] = materialService.getMaterialOtherByParam(mpArr, m);
|
|
||||||
objs[7] = m.getCommodityUnit();
|
|
||||||
objs[8] = m.getWeight() == null ? "" : m.getWeight().toString();
|
|
||||||
objs[9] = m.getExpiryNum() == null ? "" : m.getExpiryNum().toString();
|
|
||||||
objs[10] = m.getPurchaseDecimal() == null ? "" : m.getPurchaseDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
|
||||||
objs[11] = m.getCommodityDecimal() == null ? "" : m.getCommodityDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
|
||||||
objs[12] = m.getWholesaleDecimal() == null ? "" : m.getWholesaleDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
|
||||||
objs[13] = m.getLowDecimal() == null ? "" : m.getLowDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
|
||||||
objs[14] = m.getRemark();
|
|
||||||
objs[15] = m.getEnabled() ? "启用" : "禁用";
|
|
||||||
objs[16] = "1".equals(m.getEnableSerialNumber()) ? "有" : "无";
|
|
||||||
objs[17] = "1".equals(m.getEnableBatchNumber()) ? "有" : "无";
|
|
||||||
objects.add(objs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File file = ExcelUtils.exportObjectsWithoutTitle(title, names, title, objects);
|
|
||||||
ExportExecUtil.showExec(file, file.getName(), response);
|
|
||||||
} else {
|
|
||||||
List<Map<Integer, String>> list = new ArrayList<>();
|
|
||||||
Map<Integer, String> map = new HashMap<>();
|
|
||||||
list.add(map);
|
|
||||||
String fileName = "商品信息.xls";
|
|
||||||
String pathFile = basedir + File.separator + fileName;
|
|
||||||
InputStream path = ExcelUtils.getPathByFileName(templatePath, "goods_template_export.xls");
|
|
||||||
EasyExcel.write(pathFile).withTemplate(path).sheet(0).needHead(Boolean.FALSE).doWrite(list);
|
|
||||||
File file = new File(basedir, fileName);
|
|
||||||
ExportExecUtil.showExec(file, fileName, response);
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -436,14 +382,6 @@ public class MaterialController {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BigDecimal parseBigDecimalEx(String str)throws Exception{
|
|
||||||
if(!StringUtil.isEmpty(str)) {
|
|
||||||
return new BigDecimal(str);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取商品序列号
|
* 获取商品序列号
|
||||||
* @param q
|
* @param q
|
||||||
|
|||||||
@@ -2,23 +2,18 @@ package com.jsh.erp.controller;
|
|||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.jsh.erp.constants.BusinessConstants;
|
|
||||||
import com.jsh.erp.constants.ExceptionConstants;
|
|
||||||
import com.jsh.erp.datasource.entities.Supplier;
|
import com.jsh.erp.datasource.entities.Supplier;
|
||||||
import com.jsh.erp.exception.BusinessRunTimeException;
|
|
||||||
import com.jsh.erp.service.supplier.SupplierService;
|
import com.jsh.erp.service.supplier.SupplierService;
|
||||||
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
import com.jsh.erp.service.systemConfig.SystemConfigService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
import com.jsh.erp.service.userBusiness.UserBusinessService;
|
||||||
import com.jsh.erp.utils.*;
|
import com.jsh.erp.utils.BaseResponseInfo;
|
||||||
|
import com.jsh.erp.utils.ErpInfo;
|
||||||
|
import com.jsh.erp.utils.ExcelUtils;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import jxl.Sheet;
|
|
||||||
import jxl.Workbook;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.dao.DataAccessException;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
@@ -26,8 +21,6 @@ import javax.annotation.Resource;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -392,7 +385,7 @@ public class SupplierController {
|
|||||||
try {
|
try {
|
||||||
List<Supplier> dataList = supplierService.findByAll(supplier, type, phonenum, telephone);
|
List<Supplier> dataList = supplierService.findByAll(supplier, type, phonenum, telephone);
|
||||||
File file = supplierService.exportExcel(dataList, type);
|
File file = supplierService.exportExcel(dataList, type);
|
||||||
ExportExecUtil.showExec(file, file.getName(), response);
|
ExcelUtils.downloadExcel(file, file.getName(), response);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ public class MaterialVo4Unit extends Material{
|
|||||||
|
|
||||||
private String unitName;
|
private String unitName;
|
||||||
|
|
||||||
|
private BigDecimal ratio;
|
||||||
|
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
private String materialOther;
|
private String materialOther;
|
||||||
@@ -53,6 +55,14 @@ public class MaterialVo4Unit extends Material{
|
|||||||
this.unitName = unitName;
|
this.unitName = unitName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BigDecimal getRatio() {
|
||||||
|
return ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRatio(BigDecimal ratio) {
|
||||||
|
this.ratio = ratio;
|
||||||
|
}
|
||||||
|
|
||||||
public String getCategoryName() {
|
public String getCategoryName() {
|
||||||
return categoryName;
|
return categoryName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,9 @@ public interface MaterialMapperEx {
|
|||||||
@Param("enableBatchNumber") String enableBatchNumber,
|
@Param("enableBatchNumber") String enableBatchNumber,
|
||||||
@Param("remark") String remark,
|
@Param("remark") String remark,
|
||||||
@Param("idList") List<Long> idList);
|
@Param("idList") List<Long> idList);
|
||||||
|
|
||||||
|
List<MaterialExtend> getOtherMaterialList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过商品名称查询商品信息
|
* 通过商品名称查询商品信息
|
||||||
* */
|
* */
|
||||||
@@ -149,4 +152,5 @@ public interface MaterialMapperEx {
|
|||||||
@Param("otherField3") String otherField3,
|
@Param("otherField3") String otherField3,
|
||||||
@Param("unit") String unit,
|
@Param("unit") String unit,
|
||||||
@Param("unitId") Long unitId);
|
@Param("unitId") Long unitId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jsh.erp.service.material;
|
package com.jsh.erp.service.material;
|
||||||
|
|
||||||
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@@ -15,7 +16,6 @@ import com.jsh.erp.service.depotItem.DepotItemService;
|
|||||||
import com.jsh.erp.service.log.LogService;
|
import com.jsh.erp.service.log.LogService;
|
||||||
import com.jsh.erp.service.materialCategory.MaterialCategoryService;
|
import com.jsh.erp.service.materialCategory.MaterialCategoryService;
|
||||||
import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
import com.jsh.erp.service.materialExtend.MaterialExtendService;
|
||||||
import com.jsh.erp.service.redis.RedisService;
|
|
||||||
import com.jsh.erp.service.unit.UnitService;
|
import com.jsh.erp.service.unit.UnitService;
|
||||||
import com.jsh.erp.service.user.UserService;
|
import com.jsh.erp.service.user.UserService;
|
||||||
import com.jsh.erp.utils.BaseResponseInfo;
|
import com.jsh.erp.utils.BaseResponseInfo;
|
||||||
@@ -25,6 +25,7 @@ import jxl.Sheet;
|
|||||||
import jxl.Workbook;
|
import jxl.Workbook;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
@@ -33,6 +34,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -74,8 +78,15 @@ public class MaterialService {
|
|||||||
private DepotService depotService;
|
private DepotService depotService;
|
||||||
@Resource
|
@Resource
|
||||||
private MaterialExtendService materialExtendService;
|
private MaterialExtendService materialExtendService;
|
||||||
@Resource
|
|
||||||
private RedisService redisService;
|
@Value("${server.tomcat.basedir}")
|
||||||
|
private String basedir;
|
||||||
|
|
||||||
|
@Value("${template.path}")
|
||||||
|
private String templatePath;
|
||||||
|
|
||||||
|
@Value("${export.mode}")
|
||||||
|
private Integer exportMode;
|
||||||
|
|
||||||
public Material getMaterial(long id)throws Exception {
|
public Material getMaterial(long id)throws Exception {
|
||||||
Material result=null;
|
Material result=null;
|
||||||
@@ -461,26 +472,94 @@ public class MaterialService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MaterialVo4Unit> exportExcel(String materialParam, String color, String weight, String expiryNum, String enabled,
|
public void exportExcel(String categoryId, String materialParam, String color, String weight,
|
||||||
String enableSerialNumber, String enableBatchNumber, String remark, String categoryId)throws Exception {
|
String expiryNum, String enabled, String enableSerialNumber, String enableBatchNumber,
|
||||||
List<MaterialVo4Unit> resList = new ArrayList<>();
|
String remark, String mpList, HttpServletResponse response)throws Exception {
|
||||||
List<MaterialVo4Unit> list =null;
|
String[] mpArr = new String[]{};
|
||||||
try{
|
if(StringUtil.isNotEmpty(mpList)){
|
||||||
|
mpArr= mpList.split(",");
|
||||||
|
}
|
||||||
List<Long> idList = new ArrayList<>();
|
List<Long> idList = new ArrayList<>();
|
||||||
if(StringUtil.isNotEmpty(categoryId)){
|
if(StringUtil.isNotEmpty(categoryId)){
|
||||||
idList = getListByParentId(Long.parseLong(categoryId));
|
idList = getListByParentId(Long.parseLong(categoryId));
|
||||||
}
|
}
|
||||||
list= materialMapperEx.exportExcel(materialParam, color, weight, expiryNum, enabled, enableSerialNumber,
|
//查询商品主条码相关列表
|
||||||
|
List<MaterialVo4Unit> dataList = materialMapperEx.exportExcel(materialParam, color, weight, expiryNum, enabled, enableSerialNumber,
|
||||||
enableBatchNumber, remark, idList);
|
enableBatchNumber, remark, idList);
|
||||||
}catch(Exception e){
|
//查询商品副条码相关列表
|
||||||
JshException.readFail(logger, e);
|
Map<Long, MaterialExtend> otherMaterialMap = new HashMap<>();
|
||||||
|
List<MaterialExtend> otherDataList = materialMapperEx.getOtherMaterialList();
|
||||||
|
for(MaterialExtend me: otherDataList) {
|
||||||
|
otherMaterialMap.put(me.getMaterialId(), me);
|
||||||
}
|
}
|
||||||
if (null != list) {
|
if(exportMode == 0) {
|
||||||
for (MaterialVo4Unit m : list) {
|
String[] names = {"名称*", "规格", "型号", "颜色", "类别", "基础重量(kg)", "保质期(天)", "基本单位*", "副单位", "基本条码*",
|
||||||
resList.add(m);
|
"副条码", "比例", "采购价", "零售价", "销售价", "最低售价", "状态*", "序列号", "批号", "备注"};
|
||||||
|
String title = "商品信息";
|
||||||
|
List<String[]> objects = new ArrayList<>();
|
||||||
|
if (null != dataList) {
|
||||||
|
for (MaterialVo4Unit m : dataList) {
|
||||||
|
String[] objs = new String[100];
|
||||||
|
objs[0] = m.getName();
|
||||||
|
objs[1] = m.getStandard();
|
||||||
|
objs[2] = m.getModel();
|
||||||
|
objs[3] = m.getColor();
|
||||||
|
objs[4] = m.getCategoryName();
|
||||||
|
objs[5] = m.getWeight() == null ? "" : m.getWeight().setScale(3, BigDecimal.ROUND_HALF_UP).toString();
|
||||||
|
objs[6] = m.getExpiryNum() == null ? "" : m.getExpiryNum().toString();
|
||||||
|
objs[7] = m.getCommodityUnit();
|
||||||
|
objs[8] = otherMaterialMap.get(m.getId()) == null ? "": otherMaterialMap.get(m.getId()).getCommodityUnit();
|
||||||
|
objs[9] = m.getmBarCode();
|
||||||
|
objs[10] = otherMaterialMap.get(m.getId()) == null ? "": otherMaterialMap.get(m.getId()).getBarCode();
|
||||||
|
objs[11] = m.getRatio() == null ? "" : m.getRatio().toString();
|
||||||
|
objs[12] = m.getPurchaseDecimal() == null ? "" : m.getPurchaseDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
||||||
|
objs[13] = m.getCommodityDecimal() == null ? "" : m.getCommodityDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
||||||
|
objs[14] = m.getWholesaleDecimal() == null ? "" : m.getWholesaleDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
||||||
|
objs[15] = m.getLowDecimal() == null ? "" : m.getLowDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString();
|
||||||
|
objs[16] = m.getEnabled() ? "1" : "0";
|
||||||
|
objs[17] = m.getEnableSerialNumber();
|
||||||
|
objs[18] = m.getEnableBatchNumber();
|
||||||
|
objs[19] = m.getRemark();
|
||||||
|
objects.add(objs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return resList;
|
File file = ExcelUtils.exportObjectsWithoutTitle(title, "导入时本行内容请勿删除,切记!", names, title, objects);
|
||||||
|
ExcelUtils.downloadExcel(file, file.getName(), response);
|
||||||
|
} else {
|
||||||
|
List<Map<Integer, String>> objects = new ArrayList<>();
|
||||||
|
if (null != dataList) {
|
||||||
|
for (MaterialVo4Unit m : dataList) {
|
||||||
|
Map<Integer, String> map = new HashMap<>();
|
||||||
|
map.put(0, m.getName());
|
||||||
|
map.put(1, m.getStandard());
|
||||||
|
map.put(2, m.getModel());
|
||||||
|
map.put(3, m.getColor());
|
||||||
|
map.put(4, m.getCategoryName());
|
||||||
|
map.put(5, m.getWeight() == null ? "" : m.getWeight().setScale(3, BigDecimal.ROUND_HALF_UP).toString());
|
||||||
|
map.put(6, m.getExpiryNum() == null ? "" : m.getExpiryNum().toString());
|
||||||
|
map.put(7, m.getCommodityUnit());
|
||||||
|
map.put(8, otherMaterialMap.get(m.getId()) == null ? "": otherMaterialMap.get(m.getId()).getCommodityUnit());
|
||||||
|
map.put(9, m.getmBarCode());
|
||||||
|
map.put(10, otherMaterialMap.get(m.getId()) == null ? "": otherMaterialMap.get(m.getId()).getBarCode());
|
||||||
|
map.put(11, m.getRatio() == null ? "" : m.getRatio().toString());
|
||||||
|
map.put(12, m.getPurchaseDecimal() == null ? "" : m.getPurchaseDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||||
|
map.put(13, m.getCommodityDecimal() == null ? "" : m.getCommodityDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||||
|
map.put(14, m.getWholesaleDecimal() == null ? "" : m.getWholesaleDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||||
|
map.put(15, m.getLowDecimal() == null ? "" : m.getLowDecimal().setScale(2, BigDecimal.ROUND_HALF_UP).toString());
|
||||||
|
map.put(16, m.getEnabled() ? "1" : "0");
|
||||||
|
map.put(17, m.getEnableSerialNumber());
|
||||||
|
map.put(18, m.getEnableBatchNumber());
|
||||||
|
map.put(19, m.getRemark());
|
||||||
|
objects.add(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
String fileName = "商品信息.xls";
|
||||||
|
String pathFile = basedir + File.separator + fileName;
|
||||||
|
InputStream path = ExcelUtils.getPathByFileName(templatePath, "goods_template_export.xls");
|
||||||
|
EasyExcel.write(pathFile).withTemplate(path).sheet(0).needHead(Boolean.FALSE).doWrite(objects);
|
||||||
|
File file = new File(basedir, fileName);
|
||||||
|
ExcelUtils.downloadExcel(file, fileName, response);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
|||||||
@@ -602,7 +602,7 @@ public class SupplierService {
|
|||||||
objects.add(objs);
|
objects.add(objs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ExcelUtils.exportObjectsWithoutTitle(title, names, title, objects);
|
return ExcelUtils.exportObjectsWithoutTitle(title, "导入时本行内容请勿删除,切记!", names, title, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -690,6 +690,6 @@ public class SupplierService {
|
|||||||
objects.add(objs);
|
objects.add(objs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ExcelUtils.exportObjectsWithoutTitle(title, names, title, objects);
|
return ExcelUtils.exportObjectsWithoutTitle(title, "导入时本行内容请勿删除,切记!", names, title, objects);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
package com.jsh.erp.utils;
|
package com.jsh.erp.utils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -17,11 +14,11 @@ import jxl.write.WritableFont;
|
|||||||
import jxl.write.WritableSheet;
|
import jxl.write.WritableSheet;
|
||||||
import jxl.write.WritableWorkbook;
|
import jxl.write.WritableWorkbook;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ExcelUtils {
|
public class ExcelUtils {
|
||||||
|
|
||||||
public static WritableFont arial14font = null;
|
|
||||||
|
|
||||||
public static InputStream getPathByFileName(String template, String tmpFileName) {
|
public static InputStream getPathByFileName(String template, String tmpFileName) {
|
||||||
File tmpFile = new File(template, tmpFileName);
|
File tmpFile = new File(template, tmpFileName);
|
||||||
InputStream path = null;
|
InputStream path = null;
|
||||||
@@ -36,43 +33,6 @@ public class ExcelUtils {
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static File exportObjects(String fileName, String[] names,
|
|
||||||
String title, List<String[]> objects) throws Exception {
|
|
||||||
File excelFile = new File("fileName.xls");
|
|
||||||
WritableWorkbook wtwb = Workbook.createWorkbook(excelFile);
|
|
||||||
WritableSheet sheet = wtwb.createSheet(title, 0);
|
|
||||||
sheet.getSettings().setDefaultColumnWidth(20);
|
|
||||||
WritableFont wfont = new WritableFont(WritableFont.createFont("楷书"), 15);
|
|
||||||
WritableCellFormat format = new WritableCellFormat(wfont);
|
|
||||||
WritableFont wfc = new WritableFont(WritableFont.ARIAL, 20,
|
|
||||||
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
|
|
||||||
jxl.format.Colour.BLACK);
|
|
||||||
WritableCellFormat wcfFC = new WritableCellFormat(wfc);
|
|
||||||
wcfFC.setAlignment(Alignment.CENTRE);
|
|
||||||
wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
||||||
// CellView cellView = new CellView();
|
|
||||||
// cellView.setAutosize(true); //设置自动大小
|
|
||||||
format.setAlignment(Alignment.LEFT);
|
|
||||||
format.setVerticalAlignment(VerticalAlignment.TOP);
|
|
||||||
sheet.mergeCells(0, 0, names.length - 1, 0);
|
|
||||||
sheet.addCell(new Label(0, 0, title, wcfFC));
|
|
||||||
int rowNum = 2;
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
sheet.addCell(new Label(i, 1, names[i], format));
|
|
||||||
}
|
|
||||||
for (int j = 0; j < objects.size(); j++) {
|
|
||||||
String[] obj = objects.get(j);
|
|
||||||
for (int h = 0; h < obj.length; h++) {
|
|
||||||
sheet.addCell(new Label(h, rowNum, obj[h], format));
|
|
||||||
}
|
|
||||||
rowNum = rowNum + 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
wtwb.write();
|
|
||||||
wtwb.close();
|
|
||||||
return excelFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出excel,不需要第一行的title
|
* 导出excel,不需要第一行的title
|
||||||
*
|
*
|
||||||
@@ -83,7 +43,7 @@ public class ExcelUtils {
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public static File exportObjectsWithoutTitle(String fileName,
|
public static File exportObjectsWithoutTitle(String fileName, String tip,
|
||||||
String[] names, String title, List<String[]> objects)
|
String[] names, String title, List<String[]> objects)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
File excelFile = new File(fileName);
|
File excelFile = new File(fileName);
|
||||||
@@ -91,7 +51,7 @@ public class ExcelUtils {
|
|||||||
WritableSheet sheet = wtwb.createSheet(title, 0);
|
WritableSheet sheet = wtwb.createSheet(title, 0);
|
||||||
sheet.getSettings().setDefaultColumnWidth(20);
|
sheet.getSettings().setDefaultColumnWidth(20);
|
||||||
|
|
||||||
// 第一行的格式
|
// 标题的格式
|
||||||
WritableFont wfc = new WritableFont(WritableFont.ARIAL, 15,
|
WritableFont wfc = new WritableFont(WritableFont.ARIAL, 15,
|
||||||
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
|
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
|
||||||
jxl.format.Colour.BLACK);
|
jxl.format.Colour.BLACK);
|
||||||
@@ -104,13 +64,15 @@ public class ExcelUtils {
|
|||||||
format.setAlignment(Alignment.LEFT);
|
format.setAlignment(Alignment.LEFT);
|
||||||
format.setVerticalAlignment(VerticalAlignment.TOP);
|
format.setVerticalAlignment(VerticalAlignment.TOP);
|
||||||
|
|
||||||
// 第一行写入标题
|
// 第一行写入提示
|
||||||
|
sheet.addCell(new Label(0, 0, tip, wcfFC));
|
||||||
|
// 第二行写入标题
|
||||||
for (int i = 0; i < names.length; i++) {
|
for (int i = 0; i < names.length; i++) {
|
||||||
sheet.addCell(new Label(i, 0, names[i], wcfFC));
|
sheet.addCell(new Label(i, 1, names[i], wcfFC));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 其余行依次写入数据
|
// 其余行依次写入数据
|
||||||
int rowNum = 1;
|
int rowNum = 2;
|
||||||
for (int j = 0; j < objects.size(); j++) {
|
for (int j = 0; j < objects.size(); j++) {
|
||||||
String[] obj = objects.get(j);
|
String[] obj = objects.get(j);
|
||||||
for (int h = 0; h < obj.length; h++) {
|
for (int h = 0; h < obj.length; h++) {
|
||||||
@@ -123,101 +85,6 @@ public class ExcelUtils {
|
|||||||
return excelFile;
|
return excelFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String createTempFile(String[] names, String title, List<String[]> objects) throws Exception {
|
|
||||||
File excelFile = File.createTempFile(System.currentTimeMillis() + "", ".xls");
|
|
||||||
WritableWorkbook wtwb = Workbook.createWorkbook(excelFile);
|
|
||||||
WritableSheet sheet = wtwb.createSheet(title, 0);
|
|
||||||
sheet.getSettings().setDefaultColumnWidth(20);
|
|
||||||
WritableFont wfont = new WritableFont(WritableFont.createFont("楷书"), 15);
|
|
||||||
WritableCellFormat format = new WritableCellFormat(wfont);
|
|
||||||
WritableFont wfc = new WritableFont(WritableFont.ARIAL, 20,
|
|
||||||
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
|
|
||||||
jxl.format.Colour.BLACK);
|
|
||||||
WritableCellFormat wcfFC = new WritableCellFormat(wfc);
|
|
||||||
wcfFC.setAlignment(Alignment.CENTRE);
|
|
||||||
wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
||||||
// CellView cellView = new CellView();
|
|
||||||
// cellView.setAutosize(true); //设置自动大小
|
|
||||||
format.setAlignment(Alignment.LEFT);
|
|
||||||
format.setVerticalAlignment(VerticalAlignment.TOP);
|
|
||||||
sheet.mergeCells(0, 0, names.length - 1, 0);
|
|
||||||
sheet.addCell(new Label(0, 0, title, wcfFC));
|
|
||||||
int rowNum = 2;
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
sheet.addCell(new Label(i, 1, names[i], format));
|
|
||||||
}
|
|
||||||
for (int j = 0; j < objects.size(); j++) {
|
|
||||||
String[] obj = objects.get(j);
|
|
||||||
for (int h = 0; h < obj.length; h++) {
|
|
||||||
sheet.addCell(new Label(h, rowNum, obj[h], format));
|
|
||||||
}
|
|
||||||
rowNum = rowNum + 1;
|
|
||||||
}
|
|
||||||
wtwb.write();
|
|
||||||
wtwb.close();
|
|
||||||
return excelFile.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createCheckRandomTempFile(String[] names, String title, List<String[]> objects,Map<String,String> infoMap) throws Exception {
|
|
||||||
File excelFile = File.createTempFile(System.currentTimeMillis() + "", ".xls");
|
|
||||||
WritableWorkbook wtwb = Workbook.createWorkbook(excelFile);
|
|
||||||
WritableSheet sheet = wtwb.createSheet(title, 0);
|
|
||||||
sheet.getSettings().setDefaultColumnWidth(20);
|
|
||||||
WritableFont wfont = new WritableFont(WritableFont.createFont("楷书"), 14);
|
|
||||||
|
|
||||||
WritableCellFormat format = new WritableCellFormat(wfont);
|
|
||||||
format.setBorder(Border.ALL, BorderLineStyle.THIN);
|
|
||||||
format.setAlignment(Alignment.CENTRE);
|
|
||||||
format.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
||||||
|
|
||||||
WritableFont wfc = new WritableFont(WritableFont.ARIAL, 20,
|
|
||||||
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
|
|
||||||
jxl.format.Colour.BLACK);
|
|
||||||
WritableCellFormat wcfFC = new WritableCellFormat(wfc);
|
|
||||||
wcfFC.setAlignment(Alignment.LEFT);
|
|
||||||
wcfFC.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
||||||
|
|
||||||
WritableFont nameWfc = new WritableFont(WritableFont.ARIAL, 14,
|
|
||||||
WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,
|
|
||||||
jxl.format.Colour.BLACK);
|
|
||||||
WritableCellFormat nameFormat = new WritableCellFormat(nameWfc);
|
|
||||||
nameFormat.setBorder(Border.ALL, BorderLineStyle.THIN);
|
|
||||||
nameFormat.setAlignment(Alignment.CENTRE);
|
|
||||||
nameFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
||||||
|
|
||||||
WritableCellFormat infoFormat = new WritableCellFormat(wfont);
|
|
||||||
infoFormat.setAlignment(Alignment.LEFT);
|
|
||||||
infoFormat.setVerticalAlignment(VerticalAlignment.CENTRE);
|
|
||||||
|
|
||||||
|
|
||||||
sheet.mergeCells(0, 0, names.length - 1, 0);
|
|
||||||
sheet.addCell(new Label(0, 0, infoMap.get("title"), wcfFC));
|
|
||||||
|
|
||||||
sheet.addCell(new Label(0, 2, infoMap.get("info"), infoFormat));
|
|
||||||
sheet.addCell(new Label(2, 2, infoMap.get("dvrnvr"), infoFormat));
|
|
||||||
sheet.addCell(new Label(4, 2, infoMap.get("char"), infoFormat));
|
|
||||||
sheet.addCell(new Label(0, 3, infoMap.get("infoPercent"), infoFormat));
|
|
||||||
sheet.addCell(new Label(2, 3, infoMap.get("dvrnvrPercent"), infoFormat));
|
|
||||||
sheet.addCell(new Label(4, 3, infoMap.get("charPercent"), infoFormat));
|
|
||||||
|
|
||||||
int rowNum = 5;
|
|
||||||
for (int i = 0; i < names.length; i++) {
|
|
||||||
sheet.addCell(new Label(i, 4, names[i], nameFormat));
|
|
||||||
}
|
|
||||||
for (int j = 0; j < objects.size(); j++) {
|
|
||||||
String[] obj = objects.get(j);
|
|
||||||
for (int h = 0; h < obj.length; h++) {
|
|
||||||
sheet.addCell(new Label(h, rowNum, obj[h], format));
|
|
||||||
}
|
|
||||||
rowNum = rowNum + 1;
|
|
||||||
}
|
|
||||||
wtwb.write();
|
|
||||||
wtwb.close();
|
|
||||||
return excelFile.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static String getContent(Sheet src, int rowNum, int colNum) {
|
public static String getContent(Sheet src, int rowNum, int colNum) {
|
||||||
if(colNum < src.getRow(rowNum).length) {
|
if(colNum < src.getRow(rowNum).length) {
|
||||||
return src.getRow(rowNum)[colNum].getContents().trim();
|
return src.getRow(rowNum)[colNum].getContents().trim();
|
||||||
@@ -251,49 +118,20 @@ public class ExcelUtils {
|
|||||||
return rightRows;
|
return rightRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDateContent(Sheet src, int rowNum, int colNum) {
|
public static void downloadExcel(File excelFile, String fileName, HttpServletResponse response) throws Exception{
|
||||||
// 日期 类型的处理
|
response.setContentType("application/octet-stream");
|
||||||
Cell c = src.getRow(rowNum)[colNum];
|
fileName = new String(fileName.getBytes("gbk"),"ISO8859_1");
|
||||||
if(CellType.DATE.equals(c.getType())) {
|
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + ".xls" + "\"");
|
||||||
DateCell dc = (DateCell) c;
|
FileInputStream fis = new FileInputStream(excelFile);
|
||||||
Date jxlDate = dc.getDate();
|
OutputStream out = response.getOutputStream();
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
|
|
||||||
return sdf.format(jxlDate);
|
|
||||||
} else {
|
|
||||||
String dateStr = c.getContents().trim();
|
|
||||||
return dateStr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
int SIZE = 1024 * 1024;
|
||||||
* 从第i行开始到最后检测指定列的唯一性
|
byte[] bytes = new byte[SIZE];
|
||||||
*
|
int LENGTH = -1;
|
||||||
* @param src
|
while((LENGTH = fis.read(bytes)) != -1){
|
||||||
* @param colNum
|
out.write(bytes,0,LENGTH);
|
||||||
* @param fromRow
|
}
|
||||||
* 起始行
|
out.flush();
|
||||||
* @return
|
fis.close();
|
||||||
*/
|
|
||||||
public static Boolean checkUnique(Sheet src, int colNum, int fromRow) {
|
|
||||||
Cell[] colCells = src.getColumn(colNum);
|
|
||||||
Set<String> set = new HashSet<String>();
|
|
||||||
for (int i = fromRow; i < colCells.length; i++) {
|
|
||||||
if (!StringUtils.isEmpty(colCells[i].getContents())
|
|
||||||
&& !set.add(colCells[i].getContents())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static File getTempFile(String fileName) {
|
|
||||||
String dir = System.getProperty("java.io.tmpdir"); // 获取系统临时目录
|
|
||||||
return new File(dir + File.separator + fileName);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
String msg = "12345";
|
|
||||||
System.out.println(msg.indexOf("@"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,58 +0,0 @@
|
|||||||
package com.jsh.erp.utils;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
import javax.servlet.ServletOutputStream;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
import java.io.*;
|
|
||||||
import java.net.URLEncoder;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
public class ExportExecUtil {
|
|
||||||
|
|
||||||
public static void showExec(File excelFile,String fileName,HttpServletResponse response) throws Exception{
|
|
||||||
response.setContentType("application/octet-stream");
|
|
||||||
fileName = new String(fileName.getBytes("gbk"),"ISO8859_1");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=\"" + fileName + ".xls" + "\"");
|
|
||||||
FileInputStream fis = new FileInputStream(excelFile);
|
|
||||||
OutputStream out = response.getOutputStream();
|
|
||||||
|
|
||||||
int SIZE = 1024 * 1024;
|
|
||||||
byte[] bytes = new byte[SIZE];
|
|
||||||
int LENGTH = -1;
|
|
||||||
while((LENGTH = fis.read(bytes)) != -1){
|
|
||||||
out.write(bytes,0,LENGTH);
|
|
||||||
}
|
|
||||||
|
|
||||||
out.flush();
|
|
||||||
fis.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void downloadFile(InputStream inputStream, String fileName , HttpServletResponse response) {
|
|
||||||
try {
|
|
||||||
response.setContentType("multipart/form-data");
|
|
||||||
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
|
||||||
ServletOutputStream outputStream = response.getOutputStream();
|
|
||||||
byte[] buff = new byte[1024];
|
|
||||||
int length = 0;
|
|
||||||
while ((length = inputStream.read(buff)) != -1) {
|
|
||||||
outputStream.write(buff, 0, length);
|
|
||||||
}
|
|
||||||
if (outputStream != null) {
|
|
||||||
outputStream.flush();
|
|
||||||
outputStream.close();
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
|
||||||
if (inputStream != null) {
|
|
||||||
try {
|
|
||||||
inputStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.error("关闭资源出错" + e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialMapperEx">
|
<mapper namespace="com.jsh.erp.datasource.mappers.MaterialMapperEx">
|
||||||
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
<resultMap extends="com.jsh.erp.datasource.mappers.MaterialMapper.BaseResultMap" id="ResultMapList" type="com.jsh.erp.datasource.entities.MaterialVo4Unit">
|
||||||
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
|
<result column="unitName" jdbcType="VARCHAR" property="unitName" />
|
||||||
|
<result column="ratio" jdbcType="DECIMAL" property="ratio" />
|
||||||
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
<result column="categoryName" jdbcType="VARCHAR" property="categoryName" />
|
||||||
<result column="bar_code" jdbcType="VARCHAR" property="mBarCode" />
|
<result column="bar_code" jdbcType="VARCHAR" property="mBarCode" />
|
||||||
<result column="commodity_unit" jdbcType="VARCHAR" property="commodityUnit" />
|
<result column="commodity_unit" jdbcType="VARCHAR" property="commodityUnit" />
|
||||||
@@ -366,7 +367,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="exportExcel" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
|
<select id="exportExcel" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultMapList">
|
||||||
select m.*,u.name unitName, mc.name categoryName,me.bar_code,me.commodity_unit,me.purchase_decimal, me.commodity_decimal,
|
select m.*,u.name unitName, u.ratio, mc.name categoryName,me.bar_code,me.commodity_unit,me.purchase_decimal, me.commodity_decimal,
|
||||||
me.wholesale_decimal, me.low_decimal
|
me.wholesale_decimal, me.low_decimal
|
||||||
FROM jsh_material m
|
FROM jsh_material m
|
||||||
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
|
||||||
@@ -410,6 +411,13 @@
|
|||||||
and ifnull(m.delete_flag,'0') !='1'
|
and ifnull(m.delete_flag,'0') !='1'
|
||||||
order by m.id desc
|
order by m.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getOtherMaterialList" resultType="com.jsh.erp.datasource.entities.MaterialExtend">
|
||||||
|
select me.material_id, me.bar_code, me.commodity_unit from jsh_material_extend me
|
||||||
|
where me.default_flag=0 and (me.sku='' or me.sku is null)
|
||||||
|
group by me.material_id
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="findByMaterialName" resultType="com.jsh.erp.datasource.entities.Material">
|
<select id="findByMaterialName" resultType="com.jsh.erp.datasource.entities.Material">
|
||||||
select m.*
|
select m.*
|
||||||
FROM jsh_material m
|
FROM jsh_material m
|
||||||
|
|||||||
Reference in New Issue
Block a user