Commit ec0f2a79 authored by wanghuazhou's avatar wanghuazhou Committed by wux

refactor: 货币汇率菜单与接口权限

parent 5987e3c0
......@@ -33,6 +33,8 @@ CREATE TABLE IF NOT EXISTS `ecw_currency_rate_log` (
PRIMARY KEY (`id`)
) COMMENT '币种汇率变更表';
BEGIN;
INSERT INTO `system_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES ('货币汇率状态', 'currency_rate_status', 0, NULL, '1', '2022-05-23 23:29:07', '1', '2022-05-23 23:34:59', b'0');
......@@ -41,3 +43,20 @@ INSERT INTO `system_dict_data`
VALUES
(0, '已过期', '1', 'currency_rate_status', 0, 'warning', '', NULL, '1', '2022-11-18 00:18:34', '1', '2023-01-15 18:09:43', b'0', 'Expired'),
(1, '生效中', '0', 'currency_rate_status', 0, 'warning', '', NULL, '1', '2022-11-18 00:18:34', '1', '2023-01-15 18:09:43', b'0', 'Active');
SET @parent = 1244;
INSERT INTO `system_menu` (`name`, `permission`, `menu_type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `is_show_in_menu_bar`, `name_en`, `keepalive`, `redirect`)
VALUES ('货币汇率', 'ecw:currency:rate:query', 2, 3, @parent, 'currencyRate', 'money', 'ecw/currencyRate/index', 0, '115', '2023-07-09 16:02:32', '115', '2023-07-12 22:33:09', b'0', b'1', 'currency rate', b'0', NULL);
SET @parent = LAST_INSERT_ID();
INSERT INTO `system_menu`
(`name`, `permission`, `menu_type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `is_show_in_menu_bar`, `name_en`, `keepalive`, `redirect`)
VALUES
('货币汇率新增', 'ecw:currency:rate:create', 3, 1, @parent, '', '', '', 0, '115', '2023-07-09 16:02:32', '115', '2023-07-12 22:33:09', b'0', b'0', 'create', b'0', NULL),
('货币汇率编辑', 'ecw:currency:rate:update', 3, 2, @parent, '', '', '', 0, '115', '2023-07-09 16:02:32', '115', '2023-07-12 22:33:09', b'0', b'0', 'update', b'0', NULL),
('货币汇率删除', 'ecw:currency:rate:delete', 3, 3, @parent, '', '', '', 0, '115', '2023-07-09 16:02:32', '115', '2023-07-12 22:33:09', b'0', b'0', 'delete', b'0', NULL),
('货币汇率日志', 'ecw:currency:rate:history', 3, 4, @parent, '', '', '', 0, '115', '2023-07-09 16:02:32', '115', '2023-07-12 22:33:09', b'0', b'0', 'history', b'0', NULL);
COMMIT;
\ No newline at end of file
......@@ -13,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -37,6 +38,7 @@ public class CurrencyRateController {
@PostMapping("/create")
@ApiOperation("创建汇率信息")
@PreAuthorize("@ss.hasPermission('ecw:currency:rate:create')")
public CommonResult<Boolean> create(@Valid @RequestBody CurrencyRateCreateReqVO req) {
service.create(req);
return success(true);
......@@ -44,6 +46,7 @@ public class CurrencyRateController {
@PutMapping("/update")
@ApiOperation("更新汇率信息")
@PreAuthorize("@ss.hasPermission('ecw:currency:rate:update')")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<Boolean> update(@RequestParam("id") Long id, @Valid @RequestBody CurrencyRateUpdateReqVO req) {
service.update(id, req);
......@@ -52,6 +55,7 @@ public class CurrencyRateController {
@DeleteMapping("/delete")
@ApiOperation("删除汇率信息")
@PreAuthorize("@ss.hasPermission('ecw:currency:rate:delete')")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
service.delete(id);
......@@ -60,18 +64,21 @@ public class CurrencyRateController {
@GetMapping("/page")
@ApiOperation("分页查询汇率信息")
@PreAuthorize("@ss.hasPermission('ecw:currency:rate:query')")
public CommonResult<PageResult<CurrencyRateDO>> page(@Valid CurrencyRateQueryParamVO param) {
return success(service.query(param));
}
@GetMapping("/get")
@ApiOperation("根据币种获取汇率信息")
@PreAuthorize("@ss.hasPermission('ecw:currency:rate:query')")
public CommonResult<CurrencyRateDO> get(@RequestParam("sourceId") Long sourceId, @RequestParam("targetId") Long targetId) {
return success(service.find(sourceId, targetId));
}
@GetMapping("/logs")
@ApiOperation("根据币种获取汇率根据货币符号")
@PreAuthorize("@ss.hasPermission('ecw:currency:rate:history')")
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<PageResult<CurrencyRateLogDO>> logs(@RequestParam("id") Long id, PageParam page) {
return success(service.history(id, page));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment