package thyyxxk.webserver.dao.his.technologyArchives;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import thyyxxk.webserver.entity.technologyArchives.TechnologyArchives4;

import java.util.Map;

@Mapper
public interface TechnologyArchives4Dao extends BaseMapper<TechnologyArchives4> {

    @Select(" select * from technology_archives4 where social_no = #{socialNo} and id = #{id} ")
    TechnologyArchives4 selectTechnologyArchives4ById(@Param("socialNo") String socialNo, @Param("id") Integer id);

    @Select(" select image from technology_archives4 where social_no = #{socialNo} and id = #{id}")
    Map<String, Object> selectTrainingImage(@Param("socialNo") String socialNo, @Param("id") Integer id);

    @Update(" update technology_archives4 set image = #{url} where social_no = #{socialNo}   and begin_time = #{beginTime} ")
    int updateTrainingImage(@Param("socialNo") String socialNo, @Param("beginTime") String beginTime, String url);

    @Select(" select isnull(max(id), 0) as id from technology_archives4 where social_no = #{socialNo} ")
    int selectTechnologyArchives4MaxId(@Param("socialNo") String socialNo);

    @Update(" delete from technology_archives4 where social_no = #{socialNo} and id = #{id} ")
    int delTechnologyArchives4ByCode(@Param("socialNo") String socialNo, @Param("id") Integer id);

}
