You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

104 lines
5.3 KiB

<?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.daqing.financial.guarantee.mapper.DgLoanNoticeMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.daqing.framework.domain.guarantee.DgLoanNotice">
<id column="id" property="id" />
<result column="company_id" property="companyId" />
<result column="consider_id" property="considerId" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="update_time" property="updateTime" />
</resultMap>
<resultMap id="LoanNoticeListResponseMap" type="com.daqing.financial.guarantee.model.response.LoanNoticeListResponse">
<id column="id" property="id" />
<result column="business_code" property="businessCode" />
<result column="bank" property="bank" />
<result column="name" property="name" />
<result column="phone" property="phone" />
<result column="status" property="status" />
<result column="create_time" property="createTime" />
<result column="loan_tern" property="loanTern" />
<result column="loan_money" property="loanMoney" />
<result column="business_type" property="businessType" />
<result column="audit_opinion" property="auditOpinion" />
<result column="operating_status" property="operatingStatus" />
<result column="business_status" property="businessStatus" />
<result column="business_id" property="businessId" />
<result column="role_id" property="roleId" />
<result column="passing_time" property="passingTime" />
</resultMap>
<select id="pageByCondition" resultMap="LoanNoticeListResponseMap">
select ln.id,aai.business_code,cc.name,cc.phone,aai.business_type,lcc.loan_tern,lcc.loan_money,ln.role_id,
aai.create_time,ln.status,aai.bank,ln.audit_opinion,ln.operating_status,bps.business_status,ln.business_id,lcc.passing_time
from dg_loan_notice ln
left join dg_apply_amount_info aai on ln.business_id = aai.id
left join crms_company_customer ccc on ln.company_id = ccc.id
left join crms_customer cc on ccc.customer_id = cc.id
left join dg_loan_committee_consider lcc on ln.business_id = lcc.business_id
left join dg_business_process_status bps on ln.business_id = bps.business_id
<where>
ln.role_id in
<foreach collection="roleIdList" open="(" separator="," close=")" item="id">
#{id}
</foreach>
<if test="userId != null and userId != ''">
AND (ln.consider_id = #{userId} or ln.consider_id is null OR ln.consider_id = '')
</if>
<if test="customerNumberOrName != null and customerNumberOrName != ''">
AND (aai.business_code LIKE CONCAT('%' #{customerNumberOrName} '%') OR cc.name LIKE CONCAT('%' #{customerNumberOrName} '%'))
</if>
<if test="status != null and status != ''">
AND ln.status = #{status}
</if>
</where>
</select>
<select id="selectBatchData" resultMap="LoanNoticeListResponseMap">
select ln.id,aai.business_code,cc.name,cc.phone,aai.business_type,lcc.loan_tern,lcc.loan_money,
aai.create_time,ln.status,ln.operating_status,bps.business_status
from dg_loan_notice ln
left join dg_apply_amount_info aai on ln.business_id = aai.id
left join crms_company_customer ccc on ln.company_id = ccc.id
left join crms_customer cc on ccc.customer_id = cc.id
left join dg_loan_committee_consider lcc on ln.business_id = lcc.business_id
left join dg_business_process_status bps on ln.business_id = bps.business_id
where ln.id in
<foreach collection="list" close=")" open="(" item="id" separator=",">
#{id}
</foreach>
</select>
<select id="selectLoanNotice" resultMap="LoanNoticeListResponseMap">
select cc.name,lcc.loan_money,aai.bank
from dg_loan_notice ln
left join dg_apply_amount_info aai on ln.business_id = aai.id
left join crms_company_customer ccc on ln.company_id = ccc.id
left join crms_customer cc on ccc.customer_id = cc.id
left join dg_loan_committee_consider lcc on ln.business_id = lcc.business_id
left join dg_business_process_status bps on ln.business_id = bps.business_id
where ln.business_id = #{businessId} and ln.role_id = #{roleId}
</select>
<select id="selectLoanNoticeList" resultType="com.daqing.financial.guarantee.model.response.DgNoticeListResponse">
select au.id,au.role_id,ai.business_code,au.create_time
from dg_loan_notice au
left join dg_apply_amount_info ai on au.business_id = ai.id
<where>
au.role_id in
<foreach collection="roleIdlist" open="(" separator="," close=")" item="id">
#{id}
</foreach>
<if test="userId != null and userId != ''">
AND (au.consider_id =#{userId} or au.consider_id is null or au.consider_id ='')
</if>
AND au.operating_status=1
</where>
</select>
</mapper>