Browse Source

分账设置

master
xyiege 4 years ago
parent
commit
6268027f2f
  1. 100
      src/main/java/cn/chjyj/szwh/bean/AccountRatioDetail.java
  2. 88
      src/main/java/cn/chjyj/szwh/bean/AccountRatioSetting.java
  3. 17
      src/main/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapper.java
  4. 10
      src/main/java/cn/chjyj/szwh/mapper/AccountRatioSettingMapper.java
  5. 62
      src/main/resources/mapper/szwh/AccountRatioDetailMapper.xml
  6. 62
      src/main/resources/mapper/szwh/AccountRatioSettingMapper.xml
  7. 23
      src/test/java/cn/chjyj/szwh/mapper/AccountRatioDetailMapperTest.java

100
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
* idsetting_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;
}
}

88
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;
/**
* 删除01
*/
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;
}
}

17
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);
}

10
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 {
}

62
src/main/resources/mapper/szwh/AccountRatioDetailMapper.xml

@ -0,0 +1,62 @@
<?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="cn.chjyj.szwh.mapper.AccountRatioDetailMapper">
<sql id="column">
id,setting_id as settingId,role_type as roleType,cost_type as costType,calculate,amount,ratio
</sql>
<sql id="tbName">account_ratio_detail</sql>
<!--查询记录列表-->
<select id="getAdminList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.AccountRatioDetail">
WITH mm as (select * from
<include refid="tbName"/>
where id>#{startRs} limit #{pageSize}
)SELECT * FROM mm ORDER BY id DESC;
</select>
<!-- 主键查询用户信息 -->
<select id="getAccountRationDetailById" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.AccountRatioDetail">
select <include refid="column"/>
from <include refid="tbName"/>
where id=#{id};
</select>
<!--根据id查询-->
<select id="getAdminByAccountId" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.AccountRatioDetail">
select
<include refid="column"/>
from
<include refid="tbName"/>
where account_id=#{accountId}
</select>
<!--新增用户 id 自增加-->
<insert id="addAdmin" parameterType="cn.chjyj.szwh.bean.AccountRatioDetail" useGeneratedKeys="true" keyColumn="id">
insert into
<include refid="tbName"/>
(account_name,account_id)
values (
#{accountName},
#{accountId}
)
</insert>
<!-- 更新-->
<update id="updateAdmin" parameterType="cn.chjyj.szwh.bean.AccountRatioDetail">
update
<include refid="tbName"/>
<set>
<if test="accountName!=null">
account_name=#{accountName},
</if>
<if test="accountId!=null">
account_id=#{accountId},
</if>
</set>
where id=#{id};
</update>
</mapper>

62
src/main/resources/mapper/szwh/AccountRatioSettingMapper.xml

@ -0,0 +1,62 @@
<?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="cn.chjyj.szwh.mapper.AccountRatioSettingMapper">
<sql id="column">
id,user_id as userId,rule_name as ruleName,`status` ,is_deleted as isDeleted,createtime
</sql>
<sql id="tbName">account_ratio_setting</sql>
<!--查询记录列表-->
<select id="getAdminList" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.AccountRatioSetting">
WITH mm as (select * from
<include refid="tbName"/>
where id>#{startRs} limit #{pageSize}
)SELECT * FROM mm ORDER BY id DESC;
</select>
<!-- 主键查询用户信息 -->
<select id="getAdminById" parameterType="java.lang.Integer" resultType="cn.chjyj.szwh.bean.AccountRatioSetting">
select <include refid="column"/>
from <include refid="tbName"/>
where id=#{id};
</select>
<!--根据id查询-->
<select id="getAdminByAccountId" parameterType="java.lang.String" resultType="cn.chjyj.szwh.bean.AccountRatioSetting">
select
<include refid="column"/>
from
<include refid="tbName"/>
where account_id=#{accountId}
</select>
<!--新增用户 id 自增加-->
<insert id="addAdmin" parameterType="cn.chjyj.szwh.bean.AccountRatioSetting" useGeneratedKeys="true" keyColumn="id">
insert into
<include refid="tbName"/>
(account_name,account_id)
values (
#{accountName},
#{accountId}
)
</insert>
<!-- 更新-->
<update id="updateAdmin" parameterType="cn.chjyj.szwh.bean.AccountRatioSetting">
update
<include refid="tbName"/>
<set>
<if test="accountName!=null">
account_name=#{accountName},
</if>
<if test="accountId!=null">
account_id=#{accountId},
</if>
</set>
where id=#{id};
</update>
</mapper>

23
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());
}
}
Loading…
Cancel
Save