package com.goafanti.common.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.goafanti.common.model.Contract;
import com.goafanti.contract.bo.ContractSerialNumber;
import com.goafanti.common.model.ContractExample;
import com.goafanti.common.model.ContractTask;

public interface ContractMapper {
    /**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	long countByExample(ContractExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int deleteByExample(ContractExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int deleteByPrimaryKey(String id);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int insert(Contract record);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int insertSelective(Contract record);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	List<Contract> selectByExample(ContractExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	Contract selectByPrimaryKey(String id);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int updateByExampleSelective(@Param("record") Contract record, @Param("example") ContractExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int updateByExample(@Param("record") Contract record, @Param("example") ContractExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int updateByPrimaryKeySelective(Contract record);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table contract
	 * @mbg.generated  Wed May 02 19:56:05 CST 2018
	 */
	int updateByPrimaryKey(Contract record);

	List<ContractSerialNumber> selectContractSerialNumber(String principal);

	int batchDeleteByPrimaryKey(List<String> id);

	Contract findByUidAndYear(@Param("uid") String uid, @Param("year")Integer year);

	Contract findLatelyRecordByUid(String uid);
	
	com.goafanti.contract.bo.ContractDetail selectContractDetail(String id);
	
	/**
	 * 批量插入和同明细
	 * @param contractDetailList
	 */
	void batchInsert(@Param("list")List<ContractTask> list);

	/**
	 * 删除项目任务
	 * @param taskId
	 * @return
	 */
	int deleteProjectTask(String taskId);

	/**
	 * 修复派单数据
	 * @param orderNo
	 * @param taskDistribution
	 * @return
	 */
	int updateRepairData(@Param("contractId")String contractId,@Param("taskDistribution") int taskDistribution);


	int selectTaskAllCount(@Param("contractId")String contractId);

	int selectTaskDisCount(@Param("contractId")String contractId);
}