package top.lvzhiqiang.mapper;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import top.lvzhiqiang.entity.VideoInfoOther;
import java.math.BigDecimal;
import java.util.List;
/**
* 电影信息其他Mapper
*
* @author lvzhiqiang
* 2022/5/4 9:54
*/
public interface VideoInfoOtherMapper {
/**
* 删除所有
*/
@Delete("DELETE FROM video_info_other where 1=1")
void deleteAll();
@Update({""})
void updateScoreOrComment(String identificationCode, BigDecimal score, String comment);
@Select("select count(*) from video_info_other where identification_code=#{identification_code}")
int findByCode(String identificationCode);
@Insert("INSERT INTO video_info_other(identification_code, score, comment, create_time, modify_time) " +
"VALUES (#{identificationCode},#{score},#{comment}, now(), now())")
void insertScoreOrComment(String identificationCode, BigDecimal score, String comment);
/**
* 新增/修改
*
* @param identificationCode
* @param picFlag
*/
@Insert("INSERT INTO video_info_other(identification_code, pic_flag, create_time, modify_time) " +
"VALUES (#{identificationCode}, #{picFlag}, now(), now()) " +
"ON DUPLICATE KEY UPDATE pic_flag=values(pic_flag),modify_time=now()")
int insertOrUpdate(String identificationCode, Integer picFlag);
@Insert("INSERT INTO video_info_other(identification_code, javdb_url, pic_flag, create_time, modify_time) " +
"VALUES (#{identificationCode}, #{javdbUrl}, #{picFlag}, now(), now()) " +
"ON DUPLICATE KEY UPDATE javdb_url=values(javdb_url),pic_flag=values(pic_flag),modify_time=now()")
int insertOrUpdate2(String identificationCode, Integer picFlag, String javdbUrl);
@Insert("INSERT INTO video_info_other(identification_code, resolution_ratio, original, subtitle, recoding, create_time, modify_time) " +
"VALUES (#{identificationCode},#{resolutionRatio},#{original}, #{subtitle}, #{recoding}, now(), now())")
void insertVideoInfoOther(String identificationCode, String resolutionRatio, Integer original, Integer subtitle, Integer recoding);
@Update({""})
void updateVideoInfoOther(String identificationCode, String resolutionRatio, Integer original, Integer subtitle, Integer recoding);
@Update("update video_info_other set delete_flag = 2,modify_time = now() where identification_code = #{identificationCode}")
void delByCode(String identificationCode);
@Select({""})
List findVideoInfoOther4MultipleParams(String identificationCode, String resolutionRatio, Integer original, Integer subtitle, Integer recoding);
@Select("SELECT * FROM video_info_other WHERE identification_code = #{identificationCode}")
VideoInfoOther findVideoInfoOtherByCode(String identificationCode);
@Insert("INSERT INTO video_info_other(identification_code, comment,comment_first,score, comment_xp,comment_xp_count,javdb_url, create_time, modify_time) " +
"VALUES (#{identificationCode}, #{comment}, #{commentFirst}, #{score}, #{commentXp}, #{xpCount}, #{javdbUrl}, now(), now()) " +
"ON DUPLICATE KEY UPDATE comment=values(comment),comment_first=values(comment_first),score=values(score),comment_xp=values(comment_xp),comment_xp_count=values(comment_xp_count),javdb_url=values(javdb_url),modify_time=now()")
void updateVideoInfoOther4Xp(VideoInfoOther videoInfoOther);
@Update("update video_info_other set javdb_url=#{javdbUrl} where identification_code=#{identificationCode}")
int updateJavdbUrl(String identificationCode, String javdbUrl);
}