From 6268027f2fd79bb5685ab76297e4b39901682800 Mon Sep 17 00:00:00 2001 From: xyiege Date: Wed, 20 Jul 2022 01:36:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E8=B4=A6=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chjyj/szwh/bean/AccountRatioDetail.java | 100 ++++++++++++++++++ .../chjyj/szwh/bean/AccountRatioSetting.java | 88 +++++++++++++++ .../szwh/mapper/AccountRatioDetailMapper.java | 17 +++ .../mapper/AccountRatioSettingMapper.java | 10 ++ .../mapper/szwh/AccountRatioDetailMapper.xml | 62 +++++++++++ .../mapper/szwh/AccountRatioSettingMapper.xml | 62 +++++++++++ .../mapper/AccountRatioDetailMapperTest.java | 23 ++++ 7 files changed, 362 insertions(+) create mode 100644 src/main/java/cn/chjyj/szwh/bean/AccountRatioDetail.java create mode 100644 src/main/java/cn/chjyj/szwh/bean/AccountRatioSetting.java create mode 100644 src/main/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapper.java create mode 100644 src/main/java/cn/chjyj/szwh/mapper/AccountRatioSettingMapper.java create mode 100644 src/main/resources/mapper/szwh/AccountRatioDetailMapper.xml create mode 100644 src/main/resources/mapper/szwh/AccountRatioSettingMapper.xml create mode 100644 src/test/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapperTest.java diff --git a/src/main/java/cn/chjyj/szwh/bean/AccountRatioDetail.java b/src/main/java/cn/chjyj/szwh/bean/AccountRatioDetail.java new file mode 100644 index 0000000..6736315 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/bean/AccountRatioDetail.java @@ -0,0 +1,100 @@ +package cn.chjyj.szwh.bean; + +import java.math.BigDecimal; + +/** + * 分账细节 + */ +public class AccountRatioDetail { + /** + * account_ratio_detail + * id,setting_id as settingId,role_type as roleType,cost_type as costType,calculate,amount,ratio + */ + private Integer id; + + /** + * 比例设置ID + */ + private Integer settingId; + + /** + * 角色类型;1:委托方;2:购买方;3:平台方 + */ + private Integer roleType; + + /** + * 费用类型;1:平台服务费用 + */ + private Integer costType; + + /** + * 计算方式;1:比例;2:固定 + */ + private Integer calculate; + + /** + * 计算方式为固定时计算额度 + */ + private BigDecimal amount; + + /** + * 计算方式为比例时计算额度 + */ + private BigDecimal ratio; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getSettingId() { + return settingId; + } + + public void setSettingId(Integer settingId) { + this.settingId = settingId; + } + + public Integer getRoleType() { + return roleType; + } + + public void setRoleType(Integer roleType) { + this.roleType = roleType; + } + + public Integer getCostType() { + return costType; + } + + public void setCostType(Integer costType) { + this.costType = costType; + } + + public Integer getCalculate() { + return calculate; + } + + public void setCalculate(Integer calculate) { + this.calculate = calculate; + } + + public BigDecimal getAmount() { + return amount; + } + + public void setAmount(BigDecimal amount) { + this.amount = amount; + } + + public BigDecimal getRatio() { + return ratio; + } + + public void setRatio(BigDecimal ratio) { + this.ratio = ratio; + } +} \ No newline at end of file diff --git a/src/main/java/cn/chjyj/szwh/bean/AccountRatioSetting.java b/src/main/java/cn/chjyj/szwh/bean/AccountRatioSetting.java new file mode 100644 index 0000000..1c949e4 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/bean/AccountRatioSetting.java @@ -0,0 +1,88 @@ +package cn.chjyj.szwh.bean; + +import java.util.Date; + + +/** + * 分帐设置 + */ +public class AccountRatioSetting { + /** + * account_ratio_setting + * id,user_id as userId,rule_name as ruleName,`status` ,is_deleted as isDeleted,createtime + */ + private Integer id; + + /** + * 用户ID + */ + private Integer userId; + + /** + * 规则名称 + */ + private String ruleName; + + /** + * 状态;0:禁用;1:启用 + */ + private String status; + + /** + * 删除;0:否;1:是 + */ + private Integer isDeleted; + + /** + * 创建时间 + */ + private Date createtime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getUserId() { + return userId; + } + + public void setUserId(Integer userId) { + this.userId = userId; + } + + public String getRuleName() { + return ruleName; + } + + public void setRuleName(String ruleName) { + this.ruleName = ruleName; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Integer getIsDeleted() { + return isDeleted; + } + + public void setIsDeleted(Integer isDeleted) { + this.isDeleted = isDeleted; + } + + public Date getCreatetime() { + return createtime; + } + + public void setCreatetime(Date createtime) { + this.createtime = createtime; + } +} \ No newline at end of file diff --git a/src/main/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapper.java b/src/main/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapper.java new file mode 100644 index 0000000..aec0a35 --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapper.java @@ -0,0 +1,17 @@ +package cn.chjyj.szwh.mapper; + +import cn.chjyj.szwh.bean.AccountRatioDetail; +import org.springframework.stereotype.Component; + +/** + * 分账细节 + */ +@Component +public interface AccountRatioDetailMapper { + /** + * 根据id查找 + * @param id + * @return + */ + AccountRatioDetail getAccountRationDetailById(Integer id); +} diff --git a/src/main/java/cn/chjyj/szwh/mapper/AccountRatioSettingMapper.java b/src/main/java/cn/chjyj/szwh/mapper/AccountRatioSettingMapper.java new file mode 100644 index 0000000..084bd0f --- /dev/null +++ b/src/main/java/cn/chjyj/szwh/mapper/AccountRatioSettingMapper.java @@ -0,0 +1,10 @@ +package cn.chjyj.szwh.mapper; + +import org.springframework.stereotype.Component; + +/** + * 分账比例设置 + */ +@Component +public interface AccountRatioSettingMapper { +} diff --git a/src/main/resources/mapper/szwh/AccountRatioDetailMapper.xml b/src/main/resources/mapper/szwh/AccountRatioDetailMapper.xml new file mode 100644 index 0000000..ac818cf --- /dev/null +++ b/src/main/resources/mapper/szwh/AccountRatioDetailMapper.xml @@ -0,0 +1,62 @@ + + + + + + id,setting_id as settingId,role_type as roleType,cost_type as costType,calculate,amount,ratio + + account_ratio_detail + + + + + + + + + + + + + insert into + + (account_name,account_id) + values ( + #{accountName}, + #{accountId} + ) + + + + + update + + + + account_name=#{accountName}, + + + account_id=#{accountId}, + + + where id=#{id}; + + + \ No newline at end of file diff --git a/src/main/resources/mapper/szwh/AccountRatioSettingMapper.xml b/src/main/resources/mapper/szwh/AccountRatioSettingMapper.xml new file mode 100644 index 0000000..f8fcb5e --- /dev/null +++ b/src/main/resources/mapper/szwh/AccountRatioSettingMapper.xml @@ -0,0 +1,62 @@ + + + + + + id,user_id as userId,rule_name as ruleName,`status` ,is_deleted as isDeleted,createtime + + account_ratio_setting + + + + + + + + + + + + + insert into + + (account_name,account_id) + values ( + #{accountName}, + #{accountId} + ) + + + + + update + + + + account_name=#{accountName}, + + + account_id=#{accountId}, + + + where id=#{id}; + + + \ No newline at end of file diff --git a/src/test/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapperTest.java b/src/test/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapperTest.java new file mode 100644 index 0000000..c729c4d --- /dev/null +++ b/src/test/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapperTest.java @@ -0,0 +1,23 @@ +package cn.chjyj.szwh.mapper; + +import cn.chjyj.szwh.bean.AccountRatioDetail; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +@SpringBootTest +@RunWith(SpringRunner.class) +public class AccountRatioDetailMapperTest { + @Autowired + private AccountRatioDetailMapper accountRatioDetailMapper; + + @Test + public void getAccountRationDetailById() { + int id=1; + AccountRatioDetail acd = accountRatioDetailMapper.getAccountRationDetailById(id); + System.out.println(acd.getAmount()); + } +} \ No newline at end of file