Browse Source

[feat] 基础资料

按照万材要求,基础资料汇率管理新增导出功能,支持部分行和全部行导出,导出更多数据
新增导出所有和选择导出后端接口
新增 导出基础资料汇率管理明细方法
新增根据基础资料汇率管理集合方法
新增导出基础资料汇率管理明细
修复,汇率管理分页查询多余的异常抛出问题
dev
liuxiaoxu 2 days ago
parent
commit
3c18ad9b2d
  1. 19
      ruoyi-admin/src/main/java/com/ruoyi/system/controller/BaseExchangeRateController.java
  2. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java
  3. 5
      ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseExchangeRateService.java
  4. 8
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/BaseExchangeRateServiceImpl.java
  5. 8
      ruoyi-admin/src/main/resources/mapper/system/BaseExchangeRateMapper.xml
  6. 33
      ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html

19
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.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.SysCompanyBankInfo;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log; import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.enums.BusinessType;
@ -59,11 +62,19 @@ public class BaseExchangeRateController extends BaseController
@Log(title = "基础资料汇率管理", businessType = BusinessType.EXPORT) @Log(title = "基础资料汇率管理", businessType = BusinessType.EXPORT)
@PostMapping("/export") @PostMapping("/export")
@ResponseBody @ResponseBody
public AjaxResult export(BaseExchangeRate baseExchangeRate) public AjaxResult export(BaseExchangeRate baseExchangeRate,String ids)
{ {
List<BaseExchangeRate> list = baseExchangeRateService.selectBaseExchangeRateList(baseExchangeRate); if (StringUtils.isEmpty(ids)){
ExcelUtil<BaseExchangeRate> util = new ExcelUtil<BaseExchangeRate>(BaseExchangeRate.class); List<BaseExchangeRate> list = baseExchangeRateService.selectBaseExchangeRateList(baseExchangeRate);
return util.exportExcel(list, "基础资料汇率管理数据"); ExcelUtil<BaseExchangeRate> util = new ExcelUtil<BaseExchangeRate>(BaseExchangeRate.class);
return util.exportExcel(list, "基础资料汇率管理数据");
}else {
String[] exchangeRateIds = ids.split(",");
List<BaseExchangeRate> list = baseExchangeRateService.selectBaseExchangeRateListByIds(exchangeRateIds);
ExcelUtil<BaseExchangeRate> util = new ExcelUtil<BaseExchangeRate>(BaseExchangeRate.class);
return util.exportExcel(list, "基础资料汇率管理数据");
}
} }
/** /**

5
ruoyi-admin/src/main/java/com/ruoyi/system/mapper/BaseExchangeRateMapper.java

@ -101,5 +101,8 @@ public interface BaseExchangeRateMapper
public int restoreBaseExchangeRateById(Long exchangeRateId); public int restoreBaseExchangeRateById(Long exchangeRateId);
/**
* 根据ids查询基础资料汇率管理
* */
List<BaseExchangeRate> selectBaseExchangeRateListByIds(String[] exchangeRateIds);
} }

5
ruoyi-admin/src/main/java/com/ruoyi/system/service/IBaseExchangeRateService.java

@ -77,4 +77,9 @@ public interface IBaseExchangeRateService
* 查找当前时间的汇率 * 查找当前时间的汇率
* */ * */
BaseExchangeRate selectExchangeRateByTimeRange(BaseExchangeRate baseExchangeRate); BaseExchangeRate selectExchangeRateByTimeRange(BaseExchangeRate baseExchangeRate);
/**
* 根据ids查询汇率
* */
List<BaseExchangeRate> selectBaseExchangeRateListByIds(String[] exchangeRateIds);
} }

8
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); return baseExchangeRateMapper.selectBaseExchangeRateList(baseExchangeRate);
} }
/**
* 根据ids查询汇率
* */
@Override
public List<BaseExchangeRate> selectBaseExchangeRateListByIds(String[] exchangeRateIds) {
return baseExchangeRateMapper.selectBaseExchangeRateListByIds(exchangeRateIds);
}
/** /**
* 新增基础资料汇率管理 * 新增基础资料汇率管理
* *

8
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} AND exchange_rate_id != #{exchangeRateId}
</select> </select>
<select id="selectBaseExchangeRateListByIds" parameterType="Long" resultMap="BaseExchangeRateResult">
<include refid="selectBaseExchangeRateVo"/>
WHERE exchange_rate_id IN
<foreach item="exchangeRateId" collection="array" open="(" separator="," close=")">
#{exchangeRateId}
</foreach>
</select>
<insert id="insertBaseExchangeRate" parameterType="BaseExchangeRate" useGeneratedKeys="true" keyProperty="exchangeRateId"> <insert id="insertBaseExchangeRate" parameterType="BaseExchangeRate" useGeneratedKeys="true" keyProperty="exchangeRateId">
insert into base_exchange_rate insert into base_exchange_rate
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">

33
ruoyi-admin/src/main/resources/templates/system/exchangeRate/exchangeRate.html

@ -33,6 +33,11 @@
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:exchangeRate:add"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:exchangeRate:add">
<i class="fa fa-plus"></i> 添加 <i class="fa fa-plus"></i> 添加
</a> </a>
<a class="btn btn-success" onclick="exportExcel()" shiro:hasPermission="system:exchangeRate:export">
<i class="fa fa-download"></i> 导出
</a>
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table> <table id="bootstrap-table"></table>
@ -62,6 +67,9 @@
}, //双击单列字段触发事件 }, //双击单列字段触发事件
columns: [ columns: [
{
checkbox: true
},
{ {
title: '汇率ID', title: '汇率ID',
field: 'exchangeRateId', field: 'exchangeRateId',
@ -115,6 +123,31 @@
}; };
$.table.init(options); $.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();
});
});
}
</script> </script>
</body> </body>
</html> </html>
Loading…
Cancel
Save