修改删除逻辑
This commit is contained in:
@@ -134,4 +134,7 @@ public interface PrcOrderBillMapper
|
||||
@Param("surchargeAmount") BigDecimal surchargeAmount,
|
||||
@Param("incomeTotal") BigDecimal incomeTotal,
|
||||
@Param("payTotal") BigDecimal payTotal);
|
||||
|
||||
/** Count order bills that reference this sales package version. */
|
||||
int countByPsvId(@Param("psvId") Long psvId);
|
||||
}
|
||||
|
||||
+11
-3
@@ -40,6 +40,7 @@ import com.bms.price.domain.PrcSurchargeRel;
|
||||
import com.bms.price.mapper.BmsProductCountryMapper;
|
||||
import com.bms.price.mapper.BmsProductMapper;
|
||||
import com.bms.price.mapper.PrcCustomerPriceSetMapper;
|
||||
import com.bms.price.mapper.PrcOrderBillMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetDetailMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetMapper;
|
||||
import com.bms.price.mapper.PrcPriceSetProductMapper;
|
||||
@@ -141,6 +142,9 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
@Autowired
|
||||
private IBmsCustomerService bmsCustomerService;
|
||||
|
||||
@Autowired
|
||||
private PrcOrderBillMapper orderBillMapper;
|
||||
|
||||
@Override
|
||||
public PrcPriceSet selectPrcPriceSetById(Long priceSetId)
|
||||
{
|
||||
@@ -626,7 +630,7 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
{
|
||||
throw new ServiceException(MessageUtils.message("price.set.version.notExists"));
|
||||
}
|
||||
// Draft / pending: hard delete; EFFECT: soft delete then reopen previous via refreshVersionStatus
|
||||
// Draft / pending / effect may be deleted; expired stays view-only.
|
||||
if (!VER_DRAFT.equals(version.getStatus())
|
||||
&& !VER_PENDING.equals(version.getStatus())
|
||||
&& !VER_EFFECT.equals(version.getStatus()))
|
||||
@@ -634,9 +638,13 @@ public class PrcPriceSetServiceImpl implements IPrcPriceSetService
|
||||
throw new ServiceException(MessageUtils.message("price.set.version.delete.statusNotAllowed"));
|
||||
}
|
||||
requireSet(version.getPriceSetId());
|
||||
wipeVersionChildren(psvId, version.getStatus());
|
||||
// Products / details / surcharge always physical delete.
|
||||
surchargeRelMapper.physicalDeleteByPsvId(psvId);
|
||||
detailMapper.physicalDeleteByPsvId(psvId);
|
||||
setProductMapper.physicalDeleteByPsvId(psvId);
|
||||
// Version: soft-delete when any order bill references psv_id; otherwise hard-delete.
|
||||
int rows;
|
||||
if (VER_EFFECT.equals(version.getStatus()))
|
||||
if (orderBillMapper.countByPsvId(psvId) > 0)
|
||||
{
|
||||
rows = versionMapper.softDeleteById(psvId, updateBy);
|
||||
}
|
||||
|
||||
@@ -1070,4 +1070,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update_time = sysdate()
|
||||
where bill_id = #{billId}
|
||||
</update>
|
||||
|
||||
<select id="countByPsvId" resultType="int">
|
||||
select count(1) from prc_order_bill where psv_id = #{psvId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user