领料接口优化
This commit is contained in:
parent
4e3520aa3d
commit
ec9e196433
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||||
import com.bonus.material.lease.domain.LeaseOutDetails;
|
import com.bonus.material.lease.domain.LeaseOutDetails;
|
||||||
import com.bonus.material.ma.domain.Type;
|
import com.bonus.material.ma.domain.Type;
|
||||||
|
import com.bonus.material.settlement.domain.SltAgreementInfo;
|
||||||
import com.bonus.material.task.domain.TmTask;
|
import com.bonus.material.task.domain.TmTask;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
|
@ -78,4 +79,39 @@ public interface LeaseOutDetailsMapper {
|
||||||
Type selectByTypeId(@Param("record") LeaseOutDetails record);
|
Type selectByTypeId(@Param("record") LeaseOutDetails record);
|
||||||
|
|
||||||
int getCountOfCodeMachine(@Param("record") LeaseOutDetails record);
|
int getCountOfCodeMachine(@Param("record") LeaseOutDetails record);
|
||||||
|
|
||||||
|
/** 插入领料出库详情表 -- 根据字段选择注入 */
|
||||||
|
int insertSelective(LeaseOutDetails record);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 减少 (ma_type 设备规格表)的库存数量
|
||||||
|
*/
|
||||||
|
int updateMaTypeStockNum(@Param("record") LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改机具设备(ma_machine表)的状态为:在用
|
||||||
|
*/
|
||||||
|
int updateMaMachineStatus(@Param("record") LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
SltAgreementInfo getSltAgreementInfo(LeaseOutDetails record);
|
||||||
|
|
||||||
|
int updSltInfo(SltAgreementInfo sltAgreementInfo);
|
||||||
|
|
||||||
|
String getAgreementId(String taskId);
|
||||||
|
|
||||||
|
Type getMaType(Long typeId);
|
||||||
|
|
||||||
|
String getProtocol(String agreementId);
|
||||||
|
|
||||||
|
int insSltInfo(@Param("record") LeaseOutDetails record, @Param("agreementId")String agreementId,@Param("ma") Type ma);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改 (lease_apply_details 领料任务详细表)的已领数量
|
||||||
|
*/
|
||||||
|
int updateLeaseApplyDetailsOutNum(@Param("record") LeaseOutDetails leaseOutDetails);
|
||||||
|
|
||||||
|
LeaseApplyDetails getLeaseApplyDetails(@Param("record") LeaseOutDetails record);
|
||||||
|
|
||||||
|
int updateLeaseApplyDetails(@Param("record") LeaseOutDetails record);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,10 +73,10 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult insertLeaseOutDetails(List<LeaseOutDetails> leaseOutDetailsList) {
|
public AjaxResult insertLeaseOutDetails(List<LeaseOutDetails> leaseOutDetailsList) {
|
||||||
for (LeaseOutDetails bean : leaseOutDetailsList) {
|
for (LeaseOutDetails bean : leaseOutDetailsList) {
|
||||||
// AjaxResult ajaxResult = submitOut(bean);
|
AjaxResult ajaxResult = submitOut(bean);
|
||||||
// if (ajaxResult.isError()) {
|
if (ajaxResult.isError()) {
|
||||||
// return ajaxResult;
|
return ajaxResult;
|
||||||
// }
|
}
|
||||||
//leaseOutDetailsMapper.insertLeaseOutDetails(bean);
|
//leaseOutDetailsMapper.insertLeaseOutDetails(bean);
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|
@ -127,56 +127,56 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
//@Override
|
//@Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
// public AjaxResult submitOut(LeaseOutDetails record) {
|
public AjaxResult submitOut(LeaseOutDetails record) {
|
||||||
// int res = 0;
|
int res = 0;
|
||||||
// try {
|
try {
|
||||||
// // 1、判断是否重复提交
|
// 1、判断是否重复提交
|
||||||
// res = checkRepeatSubmit(record);
|
res = checkRepeatSubmit(record);
|
||||||
// //record.setPreStoreNum(getStorageNum(record));
|
//record.setPreStoreNum(getStorageNum(record));
|
||||||
// if (res > 0) {
|
if (res > 0) {
|
||||||
// if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
|
if ((record.getManageType() == 1 || record.getManageType() == 2) && record.getInputNum() != null) {
|
||||||
// record.setOutNum(record.getInputNum());
|
record.setOutNum(record.getInputNum());
|
||||||
// }
|
}
|
||||||
// //2、判断成套机具出库库存是否足够
|
//2、判断成套机具出库库存是否足够
|
||||||
// if (record.getManageType() == 2) {
|
if (record.getManageType() == 2) {
|
||||||
// res = checkStorageNumCt(record);
|
res = checkStorageNumCt(record);
|
||||||
// if (res == 0) {
|
if (res == 0) {
|
||||||
// throw new RuntimeException("出库失败,库存不足");
|
throw new RuntimeException("出库失败,库存不足");
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// res = checkStorageNum(record);
|
res = checkStorageNum(record);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// if (res > 0) {
|
if (res > 0) {
|
||||||
// // 3、插入出库记录,修改库存,修改机具状态
|
// 3、插入出库记录,修改库存,修改机具状态
|
||||||
// res = insertRecords(record);
|
res = insertRecords(record);
|
||||||
// if (res == 0) {
|
if (res == 0) {
|
||||||
// throw new RuntimeException("出库失败,更新设备规格库存数量时出错!");
|
throw new RuntimeException("出库失败,更新设备规格库存数量时出错!");
|
||||||
// }
|
}
|
||||||
// // 4、修改任务状态(tm_task)
|
// 4、修改任务状态(tm_task)
|
||||||
// res = updateTaskStatus(record);
|
res = updateTaskStatus(record);
|
||||||
// if (res == 0) {
|
if (res == 0) {
|
||||||
// throw new RuntimeException("出库失败,修改任务状态失败");
|
throw new RuntimeException("出库失败,修改任务状态失败");
|
||||||
// }
|
}
|
||||||
// // 5、插入结算记录
|
// 5、插入结算记录
|
||||||
// String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
|
String taskId = leaseOutDetailsMapper.getTaskId(record.getParentId());
|
||||||
// res = insSltInfo(taskId, record);
|
res = insSltInfo(taskId, record);
|
||||||
// if (res == 0) {
|
if (res == 0) {
|
||||||
// throw new RuntimeException("出库失败,插入结算记录失败");
|
throw new RuntimeException("出库失败,插入结算记录失败");
|
||||||
// }
|
}
|
||||||
// //record.setPostStoreNum(getStorageNum(record));
|
//record.setPostStoreNum(getStorageNum(record));
|
||||||
// } else {
|
} else {
|
||||||
// return AjaxResult.error("领料出库失败,机具库存不足");
|
return AjaxResult.error("领料出库失败,机具库存不足");
|
||||||
// }
|
}
|
||||||
// } else {
|
} else {
|
||||||
// return AjaxResult.error("已领数量大于预领数量或该机具未在库");
|
return AjaxResult.error("已领数量大于预领数量或该机具未在库");
|
||||||
// }
|
}
|
||||||
// } catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// return AjaxResult.error("出库失败");
|
return AjaxResult.error("出库失败");
|
||||||
// }
|
}
|
||||||
// return AjaxResult.success("出库成功");
|
return AjaxResult.success("出库成功");
|
||||||
// }
|
}
|
||||||
|
|
||||||
private int checkRepeatSubmit(LeaseOutDetails record) {
|
private int checkRepeatSubmit(LeaseOutDetails record) {
|
||||||
String maStatus = "15";
|
String maStatus = "15";
|
||||||
|
|
@ -278,67 +278,67 @@ public class LeaseOutDetailsServiceImpl implements ILeaseOutDetailsService {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private int insertRecords(LeaseOutDetails record) {
|
private int insertRecords(LeaseOutDetails record) {
|
||||||
// int res = 0;
|
int res = 0;
|
||||||
// // 首先更新领料任务详情表的领料数及状态(lease_apply_details)
|
// 首先更新领料任务详情表的领料数及状态(lease_apply_details)
|
||||||
// res = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record);
|
res = leaseOutDetailsMapper.updateLeaseApplyDetailsOutNum(record);
|
||||||
// LeaseApplyDetails leaseApplyDetails = leaseOutDetailsMapper.getLeaseApplyDetails(record);
|
LeaseApplyDetails leaseApplyDetails = leaseOutDetailsMapper.getLeaseApplyDetails(record);
|
||||||
// if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) {
|
if (leaseApplyDetails.getPreNum().equals(leaseApplyDetails.getAlNum()) || leaseApplyDetails.getAuditNum().equals(leaseApplyDetails.getAlNum())) {
|
||||||
// leaseOutDetailsMapper.updateLeaseApplyDetails(record);
|
leaseOutDetailsMapper.updateLeaseApplyDetails(record);
|
||||||
// }
|
}
|
||||||
// if (res > 0) {
|
if (res > 0) {
|
||||||
// // 插入领料出库明细表(lease_out_details)
|
// 插入领料出库明细表(lease_out_details)
|
||||||
// res = leaseOutDetailsMapper.insertSelective(record);
|
res = leaseOutDetailsMapper.insertSelective(record);
|
||||||
// if (res > 0) {
|
if (res > 0) {
|
||||||
// if (record.getManageType() == 2) {
|
if (record.getManageType() == 2) {
|
||||||
// // 成套机具减少 (ma_type 设备规格表)的库存数量
|
// 成套机具减少 (ma_type 设备规格表)的库存数量
|
||||||
// res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||||
// // 成套机具减少 (ma_type 设备规格表)配件的库存数量
|
// 成套机具减少 (ma_type 设备规格表)配件的库存数量
|
||||||
// List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
List<TmTask> typeIds = leaseOutDetailsMapper.getMaTypeDetails(record);
|
||||||
// typeIds.removeIf(item -> item == null);
|
typeIds.removeIf(item -> item == null);
|
||||||
//// for (TmTask typeId : typeIds) {
|
// for (TmTask typeId : typeIds) {
|
||||||
//// MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
// MachinePart machinePart = leaseOutDetailsMapper.getMachineParts(typeId);
|
||||||
//// machinePart.setPartNum((typeId.getPartNum() * record.getOutNum()));
|
// machinePart.setPartNum((typeId.getPartNum() * record.getOutNum()));
|
||||||
//// typeId.setNum(machinePart.getNum() - machinePart.getPartNum());
|
// typeId.setNum(machinePart.getNum() - machinePart.getPartNum());
|
||||||
//// res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId);
|
// res = leaseOutDetailsMapper.updateMaTypeStockNumCt(typeId);
|
||||||
//// }
|
|
||||||
// } else {
|
|
||||||
// // 普通机具减少 (ma_type 设备规格表)的库存数量
|
|
||||||
// res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
|
||||||
// }
|
|
||||||
// // 更新 (ma_machine 设备表)的状态
|
|
||||||
// leaseOutDetailsMapper.updateMaMachineStatus(record);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return res;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public int insSltInfo(String taskId, LeaseOutDetails record) {
|
|
||||||
// int res = 0;
|
|
||||||
// SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record);
|
|
||||||
// if (sltAgreementInfo != null) {
|
|
||||||
// Long num = sltAgreementInfo.getNum();
|
|
||||||
// Long outNum = record.getOutNum();
|
|
||||||
// sltAgreementInfo.setNum(num + outNum);
|
|
||||||
// res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo);
|
|
||||||
// } else {
|
|
||||||
// String agreementId = leaseOutDetailsMapper.getAgreementId(taskId);
|
|
||||||
// String protocol = leaseOutDetailsMapper.getProtocol(agreementId);
|
|
||||||
// Type ma = leaseOutDetailsMapper.getMaType(record.getTypeId());
|
|
||||||
// if (StringUtils.isEmpty(protocol)) {
|
|
||||||
// ma.setFinalPrice(ma.getLeasePrice());
|
|
||||||
// } else {
|
|
||||||
// if (MaterialConstants.INNER_PROTOCAL.equals(protocol)) {
|
|
||||||
// ma.setFinalPrice(ma.getLeasePrice());
|
|
||||||
// } else if (Constants.OUTER_PROTOCAL.equals(protocol)) {
|
|
||||||
// ma.setFinalPrice(ma.getRentPrice());
|
|
||||||
// } else {
|
|
||||||
// ma.setFinalPrice(ma.getLeasePrice());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// res = leaseOutDetailsMapper.insSltInfo(record, agreementId, ma);
|
|
||||||
// }
|
|
||||||
// return res;
|
|
||||||
// }
|
// }
|
||||||
|
} else {
|
||||||
|
// 普通机具减少 (ma_type 设备规格表)的库存数量
|
||||||
|
res = leaseOutDetailsMapper.updateMaTypeStockNum(record);
|
||||||
|
}
|
||||||
|
// 更新 (ma_machine 设备表)的状态
|
||||||
|
leaseOutDetailsMapper.updateMaMachineStatus(record);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int insSltInfo(String taskId, LeaseOutDetails record) {
|
||||||
|
int res = 0;
|
||||||
|
SltAgreementInfo sltAgreementInfo = leaseOutDetailsMapper.getSltAgreementInfo(record);
|
||||||
|
if (sltAgreementInfo != null) {
|
||||||
|
Long num = sltAgreementInfo.getNum();
|
||||||
|
Long outNum = record.getOutNum();
|
||||||
|
sltAgreementInfo.setNum(num + outNum);
|
||||||
|
res = leaseOutDetailsMapper.updSltInfo(sltAgreementInfo);
|
||||||
|
} else {
|
||||||
|
String agreementId = leaseOutDetailsMapper.getAgreementId(taskId);
|
||||||
|
String protocol = leaseOutDetailsMapper.getProtocol(agreementId);
|
||||||
|
Type maType = leaseOutDetailsMapper.getMaType(record.getTypeId());
|
||||||
|
if (StringUtils.isEmpty(protocol)) {
|
||||||
|
maType.setFinalPrice(maType.getLeasePrice());
|
||||||
|
} else {
|
||||||
|
if (MaterialConstants.INNER_PROTOCAL.equals(protocol)) {
|
||||||
|
maType.setFinalPrice(maType.getLeasePrice());
|
||||||
|
} else if (MaterialConstants.OUTER_PROTOCAL.equals(protocol)) {
|
||||||
|
maType.setFinalPrice(maType.getRentPrice());
|
||||||
|
} else {
|
||||||
|
maType.setFinalPrice(maType.getLeasePrice());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res = leaseOutDetailsMapper.insSltInfo(record, agreementId, maType);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,9 @@ public class Type extends BaseEntity {
|
||||||
@ApiModelProperty(value = "丢失赔偿价")
|
@ApiModelProperty(value = "丢失赔偿价")
|
||||||
private BigDecimal payPrice;
|
private BigDecimal payPrice;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "???价")
|
||||||
|
private BigDecimal finalPrice;
|
||||||
|
|
||||||
/** 税率 */
|
/** 税率 */
|
||||||
@ApiModelProperty(value = "税率")
|
@ApiModelProperty(value = "税率")
|
||||||
private BigDecimal taxRatio;
|
private BigDecimal taxRatio;
|
||||||
|
|
|
||||||
|
|
@ -182,4 +182,194 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
and mt.`level` = 4
|
and mt.`level` = 4
|
||||||
and mt.del_flag = '0'
|
and mt.del_flag = '0'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertSelective">
|
||||||
|
insert into lease_out_details
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="parentId!= null">
|
||||||
|
parent_id,
|
||||||
|
</if>
|
||||||
|
<if test="typeId!= null">
|
||||||
|
type_id,
|
||||||
|
</if>
|
||||||
|
<if test="maId!= null">
|
||||||
|
ma_id,
|
||||||
|
</if>
|
||||||
|
<if test="outNum!= null">
|
||||||
|
out_num,
|
||||||
|
</if>
|
||||||
|
<if test="outType!= null">
|
||||||
|
out_type,
|
||||||
|
</if>
|
||||||
|
<if test="createBy!= null">
|
||||||
|
create_by,
|
||||||
|
</if>
|
||||||
|
<if test="updateBy!= null">
|
||||||
|
update_by,
|
||||||
|
</if>
|
||||||
|
<if test="remark!= null">
|
||||||
|
remark,
|
||||||
|
</if>
|
||||||
|
<if test="companyId!= null">
|
||||||
|
company_id,
|
||||||
|
</if>
|
||||||
|
<if test="carCode!= null">
|
||||||
|
car_code,
|
||||||
|
</if>
|
||||||
|
create_time,
|
||||||
|
update_time
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="parentId!= null">
|
||||||
|
#{parentId},
|
||||||
|
</if>
|
||||||
|
<if test="typeId!= null">
|
||||||
|
#{typeId},
|
||||||
|
</if>
|
||||||
|
<if test="maId!= null">
|
||||||
|
#{maId},
|
||||||
|
</if>
|
||||||
|
<if test="outNum!= null">
|
||||||
|
#{outNum},
|
||||||
|
</if>
|
||||||
|
<if test="outType!= null">
|
||||||
|
#{outType},
|
||||||
|
</if>
|
||||||
|
<if test="createBy!= null">
|
||||||
|
#{createBy},
|
||||||
|
</if>
|
||||||
|
<if test="updateBy!= null">
|
||||||
|
#{updateBy},
|
||||||
|
</if>
|
||||||
|
<if test="remark!= null">
|
||||||
|
#{remark},
|
||||||
|
</if>
|
||||||
|
<if test="companyId!= null">
|
||||||
|
#{companyId},
|
||||||
|
</if>
|
||||||
|
<if test="carCode!= null">
|
||||||
|
#{carCode},
|
||||||
|
</if>
|
||||||
|
NOW(),
|
||||||
|
NOW()
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateMaTypeStockNum">
|
||||||
|
UPDATE
|
||||||
|
ma_type
|
||||||
|
SET
|
||||||
|
num = num - #{record.outNum} ,update_time = NOW()
|
||||||
|
WHERE
|
||||||
|
type_id = #{record.typeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<update id="updateMaMachineStatus">
|
||||||
|
UPDATE
|
||||||
|
ma_machine
|
||||||
|
SET
|
||||||
|
ma_status = '16',create_time = NOW()
|
||||||
|
<where>
|
||||||
|
type_id = #{record.typeId}
|
||||||
|
<if test="record.maId != null and record.maId != ''">
|
||||||
|
and ma_id = #{record.maId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getSltAgreementInfo" resultType="com.bonus.material.settlement.domain.SltAgreementInfo">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
agreement_id AS agreementId,
|
||||||
|
type_id AS typeId,
|
||||||
|
ma_id AS maId,
|
||||||
|
num AS num,
|
||||||
|
start_time AS startTime,
|
||||||
|
end_time AS endTime,
|
||||||
|
status AS status,
|
||||||
|
lease_id AS leaseId,
|
||||||
|
back_id AS backId,
|
||||||
|
lease_price AS leasePrice,
|
||||||
|
buy_price AS buyPrice,
|
||||||
|
company_id AS companyId
|
||||||
|
FROM
|
||||||
|
slt_agreement_info
|
||||||
|
WHERE
|
||||||
|
lease_id = #{parentId}
|
||||||
|
AND
|
||||||
|
type_id = #{typeId}
|
||||||
|
AND
|
||||||
|
ma_id IS NULL
|
||||||
|
AND
|
||||||
|
status = '0'
|
||||||
|
AND
|
||||||
|
DATE(start_time) = CURDATE();
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updSltInfo">
|
||||||
|
update slt_agreement_info
|
||||||
|
set num = #{num},
|
||||||
|
update_time = now()
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getAgreementId" resultType="java.lang.String">
|
||||||
|
select agreement_id
|
||||||
|
from tm_task_agreement
|
||||||
|
where task_id = #{taskId}
|
||||||
|
</select>
|
||||||
|
<select id="getMaType" resultType="com.bonus.material.ma.domain.Type">
|
||||||
|
select lease_price as leasePrice,
|
||||||
|
rent_price as rentPrice,
|
||||||
|
buy_price as buyPrice,
|
||||||
|
pay_price as payPrice,
|
||||||
|
company_id as companyId
|
||||||
|
from ma_type
|
||||||
|
where type_id = #{typeId} and del_flag = 0
|
||||||
|
</select>
|
||||||
|
<select id="getProtocol" resultType="java.lang.String">
|
||||||
|
select protocol
|
||||||
|
from bm_agreement_info
|
||||||
|
where agreement_id = #{agreementId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insSltInfo">
|
||||||
|
insert into slt_agreement_info (agreement_id,type_id,ma_id,num,start_time,status,lease_id,lease_price,buy_price,is_slt,company_id,lease_type,create_time)
|
||||||
|
values (#{agreementId},#{record.typeId},#{record.maId},#{record.outNum},now(),0,#{record.parentId},#{ma.finalPrice},#{ma.buyPrice},'0',#{record.companyId},#{record.leaseType},now());
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateLeaseApplyDetailsOutNum">
|
||||||
|
UPDATE
|
||||||
|
lease_apply_details
|
||||||
|
SET
|
||||||
|
al_num = IF(al_num IS NULL, #{record.outNum}, al_num + #{record.outNum}),
|
||||||
|
<if test="record.updateBy != null and record.updateBy!= '' ">
|
||||||
|
update_by = #{record.updateBy},
|
||||||
|
</if>
|
||||||
|
update_time = now(),
|
||||||
|
status = '1'
|
||||||
|
WHERE
|
||||||
|
parennt_id = #{record.parentId} and type_id = #{record.typeId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<select id="getLeaseApplyDetails" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||||
|
SELECT
|
||||||
|
ifnull( pre_num, 0 ) AS preNum,
|
||||||
|
ifnull( audit_num, 0 ) AS auditNum,
|
||||||
|
ifnull( al_num, 0 ) AS alNum
|
||||||
|
FROM
|
||||||
|
lease_apply_details
|
||||||
|
WHERE
|
||||||
|
parennt_id = #{record.parentId}
|
||||||
|
AND type_id = #{record.typeId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<update id="updateLeaseApplyDetails">
|
||||||
|
UPDATE
|
||||||
|
lease_apply_details
|
||||||
|
SET
|
||||||
|
status = '2'
|
||||||
|
WHERE
|
||||||
|
parennt_id = #{record.parentId} and type_id = #{record.typeId}
|
||||||
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue