This commit is contained in:
mashuai 2024-04-30 15:14:27 +08:00
parent 43b159ca72
commit 1ed94a6706
3 changed files with 21 additions and 1 deletions

View File

@ -42,4 +42,11 @@ public interface MaMachineMapper {
SltAgreementApply getLeaseProject(MaMachine ma);
SltAgreementApply getBackProject(MaMachine ma);
/**
* 根据typeId修改库存
* @param typeId
* @return
*/
int updateNum(long typeId);
}

View File

@ -90,7 +90,17 @@ public class MaMachineServiceImpl implements MaMachineService {
@Override
public int remove(Long[] maIds) {
return maMachineMapper.remove(maIds);
int res = 0;
if (maIds != null || maIds.length > 0) {
for (Long maId : maIds) {
MaMachine maMachine = maMachineMapper.selectMaMachineByMaId(maId);
if (maMachine.getTypeId() != 0 && ("15").equals(maMachine.getMaStatus())) {
res = maMachineMapper.updateNum(maMachine.getTypeId());
}
}
}
res += maMachineMapper.remove(maIds);
return res;
}
@Override

View File

@ -262,6 +262,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</set>
where ma_id = #{maId}
</update>
<update id="updateNum">
update ma_type set num = num - 1 where type_id = #{typeId}
</update>
<delete id="remove" parameterType="Long">
delete from ma_machine where ma_id in