<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.chinaweal.aiccs.aiceps.annual.mapper.NoAnnualMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.chinaweal.aiccs.aiccs.abnormal.entity.TREntBaseInfo">
        <id column="ENTID" property="entid" />
        <result column="ENTITYNO" property="entityno" />
        <result column="REGISTNO" property="registno" />
        <result column="ENTNAME" property="entname" />
        <result column="ENTTYPE" property="enttype" />
        <result column="EMPNUMBER" property="empnumber" />
        <result column="EMPNUMBERISSHOW" property="empnumberisshow" />
        <result column="ENTPHONE" property="entphone" />
        <result column="ENTADDRESS" property="entaddress" />
        <result column="ENTZIP" property="entzip" />
        <result column="ENTEMAIL" property="entemail" />
        <result column="ENTSTATE" property="entstate" />
        <result column="ISWEB" property="isweb" />
        <result column="ISINVEINFO" property="isinveinfo" />
        <result column="REGISTERDATE" property="registerdate" />
        <result column="REPORTYEAR" property="reportyear" />
        <result column="ISSUEDEPTID" property="issuedeptid" />
        <result column="ISTRANSFERSTOCK" property="istransferstock" />
        <result column="ONAICCIPS" property="onaiccips" />
        <result column="RELATIONS" property="relations" />
        <result column="RELATIONSISSHOW" property="relationsisshow" />
        <result column="LAUPTIME" property="lauptime" />
        <result column="AREA_CODE" property="areaCode" />
        <result column="CREATEDATE" property="createdate" />
        <result column="UPDATEDATE" property="updatedate" />
        <result column="DSTATE" property="dstate" />
        <result column="SYNCDATE" property="syncdate" />
        <result column="SYNCFLAG" property="syncflag" />
        <result column="ISSYNC" property="issync" />
        <result column="REGISTDATE" property="registdate" />
        <result column="ENTITYTYPE" property="entitytype" />
        <result column="SUBENTITYTYPE" property="subentitytype" />
        <result column="ORGID" property="orgid" />
        <result column="uscc" property="uscc" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        ENTID, ENTITYNO, REGISTNO, ENTNAME, ENTTYPE, EMPNUMBER, EMPNUMBERISSHOW, ENTPHONE, ENTADDRESS, ENTZIP, ENTEMAIL, ENTSTATE, ISWEB, ISINVEINFO, REGISTERDATE, REPORTYEAR, ISSUEDEPTID, ISTRANSFERSTOCK, ONAICCIPS, RELATIONS, RELATIONSISSHOW, LAUPTIME, AREA_CODE, CREATEDATE, UPDATEDATE, DSTATE, SYNCDATE, SYNCFLAG, ISSYNC, REGISTDATE, ENTITYTYPE, SUBENTITYTYPE, ORGID, uscc
    </sql>

    <select id="selectQynoAnnual" resultMap="BaseResultMap">
        SELECT
        tj.entno ENTITYNO,
        tj.uniscid uscc,
        tj.regno REGISTNO
        from cipentinfo tj  where
        OpState = '1'
        and tj.enttype NOT IN ('5830','6830','8000','8100','8200','8300','8500','9000','9100',
        '9200',
        '9500',
        '9600',
        '9910',
        '9999',
        '7200')
        and   EstDate &lt; #{param.EstDate}
        and not EXISTS(select 1 from trentbaseinfo t where t.entityno=tj.EntNo and t.dstate != '2' and t.reportyear = #{param.reporYear})
    </select>

    <select id="selectWgczAnnual" resultMap="BaseResultMap">
        SELECT
        tj.entno ENTITYNO,
        tj.uniscid uscc,
        tj.regno REGISTNO
        from cipentinfo tj WHERE ENTTYPE = '7200'
        AND tj.OpState = '1'
        AND tj.ESTDATE &lt; #{param.EstDate}
        and not exists (select 1 from AN_FOR_BASEINFO tr where tr.pripid=tj.entno and tr.ancheyear=#{param.reporYear} and tr.status IN ('4'))
    </select>

    <select id="selectAnnualAccountByPripid" resultType="com.chinaweal.aiccs.aiceps.annual.entity.AccountPwdLogon">

        SELECT  * from TB_MFUP_ACCOUNTPWDLOGON where suserid in (SELECT sid from TB_MFUP_COMPANYUSER where spripid = #{spripid})

    </select>
</mapper>
