调整收付款问题

This commit is contained in:
2026-09-01 11:52:15 +08:00
parent a4599c48c5
commit 1363a526ff
5 changed files with 75 additions and 49 deletions
@@ -40,6 +40,16 @@ import java.util.List;
*/
public interface AirportMasterMapper extends BaseMapper<AirportMaster> {
/**
* 按编码查询空港机场(包含逻辑删除记录,用于唯一性校验)。
*/
AirportMaster selectByCodeIncludingDeleted(@Param("code") String code);
/**
* 恢复逻辑删除空港机场。
*/
int restoreById(@Param("id") Long id);
/**
* 自定义分页
*
@@ -32,6 +32,20 @@
<result column="remark" property="remark"/>
</resultMap>
<select id="selectByCodeIncludingDeleted" resultMap="airportMasterResultMap">
SELECT
am.*
FROM blade_airport_master am
WHERE am.code = #{code}
</select>
<update id="restoreById">
UPDATE blade_airport_master
SET is_deleted = 0
WHERE id = #{id}
AND is_deleted = 1
</update>
<select id="selectAirportMasterPage" resultMap="airportMasterResultMap">
SELECT
am.id,
@@ -98,6 +98,7 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
public boolean submit(AirportMaster airportMaster) {
prepare(airportMaster, SOURCE_MANUAL);
validate(airportMaster);
prepareSubmitTarget(airportMaster);
return saveOrUpdate(airportMaster);
}
@@ -479,6 +480,22 @@ public class AirportMasterServiceImpl extends BaseServiceImpl<AirportMasterMappe
}
}
private void prepareSubmitTarget(AirportMaster airportMaster) {
if (Func.isNotEmpty(airportMaster.getId())) {
return;
}
AirportMaster existingAirportMaster = baseMapper.selectByCodeIncludingDeleted(airportMaster.getCode());
if (existingAirportMaster == null) {
return;
}
if (!Objects.equals(existingAirportMaster.getIsDeleted(), 1)) {
throw new ServiceException("该编码已存在");
}
baseMapper.restoreById(existingAirportMaster.getId());
airportMaster.setId(existingAirportMaster.getId());
airportMaster.setIsDeleted(0);
}
private void validateUnique(AirportMaster airportMaster, com.baomidou.mybatisplus.core.toolkit.support.SFunction<AirportMaster, ?> column, String value, String message) {
if (Func.isEmpty(value)) {
return;