package com.yeejoin.amos.boot.module.jg.api.mapper;

import com.yeejoin.amos.boot.module.jg.api.entity.JgChangeRegistrationTransferEq;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * 移装变更登记设备关系表 Mapper 接口
 *
 * @author system_generator
 * @date 2023-12-20
 */
public interface JgChangeRegistrationTransferEqMapper extends BaseMapper<JgChangeRegistrationTransferEq> {
    @Update("update tzs_jg_change_registration_transfer_eq set  is_invalid = 1 where equ_id = #{equipId} and equip_transfer_id != #{currentDocumentId} ")
    void updateEquipIsVaildByEquipIdAndCurrentDocumentId(@Param("equipId") String equipId,@Param("currentDocumentId") String currentDocumentId);

    @Select("select equ_id from tzs_jg_change_registration_transfer_eq where   equip_transfer_id = #{currentDocumentId} ")
    String getEquipIdByEquipTransferId(@Param("currentDocumentId") String currentDocumentId);
}
