This commit is contained in:
parent
759f754fcf
commit
59842231f8
|
|
@ -418,4 +418,14 @@ public class LeaseApplyInfoController extends BaseController {
|
|||
}
|
||||
return success("审核完成");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改预出库数量
|
||||
*/
|
||||
@ApiOperation(value = "修改预出库数量")
|
||||
@SysLog(title = "修改预出库数量", businessType = OperaType.UPDATE, logType = 1,module = "领料出库->修改预出库数量")
|
||||
@PostMapping("/updateLeaseNum")
|
||||
public AjaxResult updateLeaseNum(@RequestBody LeaseApplyDetails leaseApplyDetails) {
|
||||
return leaseApplyInfoService.updateLeaseNum(leaseApplyDetails);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,6 +186,17 @@ public class LeaseTaskController extends BaseController {
|
|||
return success(service.getDetailsById(leaseApplyInfo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据typeId查询待出库数量
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "根据typeId查询待出库数量")
|
||||
@GetMapping(value ="/getPendingOutNumByTypeId/{typeId}")
|
||||
public AjaxResult getPendingOutNumByTypeId(@PathVariable("typeId") Long typeId) {
|
||||
return service.getPendingOutNumByTypeId(typeId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出领料发布详情
|
||||
* @param response
|
||||
|
|
@ -220,6 +231,24 @@ public class LeaseTaskController extends BaseController {
|
|||
return service.leasePublishReject(leaseApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领料详情删除
|
||||
*/
|
||||
@ApiOperation(value = "领料详情删除")
|
||||
@PostMapping("/delLeaseDetails")
|
||||
public AjaxResult delLeaseDetails(@RequestBody LeaseApplyDetails leaseApplyDetails) {
|
||||
return service.delLeaseDetails(leaseApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领用/领料---退回
|
||||
*/
|
||||
@ApiOperation(value = "领料出库退回")
|
||||
@PostMapping("/leaseOutReject")
|
||||
public AjaxResult leaseOutReject(@RequestBody LeaseApplyDetails leaseApplyDetails) {
|
||||
return service.leaseOutReject(leaseApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 领用发布终结
|
||||
* @param leaseApplyInfo
|
||||
|
|
|
|||
|
|
@ -200,6 +200,9 @@ public class LeaseApplyDetails extends BaseEntity {
|
|||
@ApiModelProperty(value = "是否检验(0不检验,1检验)")
|
||||
private String isCheck;
|
||||
|
||||
@ApiModelProperty(value = "待出库数量")
|
||||
private BigDecimal pendingOutNum;
|
||||
|
||||
@ApiModelProperty(value = "领料物资名称汇总")
|
||||
private String maTypeNames;
|
||||
public LeaseApplyDetails(Long id, Long parentId, Long typeId, BigDecimal preNum, BigDecimal auditNum, BigDecimal alNum, String status, Long companyId) {
|
||||
|
|
|
|||
|
|
@ -223,4 +223,18 @@ public interface LeaseApplyInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
List<LeaseApplyDetails> selectInfo(Long id);
|
||||
|
||||
/**
|
||||
* 修改领用单的领用单出库数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateLeaseNum(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 修改领用单的领用单出库数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateLeaseNumTwo(LeaseApplyDetails leaseApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
package com.bonus.material.lease.mapper;
|
||||
|
||||
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
|
||||
import com.bonus.common.biz.domain.lease.WorkApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.WorkPeopleInfo;
|
||||
import com.bonus.common.biz.domain.lease.*;
|
||||
import com.bonus.material.back.domain.vo.MaCodeVo;
|
||||
import com.bonus.material.basic.domain.BmProject;
|
||||
import com.bonus.material.lease.domain.LeaseApplyDetails;
|
||||
import com.bonus.material.lease.domain.LeasePublishDetails;
|
||||
|
|
@ -216,4 +214,81 @@ public interface LeaseTaskMapper {
|
|||
* @return
|
||||
*/
|
||||
LeaseApplyDetails selectTypeByNewType(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 领用申请发布详情查询
|
||||
* @param detail
|
||||
* @return
|
||||
*/
|
||||
LeaseApplyDetails selectPendingOutNum(LeaseApplyDetails detail);
|
||||
|
||||
/**
|
||||
* 更改设备状态为在库
|
||||
* @param maCodeVo
|
||||
* @return
|
||||
*/
|
||||
int updateMaStatus(MaCodeVo maCodeVo);
|
||||
|
||||
/**
|
||||
* 修改库存
|
||||
* @param bean1
|
||||
* @return
|
||||
*/
|
||||
int updateInventory(LeaseApplyDetails bean1);
|
||||
|
||||
/**
|
||||
* 根据typeId删除领用申请详情
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int delApplyDetailsByTypeId(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 根据parentId查询领用申请详情数量
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
int selectLeaseApplyDetailsCountByParentId(Long parentId);
|
||||
|
||||
/**
|
||||
* 删除领用申请详情
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
int deleteLeaseApplyInfo(Long parentId);
|
||||
|
||||
/**
|
||||
* 删除领用申请详情
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int delLeaseDetails(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 领用申请详情修改 -- 减少领用数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateLeaseOutNum(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 领用申请详情修改 -- 减少领用数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int deleteLeaseOutDetails(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 领用申请详情修改 -- 减少领用数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int deleteSltInfo(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 领用申请详情修改 -- 减少领用数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
int updateLeaseOutNumNew(LeaseApplyDetails leaseApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -185,4 +185,11 @@ public interface ILeaseApplyInfoService {
|
|||
* @return
|
||||
*/
|
||||
LeaseApplyInfo getOutNum(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 修改领料任务数量
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult updateLeaseNum(LeaseApplyDetails leaseApplyDetails);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,5 +143,26 @@ public interface ILeaseTaskService {
|
|||
* @return
|
||||
*/
|
||||
List<LeaseRecordInfo> getLeaseRecordList(LeaseApplyInfo leaseApplyInfo);
|
||||
|
||||
/**
|
||||
* 领用申请发布详情查询
|
||||
* @param typeId
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getPendingOutNumByTypeId(Long typeId);
|
||||
|
||||
/**
|
||||
* 领用出库驳回
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult leaseOutReject(LeaseApplyDetails leaseApplyDetails);
|
||||
|
||||
/**
|
||||
* 领料详情删除
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
AjaxResult delLeaseDetails(LeaseApplyDetails leaseApplyDetails);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import org.springframework.stereotype.Service;
|
|||
import com.bonus.material.lease.mapper.LeaseApplyInfoMapper;
|
||||
import com.bonus.material.lease.service.ILeaseApplyInfoService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
|
@ -219,6 +220,14 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (details.size()>0){
|
||||
for (LeaseApplyDetails detail : details){
|
||||
//查询类型的库存和总待出库数量
|
||||
LeaseApplyDetails pendingOutNum = mapper.selectPendingOutNum(detail);
|
||||
detail.setPendingOutNum(pendingOutNum.getPendingOutNum());
|
||||
detail.setStorageNum(pendingOutNum.getStorageNum());
|
||||
}
|
||||
}
|
||||
stepTimes.put("领用发布查询", System.currentTimeMillis() - step81Start);
|
||||
|
||||
if (!CollectionUtils.isEmpty(details)) {
|
||||
|
|
@ -749,6 +758,29 @@ public class LeaseApplyInfoServiceImpl implements ILeaseApplyInfoService {
|
|||
return leaseApplyInfoMapper.getOutNum(leaseApplyInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult updateLeaseNum(LeaseApplyDetails leaseApplyDetails) {
|
||||
try {
|
||||
if (leaseApplyDetails.getNewTypeId()!= null){
|
||||
int res = leaseApplyInfoMapper.updateLeaseNum(leaseApplyDetails);
|
||||
if (res<=0){
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
} else {
|
||||
int res = leaseApplyInfoMapper.updateLeaseNumTwo(leaseApplyDetails);
|
||||
if (res<=0){
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
return AjaxResult.success("修改成功");
|
||||
} catch (Exception e) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("修改失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 关键字搜索
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
package com.bonus.material.lease.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.bonus.common.biz.constant.GlobalConstants;
|
||||
import com.bonus.common.biz.constant.MaterialConstants;
|
||||
import com.bonus.common.biz.domain.BmFileInfo;
|
||||
import com.bonus.common.biz.domain.LeaseRecordInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeaseApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.LeasePublishInfo;
|
||||
import com.bonus.common.biz.domain.lease.WorkApplyInfo;
|
||||
import com.bonus.common.biz.domain.lease.WorkPeopleInfo;
|
||||
import com.bonus.common.biz.domain.lease.*;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.enums.LeaseTaskStatusEnum;
|
||||
import com.bonus.common.biz.enums.TmTaskTypeEnum;
|
||||
|
|
@ -52,6 +50,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.springframework.dao.DataAccessException;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
|
|
@ -933,6 +932,11 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
// 获取领料单详情
|
||||
List<LeaseApplyDetails> details = mapper.selectPublishDetails(leaseApplyInfo);
|
||||
if (!CollectionUtils.isEmpty(details)) {
|
||||
for (LeaseApplyDetails detail : details) {
|
||||
//查询类型的待出库数量
|
||||
LeaseApplyDetails pendingOutNum = mapper.selectPendingOutNum(detail);
|
||||
detail.setPendingOutNum(pendingOutNum.getPendingOutNum());
|
||||
}
|
||||
leaseApplyRequestVo.setLeaseApplyDetailsList(details);
|
||||
}
|
||||
});
|
||||
|
|
@ -1131,6 +1135,116 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
return leaseRecordInfos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getPendingOutNumByTypeId(Long typeId) {
|
||||
try {
|
||||
LeaseApplyDetails leaseApplyDetails = new LeaseApplyDetails();
|
||||
leaseApplyDetails.setTypeId(typeId);
|
||||
LeaseApplyDetails pendingOutNum = mapper.selectPendingOutNum(leaseApplyDetails);
|
||||
return AjaxResult.success(pendingOutNum);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return AjaxResult.error("待出库数量查询失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult leaseOutReject(LeaseApplyDetails leaseApplyDetails) {
|
||||
try {
|
||||
//1、查询整个单子是否已完成,根据taskId
|
||||
TmTask tmTask = tmTaskMapper.selectStatusByTaskId(leaseApplyDetails.getTaskId());
|
||||
if (tmTask.getTaskStatus() == 4) {
|
||||
return AjaxResult.error("该领料任务已出库完成,不可退回");
|
||||
}
|
||||
//判断是编码还是数量
|
||||
if (leaseApplyDetails.getMaCodeVoList()!=null){
|
||||
//编码
|
||||
for (MaCodeVo maCodeVo : leaseApplyDetails.getMaCodeVoList()) {
|
||||
//更改设备状态为在库
|
||||
int res = mapper.updateMaStatus(maCodeVo);
|
||||
if (res == 0) {
|
||||
throw new ServiceException("设备状态修改失败,请联系管理员");
|
||||
}
|
||||
}
|
||||
}
|
||||
//判断是领用任务还是领料任务,根据newType
|
||||
LeaseApplyDetails bean1 = new LeaseApplyDetails();
|
||||
if (leaseApplyDetails.getNewTypeId()!=null){
|
||||
//清除已领设备
|
||||
//把数量清除
|
||||
int res1 = mapper.updateLeaseOutNum(leaseApplyDetails);
|
||||
//修改库存
|
||||
bean1.setTypeId(leaseApplyDetails.getNewTypeId());
|
||||
bean1.setAlNum(leaseApplyDetails.getAlNum());
|
||||
} else {
|
||||
//清除已领设备
|
||||
//把数量清除
|
||||
int res1 = mapper.updateLeaseOutNumNew(leaseApplyDetails);
|
||||
//修改库存
|
||||
bean1.setTypeId(leaseApplyDetails.getTypeId());
|
||||
bean1.setAlNum(leaseApplyDetails.getAlNum());
|
||||
}
|
||||
int res = mapper.updateInventory(bean1);
|
||||
if (res == 0) {
|
||||
throw new ServiceException("库存修改失败,请联系管理员");
|
||||
}
|
||||
// 3、修改任务状态(tm_task)
|
||||
if (leaseApplyDetails.getTaskId()!= null) {
|
||||
LeaseOutDetails leaseOutDetails = new LeaseOutDetails();
|
||||
leaseOutDetails.setTaskId(leaseApplyDetails.getTaskId()+"");
|
||||
res = editTaskStatus(leaseOutDetails);
|
||||
if (res == GlobalConstants.INT_0) {
|
||||
throw new RuntimeException("出库退回失败,修改任务状态失败");
|
||||
}
|
||||
}
|
||||
// 删除领料出库明细表(lease_out_details)
|
||||
int res2 = mapper.deleteLeaseOutDetails(leaseApplyDetails);
|
||||
// 4、删除结算记录
|
||||
res = deleteSltInfo(leaseApplyDetails);
|
||||
if (res == GlobalConstants.INT_0) {
|
||||
throw new RuntimeException("出库失败,插入结算记录失败");
|
||||
}
|
||||
return AjaxResult.success("领用出库驳回成功");
|
||||
} catch (Exception e) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
log.error("领用出库驳回失败:",e.getMessage());
|
||||
return AjaxResult.error("领用出库驳回失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除结算记录
|
||||
* @param leaseApplyDetails
|
||||
* @return
|
||||
*/
|
||||
private int deleteSltInfo(LeaseApplyDetails leaseApplyDetails) {
|
||||
return mapper.deleteSltInfo(leaseApplyDetails);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务状态(tm_task)
|
||||
* @param leaseOutDetails
|
||||
* @return
|
||||
*/
|
||||
private int editTaskStatus(LeaseOutDetails leaseOutDetails) {
|
||||
return tmTaskMapper.updateTaskStatus(leaseOutDetails.getTaskId(), LeaseTaskStatusEnum.LEASE_TASK_IN_PROGRESS.getStatus());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult delLeaseDetails(LeaseApplyDetails leaseApplyDetails) {
|
||||
try {
|
||||
int res = mapper.delLeaseDetails(leaseApplyDetails);
|
||||
if (res == 0) {
|
||||
return AjaxResult.error("领料详情删除失败");
|
||||
}
|
||||
return AjaxResult.success("删除成功");
|
||||
} catch (Exception e) {
|
||||
log.error("领料详情删除失败:",e.getMessage());
|
||||
return AjaxResult.error("领料详情删除失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成发布批次任务
|
||||
* @param thisMonthMaxOrder
|
||||
|
|
|
|||
|
|
@ -159,4 +159,11 @@ public interface TmTaskMapper {
|
|||
* @return
|
||||
*/
|
||||
int deleteAgreementId(@Param("taskIds") List<Long> taskIds);
|
||||
|
||||
/**
|
||||
* 根据任务id查询任务状态
|
||||
* @param taskId
|
||||
* @return
|
||||
*/
|
||||
TmTask selectStatusByTaskId(Long taskId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
order by
|
||||
mt.type_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectLeaseApplyDetailsById" parameterType="Long" resultMap="LeaseApplyDetailsResult">
|
||||
|
|
@ -585,6 +587,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
GROUP BY
|
||||
lpd.new_type
|
||||
order by
|
||||
lpd.new_type
|
||||
</select>
|
||||
|
||||
<select id="selectInfo" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
|
|
|
|||
|
|
@ -802,6 +802,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
is_confirm = 2
|
||||
where id = #{id}
|
||||
</update>
|
||||
<update id="updateLeaseNum">
|
||||
update lease_apply_details
|
||||
set pre_num = #{preNum},
|
||||
publish_num=#{preNum}
|
||||
|
||||
where parent_id = #{parentId}
|
||||
and new_type = #{newTypeId};
|
||||
|
||||
update lease_publish_details
|
||||
set num = #{preNum}
|
||||
where parent_id = #{parentId}
|
||||
and new_type = #{newTypeId};
|
||||
</update>
|
||||
<update id="updateLeaseNumTwo">
|
||||
update lease_apply_details
|
||||
set pre_num = #{preNum}
|
||||
where parent_id = #{parentId}
|
||||
and type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<select id="getUserList" resultMap="LeaseApplyInfoResult">
|
||||
SELECT
|
||||
|
|
|
|||
|
|
@ -1012,6 +1012,33 @@
|
|||
WHERE information_id = #{informationId}
|
||||
|
||||
</update>
|
||||
<update id="updateMaStatus">
|
||||
UPDATE ma_machine
|
||||
SET ma_status = '1',
|
||||
update_time = now()
|
||||
WHERE ma_id = #{maId}
|
||||
</update>
|
||||
<update id="updateInventory">
|
||||
update ma_type
|
||||
SET storage_num = IFNULL(storage_num, 0 ) + #{alNum}
|
||||
WHERE type_id = #{typeId}
|
||||
</update>
|
||||
<update id="updateLeaseOutNum">
|
||||
update lease_apply_details
|
||||
set al_num = al_num - #{outNum},
|
||||
update_time = now(),
|
||||
status = '1'
|
||||
where parent_id = #{parentId}
|
||||
and new_type = #{newTypeId}
|
||||
</update>
|
||||
<update id="updateLeaseOutNumNew">
|
||||
update lease_apply_details
|
||||
set al_num = al_num - #{outNum},
|
||||
update_time = now(),
|
||||
status = '1'
|
||||
where parent_id = #{parentId}
|
||||
and type_id = #{typeId}
|
||||
</update>
|
||||
|
||||
<select id="getWorkPeopleInfo" resultType="com.bonus.common.biz.domain.lease.WorkPeopleInfo">
|
||||
SELECT
|
||||
|
|
@ -1042,6 +1069,44 @@
|
|||
and new_type = #{newTypeId}
|
||||
and publish_task = #{publishTask}
|
||||
</delete>
|
||||
<delete id="delApplyDetailsByTypeId">
|
||||
DELETE
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
type_id = #{typeId}
|
||||
and parent_id = #{parentId}
|
||||
</delete>
|
||||
<delete id="deleteLeaseApplyInfo">
|
||||
DELETE
|
||||
FROM
|
||||
lease_apply_info
|
||||
WHERE
|
||||
id = #{parentId}
|
||||
</delete>
|
||||
<delete id="delLeaseDetails">
|
||||
DELETE
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
and type_id = #{typeId}
|
||||
</delete>
|
||||
<delete id="deleteLeaseOutDetails">
|
||||
delete from lease_out_details where parent_id = #{parentId} and type_id = #{typeId}
|
||||
<if test="maId != null">
|
||||
and ma_id = #{maId}
|
||||
</if>
|
||||
</delete>
|
||||
<delete id="deleteSltInfo">
|
||||
DELETE FROM slt_agreement_info
|
||||
WHERE
|
||||
lease_id = #{parentId}
|
||||
and type_id = #{typeId}
|
||||
<if test="maId != null">
|
||||
AND ma_id = #{maId}
|
||||
</if>
|
||||
</delete>
|
||||
|
||||
<select id="getAgreementInfo" resultType="com.bonus.material.task.domain.TmTaskAgreement">
|
||||
select
|
||||
|
|
@ -1076,4 +1141,48 @@
|
|||
lpd.parent_id=#{parentId}
|
||||
and new_type=#{newTypeId}
|
||||
</select>
|
||||
<select id="selectPendingOutNum" resultType="com.bonus.material.lease.domain.LeaseApplyDetails">
|
||||
SELECT
|
||||
a.typeId,
|
||||
SUM(a.preNum) as preNum,
|
||||
SUM(a.alNum) as alNum,
|
||||
SUM(a.preNum)-SUM(a.alNum) as pendingOutNum,
|
||||
ifnull(mt.storage_num,0) as storageNum
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
type_id as typeId,
|
||||
SUM(pre_num) as preNum,
|
||||
SUM(al_num) as alNum
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
type_id =#{typeId}
|
||||
and new_type is null
|
||||
GROUP BY type_id
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
new_type as typeId,
|
||||
SUM(pre_num) as preNum,
|
||||
SUM(al_num) as alNum
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
new_type = #{typeId}
|
||||
and new_type is not null
|
||||
GROUP BY new_type
|
||||
) a
|
||||
LEFT JOIN ma_type mt on mt.type_id=a.typeId
|
||||
GROUP BY typeId
|
||||
</select>
|
||||
<select id="selectLeaseApplyDetailsCountByParentId" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(1)
|
||||
FROM
|
||||
lease_apply_details
|
||||
WHERE
|
||||
parent_id = #{parentId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -239,4 +239,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
code = #{code}
|
||||
</select>
|
||||
<select id="selectStatusByTaskId" resultType="com.bonus.material.task.domain.TmTask">
|
||||
SELECT
|
||||
task_status as taskStatus
|
||||
FROM
|
||||
tm_task
|
||||
WHERE
|
||||
task_id = #{taskId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue