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.TechnologyArchives5;

import java.util.List;

@Mapper
public interface TechnologyArchives5Dao extends BaseMapper<TechnologyArchives5> {

    @Select("<script> " +
            " select * from technology_archives5 where 1 = 1 " +
            " <if test=\"socialNo != null and socialNo != '' \"> " +
            " and social_no = #{socialNo} " +
            " </if> " +
            " <if test=\"account != null and account != '' \"> " +
            " and account = #{account} " +
            " </if> " +
            "</script> ")
    List<TechnologyArchives5> selectFifthListByCode(@Param("socialNo") String socialNo, @Param("account") String account);

    @Select(" select * from technology_archives5 where social_no = #{socialNo} and time = #{time} ")
    TechnologyArchives5 selectTechnologyArchives5ByTime(@Param("socialNo") String socialNo, @Param("time") String time);

    @Update("<script>" +
            "update technology_archives5 " +
            "<trim prefix=\"set\" suffixOverrides=\",\">" +
            "<if test=\"socialNo != null and socialNo != '' \">" +
            "social_no = #{socialNo}, " +
            "</if>" +
            "<if test=\"time != null and time != '' \">" +
            "time = #{time}, " +
            "</if>" +
            "<if test=\"topic != null and topic != '' \">" +
            "topic = #{topic}, " +
            "</if>" +
            "<if test=\"periodical != null and periodical != '' \">" +
            "periodical = #{periodical}, " +
            "</if>" +
            "<if test=\"awards != null and awards != '' \">" +
            "awards = #{awards}, " +
            "</if>" +
            "</trim>" +
            "where social_no = #{socialNo} and time = #{time} " +
            "</script>")
    int updateTechnologyArchives5ByTime(TechnologyArchives5 fifth);

    @Update(" delete from technology_archives5 where social_no = #{socialNo} and time = #{time} ")
    int delTechnologyArchives5ByCode(@Param("socialNo") String socialNo, @Param("time") String time);

}
