<?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.muchinfo.mtp3interface.mapper.IUserinfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.muchinfo.mtp3pojos.entity.Userinfo">
        <id column="USERID" property="userid" />
        <result column="USERINFOTYPE" property="userinfotype" />
        <result column="CUSTOMERNAME" property="customername" />
        <result column="USERSTATUS" property="userstatus" />
        <result column="USERTYPE" property="usertype" />
        <result column="OPENMODE" property="openmode" />
        <result column="CARDTYPEID" property="cardtypeid" />
        <result column="CARDNUM" property="cardnum" />
        <result column="HALFBODYPHOTOURL" property="halfbodyphotourl" />
        <result column="CARDFRONTPHOTOURL" property="cardfrontphotourl" />
        <result column="CARDBACKPHOTOURL" property="cardbackphotourl" />
        <result column="BIZNATURE" property="biznature" />
        <result column="BIZSCOPE" property="bizscope" />
        <result column="LEGALPERSONNAME" property="legalpersonname" />
        <result column="CONTACTNAME" property="contactname" />
        <result column="SEX" property="sex" />
        <result column="TELPHONE" property="telphone" />
        <result column="MOBILE" property="mobile" />
        <result column="FAX" property="fax" />
        <result column="EMAIL" property="email" />
        <result column="QQ" property="qq" />
        <result column="WECHAT" property="wechat" />
        <result column="COUNTRYID" property="countryid" />
        <result column="PROVINCEID" property="provinceid" />
        <result column="CITYID" property="cityid" />
        <result column="DISTRICTID" property="districtid" />
        <result column="COMPANY" property="company" />
        <result column="ADDRESS" property="address" />
        <result column="POSTALCODE" property="postalcode" />
        <result column="CREATETIME" property="createtime" />
        <result column="CREATORID" property="creatorid" />
        <result column="MODIFIERTIME" property="modifiertime" />
        <result column="MODIFIERID" property="modifierid" />
        <result column="REMARK" property="remark" />
        <result column="WSKHINFO" property="wskhinfo" />
        <result column="SIGNPDFURL" property="signpdfurl" />
        <result column="LEGALCARDFRONTPHOTOURL" property="legalcardfrontphotourl" />
        <result column="LEGALCARDBACKPHOTOURL" property="legalcardbackphotourl" />
        <result column="OTHERURL" property="otherurl" />
        <result column="HASENCRYPT" property="hasencrypt" />
        <result column="BANKNAME" property="bankname" />
        <result column="BANKACCOUNT" property="bankaccount" />
        <result column="BANKCARDFRONTPHOTOURL" property="bankcardfrontphotourl" />
        <result column="NEEDINVOICE" property="needinvoice" />
        <result column="BANKID" property="bankid" />
        <result column="ATTACHMENT1" property="attachment1" />
        <result column="ATTACHMENT2" property="attachment2" />
        <result column="BANKACCOUNTNAME" property="bankaccountname" />
        <result column="HEADURL" property="headurl" />
        <result column="NICKNAME" property="nickname" />
        <result column="MOBILE2" property="mobile2" />
        <result column="BIZTYPE" property="biztype" />
        <result column="PROXYSTATEMENTURL" property="proxystatementurl" />
        <result column="CONTACTCARDFRONTPHOTOURL" property="contactcardfrontphotourl" />
        <result column="CONTACTCARDBACKPHOTOURL" property="contactcardbackphotourl" />
        <result column="ATTACHMENT3" property="attachment3" />
        <result column="ATTACHMENT4" property="attachment4" />
        <result column="ATTACHMENT5" property="attachment5" />
        <result column="TAXPAYERNUM" property="taxpayernum" />
        <result column="BIRTHDAY" property="birthday" />
        <result column="MODIFYSRC" property="modifysrc" />
        <result column="LOGINCODE" property="logincode" />
    </resultMap>

    <resultMap id="UserinfoDetailVo" type="com.muchinfo.mtp3pojos.vo.investor.UserinfoDetailVo">
        <result column="CUSTOMERNAME" property="customerName" />
        <result column="OPENMODE" property="openMode" />
        <result column="USERINFOTYPE" property="userinfoType" />
        <result column="CARDTYPEID" property="cardTypeId" />
        <result column="CARDNUM" property="cardNum" />
        <result column="HALFBODYPHOTOURL" property="halfBodyPhotoUrl" />
        <result column="CARDFRONTPHOTOURL" property="cardFrontPhotoUrl" />
        <result column="CARDBACKPHOTOURL" property="cardBackPhotoUrl" />
        <result column="BIZNATURE" property="bizNature" />
        <result column="LEGALPERSONNAME" property="legalPersonName" />
        <result column="CONTACTNAME" property="contactName" />
        <result column="SEX" property="sex" />
        <result column="COUNTRYID" property="countryid" />
        <result column="TELPHONE" property="telPhone" />
        <result column="MOBILE" property="mobile" />
        <result column="EMAIL" property="email" />
        <result column="WECHAT" property="wechat" />
        <result column="COMPANY" property="company" />
        <result column="ADDRESS" property="address" />
        <result column="POSTALCODE" property="postalCode" />
        <result column="REMARK" property="remark" />
        <result column="LEGALCARDFRONTPHOTOURL" property="legalCardFrontPhotoUrl" />
        <result column="LEGALCARDBACKPHOTOURL" property="legalCardBackPhotoUrl" />
        <result column="OTHERURL" property="otherUrl" />
        <result column="BANKNAME" property="bankName" />
        <result column="BANKACCOUNT" property="bankAccount" />
        <result column="BANKCARDFRONTPHOTOURL" property="bankCardFrontPhotoUrl" />
        <result column="NEEDINVOICE" property="needInvoice" />
        <result column="PROVINCEID" property="provinceid" />
        <result column="CITYID" property="cityid" />
        <result column="BANKID" property="bankid" />
        <result column="ATTACHMENT1" property="attachment1" />
        <result column="ATTACHMENT2" property="attachment2" />
        <result column="QQ" property="qq" />
        <result column="DISTRICTID" property="districtid" />
        <association property="pathName" column="DISTRICTID"
                     jdbcType="VARCHAR" select="com.muchinfo.mtp3interface.mapper.IDivisionMapper.selectAreaPathName"></association>
        <association property="countryName" column="COUNTRYID"
                     jdbcType="VARCHAR" select="com.muchinfo.mtp3interface.mapper.IDivisionMapper.selectAreaPathName"></association>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        USERID, USERINFOTYPE, CUSTOMERNAME, USERSTATUS, USERTYPE, OPENMODE, CARDTYPEID, CARDNUM, HALFBODYPHOTOURL, CARDFRONTPHOTOURL, CARDBACKPHOTOURL, BIZNATURE, BIZSCOPE, LEGALPERSONNAME, CONTACTNAME, SEX, TELPHONE, MOBILE, FAX, EMAIL, QQ, WECHAT, COUNTRYID, PROVINCEID, CITYID, DISTRICTID, COMPANY, ADDRESS, POSTALCODE, CREATETIME, CREATORID, MODIFIERTIME, MODIFIERID, REMARK, WSKHINFO, SIGNPDFURL, LEGALCARDFRONTPHOTOURL, LEGALCARDBACKPHOTOURL, OTHERURL, HASENCRYPT, BANKNAME, BANKACCOUNT, BANKCARDFRONTPHOTOURL, NEEDINVOICE, BANKID, ATTACHMENT1, ATTACHMENT2, BANKACCOUNTNAME, HEADURL, NICKNAME, MOBILE2, BIZTYPE, PROXYSTATEMENTURL, CONTACTCARDFRONTPHOTOURL, CONTACTCARDBACKPHOTOURL, ATTACHMENT3, ATTACHMENT4, ATTACHMENT5, TAXPAYERNUM, BIRTHDAY, MODIFYSRC, LOGINCODE
    </sql>

    <select id="getUserinfoDetail" parameterType="java.lang.Long"
            resultMap="UserinfoDetailVo">
        select t.*
        from userinfo t
        where t.userid = #{userid}
    </select>

    <select id="getUserinfoNewDetail" parameterType="java.lang.Long"
            resultMap="UserinfoDetailVo">
        select t.* from draft_userinfo t where t.userid = #{userid}
    </select>
    <select id="queryUserinfoTa" resultType="com.muchinfo.mtp3pojos.entity.Userinfo">
        select ta.accountid, ui.* from taaccount ta
        left join userinfo ui on ui.userid = ta.userid
    </select>


</mapper>
