This commit is contained in:
haozq 2024-11-11 16:18:44 +08:00
parent 127b0bc0bc
commit dc021a35fd
3 changed files with 12 additions and 3 deletions

View File

@ -89,8 +89,13 @@ public class ExportController {
public void exportDetail(HttpServletRequest request, HttpServletResponse response,@RequestBody PlanApplyBean o) { public void exportDetail(HttpServletRequest request, HttpServletResponse response,@RequestBody PlanApplyBean o) {
try { try {
List<PlanDataDetailBean> results = planService.getDetailsList(o); List<PlanDataDetailBean> results = planService.getDetailsList(o);
final int[] num = {1};
results.forEach(vo->{
vo.setXh(num[0]);
num[0]++;
});
ExportParams exportParams = new ExportParams("机具明细", "机具明细", ExcelType.XSSF); ExportParams exportParams = new ExportParams("机具明细", "机具明细", ExcelType.XSSF);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, results); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanDataDetailBean.class, results);
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("机具明细" + ".xlsx", "UTF-8")); response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("机具明细" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream(); ServletOutputStream outputStream = response.getOutputStream();

View File

@ -1,6 +1,7 @@
package com.bonus.gzgqj.business.plan.entity; package com.bonus.gzgqj.business.plan.entity;
import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
/** /**
* 新增内容详情 * 新增内容详情
@ -8,12 +9,15 @@ import cn.afterturn.easypoi.excel.annotation.Excel;
* *
* *
*/ */
@Data
public class PlanDataDetailBean { public class PlanDataDetailBean {
/** /**
* 类型 * 类型
*/ */
@Excel(name = "序号", width = 10.0, orderNum = "0") @Excel(name = "序号", width = 10.0, orderNum = "0")
private int xh;
private String applyId; private String applyId;
/** /**
@ -49,7 +53,7 @@ public class PlanDataDetailBean {
/** /**
* 备注 * 备注
*/ */
@Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "1") @Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "9")
private String remarks; private String remarks;
/** /**

View File

@ -154,7 +154,7 @@
<select id="getDetailsList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean"> <select id="getDetailsList" parameterType="com.bonus.gzgqj.business.plan.entity.PlanApplyBean" resultType="com.bonus.gzgqj.business.plan.entity.PlanDataDetailBean">
select id,apply_id applyId,model_id moduleId, select id,apply_id applyId,model_id moduleId,
need_num needNum,need_day times, need_num needNum,need_day times,
remark,type,name typeName, remark remarks,type,name typeName,
module,unit module,unit
from t_plan_details from t_plan_details
where apply_id=#{id} ORDER BY id asc where apply_id=#{id} ORDER BY id asc