diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysProductModelController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysProductModelController.java index 5fec5edb..f2ef2c85 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysProductModelController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysProductModelController.java @@ -62,15 +62,33 @@ public class SysProductModelController extends BaseController */ @RequiresPermissions("system:model:export") @Log(title = "产品型号管理", businessType = BusinessType.EXPORT) - @PostMapping("/export") + @PostMapping("/exportAll") @ResponseBody - public AjaxResult export(SysProductModel sysProductModel) + public AjaxResult exportAll(SysProductModel sysProductModel) { List list = sysProductModelService.selectSysProductModelList(sysProductModel); ExcelUtil util = new ExcelUtil(SysProductModel.class); return util.exportExcel(list, "产品型号管理数据"); } + + /** + * 导出产品型号管理列表 + */ + @RequiresPermissions("system:model:export") + @Log(title = "产品型号管理", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(@RequestBody String[] pcodes) + { + List list = sysProductModelService.selectSysProductModelListByCodes(pcodes); + ExcelUtil util = new ExcelUtil(SysProductModel.class); + return util.exportExcel(list, "产品型号管理数据"); + + } + + + /** * 新增产品型号管理 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProductModelMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProductModelMapper.java index 1ed1f04b..d8ebe820 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProductModelMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysProductModelMapper.java @@ -75,4 +75,9 @@ public interface SysProductModelMapper * @return 结果 */ public int restoreSysProductModelById(Long pid); + + /** + * 根据产品型号管理ID数组查询产品型号管理集合 + */ + List selectSysProductModelListByCodes(String[] pcodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProductModelService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProductModelService.java index 9eb40f4d..097c52fe 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProductModelService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysProductModelService.java @@ -78,4 +78,9 @@ public interface ISysProductModelService * 产品型号管理详情 * */ int detailSysProductModel(SysProductModel sysProductModel); + + /** + * 根据产品型号id数组查询产品型号列表集合 + * */ + List selectSysProductModelListByCodes(String[] pcodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProductModelServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProductModelServiceImpl.java index dd61d975..ae0f3017 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProductModelServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysProductModelServiceImpl.java @@ -170,4 +170,12 @@ public class SysProductModelServiceImpl implements ISysProductModelService return 1; } + + /** + * 根据产品型号id数组查询产品型号列表集合 + * */ + @Override + public List selectSysProductModelListByCodes(String[] pcodes) { + return sysProductModelMapper.selectSysProductModelListByCodes(pcodes); + } } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysProductModelMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysProductModelMapper.xml index 0f902ab1..dbfe7cc5 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysProductModelMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysProductModelMapper.xml @@ -64,7 +64,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" on s.pid = att.rel_id and att.source_type = 'sysProductModel' and att.source_sub_type = 'photo' where s.pid = #{pid} - + + + insert into sys_product_model diff --git a/ruoyi-admin/src/main/resources/templates/system/model/model.html b/ruoyi-admin/src/main/resources/templates/system/model/model.html index 9a82de3f..bd32b036 100644 --- a/ruoyi-admin/src/main/resources/templates/system/model/model.html +++ b/ruoyi-admin/src/main/resources/templates/system/model/model.html @@ -55,7 +55,7 @@ 添加 - + 导出 @@ -123,6 +123,61 @@ } + + //导出 + function exportExcel(formId) { + // $.table.set(); + var pcodeData = []; + var selections = $("#bootstrap-table").bootstrapTable("getSelections"); + if(selections.length === 0){ + $.modal.confirm("确定导出所有产品型号管理吗?", function() { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + var params = $("#bootstrap-table").bootstrapTable('getOptions'); + var dataParam = $("#" + currentId).serializeArray(); + dataParam.push({ "name": "orderByColumn", "value": params.sortName }); + dataParam.push({ "name": "isAsc", "value": params.sortOrder }); + $.modal.loading("正在导出数据,请稍后..."); + $.post(prefix + '/exportAll', dataParam, function(result) { + if (result.code == web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }); + }); + }else { + $.modal.confirm("确定导出选中的所有产品型号管理吗?", function () { + //·拼接单号 + for(let i=0;i