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

import com.yeejoin.amos.boot.module.common.api.mapper.CustomBaseMapper;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * 安全追溯-其他信息表 Mapper 接口
 *
 * @author system_generator
 * @date 2023-08-17
 */
public interface IdxBizJgOtherInfoMapper extends CustomBaseMapper<IdxBizJgOtherInfo> {
    @Select("select SUPERVISORY_CODE from idx_biz_jg_other_info where record = #{equipmentCode}")
    String getSupervisoryCodeByEquipmentCode(@Param("equipmentCode") String equipmentCode);

    /**
     * 批量更新other表状态为报废（2）
     *
     * @param equipIds 设备 ID 列表
     */
    @Update("<script>" +
            "update idx_biz_jg_other_info set \"STATUS\" = '2' " +
            "where \"RECORD\" in " +
            "<foreach item='equipId' collection='equipIds' open='(' separator=',' close=')'>" +
            "#{equipId}" +
            "</foreach>" +
            "</script>")
    void batchUpdateOtherInfo(@Param("equipIds") List<String> equipIds);
}
