package com.chinaweal.aiccs.aiccs.punishment.mapper;

import com.chinaweal.aiccs.aiccs.punishment.entity.EntLock;
import com.chinaweal.aiccs.aiccs.punishment.entity.Personlock;
import com.chinaweal.aiccs.aiccs.punishment.entity.Tolockentlist;
import com.chinaweal.aiccs.aiccs.punishment.entity.dto.EntDto;
import com.chinaweal.aiccs.aiccs.system.entity.TRBaseCode;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface TaskMapper {
    List<Tolockentlist> queryFromAll(String tableName);

    List<Tolockentlist> queryAll();
/*
select '2' as punishFrom, aa.F000 as punishInfoId, eb.pripid, eb.uniscid,
        eb.entname, eb.regno, eb.regstate, eb.regstate_Cn regstateCn, eb.regorg
        from crgs.ex_xxzx_10_hggjrzqymd aa left join e_baseinfo eb on
        aa.qyzwmc = eb.ENTNAME
        where PRIPID is not null
        union all
select '10' as punishFrom, aa.F000 as punishInfoId, eb.pripid, eb.uniscid,
        eb.entname, eb.regno, eb.regstate, eb.regstate_Cn regstateCn, eb.regorg
        from crgs.ex_xxzx_17_10ajnsrmd aa left join e_baseinfo eb on
        aa.nsrmc = eb.ENTNAME
        where PRIPID is not null
        union all
 */

    EntLock query(String entname);

    Personlock querypersonlock(String lerep,String entname);

    List<String> queryByTolockentlistAndTsbizPunishLock(@Param("pripid") String pripid, @Param("punishFrom") String punishFrom);

    Tolockentlist queryByPripid(String pripid);

    int deleteTolockentlistByPripid(String pripid);

    //查询存在entlock表不存在于tolockentlist表
    //查询存在于entlock表状态为0，同时在tolockentlist表中状态为1的数据
    List<String> queryEntLock();

    void updateEntLock(List pripids);

    /**
     * 查询锁定表entlock中状态为0，未解锁 及在e_baseinfo表中登记状态不为 1：营业
     * @return
     */
    List<EntDto> queryEntDto();

    /**
     * 查询存在entlock不存在来源表的数据且状态为‘0’待解锁
     */
    List<EntLock> queryAllEntFromPF();

    /**
     * 查询登记状态
     * @return
     */
    List<TRBaseCode> queryRegState();

    int checkEntLock(@Param("tableName")String tableName, @Param("entName")String entName);



}
