package com.goafanti.common.dao;

import com.goafanti.common.model.OutPublicReleaseCount;
import com.goafanti.common.model.PublicRelease;
import com.goafanti.common.model.PublicReleaseCount;
import com.goafanti.weChat.bo.OutPublicRelease;
import com.goafanti.weChat.bo.OutPublicReleaseAndDetails;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface PublicReleaseMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(PublicRelease record);

    int insertSelective(PublicRelease record);

    PublicRelease selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(PublicRelease record);

    int updateByPrimaryKey(PublicRelease record);


    OutPublicRelease selectDtails(@Param("id") Integer id);

    /**
     * 需要比对申请人其他公出时间，选择出重复的时间来判断是否生效。
     *  1 已有发起时间大于等于选择发起小于选择结束
     *  2 已有发起小于选择发起并且已有结束大于选择发起
     *  3 已有发起小于选择结束和已有结束大于选择结束
     * @param aid 申请人
     * @param start 开始时间
     * @param end 结束时间
     * @return
     */
    List<Integer> checkTime(@Param("aid")String aid, @Param("start") Date start, @Param("end")Date end);

    void updateSignByAidAndUid(@Param("uid") String buyerId, @Param("aid") String salesmanId);

    List<OutPublicReleaseCount > getTimeUserFollow(@Param("date")Date date, @Param("now")Date now);

    List<OutPublicRelease> publicByOrder(String orderNo);

    List<PublicRelease> selectByMainId(@Param("mainId") Integer mainId,@Param("type") Integer type,@Param("aid") String aid);


    void updateStatusByMainId(@Param("status") Integer status, @Param("type") Integer type,@Param("mainId") Integer mainId,@Param("aid") String aid);

    OutPublicReleaseAndDetails selectDtailsByFid(@Param("ufid")String ufid);
}
