diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExchangeRateController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExchangeRateController.java index 25c30b36..d6ab2c10 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExchangeRateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExchangeRateController.java @@ -3,10 +3,13 @@ package com.ruoyi.system.controller; import java.math.BigDecimal; import java.util.Date; import java.util.List; + +import com.ruoyi.system.domain.SysCompanyBankInfo; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; @@ -59,11 +62,19 @@ public class BaseExchangeRateController extends BaseController @Log(title = "基础资料汇率管理", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(BaseExchangeRate baseExchangeRate) + public AjaxResult export(BaseExchangeRate baseExchangeRate,String ids) { - List list = baseExchangeRateService.selectBaseExchangeRateList(baseExchangeRate); - ExcelUtil util = new ExcelUtil(BaseExchangeRate.class); - return util.exportExcel(list, "基础资料汇率管理数据"); + if (StringUtils.isEmpty(ids)){ + List list = baseExchangeRateService.selectBaseExchangeRateList(baseExchangeRate); + ExcelUtil util = new ExcelUtil(BaseExchangeRate.class); + return util.exportExcel(list, "基础资料汇率管理数据"); + }else { + String[] exchangeRateIds = ids.split(","); + List list = baseExchangeRateService.selectBaseExchangeRateListByIds(exchangeRateIds); + ExcelUtil util = new ExcelUtil(BaseExchangeRate.class); + return util.exportExcel(list, "基础资料汇率管理数据"); + } + } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java index 0ff81b8a..113cafdb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java @@ -101,5 +101,8 @@ public interface BaseExchangeRateMapper public int restoreBaseExchangeRateById(Long exchangeRateId); - + /** + * 根据ids查询基础资料汇率管理 + * */ + List selectBaseExchangeRateListByIds(String[] exchangeRateIds); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseExchangeRateService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseExchangeRateService.java index 638b2152..0fb05f5e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseExchangeRateService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseExchangeRateService.java @@ -77,4 +77,9 @@ public interface IBaseExchangeRateService * 查找当前时间的汇率 * */ BaseExchangeRate selectExchangeRateByTimeRange(BaseExchangeRate baseExchangeRate); + + /** + * 根据ids查询汇率 + * */ + List selectBaseExchangeRateListByIds(String[] exchangeRateIds); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java index e499d5ff..7c750d24 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java @@ -61,6 +61,14 @@ public class BaseExchangeRateServiceImpl implements IBaseExchangeRateService return baseExchangeRateMapper.selectBaseExchangeRateList(baseExchangeRate); } + /** + * 根据ids查询汇率 + * */ + @Override + public List selectBaseExchangeRateListByIds(String[] exchangeRateIds) { + return baseExchangeRateMapper.selectBaseExchangeRateListByIds(exchangeRateIds); + } + /** * 新增基础资料汇率管理 * diff --git a/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml index 4f0c19d7..5da5862e 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml @@ -51,6 +51,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND exchange_rate_id != #{exchangeRateId} + + insert into base_exchange_rate diff --git a/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html b/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html index 4bfb13fa..0cd22af9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html +++ b/ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html @@ -33,6 +33,11 @@ 添加 + + + 导出 + +
@@ -62,6 +67,9 @@ }, //双击单列字段触发事件 columns: [ + { + checkbox: true + }, { title: '汇率ID', field: 'exchangeRateId', @@ -115,6 +123,31 @@ }; $.table.init(options); }); + + + // 导出 + function exportExcel() { + var ids = $.table.selectColumns("exchangeRateId"); + var dataParam = $("#formId").serializeArray(); + + let tipMsg = "确定导出当前所有数据吗?"; + if ($.common.isNotEmpty(ids)) { + tipMsg = `确定导出 ${ids} 数据吗?`; + dataParam.push({ "name": "ids", "value": ids }); + } + $.modal.confirm(tipMsg, function () { + $.modal.loading("正在导出数据,请稍后..."); + $.post( prefix + "/export", dataParam, function (result) { + if (result.code === web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName="+ encodeURI(result.msg) + "&delete=" + true; + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }); + }); + } + \ No newline at end of file