package com.unis.base.server.dao;

import com.unis.base.common.vo.TzSlqyUpdateLogVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

/**
 * @author by PIG
 * 2023/6/30 14
 */
public interface TzSlqyUpdateLogDao extends Mapper<TzSlqyUpdateLogVO> {


    @Update("update tz_slqy_update_log set status = 1, after_data = #{newVal, jdbcType=VARCHAR} where update_col = #{updateCol, jdbcType=VARCHAR} and tyshxydm = #{tyshxydm, jdbcType=VARCHAR} and data_ver = #{dataVer, jdbcType=INTEGER}")
    int updateStatusByVer(@Param("tyshxydm") String tyshxydm, @Param("dataVer") Integer dataVer, @Param("updateCol") String colName, @Param("newVal") String newVal);

    @Select("select * from tz_slqy_update_log where tyshxydm = #{tyshxydm, jdbcType=VARCHAR} and data_ver = #{dataVer, jdbcType=INTEGER}")
    List<TzSlqyUpdateLogVO> listCurrentVerData(@Param("tyshxydm") String tyshxydm, @Param("dataVer") Integer dataVer);

    /** 提交更新修改人*/
    @Update("update tz_slqy_update_log set refresher = #{refresher, jdbcType=VARCHAR}, refresh_time = sysdate where tyshxydm = #{tyshxydm, jdbcType=VARCHAR} and data_ver = #{dataVer, jdbcType=INTEGER}")
    int updateRefresher(@Param("tyshxydm") String tyshxydm, @Param("dataVer") Integer dataVer, @Param("refresher") String refresher);
}
