新购模板导入和下载

This commit is contained in:
hongchao 2025-03-31 17:26:40 +08:00
parent 78ea1a4b72
commit 4a7ffb0145
8 changed files with 342 additions and 173 deletions

View File

@ -31,12 +31,12 @@ public class MaType extends BaseEntity {
/** 类型名称 */
@ApiModelProperty(value = "类型名称")
@Excel(name = "名称")
@Excel(name = "类型名称")
private String typeName;
/** 规格名称 */
@ApiModelProperty(value = "规格名称")
@Excel(name = "名称")
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String modelName;
/** 替换类型ID */
@ -69,7 +69,7 @@ public class MaType extends BaseEntity {
/** 计量单位 */
@ApiModelProperty(value = "计量单位")
@Excel(name = "计量单位")
@Excel(name = "单位")
private String unitName;
/** 管理方式 */

View File

@ -433,9 +433,7 @@ public class PoiOutPage {
return workbook;
}
public static void excelForcheckEach(HSSFWorkbook workbook,HSSFSheet sheet,List<Map<String, Object>> resultLease,List<Map<String, Object>> resultLose,List<Map<String, Object>> resultRepair,List<Map<String, Object>> resultScrap,List<Map<String, Object>> resultsReduction,
List<String> listLease,List<String> listLose,List<String> listRepair,List<String> listScrap,List<String> listReduction, String projectName, String unit,
BigDecimal totalCostLease, BigDecimal totalCostLose, BigDecimal totalCostRepair, BigDecimal totalCostScrap,BigDecimal totalCostReduction) {
public static void excelForcheckEach(HSSFWorkbook workbook,HSSFSheet sheet,List<Map<String, Object>> resultLease,List<String> listLease) {
sheet.setDefaultColumnWidth(15); // 设置列宽
@ -448,145 +446,12 @@ public class PoiOutPage {
int rowNum = 0;
// 填充表头
rowNum = createHeaderRow(sheet, rowNum, listLease, headerStyle);
rowNum = createHeaderRowTwo(sheet, rowNum, listLease, headerStyle);
// 填充数据行
if (resultLease != null && !resultLease.isEmpty()) {
rowNum = createDataRows(sheet, rowNum, resultLease, contentStyle, listLease.size());
} else {
// 如果没有数据则仅显示表头
// rowNum++;
// rowNum = createDataRows(sheet, rowNum, resultLease, contentStyle, listLease.size());
HSSFRow row = sheet.createRow(rowNum++);
HSSFCell cell = row.createCell(0);
cell.setCellStyle(headerStyle);
cell.setCellValue("暂无数据");
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLease.size() - 1)));
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLease.size() - 1));
// 设置边框样式
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
}
rowNum = createTotalRow(sheet, rowNum, listLease, totalCostLease, headerStyle);
/**
* 维修费用明细
*/
// 填充标题行
rowNum = createTitleRowStyleCost(sheet, rowNum, "维修费用明细", titleStyle, listRepair.size());
// 填充表头
rowNum = createHeaderRow(sheet, rowNum, listRepair, headerStyle);
// 填充数据行
if (resultRepair!= null &&!resultRepair.isEmpty()) {
rowNum = createDataRows(sheet, rowNum, resultRepair, contentStyle, listRepair.size());
} else {
// 如果没有数据则仅显示表头
// rowNum++;
// rowNum = createDataRows(sheet, rowNum, resultRepair, contentStyle, listRepair.size());
HSSFRow row = sheet.createRow(rowNum++);
HSSFCell cell = row.createCell(0);
cell.setCellStyle(headerStyle);
cell.setCellValue("暂无数据");
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listRepair.size() - 1)));
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listRepair.size() - 1));
// 设置边框样式
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
}
rowNum = createTotalRow(sheet, rowNum, listRepair, totalCostRepair, headerStyle);
/**
* 报废费用明细
*/
// 填充标题行
rowNum = createTitleRowStyleCost(sheet, rowNum, "报废费用明细", titleStyle, listScrap.size());
// 填充表头
rowNum = createHeaderRow(sheet, rowNum, listScrap, headerStyle);
// 填充数据行
if (resultScrap!= null &&!resultScrap.isEmpty()) {
rowNum = createDataRows(sheet, rowNum, resultScrap, contentStyle, listScrap.size());
} else {
// 如果没有数据则仅显示表头
// rowNum++;
// rowNum = createDataRows(sheet, rowNum, resultScrap, contentStyle, listScrap.size());
HSSFRow row = sheet.createRow(rowNum++);
HSSFCell cell = row.createCell(0);
cell.setCellStyle(headerStyle);
cell.setCellValue("暂无数据");
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listScrap.size() - 1)));
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listScrap.size() - 1));
// 设置边框样式
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
}
rowNum = createTotalRow(sheet, rowNum, listScrap, totalCostScrap, headerStyle);
/**
* 丢失费用明细
*/
// 填充标题行
rowNum = createTitleRowStyleCost(sheet, rowNum, "丢失费用明细", titleStyle, listLose.size());
// 填充表头
rowNum = createHeaderRow(sheet, rowNum, listLose, headerStyle);
// 填充数据行
if (resultLose!= null &&!resultLose.isEmpty()) {
rowNum = createDataRows(sheet, rowNum, resultLose, contentStyle, listLose.size());
} else {
// 如果没有数据则仅显示表头
// rowNum++;
// rowNum = createDataRows(sheet, rowNum, resultLose, contentStyle, listLose.size());
HSSFRow row = sheet.createRow(rowNum++);
HSSFCell cell = row.createCell(0);
cell.setCellStyle(headerStyle);
cell.setCellValue("暂无数据");
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLose.size() - 1)));
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listLose.size() - 1));
// 设置边框样式
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
}
rowNum = createTotalRow(sheet, rowNum, listLose, totalCostLose, headerStyle);
/**
* 减免费用明细
*/
// 填充标题行
rowNum = createTitleRowStyleCost(sheet, rowNum, "减免费用明细", titleStyle, listReduction.size());
// 填充表头
rowNum = createHeaderRow(sheet, rowNum, listReduction, headerStyle);
// 填充数据行
if (resultsReduction != null && !resultsReduction.isEmpty()) {
rowNum = createDataRows(sheet, rowNum, resultsReduction, contentStyle, listReduction.size());
} else {
// 如果没有数据则仅显示表头
// rowNum++;
// rowNum = createDataRows(sheet, rowNum, resultLease, contentStyle, listLease.size());
HSSFRow row = sheet.createRow(rowNum++);
HSSFCell cell = row.createCell(0);
cell.setCellStyle(headerStyle);
cell.setCellValue("暂无数据");
sheet.addMergedRegion(new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listReduction.size() - 1)));
CellRangeAddress cellRange = new CellRangeAddress(rowNum - 1, rowNum - 1, 0, (short) (listReduction.size() - 1));
// 设置边框样式
RegionUtil.setBorderTop(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderBottom(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderLeft(BorderStyle.THIN, cellRange, sheet);
RegionUtil.setBorderRight(BorderStyle.THIN, cellRange, sheet);
}
rowNum = createTotalRow(sheet, rowNum, listReduction, totalCostReduction, headerStyle);
//合计
BigDecimal totalCostAll = totalCostLease.add(totalCostLose).add(totalCostRepair).add(totalCostScrap).add(totalCostReduction);
rowNum = createTotalRowAll(sheet, rowNum, listScrap, totalCostAll, headerStyle);
}
@ -1116,6 +981,18 @@ public class PoiOutPage {
return rowNum;
}
private static int createHeaderRowTwo(HSSFSheet sheet, int rowNum, List<String> list, HSSFCellStyle headerStyle) {
HSSFRow row = sheet.createRow(rowNum++);
row.setHeightInPoints(20);
for (int j = 0; j < list.size(); j++) {
HSSFCell cell = row.createCell(j);
String header = list.get(j);
cell.setCellStyle(headerStyle);
cell.setCellValue(header != null ? header : "");
}
return rowNum;
}
/**
* 创建数据行
*/

