/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.wechat.dao;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.beust.jcommander.internal.Maps;
import com.wechat.global.base.dao.impl.BaseDao;
import com.wechat.model.dbEntity.MdeWorkExperience;
import com.wechat.model.dto.WorkExperienceBaseDto;

/**
 * 单表生成DAO接口
 * 
 * @author tangwc
 * @version 2018-05-23
 */
@Repository
public class MdeWorkExperienceDao extends BaseDao {

	public MdeWorkExperience getInfoById(Integer workId) {
		return super.selectOne("MdeWorkExperienceMapper.get", workId);
	}

	public int findByUserCodeCount(String userCode) {
		return sqlSession.selectOne("MdeWorkExperienceMapper.findByUserCodeCount", userCode);
	}

	/**
	 * 获取职位头衔 工作信息
	 * 
	 * @param userCode
	 * @return
	 */
	public MdeWorkExperience findWorkPTByUserCode(String userCode) {
		return sqlSession.selectOne("MdeWorkExperienceMapper.findWorkPTByUserCode", userCode);
	}

	public int insert(MdeWorkExperience mdeWorkExperience) {
		return super.insert("MdeWorkExperienceMapper.insert", mdeWorkExperience);
	}

	/**
	 * 获取工作简历列表（基本信息）
	 * 
	 * @param userCode
	 * @return
	 */
	public List<WorkExperienceBaseDto> getBaseWorkExperienceByUserCode(String userCode) {
		return super.select("MdeWorkExperienceMapper.getBaseWorkExperienceByUserCode", userCode);
	}
	
	/**
	 * 获取工作简历列表（全部信息）
	 * 
	 * @param userCode
	 * @return
	 */
	public List<MdeWorkExperience> getAllWorkExperienceByUserCode(String userCode) {
		return super.select("MdeWorkExperienceMapper.getAllWorkExperienceByUserCode", userCode);
	}

	public int update(MdeWorkExperience workExperience) {
		return super.update("MdeWorkExperienceMapper.update", workExperience);
	}

	/**
	 * 删除工作简历
	 * 
	 * @param mdeWorkExperience
	 * @return
	 */
	public int delete(Integer workId) {
		return sqlSession.delete("MdeWorkExperienceMapper.delete", workId);
	}

	public int updatePositionTitle(MdeWorkExperience workExperience) {
		return super.update("MdeWorkExperienceMapper.updatePositionTitle", workExperience);
	}

	/**
	 * 获取用户工作经历
	 * 
	 * @param userCodeList
	 *            usercode集合
	 * @return
	 */
	public List<MdeWorkExperience> getWorkExperienceByUserCodeList(List<String> userCodeList) {
		Map<String, Object> maps = Maps.newHashMap();
		maps.put("userCodeList", userCodeList);
		return super.select("MdeWorkExperienceMapper.getWorkExperienceByUserCodeList", maps);
	}
	
	/**
	 * 获取工作履历 降序
	 * @param userCode
	 * @return
	 */
	public List<MdeWorkExperience> getWorkExperienceAndQuitDateDesc(String userCode) {
		return super.select("MdeWorkExperienceMapper.getWorkExperienceAndQuitDateDesc", userCode);
	}
	
	/**
	 * 修改当前显示的头衔  为不显示
	 * @param userCode
	 * @return
	 */
	public int updateCurrentPositionTitle(String userCode) {
		return sqlSession.update("MdeWorkExperienceMapper.updateCurrentPositionTitle", userCode);
	}
	
	/**
	 * 重置用户职位头衔显示
	 * @param userCode
	 * @return
	 */
	public int resetPositionTitle(String userCode) {
		return sqlSession.update("MdeWorkExperienceMapper.resetPositionTitle", userCode);
	}
	/**
	 * 设置最近的工作履历为显示的职位头衔
	 * @param userCode
	 */
	public int setLatestWEShow(String userCode) {
		return sqlSession.update("MdeWorkExperienceMapper.setLatestWEShow", userCode);
	}
	
}