package com.xxfc.platform.vehicle.mapper;


import com.xxfc.platform.vehicle.entity.VehiclePublish;
import com.xxfc.platform.vehicle.pojo.dto.VehiclePublishFindDTO;
import com.xxfc.platform.vehicle.pojo.vo.VehiclePublishVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.additional.idlist.SelectByIdListMapper;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface VehiclePublishMapper extends Mapper<VehiclePublish>, SelectByIdListMapper<VehiclePublish,Integer> {


    List<VehiclePublishVo> selectList(VehiclePublishFindDTO publishFindDTO);


    @Update("update vehicle_publish set wait_confirm_number=wait_confirm_number+#{number} where id=#{id}")
    void  updWaitConfirmNumber(@Param("number") Integer number,@Param("id")Integer id);


    @Update("update vehicle_publish set confirm_number=confirm_number+#{number},wait_confirm_number=wait_confirm_number-#{number}  where id=#{id} and confirm_number >= (confirm_number+#{number})  and  (wait_confirm_number-#{number}) >= 0  ")
    void  updConfirmNumber(@Param("number") Integer number,@Param("id")Integer id);
}