| | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.account.api.dto.ChargingCardExcelDTO; |
| | | import com.ruoyi.account.api.dto.ChargingCardQueryDTO; |
| | | import com.ruoyi.account.api.model.TChargingCard; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | public interface TChargingCardMapper extends BaseMapper<TChargingCard> { |
| | | |
| | | IPage<TChargingCard> selectCardPage(Page<TChargingCard> page, |
| | | @Param("query") ChargingCardQueryDTO query); |
| | | |
| | | List<ChargingCardExcelDTO> selectExportList(@Param("query") ChargingCardQueryDTO query); |
| | | |
| | | int countByCardNo(@Param("cardNo") String cardNo, @Param("excludeId") Long excludeId); |
| | | |
| | | int adjustBalance(@Param("ids") List<Long> ids, |
| | | @Param("amount") BigDecimal amount, |
| | | @Param("type") Integer type, |
| | | @Param("maxAmount") BigDecimal maxAmount, |
| | | @Param("updateBy") Long updateBy); |
| | | |
| | | int insertBalanceRecord(@Param("cardId") Long cardId, |
| | | @Param("type") Integer type, |
| | | @Param("amount") BigDecimal amount, |
| | | @Param("remark") String remark, |
| | | @Param("createBy") Long createBy); |
| | | |
| | | /** |
| | | * 锁定卡片为充电中(条件更新:仅空闲卡可锁定,用于防止同卡并发多单) |
| | | */ |
| | | int lockCardForCharging(@Param("cardId") Long cardId, @Param("orderCode") String orderCode); |
| | | |
| | | /** |
| | | * 解锁卡片(带订单号比对,防止误释放其他订单) |
| | | */ |
| | | int unlockCardForCharging(@Param("cardId") Long cardId, @Param("orderCode") String orderCode); |
| | | |
| | | /** |
| | | * 订单结算原子扣款:仅按卡 ID 扣减,不限制余额下限,允许扣成负数(V0.2 定稿) |
| | | */ |
| | | int deductBalanceByCardId(@Param("cardId") Long cardId, @Param("amount") BigDecimal amount); |
| | | |
| | | /** |
| | | * 写入订单结算扣款流水并占用幂等键(charging_order_code 唯一索引) |
| | | */ |
| | | int insertOrderDeductRecord(@Param("cardId") Long cardId, |
| | | @Param("amount") BigDecimal amount, |
| | | @Param("orderCode") String orderCode, |
| | | @Param("createBy") Long createBy); |
| | | |
| | | /** |
| | | * 批量查询已存在的充电扣款流水订单号。 |
| | | */ |
| | | List<String> selectDeductedOrderCodes(@Param("orderCodes") List<String> orderCodes); |
| | | |
| | | /** |
| | | * 原子清零余额(账户模式切换回收专用:仅当余额>0时清零,返回受影响行数,天然幂等) |
| | | */ |
| | | int clearBalance(@Param("id") Long id, @Param("updateBy") Long updateBy); |
| | | } |