md
This commit is contained in:
parent
38ecc1885b
commit
e936ada53f
@ -41,12 +41,10 @@ public class EmisCreditCustomer extends BaseEntity
|
||||
private String customerCode;
|
||||
/* 月结卡号 */
|
||||
private String monthlyPayCode;
|
||||
/* 当前余额 */
|
||||
private BigDecimal curMoney;
|
||||
/* 余额比率 */
|
||||
private BigDecimal curMoneyRate;
|
||||
/* 信用额度 */
|
||||
private BigDecimal creditMoney;
|
||||
/* 使用额度 */
|
||||
private BigDecimal useMoney;
|
||||
/* 币种 */
|
||||
private String currency;
|
||||
/* 运输方式 */
|
||||
|
||||
@ -39,12 +39,10 @@ public class EmisCreditSalesmen extends BaseEntity
|
||||
private String accCode;
|
||||
/* 销售名称 */
|
||||
private String salesmen;
|
||||
/* 当前余额 */
|
||||
private BigDecimal curMoney;
|
||||
/* 余额比率 */
|
||||
private BigDecimal curMoneyRate;
|
||||
/* 信用额度 */
|
||||
private BigDecimal creditMoney;
|
||||
/* 使用额度 */
|
||||
private BigDecimal useMoney;
|
||||
/* 币种 */
|
||||
private String currency;
|
||||
/* 运输方式 */
|
||||
|
||||
@ -236,28 +236,29 @@ public class EmisBaseService {
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditCustomer)){
|
||||
EmisCreditCustomer item0=listCreditCustomer.get(0);
|
||||
if(emisWaybill.getFreight().compareTo(item0.getCurMoney()) == 1 ){
|
||||
BigDecimal preBalance=item0.getCreditMoney().subtract(item0.getUseMoney());
|
||||
|
||||
if(emisWaybill.getFreight().compareTo(preBalance) == 1 ){
|
||||
// 提示异常
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "超出信用额度");
|
||||
}else{
|
||||
|
||||
// 当前余额,变动后余额,变动金额
|
||||
BigDecimal curMoney=item0.getCurMoney();
|
||||
BigDecimal backBalance=curMoney.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=BigDecimal.ZERO.subtract(emisWaybill.getFreight());
|
||||
BigDecimal backBalance=preBalance.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=emisWaybill.getFreight();
|
||||
|
||||
// 扣减额度,插入扣额度数据明细
|
||||
EmisCreditCustomerRecord itemRecord=new EmisCreditCustomerRecord();
|
||||
itemRecord.setAccCode(item0.getAccCode());
|
||||
itemRecord.setCustomerCode(item0.getCustomerCode());
|
||||
itemRecord.setBillCode(emisWaybill.getBillCode());
|
||||
itemRecord.setPreBalance(curMoney);
|
||||
itemRecord.setPreBalance(preBalance);
|
||||
itemRecord.setChangeMoney(emisWaybill.getFreight());
|
||||
itemRecord.setChangeType("2");
|
||||
itemRecord.setBackBalance(backBalance);
|
||||
emisCreditCustomerRecordMapper.insertEmisCreditCustomerRecord(itemRecord);
|
||||
|
||||
// 更新余额
|
||||
// 更新使用额度
|
||||
emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
}
|
||||
@ -274,22 +275,22 @@ public class EmisBaseService {
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditSalesmen)){
|
||||
EmisCreditSalesmen item0=listCreditSalesmen.get(0);
|
||||
if(emisWaybill.getFreight().compareTo(item0.getCurMoney()) == 1 ){
|
||||
|
||||
BigDecimal preBalance=item0.getCreditMoney().subtract(item0.getUseMoney());
|
||||
if(emisWaybill.getFreight().compareTo(preBalance) == 1 ){
|
||||
// 提示异常
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "超出信用额度");
|
||||
}else{
|
||||
|
||||
// 当前余额,变动后余额,变动金额
|
||||
BigDecimal curMoney=item0.getCurMoney();
|
||||
BigDecimal backBalance=curMoney.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=BigDecimal.ZERO.subtract(emisWaybill.getFreight());
|
||||
|
||||
BigDecimal backBalance=preBalance.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=emisWaybill.getFreight();
|
||||
// 扣减额度,插入扣额度数据明细
|
||||
EmisCreditSalesmenRecord itemRecord=new EmisCreditSalesmenRecord();
|
||||
itemRecord.setAccCode(item0.getAccCode());
|
||||
itemRecord.setSalesmen(item0.getSalesmen());
|
||||
itemRecord.setBillCode(emisWaybill.getBillCode());
|
||||
itemRecord.setPreBalance(curMoney);
|
||||
itemRecord.setPreBalance(preBalance);
|
||||
itemRecord.setChangeMoney(emisWaybill.getFreight());
|
||||
itemRecord.setChangeType("2");
|
||||
itemRecord.setBackBalance(backBalance);
|
||||
@ -302,123 +303,6 @@ public class EmisBaseService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新运单调整信用额度
|
||||
* @param emisWaybill
|
||||
*/
|
||||
public void ajustUseQuotaCredit(EmisWaybill emisWaybill,EmisWaybill oldEmisWaybill) throws EmisBizError {
|
||||
|
||||
// 删除原来的数据数据
|
||||
EmisCreditCustomerRecord queryRecord = new EmisCreditCustomerRecord();
|
||||
queryRecord.setBillCode(emisWaybill.getBillCode());
|
||||
queryRecord.setChangeType("2");
|
||||
List<EmisCreditCustomerRecord> listRecord=emisCreditCustomerRecordMapper.selectEmisCreditCustomerRecordList(queryRecord);
|
||||
if(!CollectionUtils.isEmpty(listRecord)){
|
||||
EmisCreditCustomerRecord item0=listRecord.get(0);
|
||||
BigDecimal changeMoney=item0.getChangeMoney();
|
||||
// 删除扣减数据
|
||||
emisCreditCustomerRecordMapper.deleteEmisCreditCustomerRecordById(item0.getId());
|
||||
// 增加余额数据
|
||||
emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
|
||||
// // 返回越来现金数据
|
||||
// EmisCreditSalesmenRecord queryRecord = new EmisCreditCustomerRecord();
|
||||
// queryRecord.setBillCode(emisWaybill.getBillCode());
|
||||
// queryRecord.setChangeType("2");
|
||||
// List<EmisCreditCustomerRecord> listRecord=emisCreditCustomerRecordMapper.selectEmisCreditCustomerRecordList(queryRecord);
|
||||
// if(!CollectionUtils.isEmpty(listRecord)){
|
||||
// EmisCreditCustomerRecord item0=listRecord.get(0);
|
||||
// BigDecimal changeMoney=item0.getChangeMoney();
|
||||
// // 删除扣减数据
|
||||
// emisCreditCustomerRecordMapper.deleteEmisCreditCustomerRecordById(item0.getId());
|
||||
// // 增加余额数据
|
||||
// emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
// }
|
||||
|
||||
|
||||
// 删除原来的占用,重新变更数据
|
||||
String paymentType=emisWaybill.getPaymentType();
|
||||
// 月结客户
|
||||
if("2".equals(paymentType)
|
||||
|| "4".equals(paymentType)
|
||||
|| "5".equals(paymentType)
|
||||
){
|
||||
// 月结额度占用
|
||||
EmisCreditCustomer queryCreditCustomer = new EmisCreditCustomer();
|
||||
queryCreditCustomer.setMonthlyPayCode(emisWaybill.getCustNo());
|
||||
queryCreditCustomer.getParams().put("sendDate",emisWaybill.getSendDate());
|
||||
queryCreditCustomer.setTransType(emisWaybill.getTransType());
|
||||
List<EmisCreditCustomer> listCreditCustomer=emisCreditCustomerMapper.selectEmisCreditCustomerList(queryCreditCustomer);
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditCustomer)){
|
||||
EmisCreditCustomer item0=listCreditCustomer.get(0);
|
||||
if(emisWaybill.getFreight().compareTo(item0.getCurMoney()) == 1 ){
|
||||
// 提示异常
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "超出信用额度");
|
||||
}else{
|
||||
|
||||
// 当前余额,变动后余额,变动金额
|
||||
BigDecimal curMoney=item0.getCurMoney();
|
||||
BigDecimal backBalance=curMoney.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=BigDecimal.ZERO.subtract(emisWaybill.getFreight());
|
||||
|
||||
// 扣减额度,插入扣额度数据明细
|
||||
EmisCreditCustomerRecord itemRecord=new EmisCreditCustomerRecord();
|
||||
itemRecord.setAccCode(item0.getAccCode());
|
||||
itemRecord.setCustomerCode(item0.getCustomerCode());
|
||||
itemRecord.setBillCode(emisWaybill.getBillCode());
|
||||
itemRecord.setPreBalance(curMoney);
|
||||
itemRecord.setChangeMoney(emisWaybill.getFreight());
|
||||
itemRecord.setChangeType("2");
|
||||
itemRecord.setBackBalance(backBalance);
|
||||
emisCreditCustomerRecordMapper.insertEmisCreditCustomerRecord(itemRecord);
|
||||
|
||||
// 更新余额
|
||||
emisCreditCustomerMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
}
|
||||
}else if("1".equals(paymentType)
|
||||
|| "3".equals(paymentType)
|
||||
){
|
||||
// 现金额度占用
|
||||
EmisCreditSalesmen queryCreditSalesmen= new EmisCreditSalesmen();
|
||||
queryCreditSalesmen.setSalesmen(emisWaybill.getSalesmen());
|
||||
queryCreditSalesmen.getParams().put("sendDate",emisWaybill.getSendDate());
|
||||
queryCreditSalesmen.setTransType(emisWaybill.getTransType());
|
||||
List<EmisCreditSalesmen> listCreditSalesmen=emisCreditSalesmenMapper.selectEmisCreditSalesmenList(queryCreditSalesmen);
|
||||
|
||||
if(!CollectionUtils.isEmpty(listCreditSalesmen)){
|
||||
EmisCreditSalesmen item0=listCreditSalesmen.get(0);
|
||||
if(emisWaybill.getFreight().compareTo(item0.getCurMoney()) == 1 ){
|
||||
// 提示异常
|
||||
throw new EmisBizError(EmisBizErrorType.FAIL, "超出信用额度");
|
||||
}else{
|
||||
|
||||
// 当前余额,变动后余额,变动金额
|
||||
BigDecimal curMoney=item0.getCurMoney();
|
||||
BigDecimal backBalance=curMoney.subtract(emisWaybill.getFreight());
|
||||
BigDecimal changeMoney=BigDecimal.ZERO.subtract(emisWaybill.getFreight());
|
||||
|
||||
// 扣减额度,插入扣额度数据明细
|
||||
EmisCreditSalesmenRecord itemRecord=new EmisCreditSalesmenRecord();
|
||||
itemRecord.setAccCode(item0.getAccCode());
|
||||
itemRecord.setSalesmen(item0.getSalesmen());
|
||||
itemRecord.setBillCode(emisWaybill.getBillCode());
|
||||
itemRecord.setPreBalance(curMoney);
|
||||
itemRecord.setChangeMoney(emisWaybill.getFreight());
|
||||
itemRecord.setChangeType("2");
|
||||
itemRecord.setBackBalance(backBalance);
|
||||
emisCreditSalesmenRecordMapper.insertEmisCreditSalesmenRecord(itemRecord);
|
||||
|
||||
// 更新余额
|
||||
emisCreditSalesmenMapper.changeBalance(item0.getAccCode(),changeMoney);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 录入运单操作日志
|
||||
* @param billCode
|
||||
|
||||
@ -9,9 +9,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="accCode" column="acc_code" />
|
||||
<result property="customerCode" column="customer_code" />
|
||||
<result property="monthlyPayCode" column="monthly_pay_code" />
|
||||
<result property="curMoney" column="cur_money" />
|
||||
<result property="curMoneyRate" column="cur_money_rate" />
|
||||
<result property="creditMoney" column="credit_money" />
|
||||
<result property="useMoney" column="use_money" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="transType" column="trans_type" />
|
||||
<result property="startDate" column="start_date" />
|
||||
@ -24,13 +23,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisCreditCustomerVo">
|
||||
select id, acc_code, customer_code, monthly_pay_code, cur_money, cur_money_rate, credit_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_credit_customer
|
||||
select id, acc_code, customer_code, monthly_pay_code, credit_money, use_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_credit_customer
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisCreditCustomerList" parameterType="EmisCreditCustomer" resultMap="EmisCreditCustomerResult">
|
||||
select
|
||||
a.id,a.acc_code, a.customer_code, a.monthly_pay_code,a.cur_money, a.cur_money_rate,
|
||||
a.id,a.acc_code, a.customer_code, a.monthly_pay_code,a.use_money,
|
||||
a.credit_money, a.currency, a.trans_type, a.start_date, a.end_date,
|
||||
a.bl_open, a.remark, a.tenant_id, a.del_flag, a.create_by, a.create_time,
|
||||
a.update_by, a.update_time, a.create_site, a.update_site,
|
||||
@ -42,8 +41,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="accCode != null and accCode != ''"> and acc_code=#{accCode}</if>
|
||||
<if test="customerCode != null and customerCode != ''"> and a.customer_code=#{customerCode}</if>
|
||||
<if test="monthlyPayCode != null and monthlyPayCode != ''"> and a.monthly_pay_code=#{monthlyPayCode}</if>
|
||||
<if test="curMoney != null "> and a.cur_money = #{curMoney}</if>
|
||||
<if test="curMoneyRate != null "> and a.cur_money_rate = #{curMoneyRate}</if>
|
||||
<if test="creditMoney != null "> and a.credit_money = #{creditMoney}</if>
|
||||
<if test="currency != null and currency != ''"> and a.currency=#{currency}</if>
|
||||
<if test="transType != null and transType != ''"> and FIND_IN_SET(#{transType},a.trans_type)</if>
|
||||
@ -61,17 +58,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateSite != null and updateSite != ''"> and a.update_site like concat('%', #{updateSite}, '%')</if>
|
||||
|
||||
<if test="params.beginCurMoney != null and params.beginCurMoney != ''">
|
||||
and a.cur_money <![CDATA[ >= ]]> #{params.beginCurMoney}
|
||||
and (a.credit_money-a.use_money) <![CDATA[ >= ]]> #{params.beginCurMoney}
|
||||
</if>
|
||||
<if test="params.endCurMoney != null and params.endCurMoney != ''">
|
||||
and a.cur_money <![CDATA[ < ]]> #{params.endCurMoney}
|
||||
and (a.credit_money-a.use_money) <![CDATA[ < ]]> #{params.endCurMoney}
|
||||
</if>
|
||||
|
||||
<if test="params.beginCurMoneyRate != null and params.beginCurMoneyRate != ''">
|
||||
and (a.cur_money/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
|
||||
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
|
||||
</if>
|
||||
<if test="params.endCurMoneyRate != null and params.endCurMoneyRate != ''">
|
||||
and (a.cur_money/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
|
||||
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
|
||||
</if>
|
||||
|
||||
<if test="params.sendDate != null ">
|
||||
@ -94,10 +91,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from emis_credit_customer
|
||||
where del_flag='0'
|
||||
and id = #{id}
|
||||
and acc_code = #{accCode}
|
||||
and customer_code = #{customerCode}
|
||||
and cur_money = #{curMoney}
|
||||
and cur_money_rate = #{curMoneyRate}
|
||||
and monthly_pay_code = #{monthlyPayCode}
|
||||
and credit_money = #{creditMoney}
|
||||
and use_money = #{useMoney}
|
||||
and currency = #{currency}
|
||||
and trans_type = #{transType}
|
||||
and start_date = #{startDate}
|
||||
@ -117,7 +115,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectEmisCreditCustomerById" parameterType="Long" resultMap="EmisCreditCustomerResult">
|
||||
select
|
||||
a.id,a.acc_code, a.customer_code,a.monthly_pay_code, a.cur_money, a.cur_money_rate,
|
||||
a.id,a.acc_code, a.customer_code,a.monthly_pay_code, a.use_money,
|
||||
a.credit_money, a.currency, a.trans_type, a.start_date, a.end_date,
|
||||
a.bl_open, a.remark, a.tenant_id, a.del_flag, a.create_by, a.create_time,
|
||||
a.update_by, a.update_time, a.create_site, a.update_site,
|
||||
@ -129,12 +127,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<insert id="insertEmisCreditCustomer" parameterType="EmisCreditCustomer" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_credit_customer
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">id,</if>
|
||||
<if test="accCode != null and accCode != ''">acc_code,</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code,</if>
|
||||
<if test="monthlyPayCode != null and monthlyPayCode != ''">monthly_pay_code,</if>
|
||||
<if test="curMoney != null">cur_money,</if>
|
||||
<if test="curMoneyRate != null">cur_money_rate,</if>
|
||||
<if test="creditMoney != null">credit_money,</if>
|
||||
<if test="useMoney != null">use_money,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="transType != null and transType != ''">trans_type,</if>
|
||||
<if test="startDate != null">start_date,</if>
|
||||
@ -151,12 +149,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateSite != null and updateSite != ''">update_site,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
<if test="accCode != null and accCode != ''">#{accCode},</if>
|
||||
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
|
||||
<if test="monthlyPayCode != null and monthlyPayCode != ''">#{monthlyPayCode},</if>
|
||||
<if test="curMoney != null">#{curMoney},</if>
|
||||
<if test="curMoneyRate != null">#{curMoneyRate},</if>
|
||||
<if test="creditMoney != null">#{creditMoney},</if>
|
||||
<if test="useMoney != null">#{useMoney},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="transType != null and transType != ''">#{transType},</if>
|
||||
<if test="startDate != null">#{startDate},</if>
|
||||
@ -180,9 +178,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="accCode != null and accCode != ''">acc_code = #{accCode},</if>
|
||||
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
|
||||
<if test="monthlyPayCode != null and monthlyPayCode != ''">monthly_pay_code = #{monthlyPayCode},</if>
|
||||
<if test="curMoney != null">cur_money = #{curMoney},</if>
|
||||
<if test="curMoneyRate != null">cur_money_rate = #{curMoneyRate},</if>
|
||||
<if test="creditMoney != null">credit_money = #{creditMoney},</if>
|
||||
<if test="useMoney != null">use_money = #{useMoney},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
|
||||
<if test="startDate != null">start_date = #{startDate},</if>
|
||||
@ -203,7 +200,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<update id="changeBalance" >
|
||||
update emis_credit_customer set cur_money = cur_money + #{changeMoney} where acc_code = #{accCode}
|
||||
update emis_credit_customer set use_money = use_money + #{changeMoney} where acc_code = #{accCode}
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
@ -8,9 +8,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="id" column="id" />
|
||||
<result property="accCode" column="acc_code" />
|
||||
<result property="salesmen" column="salesmen" />
|
||||
<result property="curMoney" column="cur_money" />
|
||||
<result property="curMoneyRate" column="cur_money_rate" />
|
||||
<result property="creditMoney" column="credit_money" />
|
||||
<result property="useMoney" column="use_money" />
|
||||
<result property="currency" column="currency" />
|
||||
<result property="transType" column="trans_type" />
|
||||
<result property="startDate" column="start_date" />
|
||||
@ -19,19 +18,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisCreditSalesmenVo">
|
||||
select id, acc_code, salesmen, cur_money, cur_money_rate, credit_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_credit_salesmen
|
||||
select id, acc_code, salesmen, credit_money, use_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_credit_salesmen
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisCreditSalesmenList" parameterType="EmisCreditSalesmen" resultMap="EmisCreditSalesmenResult">
|
||||
select id, acc_code, salesmen, cur_money, cur_money_rate, credit_money, currency, trans_type, start_date, end_date, bl_open,remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, acc_code, salesmen, credit_money, use_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_credit_salesmen a
|
||||
<where>
|
||||
del_flag='0'
|
||||
<if test="id != null "> and id = #{id}</if>
|
||||
<if test="accCode != null and accCode != ''"> and acc_code=#{accCode}</if>
|
||||
<if test="salesmen != null and salesmen != ''"> and salesmen=#{salesmen}</if>
|
||||
<if test="curMoney != null "> and cur_money = #{curMoney}</if>
|
||||
<if test="curMoneyRate != null "> and cur_money_rate = #{curMoneyRate}</if>
|
||||
<if test="creditMoney != null "> and credit_money = #{creditMoney}</if>
|
||||
<if test="currency != null and currency != ''"> and currency=#{currency}</if>
|
||||
<if test="transType != null and transType != ''"> and FIND_IN_SET(#{transType},a.trans_type)</if>
|
||||
@ -50,17 +47,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<if test="params.beginCurMoney != null and params.beginCurMoney != ''">
|
||||
and a.cur_money <![CDATA[ >= ]]> #{params.beginCurMoney}
|
||||
and (a.credit_money-a.use_money) <![CDATA[ >= ]]> #{params.beginCurMoney}
|
||||
</if>
|
||||
<if test="params.endCurMoney != null and params.endCurMoney != ''">
|
||||
and a.cur_money <![CDATA[ < ]]> #{params.endCurMoney}
|
||||
and (a.credit_money-a.use_money) <![CDATA[ < ]]> #{params.endCurMoney}
|
||||
</if>
|
||||
|
||||
<if test="params.beginCurMoneyRate != null and params.beginCurMoneyRate != ''">
|
||||
and (a.cur_money/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
|
||||
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ >= ]]> #{params.beginCurMoneyRate}
|
||||
</if>
|
||||
<if test="params.endCurMoneyRate != null and params.endCurMoneyRate != ''">
|
||||
and (a.cur_money/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
|
||||
and ((a.credit_money-a.use_money)/a.credit_money)*100 <![CDATA[ < ]]> #{params.endCurMoneyRate}
|
||||
</if>
|
||||
|
||||
<if test="params.sendDate != null ">
|
||||
@ -77,10 +74,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
select count(1) from emis_credit_salesmen
|
||||
where del_flag='0'
|
||||
and id = #{id}
|
||||
and acc_code = #{accCode}
|
||||
and salesmen = #{salesmen}
|
||||
and cur_money = #{curMoney}
|
||||
and cur_money_rate = #{curMoneyRate}
|
||||
and credit_money = #{creditMoney}
|
||||
and use_money = #{useMoney}
|
||||
and currency = #{currency}
|
||||
and trans_type = #{transType}
|
||||
and start_date = #{startDate}
|
||||
@ -99,7 +96,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectEmisCreditSalesmenById" parameterType="Long" resultMap="EmisCreditSalesmenResult">
|
||||
select id, acc_code, salesmen, cur_money, cur_money_rate, credit_money, currency, trans_type, start_date, end_date, bl_open,remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
select id, acc_code, salesmen, credit_money, use_money, currency, trans_type, start_date, end_date, bl_open, remark, tenant_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
|
||||
from emis_credit_salesmen a
|
||||
where a.id = #{id}
|
||||
</select>
|
||||
@ -109,9 +106,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="accCode != null and accCode != ''">acc_code,</if>
|
||||
<if test="salesmen != null and salesmen != ''">salesmen,</if>
|
||||
<if test="curMoney != null">cur_money,</if>
|
||||
<if test="curMoneyRate != null">cur_money_rate,</if>
|
||||
<if test="creditMoney != null">credit_money,</if>
|
||||
<if test="useMoney != null">use_money,</if>
|
||||
<if test="currency != null and currency != ''">currency,</if>
|
||||
<if test="transType != null and transType != ''">trans_type,</if>
|
||||
<if test="startDate != null">start_date,</if>
|
||||
@ -130,9 +126,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="accCode != null and accCode != ''">#{accCode},</if>
|
||||
<if test="salesmen != null and salesmen != ''">#{salesmen},</if>
|
||||
<if test="curMoney != null">#{curMoney},</if>
|
||||
<if test="curMoneyRate != null">#{curMoneyRate},</if>
|
||||
<if test="creditMoney != null">#{creditMoney},</if>
|
||||
<if test="useMoney != null">#{useMoney},</if>
|
||||
<if test="currency != null and currency != ''">#{currency},</if>
|
||||
<if test="transType != null and transType != ''">#{transType},</if>
|
||||
<if test="startDate != null">#{startDate},</if>
|
||||
@ -153,11 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<update id="updateEmisCreditSalesmen" parameterType="EmisCreditSalesmen">
|
||||
update emis_credit_salesmen
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="accCode != null and accCode != ''">acc_code = #{accCode},</if>
|
||||
<if test="salesmen != null and salesmen != ''">salesmen = #{salesmen},</if>
|
||||
<if test="curMoney != null">cur_money = #{curMoney},</if>
|
||||
<if test="curMoneyRate != null">cur_money_rate = #{curMoneyRate},</if>
|
||||
<if test="creditMoney != null">credit_money = #{creditMoney},</if>
|
||||
<if test="useMoney != null">use_money = #{useMoney},</if>
|
||||
<if test="currency != null and currency != ''">currency = #{currency},</if>
|
||||
<if test="transType != null and transType != ''">trans_type = #{transType},</if>
|
||||
<if test="startDate != null">start_date = #{startDate},</if>
|
||||
@ -178,7 +170,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
|
||||
<update id="changeBalance" >
|
||||
update emis_credit_salesmen set cur_money = cur_money + #{changeMoney} where acc_code = #{accCode}
|
||||
update emis_credit_salesmen set use_money = use_money + #{changeMoney} where acc_code = #{accCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmisCreditSalesmenById" parameterType="Long">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user