Browse Source

默认币种

24282 2 years ago
parent
commit
4d881802c6

+ 44 - 0
hx-common/src/main/java/com/fjhx/common/controller/currency/CurrencyRateController.java

@@ -0,0 +1,44 @@
+package com.fjhx.common.controller.currency;
+
+import com.fjhx.common.entity.currency.po.CurrencyRate;
+import com.fjhx.common.service.currency.CurrencyRateService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 币种默认汇率 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-04-24
+ */
+@RestController
+@RequestMapping("/currencyRate")
+public class CurrencyRateController {
+
+    @Autowired
+    private CurrencyRateService currencyRateService;
+
+    /**
+     * 币种默认汇率列表
+     */
+    @PostMapping("/list")
+    public List<CurrencyRate> list() {
+        return currencyRateService.getList();
+    }
+
+    /**
+     * 币种默认汇率编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody List<CurrencyRate> currencyRateList) {
+        currencyRateService.edit(currencyRateList);
+    }
+
+}

+ 33 - 0
hx-common/src/main/java/com/fjhx/common/entity/currency/po/CurrencyRate.java

@@ -0,0 +1,33 @@
+package com.fjhx.common.entity.currency.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 币种默认汇率
+ * </p>
+ *
+ * @author
+ * @since 2023-04-24
+ */
+@Getter
+@Setter
+@TableName("currency_rate")
+public class CurrencyRate extends BasePo {
+
+    /**
+     * 币种类型
+     */
+    private String type;
+
+    /**
+     * 汇率
+     */
+    private BigDecimal rate;
+
+}

+ 16 - 0
hx-common/src/main/java/com/fjhx/common/mapper/currency/CurrencyRateMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.common.mapper.currency;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.common.entity.currency.po.CurrencyRate;
+
+/**
+ * <p>
+ * 币种默认汇率 Mapper 接口
+ * </p>
+ *
+ * @author
+ * @since 2023-04-24
+ */
+public interface CurrencyRateMapper extends BaseMapper<CurrencyRate> {
+
+}

+ 28 - 0
hx-common/src/main/java/com/fjhx/common/service/currency/CurrencyRateService.java

@@ -0,0 +1,28 @@
+package com.fjhx.common.service.currency;
+
+import com.fjhx.common.entity.currency.po.CurrencyRate;
+import com.ruoyi.common.core.service.BaseService;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 币种默认汇率 服务类
+ * </p>
+ *
+ * @author
+ * @since 2023-04-24
+ */
+public interface CurrencyRateService extends BaseService<CurrencyRate> {
+
+    /**
+     * 币种默认汇率列表
+     */
+    List<CurrencyRate> getList();
+
+    /**
+     * 币种默认汇率编辑
+     */
+    void edit(List<CurrencyRate> currencyRateList);
+
+}

+ 32 - 0
hx-common/src/main/java/com/fjhx/common/service/currency/impl/CurrencyRateServiceImpl.java

@@ -0,0 +1,32 @@
+package com.fjhx.common.service.currency.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.entity.currency.po.CurrencyRate;
+import com.fjhx.common.mapper.currency.CurrencyRateMapper;
+import com.fjhx.common.service.currency.CurrencyRateService;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 币种默认汇率 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-04-24
+ */
+@Service
+public class CurrencyRateServiceImpl extends ServiceImpl<CurrencyRateMapper, CurrencyRate> implements CurrencyRateService {
+
+    @Override
+    public List<CurrencyRate> getList() {
+        return list();
+    }
+
+    @Override
+    public void edit(List<CurrencyRate> currencyRateList) {
+        saveOrUpdateBatch(currencyRateList);
+    }
+
+}

+ 5 - 0
hx-common/src/main/resources/mapper/currency/CurrencyRateMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fjhx.common.mapper.currency.CurrencyRateMapper">
+
+</mapper>