7 changed files with 362 additions and 0 deletions
@ -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; |
|||
} |
|||
} |
|||
@ -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; |
|||
} |
|||
} |
|||
@ -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); |
|||
} |
|||
@ -0,0 +1,10 @@ |
|||
package cn.chjyj.szwh.mapper; |
|||
|
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* 分账比例设置 |
|||
*/ |
|||
@Component |
|||
public interface AccountRatioSettingMapper { |
|||
} |
|||
@ -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> |
|||
@ -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> |
|||
@ -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…
Reference in new issue