| | |
| | | <result property="registerDate" column="register_date" /> |
| | | <result property="licenseValidPeriod" column="license_valid_period" /> |
| | | <result property="licenseImage" column="license_image" /> |
| | | <result property="licenseValidType" column="license_valid_type" /> |
| | | <result property="legalIdCardFront" column="legal_id_card_front" /> |
| | | <result property="legalIdCardBack" column="legal_id_card_back" /> |
| | | <result property="legalIdValidType" column="legal_id_valid_type" /> |
| | | <result property="legalIdValidPeriod" column="legal_id_valid_period"/> |
| | | <result property="legalIdAddress" column="legal_id_address" /> |
| | | <result property="contactName" column="contact_name" /> |
| | | <result property="contactPhone" column="contact_phone" /> |
| | | <result property="contactEmail" column="contact_email" /> |
| | | <result property="payeeType" column="payee_type" /> |
| | | <result property="bankCardImage" column="bank_card_image" /> |
| | | <result property="bankCardNo" column="bank_card_no" /> |
| | | <result property="bankCity" column="bank_city" /> |
| | | <result property="auditStatus" column="audit_status" /> |
| | | <result property="auditBy" column="audit_by" /> |
| | | <result property="auditTime" column="audit_time" /> |
| | |
| | | <sql id="selectCertificationApplyVo"> |
| | | select id, user_id, subject_type, real_name, id_card, company_name, credit_code, legal_person, |
| | | registered_region, company_address, register_date, license_valid_period, license_image, |
| | | license_valid_type, legal_id_card_front, legal_id_card_back, legal_id_valid_type, |
| | | legal_id_valid_period, legal_id_address, contact_name, contact_phone, contact_email, |
| | | payee_type, bank_card_image, bank_card_no, bank_city, |
| | | audit_status, audit_by, audit_time, audit_remark, |
| | | del_flag, create_by, create_time, update_by, update_time, remark |
| | | from account_certification_apply |
| | |
| | | select a.id, a.user_id, a.subject_type, a.real_name, a.id_card, a.company_name, a.credit_code, |
| | | a.legal_person, a.registered_region, a.company_address, a.register_date, |
| | | a.license_valid_period, a.license_image, |
| | | a.license_valid_type, a.legal_id_card_front, a.legal_id_card_back, a.legal_id_valid_type, |
| | | a.legal_id_valid_period, a.legal_id_address, a.contact_name, a.contact_phone, a.contact_email, |
| | | a.payee_type, a.bank_card_image, a.bank_card_no, a.bank_city, |
| | | a.audit_status, a.audit_by, a.audit_time, a.audit_remark, |
| | | a.del_flag, a.create_by, a.create_time, a.update_by, a.update_time, a.remark, |
| | | u.phone, u.system_level |
| | |
| | | where id = #{id} and del_flag = '0' and audit_status = '0' |
| | | </update> |
| | | |
| | | <!-- |
| | | C端会员提交认证申请:把资料整份快照落库,审核结果/审核人/审核时间此时为空, |
| | | 由后台审核时回写。id 为自增主键,用 useGeneratedKeys 回填后作为申请号, |
| | | 后台列表「申请号」列展示的就是它。 |
| | | 各列均带 <if>:个人主体只填姓名与身份证号,企业字段留空即不落列。 |
| | | --> |
| | | <insert id="insertCertificationApply" parameterType="AccountCertificationApply" useGeneratedKeys="true" keyProperty="id"> |
| | | insert into account_certification_apply( |
| | | <if test="userId != null">user_id,</if> |
| | | <if test="subjectType != null">subject_type,</if> |
| | | <if test="realName != null">real_name,</if> |
| | | <if test="idCard != null">id_card,</if> |
| | | <if test="companyName != null">company_name,</if> |
| | | <if test="creditCode != null">credit_code,</if> |
| | | <if test="legalPerson != null">legal_person,</if> |
| | | <if test="registeredRegion != null">registered_region,</if> |
| | | <if test="companyAddress != null">company_address,</if> |
| | | <if test="registerDate != null">register_date,</if> |
| | | <if test="licenseValidPeriod != null">license_valid_period,</if> |
| | | <if test="licenseImage != null">license_image,</if> |
| | | <if test="licenseValidType != null">license_valid_type,</if> |
| | | <if test="legalIdCardFront != null">legal_id_card_front,</if> |
| | | <if test="legalIdCardBack != null">legal_id_card_back,</if> |
| | | <if test="legalIdValidType != null">legal_id_valid_type,</if> |
| | | <if test="legalIdValidPeriod != null">legal_id_valid_period,</if> |
| | | <if test="legalIdAddress != null">legal_id_address,</if> |
| | | <if test="contactName != null">contact_name,</if> |
| | | <if test="contactPhone != null">contact_phone,</if> |
| | | <if test="contactEmail != null">contact_email,</if> |
| | | <if test="payeeType != null">payee_type,</if> |
| | | <if test="bankCardImage != null">bank_card_image,</if> |
| | | <if test="bankCardNo != null">bank_card_no,</if> |
| | | <if test="bankCity != null">bank_city,</if> |
| | | <if test="auditStatus != null">audit_status,</if> |
| | | <if test="remark != null">remark,</if> |
| | | <if test="createBy != null and createBy != ''">create_by,</if> |
| | | create_time |
| | | )values( |
| | | <if test="userId != null">#{userId},</if> |
| | | <if test="subjectType != null">#{subjectType},</if> |
| | | <if test="realName != null">#{realName},</if> |
| | | <if test="idCard != null">#{idCard},</if> |
| | | <if test="companyName != null">#{companyName},</if> |
| | | <if test="creditCode != null">#{creditCode},</if> |
| | | <if test="legalPerson != null">#{legalPerson},</if> |
| | | <if test="registeredRegion != null">#{registeredRegion},</if> |
| | | <if test="companyAddress != null">#{companyAddress},</if> |
| | | <if test="registerDate != null">#{registerDate},</if> |
| | | <if test="licenseValidPeriod != null">#{licenseValidPeriod},</if> |
| | | <if test="licenseImage != null">#{licenseImage},</if> |
| | | <if test="licenseValidType != null">#{licenseValidType},</if> |
| | | <if test="legalIdCardFront != null">#{legalIdCardFront},</if> |
| | | <if test="legalIdCardBack != null">#{legalIdCardBack},</if> |
| | | <if test="legalIdValidType != null">#{legalIdValidType},</if> |
| | | <if test="legalIdValidPeriod != null">#{legalIdValidPeriod},</if> |
| | | <if test="legalIdAddress != null">#{legalIdAddress},</if> |
| | | <if test="contactName != null">#{contactName},</if> |
| | | <if test="contactPhone != null">#{contactPhone},</if> |
| | | <if test="contactEmail != null">#{contactEmail},</if> |
| | | <if test="payeeType != null">#{payeeType},</if> |
| | | <if test="bankCardImage != null">#{bankCardImage},</if> |
| | | <if test="bankCardNo != null">#{bankCardNo},</if> |
| | | <if test="bankCity != null">#{bankCity},</if> |
| | | <if test="auditStatus != null">#{auditStatus},</if> |
| | | <if test="remark != null">#{remark},</if> |
| | | <if test="createBy != null and createBy != ''">#{createBy},</if> |
| | | sysdate() |
| | | ) |
| | | </insert> |
| | | |
| | | <!-- |
| | | 统计该会员「待审核」的申请数:C端提交前用它做防重闸门。 |
| | | 只数 audit_status='0' 的行——已通过(auth_status 已是 '2')或已驳回 |
| | | (会员要改资料重提)都不该拦住新的提交,否则会员被驳回一次就再也交不了。 |
| | | 个人与企业/个体按主体类型隔离:subject_type='1' 为个人,个人与企业的待审互不干扰。 |
| | | --> |
| | | <select id="countPendingPersonalApplyByUserId" parameterType="Long" resultType="int"> |
| | | select count(1) from account_certification_apply |
| | | where del_flag = '0' and audit_status = '0' and subject_type = '1' and user_id = #{userId} |
| | | </select> |
| | | |
| | | <!-- 企业/个体待审核申请数:subject_type in ('2','3') --> |
| | | <select id="countPendingCompanyApplyByUserId" parameterType="Long" resultType="int"> |
| | | select count(1) from account_certification_apply |
| | | where del_flag = '0' and audit_status = '0' and subject_type in ('2','3') and user_id = #{userId} |
| | | </select> |
| | | |
| | | <!-- |
| | | C端进入认证页时回填:取该会员最近一次个人认证申请(按主键倒序取一条)。 |
| | | 驳回后重提会多一条,最近一条即当前应展示的状态与资料; |
| | | 此处不过滤 audit_status——未提交/待审/通过/驳回都需要能回填。 |
| | | --> |
| | | <select id="selectLatestPersonalApplyByUserId" parameterType="Long" resultMap="AccountCertificationApplyResult"> |
| | | <include refid="selectCertificationApplyVo"/> |
| | | where user_id = #{userId} and subject_type = '1' and del_flag = '0' |
| | | order by id desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | <!-- 企业/个体最近一次认证申请:subject_type in ('2','3') --> |
| | | <select id="selectLatestCompanyApplyByUserId" parameterType="Long" resultMap="AccountCertificationApplyResult"> |
| | | <include refid="selectCertificationApplyVo"/> |
| | | where user_id = #{userId} and subject_type in ('2','3') and del_flag = '0' |
| | | order by id desc |
| | | limit 1 |
| | | </select> |
| | | |
| | | </mapper> |