View File

@ -2,14 +2,17 @@ package com.bonus.sgzb.material.controller;
import java.io.OutputStream;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.convert.Convert;
import com.alibaba.fastjson.JSONObject;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.SltAgreementInfo;
import com.bonus.sgzb.common.security.annotation.PreventRepeatSubmit;
import com.bonus.sgzb.common.security.annotation.RequiresPermissions;
@ -31,6 +34,8 @@ import com.bonus.sgzb.common.core.web.controller.BaseController;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.page.TableDataInfo;
import org.springframework.web.multipart.MultipartFile;
/**
* 新购验收任务
*
@ -165,38 +170,85 @@ public class PurchaseCheckInfoController extends BaseController {
* 机具模板下载--all
*/
@ApiOperation(value = "机具模板下载")
@PreventRepeatSubmit
// @RequiresPermissions("settlement:info:export")
@Log(title = "机具模板下载")
@PostMapping("/downLoadTypeModel")
public void downLoadTypeModel(HttpServletResponse response, @RequestParam("params") String params) {
// try {
// List<SltAgreementInfo> sltAgreementInfo = JSONObject.parseArray(params,SltAgreementInfo.class);
// // 创建工作簿
// HSSFWorkbook workbook = new HSSFWorkbook();
// int sheetIndex = 1;
//
// // 创建工作表
// HSSFSheet sheet = workbook.createSheet("机具新增" + sheetIndex);
//
// // 创建工作簿和工作表
// PoiOutPage.excelForcheckEach(workbook, sheet, resultsLease,resultsLose,resultsRepair,resultsScrap,resultsReduction, headersLease,headersLose,headersRepair,headersScrap,headersReduction,projectName,unitName,totalCostLease,totalCostLose,totalCostRepair,totalCostScrap,totalCostReduction);
//
// sheetIndex++;
//
// OutputStream out = null;
// response.setContentType("application/vnd.ms-excel;charset=UTF-8");
// response.addHeader("Content-Disposition",
// "attachment;filename=" + URLEncoder.encode("各结算明细", "UTF-8") + ".xls");
// response.setHeader("Pragma", "No-cache");
// out = response.getOutputStream();
// workbook.write(out);
// out.flush();
// out.close();
//
// } catch (Exception e) {
// log.error(e.toString(), e);
// }
try {
// 创建工作簿
HSSFWorkbook workbook = new HSSFWorkbook();
int sheetIndex = 1;
// 创建工作表
HSSFSheet sheet = workbook.createSheet("机具新增");
//创建表头
ArrayList<String> list = new ArrayList<String>();
list.add("类型名称");
list.add("规格型号");
list.add("单位");
//数据转换
Map<String, Object> map = new LinkedHashMap<String, Object>();
map.put("typeName",null );
map.put("modelName",null );
map.put("nuitName", null);
List<Map<String, Object>> maps = new ArrayList<Map<String, Object>>();
maps.add(map);
// 创建工作簿和工作表
PoiOutPage.excelForcheckEach(workbook, sheet,maps,list);
sheetIndex++;
HSSFSheet sheetTwo = workbook.createSheet("机具类型规格");
//创建表头
ArrayList<String> listTwo = new ArrayList<String>();
listTwo.add("类型名称");
listTwo.add("规格型号");
listTwo.add("单位");
List<MaType> listType = purchaseCheckInfoService.selectMaTypeList();
List<MaType> type = Convert.toList(MaType.class, listType);
List<Map<String, Object>> mapsType = new ArrayList<Map<String, Object>>();
//数据转换
if (type!= null) {
int sizeLease = type.size();
for (int i = 0; i < sizeLease; i++) {
MaType bean = type.get(i);
Map<String, Object> mapTwo = new LinkedHashMap<String, Object>();
mapTwo.put("typeName",bean.getTypeName());
mapTwo.put("modelName",bean.getModelName() );
mapTwo.put("nuitName", bean.getUnitName());
mapsType.add(mapTwo);
}
}else{
map.put("typeName",null );
map.put("modelName",null );
map.put("nuitName", null);
mapsType.add(map);
}
// 创建工作簿和工作表
PoiOutPage.excelForcheckEach(workbook, sheetTwo,mapsType,listTwo);
sheetIndex++;
OutputStream out = null;
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.addHeader("Content-Disposition",
"attachment;filename=" + URLEncoder.encode("模板下载", "UTF-8") + ".xls");
response.setHeader("Pragma", "No-cache");
out = response.getOutputStream();
workbook.write(out);
out.flush();
out.close();
} catch (Exception e) {
logger.error("模板下载失败", e);
}
}
/**
* 物资信息导入
* @param file
* @return
*/
@ApiOperation(value = "物资信息导入")
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file)
{
return purchaseCheckInfoService.importTbPeople(file);
}
}

