package com.ruoyi.tc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 资产基础网络复制表(asset_basic_network_cp)表数据库访问层
 *
 * @author makejava
 * @since 2024-11-15 10:03:56
 */
public interface AssetBasicNetWorkCpMapper extends BaseMapper<AssetBasicNetworkCpPo> {

    /**
     * 根据资产id资产供应链原有id
     *
     * @param id 资产id
     * @return
     */
   // @Select("select a.* from asset_basic_network a  left join asset_current_cp b  on a.asset_id =b.id where  b.task_id=#{taskId} ")
    @Select("select * from asset_basic_network where asset_id=#{id} ")
    List<AssetBasicNetworkCpPo> findByassetId(@Param("id") Long id);



    /**
     * 根据资产id和任务id删除数据
     *
     * @param assetId 资产id
     * @param taskId  任务id
     */
    @Delete("delete from asset_basic_network_cp where asset_id=#{assetId} and task_id =#{taskId}  ")
    void deletByAssetIdandTaskId(@Param("assetId") Long assetId, @Param("taskId") int taskId);


    /**
     * 根据assetId查询查询数据
     *
     * @param assetId 资产id
     * @param taskId  任务id
     * @return
     */
    @Select("select * from  asset_basic_network_cp where asset_id=#{assetId} and task_id =#{taskId}")
    List<AssetBasicNetworkCpPo>  findByTaskId(@Param("assetId") int assetId, @Param("taskId") int taskId);


    /**
     * 根据资产id和任务id删除数据
     *
     * @param assetId 资产id

     */
    @Delete("delete from asset_basic_network_cp where asset_id=#{assetId}")
    void deletByAssetId(@Param("assetId") Long assetId);

}