123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- <?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.minpay.db.table.own.mapper.CustomerMapper">
- <select id="queryCustomer" resultType="hashmap" parameterType="hashmap">
- SELECT
- CIF_ID userId,
- CIF_CERT_NO certNo,
- CIF_BUSINESS_TERM businessTerm,
- CIF_BUSINESS_SCOPE businessScope,
- CIF_REG_CAPITAL regCapital,
- CIF_REG_DATE regDate,
- CIF_REG_ADDRESS address,
- CIF_COR_NAME corName,
- CIF_COR_MOBILE corMobile,
- CIF_COR_ID_NUM corIdNum,
- CIF_COR_ID_HEADS idHead,
- CIF_COR_ID_TAILS idTails,
- CIF_COR_ID_TERMBEG corIdTermbeg,
- CIF_COR_ID_TERMEND corIdTermend,
- CIF_ACC_NO accNo,
- CIF_ACC_BANK accBank,
- CIF_CONTACTS contacts,
- CIF_CONTACTS_MOBILE contactsMobile,
- a.usr_id usrId,
- a.USR_PHONE userName,
- CIF_NAME companyName,
- CIF_GRADE_LEVEL gradeLevel,
- cast(IFNULL(CIF_CREDITS_BALANCE,"0") as DECIMAL(20,6)) balance,
- SUBSTR(a.USR_CREATEDATE, 1, 8) createTime,
- SUBSTR(CIF_CREATE_TIME, 1, 8) corCreateTime,
- b.USR_NAME customerName,
- b.USR_ID customerId,
- cast(CIF_CREDITS as DECIMAL(20,6)) creditLine,
- cast((CIF_CREDITS - CIF_CREDITS_BALANCE) as DECIMAL(20,6)) remainingMargin,
- CIF_STT state,
- IFNULL(CAP_APPLY_NO, '') 'applyNo',
- a.USR_STT stt
- FROM
- tp_company_info
- left join im_user a on a.USR_COMID = CIF_ID
- left join im_user b on b.USR_ID = CIF_MANAGER_NO
- left join tp_credit_apply on CAP_COM_ID = CIF_ID and CAP_STT ='00'
- WHERE 1=1
- <if test="userName != null and userName != ''">
- and a.USR_PHONE like CONCAT('%',#{userName, jdbcType=VARCHAR},'%')
- </if>
- <if test="userId != null and userId != ''">
- and CIF_ID like CONCAT('%',#{userId, jdbcType=VARCHAR},'%')
- </if>
- <if test="companyName != null and companyName != ''">
- and CIF_NAME like CONCAT('%',#{companyName, jdbcType=VARCHAR},'%')
- </if>
- <if test="beginDate != null and beginDate != ''">
- and CIF_REG_DATE >= #{beginDate, jdbcType=VARCHAR}
- </if>
- <if test="endDate != null and endDate != ''">
- and CIF_REG_DATE <= #{endDate, jdbcType=VARCHAR}
- </if>
- <if test="state != null and state != ''">
- and CIF_STT = #{state, jdbcType=VARCHAR}
- </if>
- <if test="imUserId != null and imUserId != ''">
- and CIF_MANAGER_NO = #{imUserId, jdbcType=VARCHAR}
- </if>
- order by CIF_CREATE_TIME desc
- </select>
- <select id="queryAccInfManage" resultType="hashmap" parameterType="hashmap">
- SELECT
- ACF_NO userId,
- ACF_NAME companyName,
- cast(ACF_AMT as DECIMAL(20,6)) creditLine,
- cast((ACF_AMT - (select ifnull(sum(ADL_TRXAMOUT),0) from tp_acc_detail where ADL_ACCNO = ACF_NO)) as DECIMAL(20,6)) balance,
- cast((select IFNULL(SUM(ADL_TRXAMOUT),0) from tp_acc_detail where ADL_ACCNO = ACF_NO) as DECIMAL(20,6)) remainingMargin,
- ACF_CREATE_TIME createTime
- FROM
- tp_acc_inf
- WHERE 1=1
- <if test="userId != null and userId != ''">
- and ACF_NO like CONCAT('%',#{userId, jdbcType=VARCHAR},'%')
- </if>
- <if test="companyName != null and companyName != ''">
- and ACF_NAME like CONCAT('%',#{companyName, jdbcType=VARCHAR},'%')
- </if>
- <if test="beginDate != null and beginDate != ''">
- and SUBSTR(ACF_CREATE_TIME,1,8) >= #{beginDate, jdbcType=VARCHAR}
- </if>
- <if test="endDate != null and endDate != ''">
- and SUBSTR(ACF_CREATE_TIME,1,8) <= #{endDate, jdbcType=VARCHAR}
- </if>
- order by ACF_CREATE_TIME desc
- </select>
- <select id="queryAccInfDetail" resultType="hashmap" parameterType="hashmap">
- SELECT
- cast(ADL_TRXAMOUT as DECIMAL(20,6)) loaningAmt,
- ADL_CREATE_TIME applyDate,
- ADL_REL_NO orderno,
- CIF_NAME corName
- FROM
- tp_acc_detail,
- tp_order_inf,
- tp_company_info
- WHERE OIF_ORDERNO = ADL_REL_NO
- and OIF_COM_ID = CIF_ID
- and ADL_ACCNO = #{accNo, jdbcType=VARCHAR}
- <if test="corName != null and corName != ''">
- and CIF_NAME like CONCAT('%',#{corName, jdbcType=VARCHAR},'%')
- </if>
- <if test="beginDate != null and beginDate != ''">
- and SUBSTR(ADL_CREATE_TIME,1,8) >= #{beginDate, jdbcType=VARCHAR}
- </if>
- <if test="endDate != null and endDate != ''">
- and SUBSTR(ADL_CREATE_TIME,1,8) <= #{endDate, jdbcType=VARCHAR}
- </if>
- order by ADL_CREATE_TIME desc
- </select>
- <select id = "cregitQuery" resultType="hashmap" parameterType="hashmap">
- select
- a.CAP_APPLY_NO id,
- c.CIF_ID userId,
- u.USR_PHONE userName,
- c.CIF_NAME companyName,
- c.CIF_GRADE_LEVEL gradeLevel,
- cast(a.CAP_QUOTA as DECIMAL(20,6)) balance,
- c.CIF_REG_DATE createTime,
- b.USR_NAME customerName,
- ifnull(a.CAP_APPROVER, '00') approver
- from
- tp_credit_apply a,im_user u,tp_company_info c
- LEFT JOIN im_user b ON b.USR_ID = c.CIF_MANAGER_NO
- where
- a.CAP_COM_ID = c.CIF_ID
- and u.USR_ID = a.CAP_USER
- and CAP_STT in ('01','02')
- <if test="approverType != null and approverType != ''">
- and ifnull(a.CAP_APPROVER, '00') = #{approverType, jdbcType=VARCHAR}
- </if>
- </select>
- <select id = "queryCreditApplyFlow" resultType="hashmap" parameterType="hashmap">
- SELECT
- AAH_STT stt,
- AAH_RESULT result,
- USR_NAME userName,
- AAH_AUTHTIME authTime,
- AAH_OPINION opinion
- FROM
- tp_approve_auth,
- im_user u
- WHERE 1=1
- AND AAH_USER = u.USR_ID
- AND AAH_APPLYNO = #{applyNo, jdbcType=VARCHAR}
-
- </select>
- <select id = "queryCreditApply" resultType="hashmap" parameterType="hashmap">
- SELECT
- CAP_QUOTA quota,
- CAP_APPLY_NO applyNo,
- CAP_BEGIN begin,
- CAP_END end,
- CAP_CREATETIME createTime,
- CAP_STT stt,
- CAP_REMARK remark
- FROM
- tp_credit_apply
- WHERE 1=1
- and CAP_COM_ID = #{userId, jdbcType=VARCHAR}
- and CAP_STT ='00'
- ORDER BY CAP_CREATETIME DESC
- </select>
- <select id="queryUserList" parameterType="hashmap" resultType="com.minpay.common.bean.UserModel">
- SELECT
- iu.USR_COMID AS 'userId',
- iu.USR_LOGONNAME AS 'userName',
- tci.CIF_REG_DATE AS 'regDate',
- tci.CIF_NAME AS 'companyName',
- tci.CIF_GRADE_LEVEL AS 'gradeLevel',
- tci.CIF_CREDITS_BALANCE AS 'creditsBalance',
- iuu.USR_NAME AS 'managerName',
- (
- CASE tci.CIF_STT
- WHEN '01' THEN
- '未实名'
- WHEN '02' THEN
- '实名认证中'
- WHEN '03' THEN
- '已申请'
- WHEN '04' THEN
- '已提交'
- WHEN '05' THEN
- '审批中'
- WHEN '06' THEN
- '审批通过'
- WHEN '07' THEN
- '审批未通过'
- END
- ) AS 'stt'
- FROM
- im_user iu
- INNER JOIN tp_company_info tci ON iu.USR_COMID = tci.CIF_ID
- INNER JOIN im_user iuu ON iuu.USR_ID = tci.CIF_MANAGER_NO
- <where>
- <if test="userId != null and userId != ''">
- iu.USR_COMID like CONCAT('%',#{userId},'%')
- </if>
- <if test="userName != null and userName != ''">
- and iu.USR_LOGONNAME like CONCAT('%',#{userName},'%')
- </if>
- <if test="companyName != null and companyName != ''">
- and tci.CIF_NAME like CONCAT('%',#{companyName},'%')
- </if>
- <if test="beginDate != null and beginDate != ''">
- <![CDATA[and tci.CIF_REG_DATE >= #{beginDate}]]>
- </if>
- <if test="endDate != null and endDate != ''">
- <![CDATA[and tci.CIF_REG_DATE <= #{endDate}]]>
- </if>
- <if test="state != null and state != ''">
- and CIF_STT = #{state}
- </if>
- </where>
- </select>
- </mapper>
|