package cn.com.ty.lift.ud.payment.mapper;


import cn.com.ty.lift.ud.payment.mapper.entity.ApplyInvoiceEntity;

import java.math.BigDecimal;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import  com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * 申请发票 -Repository
 * 
 * @author Xson
 * @date 2020-04-22
 */
public interface ApplyInvoiceMapper extends BaseMapper<ApplyInvoiceEntity> {

    int deleteByPrimaryKey(Integer id);

    int insertSelective(ApplyInvoiceEntity record);

    ApplyInvoiceEntity selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(ApplyInvoiceEntity record);

    int updateByPrimaryKeyWithBLOBs(ApplyInvoiceEntity record);

    int updateByPrimaryKey(ApplyInvoiceEntity record);
    
    /**
     * 审批，修改审批状态为1
     *
     * @param id
     */
    @Update(value = "update apply_invoice set check_flag= 1 where id = #{id}")
    void examineById(@Param("id")Long id);
    
    /**
     * 审批驳回，修改审批状态为0
     *
     * @param id
     */
    @Update(value = "update apply_invoice set check_flag= 0,reason =#{reason} where id = #{id}")
    void updateInfoById(@Param("id")Long id,@Param("reason")String reason);
    
    @Update(value = "update apply_invoice set jshj=#{amount}  where id = #{id}")
    void updateJshjById(Long id,BigDecimal amount);
}