View File

@ -1,5 +1,6 @@
package com.bonus.sgzb.material.mapper;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.material.domain.BmNoticeInfo;
import com.bonus.sgzb.base.api.domain.MachinePart;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
@ -128,4 +129,8 @@ public interface PurchaseCheckInfoMapper {
* @return
*/
List<MachinePart> getWholeSetDetails(PurchaseCheckInfo purchaseCheckInfo);
List<MaType> selectMaTypeList();
List<MaType> selectTypeDetail(MaType type);
}

View File

@ -1,9 +1,12 @@
package com.bonus.sgzb.material.service;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.MachinePart;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.material.domain.PurchaseCheckInfo;
import com.bonus.sgzb.material.domain.PurchaseInput;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@ -114,4 +117,17 @@ public interface IPurchaseCheckInfoService
* @return
*/
List<MachinePart> getWholeSetDetails(PurchaseCheckInfo purchaseCheckInfo);
/**
* 查询类型规格
* @return
*/
List<MaType> selectMaTypeList();
/**
* 物资信息导入
* @param file
* @return
*/
AjaxResult importTbPeople(MultipartFile file);
}

View File

@ -1,9 +1,15 @@
package com.bonus.sgzb.material.service.impl;
import com.bonus.sgzb.base.api.domain.MaType;
import com.bonus.sgzb.base.api.domain.MachinePart;
import com.bonus.sgzb.common.core.utils.DateUtils;
import com.bonus.sgzb.common.core.utils.HttpCodeEnum;
import com.bonus.sgzb.common.core.utils.StringHelper;
import com.bonus.sgzb.common.core.utils.StringUtils;
import com.bonus.sgzb.common.core.utils.poi.ExcelUtil;
import com.bonus.sgzb.common.core.web.domain.AjaxResult;
import com.bonus.sgzb.common.security.utils.SecurityUtils;
import com.bonus.sgzb.material.config.MaterialConstants;
import com.bonus.sgzb.material.domain.*;
import com.bonus.sgzb.material.mapper.PurchaseCheckDetailsMapper;
import com.bonus.sgzb.material.mapper.PurchaseCheckInfoMapper;
@ -12,12 +18,20 @@ import com.bonus.sgzb.material.service.IPurchaseCheckInfoService;
import com.bonus.sgzb.material.vo.GlobalContants;
import com.bonus.sgzb.material.vo.NoticeInfoVO;
import com.bonus.sgzb.system.api.RemoteUserService;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* 新购验收任务Service业务层处理
@ -318,4 +332,172 @@ public class PurchaseCheckInfoServiceImpl implements IPurchaseCheckInfoService {
}
return send;
}
@Override
public List<MaType> selectMaTypeList() {
List<MaType> listType = purchaseCheckInfoMapper.selectMaTypeList();
return listType;
}
/**
* 物资信息导入
* @param file
* @return
*/
@Override
public AjaxResult importTbPeople(MultipartFile file) {
String fileName = file.getOriginalFilename();
if (fileName != null) {
String fileExtension = fileName.substring(fileName.lastIndexOf(".") + 1);
if (!MaterialConstants.XLSX.equalsIgnoreCase(fileExtension)) {
// 文件后缀名不符合要求
return AjaxResult.error("导入失败:文件后缀名不符合要求,必须为xlsx结尾");
}
}
try {
InputStream inputStream = file.getInputStream();
Workbook workbook = new XSSFWorkbook(inputStream); // 处理.xlsx文件
Sheet sheet = workbook.getSheetAt(0);
// 得到Excel的行数
int totalRows = sheet.getPhysicalNumberOfRows();
// 检查是否有行数
if (totalRows <= 1) {
throw new IllegalArgumentException("导入失败Excel文件中没有数据请检查后重新导入");
}
// 读取第一行表头
Row headerRow = sheet.getRow(0);
if (headerRow == null) {
throw new IllegalArgumentException("导入失败:文件中没有表头");
}
// 获取表头的列数
int totalCells = headerRow.getPhysicalNumberOfCells();
// 预期的表头列数为11列可以根据实际需求修改这个条件
if (totalCells != 3) {
throw new IllegalArgumentException("导入失败:表头列数与预期不符,请检查导入模板");
}
// // 获取数据行数
// int rowCount = sheet.getLastRowNum() + 1;
// if (rowCount > 50) {
// throw new IllegalArgumentException("导入失败:数据总条数不能超过 50 条");
// }
// 读取表头内容并验证每一列
extractedText(headerRow, totalCells);
//读取Excel表格数据做非空及格式判断
extractedCell(sheet, totalRows, totalCells);
ExcelUtil<MaType> util = new ExcelUtil<>(MaType.class);
List<MaType> maDevList = util.importExcel(file.getInputStream());
List<MaType> templateVos = new ArrayList<>();
// 判断装备类目是否为空查询装备id及价格
if (!CollectionUtils.isEmpty(maDevList)) {
int i =1;
for (MaType devTemplateVo : maDevList) {
i++;
if (StringUtils.isNotBlank(devTemplateVo.getTypeName()) && StringUtils.isNotBlank(devTemplateVo.getModelName()) && StringUtils.isNotBlank(devTemplateVo.getUnitName())) {
// 根据物资类型详情
List<MaType> list = purchaseCheckInfoMapper.selectTypeDetail(devTemplateVo);
if (!CollectionUtils.isEmpty(list)) {
if(list.size()!=1){
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), ""+i+"行数据有误,请检查");
}
MaType devType = list.get(0);
devTemplateVo.setTypeId(devType.getTypeId());
templateVos.add(devTemplateVo);
}else{
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), ""+i+"行数据有误,请检查");
}
}
}
}
return AjaxResult.success(templateVos);
} catch (IOException e) {
e.printStackTrace();
}
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
}
/**
* 读取Excel表格数据做非空及格式判断
* @param headerRow
* @param totalCells
*/
private void extractedText(Row headerRow, int totalCells) {
for (int cellNum = 0; cellNum < totalCells; cellNum++) {
Cell cell = headerRow.getCell(cellNum);
// 获取单元格内容并去除首尾空格
String headerValue = cell.getStringCellValue().trim();
// 根据列索引进行验证
switch (cellNum) {
case 0:
if (!"类型名称".equals(headerValue)) {
throw new IllegalArgumentException("" + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
}
break;
case 1:
if (!"规格型号".equals(headerValue)) {
throw new IllegalArgumentException("" + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
}
break;
case 2:
if (!"单位".equals(headerValue)) {
throw new IllegalArgumentException("" + (cellNum + 1) + " 列表头列名与预期不符,请检查导入模板");
}
break;
default:
break;
}
}
}
/**
* 读取Excel表格数据做非空判断
* @param sheet
* @param totalRows
* @param totalCells
*/
private void extractedCell(Sheet sheet, int totalRows, int totalCells) {
//读取Excel表格数据做非空判断
// 循环Excel行数
DataFormatter dataFormatter = new DataFormatter();
for (int r = 1; r < totalRows; r++) {
Row row = sheet.getRow(r);
// 循环Excel列数
for (int c = 0; c < totalCells; c++) {
Cell cell = row.getCell(c);
String cellValue = "";
if (cell != null && cell.getCellType() == CellType.STRING) {
cellValue = cell.getStringCellValue();
}
if (c == 5) {
cellValue = dataFormatter.formatCellValue(row.getCell(c));
}
switch (c) {
case 0:
checkBlank(cellValue, r, c);
break;
case 1:
checkBlank(cellValue, r, c);
break;
case 2:
checkBlank(cellValue, r, c);
break;
default:
break;
}
}
}
}
/**
* 检查数据是否为空
* @param cellValue
* @param rowIndex
* @param colIndex
*/
private void checkBlank(String cellValue, int rowIndex, int colIndex) {
if (StringUtils.isBlank(cellValue)) {
throw new IllegalArgumentException(
String.format("第 %d 行,第 %d 列数据为空,请检查后重新导入", rowIndex + 1, colIndex + 1));
}
}
}

View File

@ -339,4 +339,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
or mt3.type_name like concat('%', #{keyWord}, '%'))
</if>
</select>
<select id="selectMaTypeList"
resultType="com.bonus.sgzb.base.api.domain.MaType">
select
mt1.type_id as typeId,
mt2.type_id as parentId,
mt1.unit_name as unitName,
mt1.level,
mt1.type_name as modelName,
mt2.type_name as typeName
from ma_type mt1
left join ma_type mt2 on mt1.parent_id = mt2.type_id
where mt1.level = 4
and mt2.level = 3
and mt1.status = '0'
and mt1.del_flag = '0'
</select>
<select id="selectTypeDetail"
resultType="com.bonus.sgzb.base.api.domain.MaType">
select
mt1.type_id as typeId,
mt2.type_id as parentId,
mt1.unit_name as unitName,
mt1.level,
mt1.type_name as typeName,
mt2.type_name as modelName
from ma_type mt1
left join ma_type mt2 on mt1.parent_id = mt2.type_id
where mt1.level = 4
and mt2.level = 3
and mt1.type_name = #{modelName}
and mt2.type_name = #{typeName}
and mt1.unit_name = #{unitName}
and mt1.status = '0'
and mt1.del_flag = '0'
</select>
</mapper>

View File

@ -152,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id
WHERE mm.ma_code is not null and mm.ma_status in (15)
GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id
WHERE mt.del_flag = '0' and mt.is_whole_set IS NULL
WHERE mt.del_flag = '0'
<if test="level!=null and level!=''">
<if test="level == 2">
AND mt.level IN ('1','2')