标准配置导出

This commit is contained in:
mashuai 2025-03-20 13:40:39 +08:00
parent 303621a8d5
commit 46157c7745
4 changed files with 62 additions and 5 deletions

View File

@ -1,20 +1,19 @@
package com.bonus.material.ma.controller;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.material.common.annotation.PreventRepeatSubmit;
import com.bonus.material.common.domain.dto.SelectDto;
import com.bonus.material.ma.domain.StandardConfigBean;
import com.bonus.material.ma.domain.Type;
import com.bonus.material.ma.domain.vo.StandardConfigDetailsVo;
import com.bonus.material.ma.service.StandardConfigManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 机械设备标准配置管理Controller
@ -59,6 +58,17 @@ public class StandardConfigManageController extends BaseController {
return service.getListByConfigId(bean);
}
/**
* 导出标准配置管理列表
* @param response
* @param bean
*/
@PostMapping("/export")
public void export(HttpServletResponse response, StandardConfigDetailsVo bean) {
List<StandardConfigDetailsVo> list = service.selectStandardList(bean);
ExcelUtil<StandardConfigDetailsVo> util = new ExcelUtil<>(StandardConfigDetailsVo.class);
util.exportExcel(response, list, "标准配置管理列表数据");
}
/**
* 新增标准配置
*/

View File

@ -18,7 +18,7 @@ import java.util.Date;
*/
@Getter
@Setter
public class StandardConfigDetailsVo extends Type {
public class StandardConfigDetailsVo {
/** 配置ID */
@ApiModelProperty(value = "配置ID")
@ -33,15 +33,19 @@ public class StandardConfigDetailsVo extends Type {
private Long houseId;
@ApiModelProperty(value = "仓库名称")
@Excel(name = "仓库信息")
private String houseName;
@ApiModelProperty(value = "施工类型")
@Excel(name = "施工类型")
private String constructionType;
@ApiModelProperty(value = "物资类型")
@Excel(name = "物资类型")
private String materialType;
@ApiModelProperty(value = "物资名称")
@Excel(name = "物资名称")
private String typeName;
@ApiModelProperty(value = "类型名称")
@ -54,15 +58,18 @@ public class StandardConfigDetailsVo extends Type {
private Long[] typeIds;
@ApiModelProperty(value = "规格型号")
@Excel(name = "规格型号")
private String typeModelName;
@ApiModelProperty(value = "计量单位")
@Excel(name = "计量单位")
private String unit;
@ApiModelProperty(value = "计量单位")
private String unitName;
@ApiModelProperty(value = "数量")
@Excel(name = "数量")
private BigDecimal num;
@ApiModelProperty(value = "预领数量")
@ -73,6 +80,7 @@ public class StandardConfigDetailsVo extends Type {
private BigDecimal storageNum;
@ApiModelProperty(value = "备注")
@Excel(name = "备注")
private String remark;
/** 管理方式(0编号 1计数) */
@ -98,4 +106,7 @@ public class StandardConfigDetailsVo extends Type {
@ApiModelProperty(value = "关键字")
private String keyWord;
@ApiModelProperty(value = "层级")
private String level;
}

View File

@ -90,4 +90,11 @@ public interface StandardConfigManageService {
* @return
*/
AjaxResult getListsByConfigId(StandardConfigDetailsVo bean);
/**
* 导出标准配置管理列表
* @param bean
* @return
*/
List<StandardConfigDetailsVo> selectStandardList(StandardConfigDetailsVo bean);
}

View File

@ -91,6 +91,35 @@ public class StandardConfigManageServiceImpl implements StandardConfigManageServ
}
}
/**
* 导出标准配置管理列表
* @param bean
* @return
*/
@Override
public List<StandardConfigDetailsVo> selectStandardList(StandardConfigDetailsVo bean) {
List<StandardConfigDetailsVo> list = new ArrayList<>();
try {
if (StringUtils.isNull(bean.getConfigId())){
//查全部
list.addAll(mapper.getListByParentId(null, bean));
}else {
//根据level层级和配置id 查询父级ID
List<Integer> parentIds = mapper.selectParentId(bean);
if (CollectionUtils.isEmpty(parentIds)) {
return new ArrayList<>();
}
for (Integer parentId : parentIds) {
list.addAll(mapper.getListByParentId(parentId.longValue(), bean));
}
}
return list;
} catch (Exception e) {
e.printStackTrace();
return new ArrayList<>();
}
}
@Override
public int insertConfig(StandardConfigBean bean) {
//根据类型名称判断去重