package cn.com.countrygarden.bi.main.dao.dup;

import cn.com.countrygarden.bi.main.model.dup.CaseFieldInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

import javax.transaction.Transactional;
import java.util.List;

@Repository
@Transactional
public interface CaseFieldInfoMapper extends Mapper<CaseFieldInfo> {

    /**
     * 插入案场信息
     *
     * @param caseFieldInfo
     * @return
     */
    int insertCaseFieldInfo(CaseFieldInfo caseFieldInfo);

    int modifyCaseFieldInfo(CaseFieldInfo caseFieldInfo);

    /**
     * 软删除
     *
     * @param id
     * @param userCode
     * @return
     */
    int deleteCaseFieldInfoById(@Param("id") int id, @Param("userCode") String userCode);

    /**
     * 查询特定条件下的记录
     *
     * @param organCode
     * @param commId
     * @return
     */
    List<CaseFieldInfo> queryCaseFieldInfo(@Param("organCode") String organCode, @Param("organs") List<String> organs, @Param("commId") String commId, @Param("commIds") List<String> commIds,
                                           @Param("caseFieldId") String caseFieldId, @Param("page") int page, @Param("size") int size);


    /**
     * 查询特定条件下的总数
     *
     * @param organCode
     * @param commId
     * @return
     */
    int queryTotal(@Param("organCode") String organCode, @Param("commId") String commId, @Param("commIds") List<String> commIds,
                   @Param("caseFieldId") String caseFieldId);


    CaseFieldInfo queryById(@Param("id") int id);
}
