Files
intc-cloud/intc-modules/intc-invest/src/main/resources/mapper/invest/BankCardLendMapper.xml

228 lines
11 KiB
XML

<?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.intc.invest.mapper.BankCardLendMapper">
<resultMap type="BankCardLendVo" id="BankCardLendResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="code" column="code" />
<result property="openingBank" column="opening_bank" />
<result property="activationDate" column="activation_date" />
<result property="billDate" column="bill_date" />
<result property="payDate" column="pay_date" />
<result property="delayPeriod" column="delay_period" />
<result property="creditLimit" column="credit_limit" />
<result property="effectiveDate" column="effective_date" />
<result property="cvv" column="cvv" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="remark" column="remark" />
<result property="debitType" column="debit_type" />
<result property="lendType" column="lend_type" />
<result property="isNextBillDate" column="is_next_bill_date" />
<result property="nextBillDateTime" column="next_bill_date_time" />
<result property="isZeroBill" column="is_zero_bill" />
<result property="balance" column="balance" />
<result property="availableLimit" column="available_limit" />
<result property="status" column="status" />
<result property="cardFace" column="card_face" />
<result property="cardTier" column="card_tier" />
<result property="bankId" column="bank_id" />
</resultMap>
<sql id="selectBankCardLendVo">
select
a.id,
a.name,
a.type,
a.code,
a.opening_bank,
a.activation_date,
a.bill_date,
a.pay_date,
a.delay_period,
a.credit_limit,
a.effective_date,
a.cvv,
a.create_by,
a.create_time,
a.update_by,
a.update_time,
a.del_flag,
a.remark,
a.debit_type,
a.lend_type,
a.is_next_bill_date,
a.next_bill_date_time,
a.is_zero_bill,
a.status,
a.card_face,
a.card_tier,
a.bank_id,
t.balance,
t.available_limit
from bank_card_lend a
left join accounts t on t.id=a.id
</sql>
<select id="selectBankCardLendList" parameterType="BankCardLendDto" resultMap="BankCardLendResult">
<include refid="selectBankCardLendVo"/>
<where>
a.del_flag='0'
<if test="name != null and name != ''"> and a.name like '%'|| #{name}||'%'</if>
<if test="code != null and code != ''"> and a.code like '%'|| #{code}||'%'</if>
<if test="type != null and type != ''"> and a.type = #{type}</if>
<if test="debitType != null and debitType != ''"> and a.debit_type = #{debitType}</if>
<if test="creditCardId != null "> and a.id = #{creditCardId}</if>
<if test="bankId != null "> and a.bank_id = #{bankId}</if>
<if test="lendType != null and lendType != ''"> and a.lend_type = #{lendType}</if>
<if test="status != null and status != ''"> and a.card_tier = #{status}</if>
<if test="cardTier != null and cardTier != ''"> and a.status = #{cardTier}</if>
<if test="repayFlag != null and repayFlag != ''"> and a.debit_type in('1','2','3')</if>
<if test="staticFlag != null and staticFlag != ''"> and ( a.debit_type in('1','2') and a.status!='2') </if>
<if test="startMonth!=null and startMonth !=''">
and to_char(a.activation_date, 'yyyy-MM')>=#{startMonth}
</if>
<if test="endMonth!=null and endMonth !=''">
and #{endMonth}>=to_char(a.activation_date, 'yyyy-MM')
</if>
</where>
<!-- 数据范围过滤 -->
${params.dataScope}
<if test="staticFlag != null and staticFlag != ''">
order by a.activation_date desc
</if>
<if test="staticFlag == null or staticFlag == ''">
order by a.type asc, a.bill_date asc,a.debit_type asc,a.update_time desc
</if>
</select>
<select id="selectBankCardLendById" parameterType="Long" resultMap="BankCardLendResult">
<include refid="selectBankCardLendVo"/>
where a.id = #{id}
</select>
<insert id="insertBankCardLend" parameterType="BankCardLend">
insert into bank_card_lend
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="name != null and name != ''">name,</if>
<if test="type != null and type != ''">type,</if>
<if test="code != null and code != ''">code,</if>
<if test="openingBank != null">opening_bank,</if>
<if test="activationDate != null">activation_date,</if>
<if test="billDate != null and billDate != ''">bill_date,</if>
<if test="payDate != null and payDate != ''">pay_date,</if>
<if test="delayPeriod != null">delay_period,</if>
<if test="creditLimit != null">credit_limit,</if>
<if test="effectiveDate != null">effective_date,</if>
<if test="cvv != null and cvv != ''">cvv,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="delFlag != null">del_flag,</if>
<if test="remark != null">remark,</if>
<if test="debitType != null">debit_type,</if>
<if test="lendType != null">lend_type,</if>
<if test="isNextBillDate != null">is_next_bill_date,</if>
<if test="nextBillDateTime != null">next_bill_date_time,</if>
<if test="isZeroBill != null">is_zero_bill,</if>
<if test="status != null">status,</if>
<if test="cardFace != null">card_face,</if>
<if test="cardTier != null">card_tier,</if>
<if test="bankId != null">bank_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="name != null and name != ''">#{name},</if>
<if test="type != null and type != ''">#{type},</if>
<if test="code != null and code != ''">#{code},</if>
<if test="openingBank != null">#{openingBank},</if>
<if test="activationDate != null">#{activationDate},</if>
<if test="billDate != null and billDate != ''">#{billDate},</if>
<if test="payDate != null and payDate != ''">#{payDate},</if>
<if test="delayPeriod != null">#{delayPeriod},</if>
<if test="creditLimit != null ">#{creditLimit},</if>
<if test="effectiveDate != null">#{effectiveDate},</if>
<if test="cvv != null and cvv != ''">#{cvv},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="debitType != null">#{debitType},</if>
<if test="lendType != null">#{lendType},</if>
<if test="isNextBillDate != null">#{isNextBillDate},</if>
<if test="nextBillDateTime != null">#{nextBillDateTime},</if>
<if test="isZeroBill != null">#{isZeroBill},</if>
<if test="status != null">#{status},</if>
<if test="cardFace != null">#{cardFace},</if>
<if test="cardTier != null">#{cardTier},</if>
<if test="bankId != null">#{bankId},</if>
</trim>
</insert>
<update id="updateBankCardLend" parameterType="BankCardLend">
update bank_card_lend
<trim prefix="SET" suffixOverrides=",">
<if test="name != null and name != ''">name = #{name},</if>
<if test="type != null and type != ''">type = #{type},</if>
<if test="code != null and code != ''">code = #{code},</if>
<if test="openingBank != null">opening_bank = #{openingBank},</if>
<if test="activationDate != null">activation_date = #{activationDate},</if>
<if test="billDate != null and billDate != ''">bill_date = #{billDate},</if>
<if test="payDate != null and payDate != ''">pay_date = #{payDate},</if>
<if test="delayPeriod != null">delay_period = #{delayPeriod},</if>
<if test="creditLimit != null">credit_limit = #{creditLimit},</if>
<if test="effectiveDate != null">effective_date = #{effectiveDate},</if>
<if test="cvv != null and cvv != ''">cvv = #{cvv},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="debitType != null">debit_type = #{debitType},</if>
<if test="lendType != null">lend_type = #{lendType},</if>
<if test="isNextBillDate != null">is_next_bill_date = #{isNextBillDate},</if>
<if test="nextBillDateTime != null">next_bill_date_time = #{nextBillDateTime},</if>
<if test="isZeroBill != null">is_zero_bill = #{isZeroBill},</if>
<if test="status != null">status = #{status},</if>
<if test="cardFace != null">card_face = #{cardFace},</if>
<if test="cardTier != null">card_tier = #{cardTier},</if>
<if test="bankId != null">bank_id = #{bankId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteBankCardLendById" parameterType="Long">
delete from bank_card_lend where id = #{id}
</delete>
<delete id="deleteBankCardLendByIds" parameterType="String">
delete from bank_card_lend where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="removeBankCardLendById" parameterType="Long">
update bank_card_lend set del_flag='1' where id = #{id}
</update>
<update id="removeBankCardLendByIds" parameterType="String">
update bank_card_lend set del_flag='1' where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
</mapper>