package cn.com.ty.lift.ud.recruitmentInfos.mapper;


import java.util.List;

import cn.com.ty.lift.ud.recruitmentInfos.controller.query.RecruitmentInfoQuery;
import cn.com.ty.lift.ud.recruitmentInfos.mapper.entity.RecruitmentInfoEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import  com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * 招聘信息 -Repository
 * 
 * @author Xson
 * @date 2020-04-23
 */
public interface RecruitmentInfoMapper extends BaseMapper<RecruitmentInfoEntity> {

	List<RecruitmentInfoEntity> selectByQuery(@Param("ew") Wrapper wrapper, @Param("page") RecruitmentInfoQuery page);

    int countByQuery(@Param("ew") Wrapper wrapper);
    
    RecruitmentInfoEntity finOneById(@Param("id")Long id);
    
    /**
     * 审批，修改审批状态为1
     *
     * @param id
     */
    @Update(value = "update recruitment_info set check_flag= 1,statuz=1 where id = #{id}")
    void examineById(@Param("id")Long id);
    
    /**
     * 审批驳回，修改审批状态为0
     *
     * @param id
     */
    @Update(value = "update recruitment_info set check_flag= 0,statuz=0,reason =#{reason} where id = #{id}")
    void updateInfoById(@Param("id")Long id,@Param("reason")String reason);
    
    @Update(value = "update recruitment_info set browse_num= browse_num+1 where id = #{id}")
    void updateBrowseNum(@Param("id")Long id);
}
